fixed: auto_ptr -> unique_ptr
[opensg.git] / CMakeLists.txt
blob5b8ba4b2039c367d9fb1ee26f927ccd3ed354c47
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3 MESSAGE(STATUS "Running cmake version : ${CMAKE_VERSION}")
5 IF(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
6   CMAKE_POLICY(SET CMP0020 OLD) # behaviour change in linking qt
7 ENDIF()
9 PROJECT(OpenSG)
11 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenSG_SOURCE_DIR}/CMake")
13 IF(APPLE AND IOS)
14   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenSG_SOURCE_DIR}/CMake/IOS")
15 ENDIF()
17 INCLUDE(OpenSGVersion)
19 # Disable boost cmake config, as it screws up OpenSG's boost config
21 SET(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "" FORCE)
23 IF(WIN32)
24   SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
25 ENDIF()
27 ##############################################
28 # Initial cache to make life easier on Windows
29 ##############################################
31 IF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt AND NOT OSG_BUILD_DEPENDEND)
32   GET_FILENAME_COMPONENT(_OSGTMPF "${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt" REALPATH)
33   GET_FILENAME_COMPONENT(_OSGTMP  "${_OSGTMPF}" PATH)
35   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_OSGTMP}")
36   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_OSGTMP}/CMake")
38   INCLUDE(${_OSGTMPF})
39   SET(_OSGINITCACHELOADED TRUE CACHE INTERNAL "")
40 ENDIF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt AND NOT OSG_BUILD_DEPENDEND)
43 INCLUDE(OSGBuildFunctions)
45 ##########################
46 # Disallow in-source build
47 ##########################
49 IF("${OpenSG_SOURCE_DIR}"  STREQUAL "${OpenSG_BINARY_DIR}")
50   MESSAGE(FATAL_ERROR "OpenSG requires an out of source Build. \n"
51                       "Please create a separate binary directory and run "
52                       "CMake there.")
53 ENDIF("${OpenSG_SOURCE_DIR}"  STREQUAL "${OpenSG_BINARY_DIR}")
55 SET(OSG_BUILD_ACTIVE TRUE)
57 ##############################################################################
58 # BUILD OPTIONS
59 ##############################################################################
61 INCLUDE(OSGCommonOptions)
62 INCLUDE(OSGCommonConfig)
64 OSG_COMMON_OPTIONS()
65 OSG_COMMON_OPTIONS_CONFIGURED()
66 OSG_COMMON_OPTIONS_DEPRECATED()
68 OPTION(OSG_VERBOSE_BUILD_MESSAGES 
69        "Print verbose messages when generating the build system" OFF)
70 MARK_AS_ADVANCED(OSG_VERBOSE_BUILD_MESSAGES)
72 OSG_OPTION(OSGBUILD_TESTS                        "Build test programs" ON)
73 OSG_OPTION(OSGBUILD_UNITTESTS                    "Build/run unit test programs" OFF)
74 OSG_OPTION(OSGBUILD_EXAMPLES_SIMPLE              "Build example programs during system build" OFF)
75 OSG_OPTION(OSGBUILD_EXAMPLES_ADVANCED            "Build advanced example programs during system build" OFF)
76 OSG_OPTION(OSGBUILD_EXAMPLES_TUTORIAL            "Build tutorial example programs during system build" OFF)
78 OSG_OPTION(OSGBUILD_PYTHON_BINDINGS              "Build python bindings" OFF)
79 OSG_OPTION(OSGBUILD_PYTHON_DUMP_DECLS            "Dump decls while building python" FALSE)
81 OSG_OPTION(OSGEXCLUDE_TESTS_FROM_ALL             "Exclude test programs from all target" OFF)
82 OSG_OPTION(OSGEXCLUDE_UNITTESTS_FROM_ALL         "Build/run unit test programs" OFF)
83 OSG_OPTION(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL   "Build example programs during system build" OFF)
84 OSG_OPTION(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL "Build advanced example programs during system build" OFF)
85 OSG_OPTION(OSG_ENABLE_MULTISHADER_VARCHUNK "" OFF)
86 OSG_OPTION(OSG_ENABLE_OGL_COREONLY "" OFF)
87 OSG_OPTION(OSG_ENABLE_OGL_ES2 "" OFF)
88 OSG_OPTION(OSG_ENABLE_OGL_ES2_SIMGL3 "" OFF)
89 OSG_OPTION(OSG_ENABLE_CSM_WIN7_FEATURES "" OFF)
91 OSG_OPTION(OSG_ENABLE_OGL3_PROTOS "" OFF)
92 OSG_OPTION(OSG_ENABLE_OGL4_PROTOS "" OFF)
93 OSG_OPTION(OSG_ENABLE_OGLES_PROTOS "" OFF)
95 OSG_OPTION(OSG_ENABLE_GL_INCLUDE_GLEW "" OFF)
97 OSG_SET_CACHE(OSG_SHADER_CACHE_MODE 5 STRING "")
99 OSG_OPTION(OSG_ENABLE_FCD2CODE "" OFF)
100 OSG_OPTION(OSG_FCD2CODE_WRITE_CLASS "Write class file during cmake run if only
101 the fcd file is found" OFF)
102 OSG_OPTION(OSG_ENABLE_SCANPARSE_REGEN "" OFF)
104 OSG_OPTION(OSG_ENABLE_GLDEFINE_MAPPER "" ON)
105 OSG_OPTION(OSG_ENABLE_NEW_OSB_IO "" ON)
107 OSG_OPTION   (OSG_ENABLE_SSE2        ""    OFF      )
108 OSG_OPTION   (OSG_ENABLE_SSE4        ""    ON       )
109 OSG_SET_CACHE(OSG_SSE4_VARIANT       "4.2" STRING "")
110 OSG_OPTION   (OSG_ENABLE_AVX         ""    OFF      )
111 OSG_SET_CACHE(OSG_AVX_VARIANT        ""    STRING "")
112 OSG_OPTION   (OSG_ENABLE_ABI6        ""    OFF      )
113 OSG_OPTION   (OSG_USE_OSG2_NAMESPACE ""    OFF      )
114 OSG_OPTION   (OSG_ENABLE_C++11       ""    ON       )
116 OSG_OPTION(OSG_ENABLE_BOOST_C++11_STD_ATOMICS "" OFF)
118 OSG_OPTION(OSG_ENABLE_TESTCONTAINER "" OFF)
119 OSG_OPTION(OSG_ENABLE_VALGRIND_CHECKS "" OFF)
120 OSG_OPTION(OSG_ENABLE_MEMORY_DEBUGGING "" OFF)
121 OSG_OPTION(OSG_ENABLE_DOUBLE_MATRIX_STACK "" OFF)
122 OSG_OPTION(OSG_ENABLE_DEFAULT_READONLY_CHANGELIST "" OFF)
123 OSG_OPTION(OSG_DISABLE_SOURCE_GROUPS "" OFF)
124 OSG_OPTION(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE "" OFF)
126 OSG_OPTION(OSG_ENABLE_CUDA "" OFF)
127 OSG_OPTION(OSG_ENABLE_VTK  "" ON )
129 IF(WIN32)
130   OPTION(OSG_ENABLE_WIN_LOCALSTORAGE "" ON)
131   OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
133   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
134     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
135   ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
136     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
137   ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
138 ELSEIF(APPLE)
139   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" OFF)
140 ELSEIF(UNIX)
141   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" ON)
142 ENDIF()
144 OSG_OPTION(OSG_ENABLE_AUTOINIT_THREADS "" OFF)
145 OPTION(OSG_DEPENDENT_INCLUDE_BUILD "" OFF)
147 IF(WIN32)
148   OSG_OPTION(OSG_USE_SEPARATE_LIBDIRS "" ON)
149   OSG_OPTION(OSG_INSTALL_PDB_FILES "" OFF)
150   OSG_OPTION(OSG_WINDOWS_LINK_OPTIMIZE "" OFF)
151 ENDIF(WIN32)
153 OSG_OPTION(OSG_INSTALL_EXAMPLES "" OFF)
154 OSG_OPTION(OSG_INSTALL_EXAMPLES_EXE "" OFF)
155 OSG_OPTION(OSG_INSTALL_APPS "" ON)
157 OSG_OPTION(OSGCOMPAT_ENABLE                  "" OFF)
158 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED       "" OFF)
159 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED_PROPS "" OFF)
161 OSG_SET_CACHE(OSG_RENDERPROPERTY_BITS 64 STRING "")
162 OSG_SET_CACHE(OSG_RENDERPROPERTY_UNIQUE_BITS 16 STRING "")
164 OSG_OPTION(OSG_GENERATE_SEPARATE_LIB_DOC "Generate separate doxygen documentation for contrib libraries" OFF)
165 OSG_OPTION(OSG_INSTALL_DOXYDOC "Install Doxygen documentation" OFF)
167 OSG_OPTION(OSG_LINK_EXTERNAL_MODULES_TO_CSM "" FALSE)
170 #OSG_OPTION(OSGBUILD_ENABLE_PACKAGING "Generate binary packages with CPack" OFF)
171 #SET(OSGBUILD_PACKAGE_TYPE "" CACHE STRING
172 #    "The type of package to generate (empty->default)")
175 SET(OSG_DOXY_DOC_TYPE "User" CACHE STRING
176     "The type of documentation to generate (User, Developer, Trac)")
177 SET(OSG_DOXY_INPUTS CACHE FILEPATH "include given file instead of autogen")
178 SET(OSG_DOXY_STDOUT_LOG CACHE FILEPATH "log std to file")
180 # Not sure
181 #OPTION(OSG_ENABLE_MTCPTR "" ON)
182 #OPTION(OSG_ENABLE_GIF    "" ON)
184 ## prep options for OSGConfigured.h
186 IF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
187   SET(OSG_DISABLE_DEPRECATED 1)
188 ENDIF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
190 IF(OSG_USE_OSG2_NAMESPACE)
191   ADD_DEFINITIONS(-DOSG_USE_OSG2_NAMESPACE=1)
192 ENDIF()
194 IF(OSG_ENABLE_SSE2 OR OSG_ENABLE_SSE4)
195   SET(OSG_SIMD_SSE 1)
196 ENDIF()
198 IF(OSG_ENABLE_NEW_OSB_IO)
199   SET(OSG_NEW_OSB_IO 1)
200 ENDIF(OSG_ENABLE_NEW_OSB_IO)
202 IF(OSG_ENABLE_GLDEFINE_MAPPER)
203   SET(OSG_GL_DEFMAPPER 1)
204 ENDIF(OSG_ENABLE_GLDEFINE_MAPPER)
206 IF(OSG_ENABLE_MULTISHADER_VARCHUNK)
207   SET(OSG_MULTISHADER_VARCHUNK 1)
208 ENDIF(OSG_ENABLE_MULTISHADER_VARCHUNK)
210 IF(OSG_ENABLE_OGL_COREONLY)
211   SET(OSG_OGL_COREONLY 1)
212 ENDIF(OSG_ENABLE_OGL_COREONLY)
214 IF(OSG_ENABLE_GL_INCLUDE_GLEW)
215   SET(OSG_GL_INCLUDE_GLEW 1)
216 ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW)
218 IF(OSG_ENABLE_OGL_ES2)
219   SET(OSG_OGL_ES2 1)
220   SET(OSG_OGL_NO_DOUBLE 1)
221 ENDIF(OSG_ENABLE_OGL_ES2)
223 IF(OSG_ENABLE_OGLES_PROTOS)
224   SET(OSG_USE_OGLES_PROTOS 1)
225   SET(GL_GLEXT_PROTOTYPES 1)
226 ENDIF(OSG_ENABLE_OGLES_PROTOS)
228 IF(OSG_ENABLE_OGL3_PROTOS)
229   SET(GL_GLEXT_PROTOTYPES 1)
230   SET(GL3_PROTOTYPES 1)
231   SET(OSG_USE_OGL3_PROTOS 1)
232 ENDIF(OSG_ENABLE_OGL3_PROTOS)
234 IF(OSG_ENABLE_OGL4_PROTOS)
235   SET(GL_GLEXT_PROTOTYPES 1)
236   SET(GL3_PROTOTYPES 1)
237   SET(OSG_USE_OGL3_PROTOS 1)
238   SET(OSG_USE_OGL4_PROTOS 1)
239 ENDIF(OSG_ENABLE_OGL4_PROTOS)
241 IF(OSG_ENABLE_OGL_ES2_SIMGL3)
242   SET(OSG_OGL_ES2_SIMGL3 1)
243 ENDIF(OSG_ENABLE_OGL_ES2_SIMGL3)
245 IF(OSGCOMPAT_ENABLE)
246   SET(OSG_1_COMPAT 1)
247 ENDIF(OSGCOMPAT_ENABLE)
249 IF(NOT OSG_ENABLE_SCANPARSE_REGEN)
250   SET(OSG_PREBUILD_SCANPARSE 1)
251 ENDIF(NOT OSG_ENABLE_SCANPARSE_REGEN)
253 IF(OSG_ENABLE_ELF_LOCALSTORAGE)
254   SET(OSG_PTHREAD_ELF_TLS 1)
255 ENDIF(OSG_ENABLE_ELF_LOCALSTORAGE)
257 IF(OSG_ENABLE_WIN_LOCALSTORAGE)
258   SET(OSG_WIN32_ASPECT_USE_LOCALSTORAGE 1)
259 ENDIF(OSG_ENABLE_WIN_LOCALSTORAGE)
261 IF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
262   SET(OSG_DEPRECATED_PROPS 1)
263 ENDIF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
265 SET(OSG_SHC_MODE_${OSG_SHADER_CACHE_MODE} 1)
267 IF(NOT IOS)
268   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
269   SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
270   SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
271 ENDIF(NOT IOS)
273 INCLUDE(OSGConfigurePackages)
275 LIST(APPEND OSG_ADDITIONAL_CONFIGURE_LINES "")
277 IF(OSGEXCLUDE_TESTS_FROM_ALL)
278   SET(OSGEXCLUDE_TESTS EXCLUDE_FROM_ALL)
279 ELSE()
280   SET(OSGEXCLUDE_TESTS "")
281 ENDIF()
283 IF(OSGEXCLUDE_UNITTESTS_FROM_ALL)
284   SET(OSGEXCLUDE_UNITTESTS EXCLUDE_FROM_ALL)
285 ELSE()
286   SET(OSGEXCLUDE_UNITTESTS "")
287 ENDIF()
289 IF(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL)
290   SET(OSGEXCLUDE_EXAMPLES_SIMPLE EXCLUDE_FROM_ALL)
291 ELSE()
292   SET(OSGEXCLUDE_EXAMPLES_SIMPLE "")
293 ENDIF()
295 IF(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL)
296   SET(OSGEXCLUDE_EXAMPLES_ADVANCED EXCLUDE_FROM_ALL)
297 ELSE()
298   SET(OSGEXCLUDE_EXAMPLES_ADVANCED "")
299 ENDIF()
301 IF(NOT WIN32)
302   IF(OSG_BUILD_DEPENDEND)
303     INCLUDE(${OSG_REFERENCE_DIR}/CMake.global.settings)
304     IF(OSG_DEPENDENT_INCLUDE_BUILD)
305       INCLUDE(${OSG_REFERENCE_DIR}/CMake.build.settings)
306     ENDIF()
307   ENDIF()
308 ENDIF()
310 #####################
311 # External extensions
312 #####################
314 OSG_SET_CACHE(OSG_EXTRA_EXTERNAL_MODULES "" STRING
315               "Extra modules that OpenSG will try to import.")
317 OSG_SET_CACHE(OSG_IGNORE_INSTALL "" STRING
318               "Extra modules that OpenSG will build but not installed.")
320 OSG_SET_CACHE(OSG_EXTERNAL_MODULES_INCLUDE "" FILEPATH 
321               "Include file of extra modules")
323 IF(EXISTS "${OSG_EXTERNAL_MODULES_INCLUDE}")
324   INCLUDE("${OSG_EXTERNAL_MODULES_INCLUDE}")
325 ENDIF()
327 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_MODULES})
328     OPTION(OSGBUILD_${EXTERNAL}
329            "Build using ${EXTERNAL} module" OFF)
331     IF(OSGBUILD_${EXTERNAL})
332         FIND_PATH(OSG_${EXTERNAL}_SOURCE_DIR
333                   CMakeLists.Lib.${EXTERNAL}.txt
334                   ${CMAKE_CURRENT_SOURCE_DIR}/../${EXTERNAL})
336         OSG_ADD_OPT(OSG_${EXTERNAL}_SOURCE_DIR)
338         IF(NOT EXISTS
339                 ${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.Lib.${EXTERNAL}.txt)
341             MESSAGE(SEND_ERROR "Cannot find ${EXTERNAL} sources directory: "
342                                "${OSG_${EXTERNAL}_SOURCE_DIR}")              
343         ELSE()
344             LIST(APPEND OSG_EXTERNAL_CONFIGS "${EXTERNAL}")
346             GET_FILENAME_COMPONENT(_EXT_SRC_DIR
347                                    "${OSG_${EXTERNAL}_SOURCE_DIR}/.."
348                                    REALPATH                         )
350             IF(EXISTS "${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.PackagePrepare.cmake")
351               LIST(APPEND OSG_EXTERNAL_PREPARE "${OSG_${EXTERNAL}_SOURCE_DIR}")
352             ENDIF()
354             IF(EXISTS "${_EXT_SRC_DIR}/CMakeLists.PackagePrepare.cmake")
355               LIST(APPEND OSG_EXTERNAL_PREPARE "${_EXT_SRC_DIR}")
356             ENDIF()
357         ENDIF()
358     ENDIF()
359 ENDFOREACH(EXTERNAL)
361 IF(OSG_EXTERNAL_PREPARE)
362   LIST(REMOVE_DUPLICATES OSG_EXTERNAL_PREPARE)
363 ENDIF()
365 ##############
366 # Compiler
367 ##############
369 SET(OSG_PLATFORM_64 0)
370 SET(OSG_PLATFORM_32 0)
371 SET(OSG_APPLE64     0)
372 SET(OSG_APPLE32     0)
373 SET(OSG_LIBDIR_SUFFIX "")
375 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
376   SET(OSG_PLATFORM_64 1)
377   SET(OSG_LIBDIR_SUFFIX "64")
379   IF(NOT WIN32)
380     SET(OSG_LIBDIR_BASE_SUFFIX "64")
381   ENDIF(NOT WIN32)
383   IF(APPLE)
384     SET(OSG_APPLE64 1)
385   ENDIF(APPLE)
386 ELSE()
387   SET(OSG_PLATFORM_32 1)
389   IF(APPLE)
390     SET(OSG_APPLE32 1)
391   ENDIF(APPLE)
392 ENDIF()
395 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
396     SET(LINUX 1)
397 ENDIF()
399 IF(WIN32)
400   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
401                                 CACHE STRING "OpenSG Build Types" FORCE )
402 ELSE()
403   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
404                                 CACHE STRING "OpenSG Build Types" FORCE )
405 ENDIF(WIN32)
406 IF(APPLE AND IOS)
407   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
408                                 CACHE STRING "OpenSG Build Types" FORCE )
409 ENDIF()
411 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
412   SET(CMAKE_BUILD_TYPE Debug CACHE STRING
413       "Choose the type of build, options are: Debug Release."
414       FORCE)
415 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
417 IF(NOT WIN32) 
418   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"          AND 
419      NOT CMAKE_BUILD_TYPE STREQUAL "DebugGV"        AND
420      NOT CMAKE_BUILD_TYPE STREQUAL "Release"        AND
421      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseGV"      AND
422      NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"   )
424     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
425                         "Please use either Release or Debug")
427   ENDIF()
428 ELSEIF(NOT MSVC_IDE)
430   IF(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
431     SET(CMAKE_BUILD_TYPE DebugOpt CACHE STRING
432         "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}."
433         FORCE)  
434   ENDIF()
436   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"    AND 
437      NOT CMAKE_BUILD_TYPE STREQUAL "DebugOpt" AND
438      NOT CMAKE_BUILD_TYPE STREQUAL "Release"  AND
439      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseNoOpt")
441     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
442                         "Please use on of ${CMAKE_CONFIGURATION_TYPES}")
444   ENDIF()
445 ENDIF()
447 IF(NOT OSG_COMPILER_DEFAULTS)
448    INCLUDE(CMake/OSGSetupCompiler.cmake)
449    SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) 
450 ENDIF(NOT OSG_COMPILER_DEFAULTS)
452 INCLUDE(CMake/OSGUpdateCompiler.cmake)
454 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
455    CMAKE_BUILD_TYPE STREQUAL "DebugGV")
457     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
458     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
460 ENDIF()
462 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
464 OSG_CHECK_INSTALL()
466 ##############################################################################
467 # DEPENDENCIES
468 ##############################################################################
470 # Global include/library dirs, libs and definitions
471 SET(OSG_GLOBAL_DEP_INCDIR "")
472 SET(OSG_SYSTEM_DEP_INCDIR "")
473 SET(OSG_GLOBAL_DEP_LIBDIR "")
474 SET(OSG_GLOBAL_DEP_LIBS   "")
475 SET(OSG_GLOBAL_DEP_DEFS   "")
477 IF(NOT WIN32)
478   SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
479 ENDIF()
481 #IF(WIN32)
482   OSG_OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
483   OSG_OPTION(OSG_USE_STATIC_SUPPORT_LIBS "" OFF)
485   IF(OSG_USE_OSGSUPPORT_LIBS)
486     OSG_SET_CACHE(OSG_SUPPORT_ROOT "" PATH "")
487   ENDIF(OSG_USE_OSGSUPPORT_LIBS)
489   IF(EXISTS "${OSG_SUPPORT_ROOT}" AND
490      EXISTS "${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
492     INCLUDE("${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
494     SET(_OSG_FATAL_DMS_COMBO  FALSE)
495     SET(_OSG_FATAL_ITER_COMBO FALSE)
497     IF( NOT OSG_DISABLE_MICROSOFT_SECURE_CXXX AND     OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
498       SET(_OSG_FATAL_DMS_COMBO TRUE)
499     ENDIF()
501     IF(     OSG_DISABLE_MICROSOFT_SECURE_CXXX AND NOT OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
502       SET(_OSG_FATAL_DMS_COMBO TRUE)
503     ENDIF()
505     IF(_OSG_FATAL_DMS_COMBO)
507       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_SECURE settings:\n"
508                           "  Support : ${OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX}\n"
509                           "  OpenSG  : ${OSG_DISABLE_MICROSOFT_SECURE_CXXX}")
511     ENDIF()
514     IF( NOT OSG_DISABLE_MS_ITERATOR_DEBUGGING AND     OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
515       SET(_OSG_FATAL_ITER_COMBO TRUE)
516     ENDIF()
518     IF(     OSG_DISABLE_MS_ITERATOR_DEBUGGING AND NOT OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
519       SET(_OSG_FATAL_ITER_COMBO TRUE)
520     ENDIF()
522     IF(_OSG_FATAL_ITER_COMBO)
524       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_ITER_DEBUG settings:\n"
525                           "  Support : ${OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING}\n"
526                           "  OpenSG  : ${OSG_DISABLE_MS_ITERATOR_DEBUGGING}")
528     ENDIF()
529   ENDIF()
531 IF(WIN32)
532    SET(OSG_INSTALL_SUBDIR "" CACHE STRING "add subdir to installed libs")
533 ENDIF(WIN32)
535 IF(NOT OSG_BUILD_DEPENDEND)
537     ##########
538     #### boost
539     ##########
541     OSG_CONFIGURE_BOOST()
543     #########
544     #### zlib
545     #########
547     OSG_CONFIGURE_ZLIB()
549 #    MESSAGE(STATUS "zlib: ${ZLIB_FOUND}")
551     IF(UNIX AND NOT OSG_APPLE32)
552         #############
553         #### Freetype
554         #############
556         FIND_PACKAGE(Freetype)
558         IF(FREETYPE_FOUND)
559             OSG_SET(OSG_WITH_FT2 1)
561             FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig)
563             IF(FONTCONFIG_LIBRARY MATCHES "fontconfig")
564                 OSG_SET(OSG_WITH_FONTCONFIG 1)
565             ENDIF()
567         ENDIF(FREETYPE_FOUND)
569         OSG_ADD_OPT(FREETYPE_FOUND)
570         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_freetype2)
571         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_ft2build)
572         OSG_ADD_OPT(FONTCONFIG_LIBRARY)
573         OSG_ADD_OPT(FREETYPE_LIBRARIES)
574     ENDIF(UNIX AND NOT OSG_APPLE32)
576     ##############
577     #### ImageLibs
578     ##############
580     OSG_CONFIGURE_TIFF()
581     OSG_CONFIGURE_PNG()
582     OSG_CONFIGURE_JPEG()
583     OSG_CONFIGURE_GDAL()
584     OSG_CONFIGURE_OPENEXR()
586     SET(OSG_EXTERNAL_IMAGELIBS)
587     SET(OSG_EXTERNAL_IMAGEINCS)
589 #    MESSAGE(STATUS "tiff: ${TIFF_FOUND} - png ${PNG_FOUND} - jpg: ${JPEG_FOUND} - exr ${OPENEXR_FOUND}")
591     IF(TIFF_FOUND)
592         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
593         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
594         OSG_SET(OSG_WITH_TIF 1)
595         OSG_ADD_OPT(TIFF_LIBRARIES)
596     ENDIF(TIFF_FOUND)
598     IF(PNG_FOUND)
599         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
600         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
601         OSG_SET(OSG_WITH_PNG 1)
602         OSG_ADD_OPT(PNG_INCLUDE_DIR)
603         OSG_ADD_OPT(PNG_LIBRARIES)
604     ENDIF(PNG_FOUND)
606     IF(JPEG_FOUND)
607         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
608         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
609         OSG_SET(OSG_WITH_JPG 1)
610         OSG_ADD_OPT(JPEG_LIBRARIES)
611     ENDIF(JPEG_FOUND)
613     IF(GDAL_FOUND)
614         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
615         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
616         OSG_SET(OSG_WITH_GDAL 1)
617         OSG_ADD_OPT(GDAL_LIBRARIES)
618     ENDIF(GDAL_FOUND)
620     IF(OPENEXR_FOUND)
621         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
622         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
623         OSG_SET(OSG_WITH_IMF 1)
625         OSG_ADD_OPT(OPENEXR_LIBRARIES)
626         OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
627     ENDIF(OPENEXR_FOUND)
630     OSG_ADD_OPT(OSG_EXTERNAL_IMAGELIBS)
631     OSG_ADD_OPT(OSG_EXTERNAL_IMAGEINCS)
633     #############
634     #### Collada
635     #############
637     #FIND_PACKAGE(Collada)
639     OSG_CONFIGURE_COLLADA()
641     IF(COLLADA_FOUND)
643       OSG_SET(OSG_WITH_COLLADA 1)
645       IF(NOT WIN32)
646         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
647            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
649             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
651         ELSE()
653             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
655         ENDIF()
656       ENDIF(NOT WIN32)
658       OSG_ADD_OPT(COLLADA_DAE_INCLUDE_DIR)
659       OSG_ADD_OPT(COLLADA_DOM_INCLUDE_DIR)
661       IF(WIN32 OR COLLADA_TARGET_FOUND)
662         SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
663       ENDIF(WIN32 OR COLLADA_TARGET_FOUND)
665     ELSE(COLLADA_FOUND)
667       SET(OSG_COLLADA_LIBS "")
669     ENDIF(COLLADA_FOUND)
671     OSG_ADD_OPT(COLLADA_FOUND)
673     #############
674     #### GLUT
675     #############
677     OSG_CONFIGURE_GLUT()
679     IF(GLUT_FOUND)
680       OSG_SET(OSG_WITH_GLUT 1)
681       OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
682       OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
683     ELSE(GLUT_FOUND)
684       OSG_SET(OSG_WITH_GLUT 0)
685       OSG_SET(OSG_GLUT_INC_DIR "")
686       OSG_SET(OSG_GLUT_LIBS "")
687     ENDIF(GLUT_FOUND)
689     #############
690     #### QT
691     #############
693     OSG_CONFIGURE_QT()
695     #############
696     #### OpenGL
697     #############
699     IF(APPLE AND IOS)
700       FIND_PACKAGE(OpenGLES REQUIRED)
702       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
703       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
704     ELSE()
705       FIND_PACKAGE(OpenGL REQUIRED)
707       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
708       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
709     ENDIF()
711     IF(OSG_USE_OGL3_PROTOS OR OSG_USE_OGL4_PROTOS)
712       SET(OSG_OGL_INCDIRS ${CMAKE_SOURCE_DIR}/Source/External/OpenGL)
713       LIST(APPEND OSG_GLOBAL_DEP_INCDIR OSG_OGL_INCDIRS)
715       ADD_DEFINITIONS(-DOSG_USE_GL3_INCLUDES=1)
716     ENDIF()
718     #############
719     #### X11
720     #############
722     FIND_PACKAGE(X11)
724     IF(X11_FOUND)
725         OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
726         OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
727     ENDIF(X11_FOUND)
729     OSG_ADD_OPT(X11_FOUND)
731     #############
732     #### VTK
733     #############
735     IF(OSG_ENABLE_VTK)
736       IF(OSG_USE_OSG_VTK_SETUP)
737         OSG_CONFIGURE_VTK()
738       ELSE(OSG_USE_OSG_VTK_SETUP)
739         FIND_PACKAGE(VTK NO_MODULE)
741         IF(VTK_FOUND)
742           OSG_SET(OSG_WITH_VTK 1)
744           INCLUDE(${VTK_USE_FILE})
745           OSG_SET(OSG_VTK_LIBS "${VTK_LIBRARIES}")
747           OSG_ADD_OPT(OSG_VTK_LIBS)
748           OSG_ADD_OPT(VTK_LIBRARY_DIRS)
749           OSG_ADD_OPT(VTK_INCLUDE_DIRS)
750           OSG_ADD_OPT(VTK_DIR)
751         ENDIF(VTK_FOUND)
752       ENDIF(OSG_USE_OSG_VTK_SETUP)
754       OSG_ADD_OPT(VTK_FOUND)
755     ENDIF()
757     ##############
758     #### GLEW
759     ##############
761     IF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
762       OSG_CONFIGURE_GLEW()
764       IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
765         LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
766       ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
768     ENDIF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
770     ##############
771     #### Mini
772     ##############
774     OSG_CONFIGURE_LIBMINI()
776     OSG_ADD_OPT(OSG_LIBMINI_FOUND)
777     OSG_ADD_OPT(OSG_LIBMINI_INCLUDE_DIR)
778     OSG_ADD_OPT(OSG_LIBMINI_LIBRARIES)
780     ###############
781     #### OpenNurbs
782     ###############
784     OSG_CONFIGURE_OPENNURBS()
786     OSG_ADD_OPT(OPENNURBS_FOUND)
787     OSG_ADD_OPT(OPENNURBS_INCLUDE_DIR)
788     OSG_ADD_OPT(OPENNURBS_LIBRARIES)
790     #################
791     #### AntTweakBar
792     #################
794     OSG_CONFIGURE_ANTTWEAKBAR()
796     OSG_ADD_OPT(OSG_ANTTWEAKBAR_FOUND)
797     OSG_ADD_OPT(OSG_ANTTWEAKBAR_INCLUDE_DIR)
798     OSG_ADD_OPT(OSG_ANTTWEAKBAR_LIBRARIES)
800     ###########
801     #### QHull
802     ###########
804     OSG_CONFIGURE_QHULL()
806     OSG_ADD_OPT(OSG_QHULL_FOUND)
807     OSG_ADD_OPT(OSG_QHULL_INCLUDE_DIR)
808     OSG_ADD_OPT(OSG_QHULL_LIBRARIES)
810     #############
811     #### Python
812     #############
814     FIND_PACKAGE(PythonInterp)
815     FIND_PACKAGE(PythonLibs)
817     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
818     OSG_ADD_OPT(PYTHON_LIBRARY)
819     OSG_ADD_OPT(PYTHONLIBS_FOUND)
821     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
823       FIND_PACKAGE(Boost COMPONENTS python)
825       IF(Boost_FOUND AND WIN32)
827         SET(OSG_BOOST_PYTHON_TARGETS )
828         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
829         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
830       
831       ELSE(Boost_FOUND AND WIN32)
833         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
834            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
836           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
838         ELSE()
839           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
840         ENDIF()
842       ENDIF(Boost_FOUND AND WIN32)
844       # We ignore if boost python fails, we catch that somewhere else
845       # so if we get here Boost_FOUND was true in the first place
846       SET(Boost_FOUND TRUE)
848       FIND_PACKAGE(GCCXML)
850       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
851       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
852       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
854     ENDIF()
857     ###############
858     #### Flex/Bison
859     ###############
861     FIND_PROGRAM(FLEX_EXE flex)
862     FIND_PROGRAM(BISON_EXE bison)
864     OSG_ADD_OPT(FLEX_EXE)
865     OSG_ADD_OPT(BISON_EXE)
867     ##############
868     #### NVPerfSDK
869     ##############
871 #    OSG_FIND_PACKAGE(NVidiaPerfSDK)
873 #    IF(NVIDIAPERFSDK_FOUND)
874 #        OSG_SET(OSG_WITH_NVPERFSDK 1)
875 #        OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
876 #        OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
877 #    ELSE(NVIDIAPERFSDK_FOUND)
878 #        OSG_SET(OSG_WITH_NVPERFSDK 0)
879 #        OSG_SET(OSG_NVPERFSDK_INC_DIR "")
880 #        OSG_SET(OSG_NVPERFSDK_LIBS "")
881 #    ENDIF(NVIDIAPERFSDK_FOUND)
884     #############
885     #### Support
886     #############
888     IF(UNIX)
889         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
890         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
891         FIND_LIBRARY(OSG_RT_LIB     NAMES rt)
893         OSG_ADD_OPT(OSG_THREAD_LIB)
894         OSG_ADD_OPT(OSG_DL_LIB)
895         OSG_ADD_OPT(OSG_RT_LIB)
896     ENDIF(UNIX)
898     IF(APPLE)
899         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
900         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
901         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
902         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
904         OSG_ADD_OPT(OSG_APPLICATIONSERVICES_FRAMEWORK)
905         OSG_ADD_OPT(OSG_CORESERVICES_FRAMEWORK)
906         OSG_ADD_OPT(OSG_CARBON_FRAMEWORK)
907         OSG_ADD_OPT(OSG_COCOA_FRAMEWORK)
908     ENDIF(APPLE)
910     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
912 ENDIF(NOT OSG_BUILD_DEPENDEND)
914 MESSAGE("")
916 SET(CFG_NAME OSG)
917 FOREACH(EXTERNAL_PREPARE ${OSG_EXTERNAL_PREPARE})
918   INCLUDE("${EXTERNAL_PREPARE}/CMakeLists.PackagePrepare.cmake")
919 ENDFOREACH()
921 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
922   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
923     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
924   ENDIF(EXISTS
925   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
926 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
929 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
930   INCLUDE(${OSG_GLOBAL_PREP})
931 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
933 IF(APPLE AND OSG_COCOA_FRAMEWORK)
934     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
935 ELSEIF(WIN32)
936     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
937 ELSEIF(UNIX AND X11_FOUND)
938     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
939 ELSEIF(APPLE AND IOS)
940     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
941 ELSE()
942     OSG_SET(OSG_NATIVE_WINDOW "")
943 ENDIF()
945 ###############
946 #### Doxygen
947 ###############
949 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
950   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
951                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
952 ENDIF()
954 FIND_PACKAGE(Doxygen)
956 ##############################################################################
957 # Overrides if dependend
958 ##############################################################################
960 IF(NOT WIN32)
961     IF(OSG_BUILD_DEPENDEND)
962         MESSAGE(STATUS "Load reference settings")
963         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
964         # Needed to get the correct vtk/boost settings
965         FIND_PACKAGE(VTK)
966         OSG_BOOST_DEP_SETUP()
967         OSG_CONFIGURE_QT()
969         IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
970           LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
971         ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
973     ELSE(OSG_BUILD_DEPENDEND)
974 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
975     ENDIF(OSG_BUILD_DEPENDEND)
976 ENDIF(NOT WIN32)
978 ##############################################################################
979 # MAIN BUILD STEPS
980 ##############################################################################
982 # when adding passes, make sure to add a corresponding pass directory variable
983 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
984 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
986 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
987 SET(OSG_PASSDIR_OSGSETUP   "Build")
989 OSG_COMMON_TARGETS()
991 ###############
992 # Clean
993 ###############
995 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
997 IF(OSG_OLD_BUILD_FILES)
998     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
999 ENDIF(OSG_OLD_BUILD_FILES)
1001 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
1003 IF(OSG_OLD_CONFIG_FILES)
1004     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
1005 ENDIF(OSG_OLD_CONFIG_FILES)
1007 ###############
1008 # Tests
1009 ###############
1011 # optional pass for test programs
1012 IF(OSGBUILD_TESTS)
1013     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
1014     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
1015 ENDIF(OSGBUILD_TESTS)
1017 ###############
1018 # UnitTests
1019 ###############
1021 IF(OSGBUILD_UNITTESTS)
1022     ENABLE_TESTING()
1023     INCLUDE(CTest)
1025     # optional pass for unittest programs
1026     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
1027     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
1029     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
1030                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
1032     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
1033     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
1034     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
1036     ADD_CUSTOM_TARGET(OSGAllUnitTests)
1037     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
1038 ENDIF(OSGBUILD_UNITTESTS)
1040 ###############
1041 # Python
1042 ###############
1044 INCLUDE(OSGSetupPython)
1045 SETUP_PYTHON_BUILD()
1047 #################
1048 # Documentation I
1049 #################
1050 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1051 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1053 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1054     ADD_CUSTOM_TARGET(Doc)
1055 ENDIF()
1057 IF(DOXYGEN_EXECUTABLE)
1058     SET(DOXYGEN_VERSION)
1059     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1060                     OUTPUT_VARIABLE DOXYGEN_VERSION
1061                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1062     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1063         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1064                         "when building OpenSG documentation. "
1065                         "Please use a different version, sorry for the inconvenience.")
1066     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1067 ENDIF(DOXYGEN_EXECUTABLE)
1069 IF(NOT OSG_DOXY_INPUTS)
1070     # add a pass for doxygen to run
1071     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1072     SET(OSG_PASSDIR_OSGDOXYDOC "Doc/build")
1073 ELSE()
1074     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC_EXT")
1075     SET(OSG_PASSDIR_OSGDOXYDOC_EXT "DocExt/build")
1076 ENDIF(NOT OSG_DOXY_INPUTS)
1078 # set up variables for the config file
1079 IF(DOXYGEN_DOT_EXECUTABLE)
1080     SET(OSG_DOXY_HAVE_DOT "YES")
1081 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1083 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1084 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1085 SET(OSG_GENDOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/GenDoc/opensg-doxy")
1087 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1089 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1090     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1091     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1092     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1093     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1094     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1095     SET(OSG_DOXY_SEARCHENGINE "NO")
1097 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1098     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1099     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1100     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1101     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1102     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1103     SET(OSG_DOXY_SEARCHENGINE "NO")
1105 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1106     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1107     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1108     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1109     SET(OSG_DOXY_HAVE_DOT "NO")
1110     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1111     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1112     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1113     SET(OSG_DOXY_SEARCHENGINE "NO")
1115 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1117 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1118   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1119 ELSE()
1120   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1121 ENDIF()
1123 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1125 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1126 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1128 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1129   SET(OSG_DOC_SECTION "all_in_one")
1130   SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
1131 ELSE()
1132   SET(OSG_DOC_SECTION "separate")
1133 ENDIF()
1135 # write doxygen config file
1136 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1137                "${OSG_DOXY_CONFIGURATION_FILE}")
1140 # write general doc config file
1142 SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/GenDoc")
1143 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "")
1144 #SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS=${CMAKE_BINARY_DIR}/Doc/html/Full/html")
1146 SET(OSG_DOC_SECTION "${OSG_DOC_SECTION} include_general_doc")
1148 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1149                "${OSG_GENDOXY_CONFIGURATION_FILE}")
1151 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1153 # find/process documentation include files
1154 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1156 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1158   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1160   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1161                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1163 ENDFOREACH()
1165 IF(OSG_DOXY_INPUTS)
1166     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1167                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1168 ENDIF(OSG_DOXY_INPUTS)
1171 IF(DOXYGEN_EXECUTABLE)
1172   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1173   ADD_DEPENDENCIES(DocUpload Doc)
1176   ADD_CUSTOM_TARGET(DocSyncGV
1177                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1178                     WORKING_DIRECTORY Doc)
1180   ADD_CUSTOM_TARGET(DocCompleteGV)
1181   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1182 ENDIF(DOXYGEN_EXECUTABLE)
1184 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1186 ###############
1187 # PrePasses
1188 ###############
1190 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1191   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1192     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1193   ENDIF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1194 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1196 ###############
1197 # Passes
1198 ###############
1200 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1201   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1203   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1204        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1206   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1207     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1208     INCLUDE(${_OSGCORE_EXT_FILE})
1209   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1212 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1214 # Find files describing libraries to build, but make sure base
1215 # and system are processed first
1216 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1217      "Source/CMakeLists.Lib.OSGBase.txt")
1219 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1220      "Source/CMakeLists.Lib.OSGSystem.txt")
1222 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1223      "Source/*CMakeLists.Lib.*.txt")
1225 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1226 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1228 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1229 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1231 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1232   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1234   IF(_OSG_FOUND_CONTRIB_CONFIG)
1235     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1236   ELSE()
1237     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1238   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1239 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1241 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1243 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1245   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1246                          ${_OSG_LIBRARY_CONFIG}
1247                           PATH)
1249   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1250                          ${_OSG_LIBRARY_CONFIG}
1251                           NAME)
1253   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1254                      ${_OSG_LIBCONFIG_BASENAME})
1256   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1257                          ${_OSG_LIBCONFIG_BASENAME_1}
1258                          NAME_WE)
1260   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1261     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1262   ENDIF()
1264 ENDFOREACH()
1266 OSG_COMMON_CUDA()
1268 # run build passes
1269 FOREACH(PASS ${OSG_CMAKE_PASSES})
1270     SET(OSG_CMAKE_PASS ${PASS})
1272     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1274     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1275         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1276         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1277         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1278         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1280         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1282         IF(_OSG_IS_CONTRIBLIB)
1283           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1284         ELSE()
1285           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1286         ENDIF()
1288         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1289     ENDFOREACH(LIBCONFIGFILE)
1291     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1293     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1294         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1295                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1296     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1298 ENDFOREACH()
1300 IF(NOT WIN32)
1301   IF(NOT OSG_BUILD_DEPENDEND)
1302     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1303   ENDIF(NOT OSG_BUILD_DEPENDEND)
1304 ENDIF(NOT WIN32)
1306 ###############
1307 # OSGConfigured
1308 ###############
1311 EXECUTE_PROCESS(
1312     COMMAND "${CMAKE_COMMAND}" -E copy
1313                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1314                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1316 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1317   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1318 ENDFOREACH()
1320 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1322 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1323                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1325 EXECUTE_PROCESS(
1326     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1327                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1328                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1330 #################
1331 # Examples/Simple
1332 #################
1334 ADD_CUSTOM_TARGET(OSGAllExamples)
1335 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1337 IF(OSGBUILD_EXAMPLES_SIMPLE)
1338     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1339     ADD_SUBDIRECTORY("Examples/Simple")
1340     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1341 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1343 ###################
1344 # Examples/Advanced
1345 ###################
1347 IF(OSGBUILD_EXAMPLES_ADVANCED)
1348     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1349     ADD_SUBDIRECTORY("Examples/Advanced")
1350     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1351     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1352     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1353 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1355 ###################
1356 # Examples/Advanced
1357 ###################
1359 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1360     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1361     ADD_SUBDIRECTORY("Examples/Tutorial")
1362     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1363 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1365 ###################
1366 # External Examples
1367 ###################
1369 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1370   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1372   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1373     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1374     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1375   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1376 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1378 ##################
1379 # Documentation II
1380 ##################
1382 SET(OSG_DOC_PIPES "")
1384 IF(OSG_DOXY_STDOUT_LOG)
1385     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1386 ENDIF(OSG_DOXY_STDOUT_LOG)
1388 IF(DOXYGEN_EXECUTABLE)
1389     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1390         ADD_CUSTOM_TARGET(Doc
1391             VERBATIM
1392             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1393     ENDIF()
1394 ENDIF()
1396 IF(DOXYGEN_EXECUTABLE)
1397   ADD_CUSTOM_TARGET(GenDoc
1398                     VERBATIM
1399                     COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_GENDOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1400 ENDIF()
1402 ##################
1403 # Documentation II
1404 ##################
1406 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1407   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1408     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1409   ENDIF()
1410 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1412 ##################
1413 # osg2-config
1414 ##################
1416 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1417 # is generated during the OSGCOLLECT pass.
1419 # substitute variables in static parts
1420 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1421                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1422 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1423                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1425 # read in all parts
1426 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1427 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1428 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1430 # concatenate final file
1431 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1432 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1433 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1435 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1436 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1437 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1439 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1440         DESTINATION bin)
1441 #        COMPONENT development_tools)
1443 ##################
1444 # cmake modules
1445 ##################
1447 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cmake)
1449 STRING(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_UP)
1451 STRING(REPLACE "OpenSG" "OSG" CMAKE_PROJECT_NAME_SHORT ${CMAKE_PROJECT_NAME})
1453 STRING(TOUPPER "OpenSG" ${CMAKE_PROJECT_NAME_SHORT} ${CMAKE_PROJECT_NAME_SHORT_UP})
1455 CONFIGURE_FILE(CMake/FindOpenSG.cmake.in
1456                ${CMAKE_BINARY_DIR}/cmake/Find${CMAKE_PROJECT_NAME}.cmake
1457                @ONLY                                                   )
1459 INSTALL(FILES "${CMAKE_BINARY_DIR}/cmake/FindOpenSG.cmake"
1460         DESTINATION share/OpenSG/cmake)
1461 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake.in"
1462         DESTINATION share/OpenSG/cmake)
1463 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1464         DESTINATION share/OpenSG/cmake)
1465 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1466         DESTINATION share/OpenSG/cmake)
1467 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindExpat_OpenSG.cmake"
1468         DESTINATION share/OpenSG/cmake)
1469 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1470         DESTINATION share/OpenSG/cmake)
1471 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1472         DESTINATION share/OpenSG/cmake)
1473 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLEW_OpenSG.cmake"
1474         DESTINATION share/OpenSG/cmake)
1475 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1476         DESTINATION share/OpenSG/cmake)
1477 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1478         DESTINATION share/OpenSG/cmake)
1479 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1480         DESTINATION share/OpenSG/cmake)
1481 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGSetupCompiler.cmake"
1482         DESTINATION share/OpenSG/cmake)
1483 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGUpdateCompiler.cmake"
1484         DESTINATION share/OpenSG/cmake)
1485 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGBuildFunctions.cmake"
1486         DESTINATION share/OpenSG/cmake)
1487 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGConfigurePackages.cmake"
1488         DESTINATION share/OpenSG/cmake)
1489 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGExternalProjectHelper.cmake"
1490         DESTINATION share/OpenSG/cmake)
1491 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1492         DESTINATION share/OpenSG/cmake)
1493 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1494         DESTINATION share/OpenSG/cmake)
1495 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonOptions.cmake"
1496         DESTINATION share/OpenSG/cmake)
1497 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonConfig.cmake"
1498         DESTINATION share/OpenSG/cmake)
1499 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonSupportConfig.cmake"
1500         DESTINATION share/OpenSG/cmake)
1502 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1503         DESTINATION bin
1504 #        COMPONENT development_tools
1505         PATTERN "*/fcd2code/fcd2code" EXCLUDE
1506         PATTERN "*.pyc" EXCLUDE
1507         PATTERN ".svn"  EXCLUDE)
1508 INSTALL(PROGRAMS "${CMAKE_SOURCE_DIR}/Tools/fcd2code/fcd2code"
1509         DESTINATION bin/fcd2code)
1511 ##################
1512 # Global Python
1513 ##################
1515 IF(OSGBUILD_PYTHON_BINDINGS)
1516   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1517                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1518                   OUTPUT_VARIABLE _OSG_LIBORDER)
1521                  
1522   SET(_OSG_PY_MODNAME_LIST "osg2ModuleNameList = [\n")
1523   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1525   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1526     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1527     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1528     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1529     SET(_OSG_PY_MODNAME_LIST "${_OSG_PY_MODNAME_LIST}  \"${_OSG_LIB}\",\n")
1530   ENDFOREACH()
1532   SET(OSG_PYTHON_ALL_IMPORTS "${_OSG_PY_MODNAME_LIST}  ]\n\n${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1534   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1535   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1538   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1539                  "${_OSG_GEN_INIT_FILE_OUT}")
1541   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1542                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1544   IF(WIN32) 
1546     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1547     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1548     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1549     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1551     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1552             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1553             CONFIGURATIONS Release)
1554 #            COMPONENT      release_runtimes)
1556     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1557             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/osg
1558             CONFIGURATIONS Debug)
1559 #            COMPONENT      debug_runtimes)
1561     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1562             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/osg
1563             CONFIGURATIONS DebugOpt)
1564 #            COMPONENT      debug_opt_runtimes)
1566     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1567             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/osg
1568             CONFIGURATIONS ReleaseNoOpt)
1569 #            COMPONENT      release_no_opt_runtimes)
1572     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1573             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1574             CONFIGURATIONS Release)
1575 #            COMPONENT      release_runtimes)
1577     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1578                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1579                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1580                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1581             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1582             CONFIGURATIONS Release)
1583 #            COMPONENT      release_runtimes)
1586     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1587             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1588             CONFIGURATIONS Debug)
1589 #            COMPONENT      debug_runtimes)
1591     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1592                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1593                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1594                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1595             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1596             CONFIGURATIONS Debug)
1597 #            COMPONENT      debug_runtimes)
1600     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1601             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1602             CONFIGURATIONS DebugOpt)
1603 #            COMPONENT      debug_opt_runtimes)
1605     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1606                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1607                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1608                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1609             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1610             CONFIGURATIONS DebugOpt)
1611 #            COMPONENT      debug_opt_runtimes)
1614     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1615             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1616             CONFIGURATIONS ReleaseNoOpt)
1617 #            COMPONENT      release_no_opt_runtimes)
1619     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1620                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1621                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1622                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1623             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1624             CONFIGURATIONS ReleaseNoOpt)
1625 #            COMPONENT      release_no_opt_runtimes)
1627   ELSE(WIN32)   
1629     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1630     SET(_OSG_PY_INST_BASE 
1631         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1633     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1634             DESTINATION ${_OSG_PY_INST_BASE}/osg)
1635 #            COMPONENT   libraries)
1637     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1638             DESTINATION ${_OSG_PY_INST_BASE})
1639 #            COMPONENT   libraries)
1641     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1642                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1643                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1644                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1645             DESTINATION ${_OSG_PY_INST_BASE}/helpers)
1646 #            COMPONENT   libraries)
1648   ENDIF(WIN32)
1650 ENDIF()
1652 INSTALL_PYTHON_ELEMENTS()
1654 ##################
1655 # Documentation
1656 ##################
1658 IF(DOXYGEN_EXECUTABLE)
1659     IF(OSG_INSTALL_DOXYDOC)
1660         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1661                 DESTINATION share/OpenSG/documentation)
1662 #                COMPONENT documentation)
1663     ENDIF()
1664 ENDIF()
1666 ##################
1667 # Images/Icons
1668 ##################
1670 ##################
1671 # CSM Example
1672 ##################
1674 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
1675         DESTINATION share/OpenSG/Examples/)
1676 #        COMPONENT examples_basic)
1678 ##################
1679 # Packaging
1680 ##################
1682 #IF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1684 #    SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
1686 #    SET(CPACK_PACKAGE_NAME                "OpenSG")
1687 #    SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
1688 #    SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
1689 #    SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
1690 #    SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
1691 #    SET(CPACK_PACKAGE_VENDOR              "OpenSG")
1692 #    SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
1693 #    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
1694 #    SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
1695 #    SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
1697 #    if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
1698 #        set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
1699 #        set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
1700 #    endif ()
1702 #    if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
1703 #        set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
1704 #    endif()
1706 #    #Define Components
1707 #    SET(CPACK_COMPONENTS_ALL development_tools
1708 #        development_configuration
1709 #        code_headers
1710 #        libraries
1711 #        debug_program_db
1712 #        release_program_db
1713 #        debug_libraries
1714 #        release_libraries
1715 #        debug_runtimes
1716 #        release_runtimes
1717 #        data_images
1718 #        examples_basic
1719 #        examples_advanced
1720 #        Unspecified
1721 #        )
1724 #    #Components
1725 #    #Runtime
1726 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
1728 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
1729 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
1730 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
1731 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1733 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
1734 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
1735 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
1736 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1738 #    #Development
1739 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
1741 #    #Libraries
1742 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
1743 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
1744 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
1745 #    set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
1747 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
1748 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
1749 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
1750 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
1752 #    #Program database
1753 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
1754 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
1755 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
1756 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
1758 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
1759 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
1760 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
1761 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
1763 #    #Tools
1764 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
1765 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
1766 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
1767 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
1769 #    #Configuration
1770 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
1771 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
1772 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
1773 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
1775 #    #Headers
1776 #    SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
1777 #    SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
1778 #    SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
1779 #    SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
1781 #    #Examples
1782 #    SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
1784 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
1785 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
1786 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
1787 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
1789 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
1790 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
1791 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
1792 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
1794 #    #Shared Data
1795 #    SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
1797 #    SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
1798 #    SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
1799 #    SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
1800 #    SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
1802 #    #Documentation
1803 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
1805 #    #Dependencies
1806 #    #Boost
1807 #    #Base
1809 #    #NSIS specific configuration
1810 #    IF(WIN32)
1811 #        INCLUDE(InstallRequiredSystemLibraries)
1812 #        IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
1813 #            IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
1814 #                         ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
1815 #                 include(CMakeDetermineVSServicePack)
1816 #                 DetermineVSServicePack( my_service_pack )
1818 #                 IF( my_service_pack )
1819 #                     SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
1820 #                 ENDIF()
1821 #            ENDIF()
1823 #            #Extra install commands
1824 #            SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
1825 #            SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
1828 #            SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1829 #            SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1830 #            FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
1831 #            SET(CPACK_NSIS_MODIFY_PATH         ON)
1832 #            SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
1833 #            SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
1834 #            SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
1835 #            SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
1836 #            SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
1837 #            SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
1838 #            SET(CPACK_NSIS_MENU_LINKS          "")
1839 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
1840 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
1841 #        ENDIF()
1842 #    ENDIF()
1845 #    # Date macro by Benoit RAT (www.neub.co.nr)
1846 #    MACRO (TODAY RESULT)
1847 #        IF (WIN32)
1848 #            EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
1849 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1850 #        ELSEIF(UNIX)
1851 #            EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
1852 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1853 #        ELSE (WIN32)
1854 #            MESSAGE(SEND_ERROR "date not implemented")
1855 #            SET(${RESULT} 000000)
1856 #        ENDIF (WIN32)
1857 #    ENDMACRO (TODAY)
1859 #    TODAY(DATE)
1861 #    # Determine package type
1862 #    IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1863 #        IF(WIN32)
1864 #            SET(OSGBUILD_PACKAGE_TYPE "ZIP")
1865 #        ELSE(WIN32)
1866 #            SET(OSGBUILD_PACKAGE_TYPE "RPM")
1867 #        ENDIF(WIN32)
1868 #    ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1870 #    STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
1872 #    IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
1873 #        SET( PACK_EXT "tar.bz2" )
1874 #    ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
1875 #        SET( PACK_EXT "tar.gz" )
1876 #    ELSE()
1877 #        STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
1878 #    ENDIF()
1880 #    SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
1881 #    SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
1883 #    INCLUDE(CPack)
1886 #    # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
1887 #    IF(WIN32)
1888 #        #TODO: Need a way to do this on Windows
1889 #        #ADD_CUSTOM_TARGET(PackageUpload COMMAND curl -F "code=${OPENSG_UPLOAD_CODE}" -F "quiet=1" -F "out=${OUTFILE}" -F "file=@${PACKAGE}" http://www.opensg.org/htdocs/drop.php )
1890 #        #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1891 #    ELSE(WIN32)
1892 #        ADD_CUSTOM_TARGET(PackageUpload COMMAND curl -F "code=${OPENSG_UPLOAD_CODE}" -F "quiet=1" -F "out=${OUTFILE}" -F "file=@${PACKAGE}" http://www.opensg.org/htdocs/drop.php )
1893 #        ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1894 #    ENDIF(WIN32)
1897 #ENDIF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1899 IF(NOT WIN32)
1900   CONFIGURE_FILE(CMake/CMakeLists.packaging.unix.txt 
1901                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1902                  @ONLY                                      )
1903 ELSE()
1905   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
1906     SET(OSG_WIN_SEC "nosec")
1907   ELSE()
1908     SET(OSG_WIN_SEC "msdefault")
1909   ENDIF()
1911   CONFIGURE_FILE(CMake/CMakeLists.packaging.win.txt 
1912                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1913                  @ONLY                                      )
1914   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico"
1915           DESTINATION share/OpenSG/Packaging
1916 #          COMPONENT packaging
1917           PERMISSIONS OWNER_WRITE OWNER_READ
1918                       GROUP_READ
1919                       WORLD_READ            )
1921   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp"
1922           DESTINATION share/OpenSG/Packaging
1923 #          COMPONENT packaging
1924           PERMISSIONS OWNER_WRITE OWNER_READ
1925                       GROUP_READ
1926                       WORLD_READ            )
1927 ENDIF()
1929 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1930         DESTINATION share/OpenSG/Packaging
1931 #        COMPONENT packaging
1932         PERMISSIONS OWNER_WRITE OWNER_READ
1933                     GROUP_READ
1934                     WORLD_READ
1935         RENAME CMakeLists.txt)
1937 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
1938         DESTINATION share/doc/OpenSG/
1939 #        COMPONENT doc
1940         PERMISSIONS OWNER_WRITE OWNER_READ
1941                     GROUP_READ
1942                     WORLD_READ)
1944 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/PLY/README
1945         DESTINATION share/doc/OpenSG/
1946 #        COMPONENT doc
1947         PERMISSIONS OWNER_WRITE OWNER_READ
1948                     GROUP_READ
1949                     WORLD_READ
1950         RENAME README.ply)
1952 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/TrapezoidalShadowMaps/README
1953         DESTINATION share/doc/OpenSG/
1954 #        COMPONENT doc
1955         PERMISSIONS OWNER_WRITE OWNER_READ
1956                     GROUP_READ
1957                     WORLD_READ
1958         RENAME README.tsm)
1960 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README
1961         DESTINATION share/doc/OpenSG/
1962 #        COMPONENT doc
1963         PERMISSIONS OWNER_WRITE OWNER_READ
1964                     GROUP_READ
1965                     WORLD_READ
1966         RENAME README.rhine)
1968 IF(WIN32)
1969   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
1970                                 CACHE STRING "OpenSG Build Types" FORCE )
1971 ELSE()
1972   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
1973                                 CACHE STRING "OpenSG Build Types" FORCE )
1974 ENDIF(WIN32)
1975 IF(APPLE AND IOS)
1976   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
1977                                 CACHE STRING "OpenSG Build Types" FORCE )
1978 ENDIF()
1980 IF(WIN32)
1981   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1982        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
1984   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1985        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
1987 ENDIF(WIN32)
1989 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1990      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
1992 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1993      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
1995 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1996      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
1998 ###########################
1999 # Component install Setting
2000 ###########################
2002 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
2004 IF(NOT WIN32)
2005   ADD_CUSTOM_TARGET(OSG_preinstall
2006                     make preinstall
2007                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2008 ELSE()
2009 ENDIF()
2011 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
2013   IF(NOT WIN32)
2014     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2015                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
2016                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2017   ELSE()
2019     SET(_OSG_CMP_CONF Release)
2021     IF(${_OSG_CMP} MATCHES ^debug_)
2022       SET(_OSG_CMP_CONF Debug)
2023     ENDIF()
2025     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2026                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
2027                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2029     SET_PROPERTY(TARGET INSTALL_${_OSG_CMP} PROPERTY FOLDER "Packaging")
2030   ENDIF()
2032   IF(NOT WIN32)
2033     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
2034   ELSE()
2035   ENDIF()
2036 ENDFOREACH()
2039 IF(WIN32)
2041   ADD_CUSTOM_TARGET(INSTALL_runtime)
2043   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_runtimes)
2044   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_binaries)
2046   SET_PROPERTY(TARGET INSTALL_runtime PROPERTY FOLDER "Packaging")
2048 ELSE()
2050   ADD_CUSTOM_TARGET(INSTALL_runtime)
2052   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
2053   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_binaries)
2054 ENDIF()
2056 #IF(WIN32)
2057 #  SET_PROPERTY(TARGET ALL_BUILD PROPERTY FOLDER "CMakePredefinedTargets")
2058 #ENDIF()
2060 ################
2061 # Build Setting
2062 ################
2064 IF(NOT WIN32)
2065   IF(NOT OSG_BUILD_DEPENDEND)
2066     OSG_WRITE_OSGBUILD(${CMAKE_BINARY_DIR}/CMake.build.settings)
2067     OSG_WRITE_OSGGLOBALSETUP(${CMAKE_BINARY_DIR}/CMake.global.settings)
2068   ENDIF(NOT OSG_BUILD_DEPENDEND)
2069 ENDIF(NOT WIN32)
2071 IF(OSG_WITH_CUDA)
2072   CUDA_BUILD_CLEAN_TARGET()
2073 ENDIF(OSG_WITH_CUDA)
2076 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2078 FOREACH(_variableName ${_variableNames})
2079   IF(_variableName MATCHES "^OSG")
2080 #    MESSAGE("FOO : ${_variableName}")
2081 #    FILE(APPEND ${FILENAME}
2082 #         "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2083   ENDIF()
2084 ENDFOREACH()