fixed: dxt1 flip on odd height images
[opensg.git] / Support / CMakeLists.txt
blob465352436f5984a63af2cc0315eccb33f7ff273e
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 ##############################################
47 # Subdirs
48 ##############################################
50 IF(WIN32)
51   ADD_SUBDIRECTORY(zlib)
52   ADD_SUBDIRECTORY(libpng)
53   ADD_SUBDIRECTORY(libjpeg)
54   ADD_SUBDIRECTORY(freeglut)
55   ADD_SUBDIRECTORY(glut)
56   ADD_SUBDIRECTORY(libtiff)
57   ADD_SUBDIRECTORY(pcre)
58 #  ADD_SUBDIRECTORY(libiconv)
59   ADD_SUBDIRECTORY(libxml2)
60   ADD_SUBDIRECTORY(OpenEXR)
61   ADD_SUBDIRECTORY(expat)
62   ADD_SUBDIRECTORY(gdal)
63 ELSE(WIN32)
64   IF(NOT APPLE)
65     ADD_SUBDIRECTORY(doxygen)
66   ENDIF(NOT APPLE)
68 ENDIF(WIN32)
70 ADD_SUBDIRECTORY(glew)
71 ADD_SUBDIRECTORY(collada)
72 ADD_SUBDIRECTORY(opennurbs)
73 ADD_SUBDIRECTORY(libMini)
75 ##############################################
76 # contrib support
77 ##############################################
79 FILE(GLOB_RECURSE OSG_SUPPORT_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
80      "../Source/Contrib/*CMakeLists.Support.*.txt")
82 FOREACH(OSG_CONTRIB_SUPPORT ${OSG_SUPPORT_CONFIG_FILES})
83   INCLUDE(${OSG_CONTRIB_SUPPORT})
84 ENDFOREACH()
86 ##############################################
87 # extra support
88 ##############################################
90 OSG_COMMON_SUPP_EXTERNAL()
92 OSG_COMMON_SUPP_WRITE_CONFIG(OSGSupportConfig.cmake)
94 ##############################################
95 # install packaging
96 ##############################################
98 IF(NOT WIN32)
99   CONFIGURE_FILE(CMakeLists.packaging.unix.txt 
100                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
101                  @ONLY                                      )
102 ELSE()
103   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
104     SET(OSG_WIN_SEC "nosec")
105   ELSE()
106     SET(OSG_WIN_SEC "msdefault")
107   ENDIF()
109   CONFIGURE_FILE(CMakeLists.packaging.win.txt 
110                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
111                  @ONLY                                      )
113   INSTALL(FILES 
114             "${CMAKE_SOURCE_DIR}/../CMake/Packaging/Windows/OpenSG2_Icon.ico"
115             DESTINATION share/OpenSG/Packaging
116             COMPONENT   packaging
117             PERMISSIONS OWNER_WRITE OWNER_READ
118                         GROUP_READ
119                         WORLD_READ            )
121   INSTALL(FILES 
122             "${CMAKE_SOURCE_DIR}/../CMake/Packaging/Windows/InstallerHeader.bmp"
123             DESTINATION share/OpenSG/Packaging
124             COMPONENT   packaging
125             PERMISSIONS OWNER_WRITE OWNER_READ
126                         GROUP_READ
127                         WORLD_READ            )
129 ENDIF()
131 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
132         DESTINATION share/OpenSG/Packaging
133         COMPONENT packaging
134         PERMISSIONS OWNER_WRITE OWNER_READ
135                     GROUP_READ
136                     WORLD_READ
137         RENAME CMakeLists.txt)
139 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
140         DESTINATION share/doc/OpenSG
141         COMPONENT doc
142         PERMISSIONS OWNER_WRITE OWNER_READ
143                     GROUP_READ
144                     WORLD_READ
145         RENAME COPYING.support)
147 ##############################################
148 # Component install Setting
149 ##############################################
151 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
153 IF(NOT WIN32)
154   ADD_CUSTOM_TARGET(OSG_preinstall
155                     make preinstall
156                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
157 ELSE()
158 ENDIF()
160 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
162   IF(NOT WIN32)
164     ADD_CUSTOM_TARGET(
165       INSTALL_${_OSG_CMP}
166       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
167       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
169   ELSE()
171     SET(_OSG_CMP_CONF Release)
173     IF(${_OSG_CMP} MATCHES ^debug_)
174       SET(_OSG_CMP_CONF Debug)
175     ENDIF()
177     ADD_CUSTOM_TARGET(
178       INSTALL_${_OSG_CMP}
179       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
180       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
182   ENDIF()
184   IF(NOT WIN32)
185     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
186   ELSE()
187   ENDIF()
189 ENDFOREACH()
192 IF(WIN32)
194 ELSE()
195   ADD_CUSTOM_TARGET(INSTALL_runtime)
197   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
198 ENDIF()
200 ##############################################
201 # cuda cleanup
202 ##############################################
204 IF(CUDA_FOUND)
205   CUDA_BUILD_CLEAN_TARGET()
206 ENDIF(CUDA_FOUND)