fixed: compile issue
[opensg.git] / Support / CMakeLists.txt
blobe6bad556ab6d75e4d815fa7e6f25614b7aa7bd3e
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3 PROJECT(OpenSGSupport)
5 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
6                       "${OpenSGSupport_SOURCE_DIR}/../CMake")
8 ##############################################
9 # Initial cache to make life easier on Windows
10 ##############################################
12 IF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt)
13   GET_FILENAME_COMPONENT(_OSGTMPF "${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt" REALPATH)
14   GET_FILENAME_COMPONENT(_OSGTMP  "${_OSGTMPF}" PATH)
16   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_OSGTMP}")
17   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_OSGTMP}/CMake")
18 MESSAGE("xx ${_OSGTMP}")
20   INCLUDE(${_OSGTMPF})
21   SET(_OSGINITCACHELOADED TRUE CACHE INTERNAL "")
22 ENDIF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt)
24 ##############################################
25 # Disallow in-source build
26 ##############################################
28 IF("${OpenSGSupport_SOURCE_DIR}"  STREQUAL "${OpenSGSupport_BINARY_DIR}")
29   MESSAGE(FATAL_ERROR "OpenSGSupport requires an out of source Build. \n"
30                       "Please create a separate binary directory and run "
31                       "CMake there.")
32 ENDIF("${OpenSGSupport_SOURCE_DIR}"  STREQUAL "${OpenSGSupport_BINARY_DIR}")
34 ##############################################
35 # Common
36 ##############################################
38 INCLUDE(OSGCommonSupportConfig)
40 OSG_COMMONSUPP_SETUP()
42 INCLUDE(OpenSGVersion)
44 SET(OSG_BUILD_ACTIVE TRUE)
46 FOREACH(_OSG_GLOBAL_DEP_DEF ${OSG_GLOBAL_DEP_DEFS})
47   ADD_DEFINITIONS(-D${_OSG_GLOBAL_DEP_DEF})
48 ENDFOREACH(_OSG_GLOBAL_DEP_DEF)
50 ##############################################
51 # Subdirs
52 ##############################################
54 IF(WIN32)
55   ADD_SUBDIRECTORY(zlib)
56   ADD_SUBDIRECTORY(libpng)
57   ADD_SUBDIRECTORY(libjpeg)
58   ADD_SUBDIRECTORY(freeglut)
59   ADD_SUBDIRECTORY(glut)
60   ADD_SUBDIRECTORY(libtiff)
61   ADD_SUBDIRECTORY(pcre)
62 #  ADD_SUBDIRECTORY(libiconv)
63   ADD_SUBDIRECTORY(libxml2)
64   ADD_SUBDIRECTORY(OpenEXR)
65   ADD_SUBDIRECTORY(expat)
66   ADD_SUBDIRECTORY(gdal)
67 ELSE(WIN32)
68   IF(NOT APPLE)
69     ADD_SUBDIRECTORY(doxygen)
70   ENDIF(NOT APPLE)
72 ENDIF(WIN32)
74 ADD_SUBDIRECTORY(glew)
75 ADD_SUBDIRECTORY(collada)
76 ADD_SUBDIRECTORY(opennurbs)
77 ADD_SUBDIRECTORY(libMini)
79 ##############################################
80 # contrib support
81 ##############################################
83 FILE(GLOB_RECURSE OSG_SUPPORT_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
84      "../Source/Contrib/*CMakeLists.Support.*.txt")
86 FOREACH(OSG_CONTRIB_SUPPORT ${OSG_SUPPORT_CONFIG_FILES})
87   INCLUDE(${OSG_CONTRIB_SUPPORT})
88 ENDFOREACH()
90 ##############################################
91 # extra support
92 ##############################################
94 OSG_COMMON_SUPP_EXTERNAL()
96 OSG_COMMON_SUPP_WRITE_CONFIG(OSGSupportConfig.cmake)
98 ##############################################
99 # install packaging
100 ##############################################
102 IF(NOT WIN32)
103   CONFIGURE_FILE(CMakeLists.packaging.unix.txt 
104                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
105                  @ONLY                                      )
106 ELSE()
107   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
108     SET(OSG_WIN_SEC "nosec")
109   ELSE()
110     SET(OSG_WIN_SEC "msdefault")
111   ENDIF()
113   CONFIGURE_FILE(CMakeLists.packaging.win.txt 
114                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
115                  @ONLY                                      )
117   INSTALL(FILES 
118             "${CMAKE_SOURCE_DIR}/../CMake/Packaging/Windows/OpenSG2_Icon.ico"
119             DESTINATION share/OpenSG/Packaging
120             COMPONENT   packaging
121             PERMISSIONS OWNER_WRITE OWNER_READ
122                         GROUP_READ
123                         WORLD_READ            )
125   INSTALL(FILES 
126             "${CMAKE_SOURCE_DIR}/../CMake/Packaging/Windows/InstallerHeader.bmp"
127             DESTINATION share/OpenSG/Packaging
128             COMPONENT   packaging
129             PERMISSIONS OWNER_WRITE OWNER_READ
130                         GROUP_READ
131                         WORLD_READ            )
133 ENDIF()
135 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
136         DESTINATION share/OpenSG/Packaging
137         COMPONENT packaging
138         PERMISSIONS OWNER_WRITE OWNER_READ
139                     GROUP_READ
140                     WORLD_READ
141         RENAME CMakeLists.txt)
143 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
144         DESTINATION share/doc/OpenSG
145         COMPONENT doc
146         PERMISSIONS OWNER_WRITE OWNER_READ
147                     GROUP_READ
148                     WORLD_READ
149         RENAME COPYING.support)
151 ##############################################
152 # Component install Setting
153 ##############################################
155 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
157 IF(NOT WIN32)
158   ADD_CUSTOM_TARGET(OSG_preinstall
159                     make preinstall
160                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
161 ELSE()
162 ENDIF()
164 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
166   IF(NOT WIN32)
168     ADD_CUSTOM_TARGET(
169       INSTALL_${_OSG_CMP}
170       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
171       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
173   ELSE()
175     SET(_OSG_CMP_CONF Release)
177     IF(${_OSG_CMP} MATCHES ^debug_)
178       SET(_OSG_CMP_CONF Debug)
179     ENDIF()
181     ADD_CUSTOM_TARGET(
182       INSTALL_${_OSG_CMP}
183       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
184       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
186   ENDIF()
188   IF(NOT WIN32)
189     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
190   ELSE()
191   ENDIF()
193 ENDFOREACH()
196 IF(WIN32)
198 ELSE()
199   ADD_CUSTOM_TARGET(INSTALL_runtime)
201   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
202 ENDIF()
204 ##############################################
205 # cuda cleanup
206 ##############################################
208 IF(CUDA_FOUND)
209   CUDA_BUILD_CLEAN_TARGET()
210 ENDIF(CUDA_FOUND)