1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
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 INCLUDE(${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt)
14 SET(_OSGINITCACHELOADED TRUE CACHE INTERNAL "")
15 ENDIF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt)
17 ##########################
18 # Disallow in-source build
19 ##########################
21 IF("${OpenSGSupport_SOURCE_DIR}" STREQUAL "${OpenSGSupport_BINARY_DIR}")
22 MESSAGE(FATAL_ERROR "OpenSGSupport requires an out of source Build. \n"
23 "Please create a separate binary directory and run "
25 ENDIF("${OpenSGSupport_SOURCE_DIR}" STREQUAL "${OpenSGSupport_BINARY_DIR}")
32 SET(BUILD_SHARED_LIBS ON CACHE INTERNAL "Set to ON to build dynamic libraries" FORCE)
33 SET(BUILD_STATIC_LIBS ON CACHE INTERNAL "Set to ON to build static libraries" FORCE)
36 OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
38 IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
39 OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
40 ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
41 OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
42 ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
45 SET(OSG_PLATFORM_64 0)
46 SET(OSG_PLATFORM_32 0)
47 SET(OSG_LIBDIR_SUFFIX "")
49 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
50 SET(OSG_PLATFORM_64 1)
51 SET(OSG_LIBDIR_SUFFIX "64")
53 SET(OSG_LIBDIR_BASE_SUFFIX "64")
56 SET(OSG_PLATFORM_32 1)
59 IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
60 SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
63 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
67 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
68 SET(CMAKE_BUILD_TYPE Debug CACHE STRING
69 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
71 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
74 IF(NOT OSG_COMPILER_DEFAULTS)
75 INCLUDE(../CMake/SetupCompiler.cmake)
76 SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) #INTERNAL
77 ENDIF(NOT OSG_COMPILER_DEFAULTS)
79 INCLUDE(../CMake/UpdateCompiler.cmake)
80 INCLUDE(../CMake/BuildFunctions.cmake)
81 INCLUDE(../CMake/ConfigurePackages.cmake)
82 INCLUDE(../CMake/OpenSGVersion)
84 SET(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "" FORCE)
85 SET(OSG_BUILD_ACTIVE TRUE)
91 ADD_CUSTOM_TARGET(ALL_CUDA_BUILD)
92 ADD_CUSTOM_TARGET(ALL_STANDARD_BUILD)
94 IF(OSGGlutSrcDir AND OSGFreeGlutSrcDir)
95 MESSAGE(FATAL_ERROR "choose either glut or freeglut")
96 ENDIF(OSGGlutSrcDir AND OSGFreeGlutSrcDir)
99 ADD_SUBDIRECTORY(zlib)
100 ADD_SUBDIRECTORY(libpng)
101 ADD_SUBDIRECTORY(libjpeg)
102 ADD_SUBDIRECTORY(freeglut)
103 ADD_SUBDIRECTORY(glut)
104 ADD_SUBDIRECTORY(libtiff)
105 ADD_SUBDIRECTORY(pcre)
106 # ADD_SUBDIRECTORY(libiconv)
107 ADD_SUBDIRECTORY(libxml2)
108 ADD_SUBDIRECTORY(OpenEXR)
109 ADD_SUBDIRECTORY(expat)
110 ADD_SUBDIRECTORY(gdal)
112 ADD_SUBDIRECTORY(doxygen)
115 ADD_SUBDIRECTORY(glew)
116 ADD_SUBDIRECTORY(collada)
117 ADD_SUBDIRECTORY(opennurbs)
119 ADD_SUBDIRECTORY(libMini)
121 SET(OSG_EXTRA_EXTERNAL_SUPPORT "" CACHE STRING
122 "Extra modules that OpenSG will try to compile.")
124 FILE(GLOB_RECURSE OSG_SUPPORT_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
125 "../Source/Contrib/*CMakeLists.Support.*.txt")
127 FOREACH(OSG_CONTRIB_SUPPORT ${OSG_SUPPORT_CONFIG_FILES})
128 INCLUDE(${OSG_CONTRIB_SUPPORT})
131 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_SUPPORT})
133 IF(NOT DEFINED OSG_${EXTERNAL}_SUPP_SOURCE_DIR)
134 SET(OSG_${EXTERNAL}_SUPP_SOURCE_DIR "OSG_${EXTERNAL}_SUPP_SOURCE_DIR-NOTFOUND" CACHE PATH "")
137 IF(OSG_${EXTERNAL}_SUPP_SOURCE_DIR AND
138 EXISTS ${OSG_${EXTERNAL}_SUPP_SOURCE_DIR}/CMakeLists.txt)
139 ADD_SUBDIRECTORY(${OSG_${EXTERNAL}_SUPP_SOURCE_DIR} External/${EXTERNAL})
144 SET(CMAKE_CONFIGURATION_TYPES "Debug;Release"
145 CACHE STRING "OpenSGSupport Build Types" FORCE )
147 FILE(WRITE "${CMAKE_BINARY_DIR}/OSGSupportConfig.cmake"
148 "SET(OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\")\n\n")
149 FILE(APPEND "${CMAKE_BINARY_DIR}/OSGSupportConfig.cmake"
150 "SET(OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\")\n\n")
152 INSTALL(FILES ${CMAKE_BINARY_DIR}/OSGSupportConfig.cmake
154 PERMISSIONS OWNER_WRITE OWNER_READ
159 CUDA_BUILD_CLEAN_TARGET()