changed: preserve project header files
[opensg.git] / CMakeLists.txt
blobd528c4216799d4ea5f67454e7232a40b02fc6443
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        "" ON)
108 OSG_OPTION(OSG_USE_OSG2_NAMESPACE "" OFF)
109 OSG_OPTION(OSG_ENABLE_C++11 "" OFF)
110 OSG_OPTION(OSG_ENABLE_BOOST_C++11_STD_ATOMICS "" OFF)
112 OSG_OPTION(OSG_ENABLE_TESTCONTAINER "" OFF)
113 OSG_OPTION(OSG_ENABLE_VALGRIND_CHECKS "" OFF)
114 OSG_OPTION(OSG_ENABLE_MEMORY_DEBUGGING "" OFF)
115 OSG_OPTION(OSG_ENABLE_DOUBLE_MATRIX_STACK "" OFF)
116 OSG_OPTION(OSG_ENABLE_DEFAULT_READONLY_CHANGELIST "" OFF)
117 OSG_OPTION(OSG_DISABLE_SOURCE_GROUPS "" OFF)
118 OSG_OPTION(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE "" OFF)
120 OSG_OPTION(OSG_ENABLE_CUDA "" OFF)
121 OSG_OPTION(OSG_ENABLE_VTK  "" ON )
123 IF(WIN32)
124   OPTION(OSG_ENABLE_WIN_LOCALSTORAGE "" ON)
125   OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
127   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
128     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
129   ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
130     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
131   ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
132 ELSEIF(APPLE)
133   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" OFF)
134 ELSEIF(UNIX)
135   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" ON)
136 ENDIF()
138 OSG_OPTION(OSG_ENABLE_AUTOINIT_THREADS "" OFF)
139 OPTION(OSG_DEPENDENT_INCLUDE_BUILD "" OFF)
141 IF(WIN32)
142   OSG_OPTION(OSG_USE_SEPARATE_LIBDIRS "" ON)
143   OSG_OPTION(OSG_INSTALL_PDB_FILES "" OFF)
144   OSG_OPTION(OSG_WINDOWS_LINK_OPTIMIZE "" OFF)
145 ENDIF(WIN32)
147 OSG_OPTION(OSG_INSTALL_EXAMPLES "" OFF)
148 OSG_OPTION(OSG_INSTALL_EXAMPLES_EXE "" OFF)
149 OSG_OPTION(OSG_INSTALL_APPS "" ON)
151 OSG_OPTION(OSGCOMPAT_ENABLE                  "" OFF)
152 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED       "" OFF)
153 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED_PROPS "" OFF)
155 OSG_SET_CACHE(OSG_RENDERPROPERTY_BITS 64 STRING "")
156 OSG_SET_CACHE(OSG_RENDERPROPERTY_UNIQUE_BITS 16 STRING "")
158 OSG_OPTION(OSG_GENERATE_SEPARATE_LIB_DOC "Generate separate doxygen documentation for contrib libraries" OFF)
159 OSG_OPTION(OSG_INSTALL_DOXYDOC "Install Doxygen documentation" OFF)
161 OSG_OPTION(OSG_LINK_EXTERNAL_MODULES_TO_CSM "" FALSE)
164 #OSG_OPTION(OSGBUILD_ENABLE_PACKAGING "Generate binary packages with CPack" OFF)
165 #SET(OSGBUILD_PACKAGE_TYPE "" CACHE STRING
166 #    "The type of package to generate (empty->default)")
169 SET(OSG_DOXY_DOC_TYPE "User" CACHE STRING
170     "The type of documentation to generate (User, Developer, Trac)")
171 SET(OSG_DOXY_INPUTS CACHE FILEPATH "include given file instead of autogen")
172 SET(OSG_DOXY_STDOUT_LOG CACHE FILEPATH "log std to file")
174 # Not sure
175 #OPTION(OSG_ENABLE_MTCPTR "" ON)
176 #OPTION(OSG_ENABLE_GIF    "" ON)
178 ## prep options for OSGConfigured.h
180 IF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
181   SET(OSG_DISABLE_DEPRECATED 1)
182 ENDIF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
184 IF(OSG_USE_OSG2_NAMESPACE)
185   ADD_DEFINITIONS(-DOSG_USE_OSG2_NAMESPACE=1)
186 ENDIF()
188 IF(OSG_ENABLE_SSE2)
189   SET(OSG_SIMD_SSE 1)
190 ENDIF(OSG_ENABLE_SSE2)
192 IF(OSG_ENABLE_NEW_OSB_IO)
193   SET(OSG_NEW_OSB_IO 1)
194 ENDIF(OSG_ENABLE_NEW_OSB_IO)
196 IF(OSG_ENABLE_GLDEFINE_MAPPER)
197   SET(OSG_GL_DEFMAPPER 1)
198 ENDIF(OSG_ENABLE_GLDEFINE_MAPPER)
200 IF(OSG_ENABLE_MULTISHADER_VARCHUNK)
201   SET(OSG_MULTISHADER_VARCHUNK 1)
202 ENDIF(OSG_ENABLE_MULTISHADER_VARCHUNK)
204 IF(OSG_ENABLE_OGL_COREONLY)
205   SET(OSG_OGL_COREONLY 1)
206 ENDIF(OSG_ENABLE_OGL_COREONLY)
208 IF(OSG_ENABLE_GL_INCLUDE_GLEW)
209   SET(OSG_GL_INCLUDE_GLEW 1)
210 ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW)
212 IF(OSG_ENABLE_OGL_ES2)
213   SET(OSG_OGL_ES2 1)
214   SET(OSG_OGL_NO_DOUBLE 1)
215 ENDIF(OSG_ENABLE_OGL_ES2)
217 IF(OSG_ENABLE_OGLES_PROTOS)
218   SET(OSG_USE_OGLES_PROTOS 1)
219   SET(GL_GLEXT_PROTOTYPES 1)
220 ENDIF(OSG_ENABLE_OGLES_PROTOS)
222 IF(OSG_ENABLE_OGL3_PROTOS)
223   SET(GL_GLEXT_PROTOTYPES 1)
224   SET(GL3_PROTOTYPES 1)
225   SET(OSG_USE_OGL3_PROTOS 1)
226 ENDIF(OSG_ENABLE_OGL3_PROTOS)
228 IF(OSG_ENABLE_OGL4_PROTOS)
229   SET(GL_GLEXT_PROTOTYPES 1)
230   SET(GL3_PROTOTYPES 1)
231   SET(OSG_USE_OGL3_PROTOS 1)
232   SET(OSG_USE_OGL4_PROTOS 1)
233 ENDIF(OSG_ENABLE_OGL4_PROTOS)
235 IF(OSG_ENABLE_OGL_ES2_SIMGL3)
236   SET(OSG_OGL_ES2_SIMGL3 1)
237 ENDIF(OSG_ENABLE_OGL_ES2_SIMGL3)
239 IF(OSGCOMPAT_ENABLE)
240   SET(OSG_1_COMPAT 1)
241 ENDIF(OSGCOMPAT_ENABLE)
243 IF(NOT OSG_ENABLE_SCANPARSE_REGEN)
244   SET(OSG_PREBUILD_SCANPARSE 1)
245 ENDIF(NOT OSG_ENABLE_SCANPARSE_REGEN)
247 IF(OSG_ENABLE_ELF_LOCALSTORAGE)
248   SET(OSG_PTHREAD_ELF_TLS 1)
249 ENDIF(OSG_ENABLE_ELF_LOCALSTORAGE)
251 IF(OSG_ENABLE_WIN_LOCALSTORAGE)
252   SET(OSG_WIN32_ASPECT_USE_LOCALSTORAGE 1)
253 ENDIF(OSG_ENABLE_WIN_LOCALSTORAGE)
255 IF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
256   SET(OSG_DEPRECATED_PROPS 1)
257 ENDIF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
259 SET(OSG_SHC_MODE_${OSG_SHADER_CACHE_MODE} 1)
261 IF(NOT IOS)
262   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
263   SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
264   SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
265 ENDIF(NOT IOS)
267 INCLUDE(OSGConfigurePackages)
269 LIST(APPEND OSG_ADDITIONAL_CONFIGURE_LINES "")
271 IF(OSGEXCLUDE_TESTS_FROM_ALL)
272   SET(OSGEXCLUDE_TESTS EXCLUDE_FROM_ALL)
273 ELSE()
274   SET(OSGEXCLUDE_TESTS "")
275 ENDIF()
277 IF(OSGEXCLUDE_UNITTESTS_FROM_ALL)
278   SET(OSGEXCLUDE_UNITTESTS EXCLUDE_FROM_ALL)
279 ELSE()
280   SET(OSGEXCLUDE_UNITTESTS "")
281 ENDIF()
283 IF(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL)
284   SET(OSGEXCLUDE_EXAMPLES_SIMPLE EXCLUDE_FROM_ALL)
285 ELSE()
286   SET(OSGEXCLUDE_EXAMPLES_SIMPLE "")
287 ENDIF()
289 IF(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL)
290   SET(OSGEXCLUDE_EXAMPLES_ADVANCED EXCLUDE_FROM_ALL)
291 ELSE()
292   SET(OSGEXCLUDE_EXAMPLES_ADVANCED "")
293 ENDIF()
295 IF(NOT WIN32)
296   IF(OSG_BUILD_DEPENDEND)
297     INCLUDE(${OSG_REFERENCE_DIR}/CMake.global.settings)
298     IF(OSG_DEPENDENT_INCLUDE_BUILD)
299       INCLUDE(${OSG_REFERENCE_DIR}/CMake.build.settings)
300     ENDIF()
301   ENDIF()
302 ENDIF()
304 #####################
305 # External extensions
306 #####################
308 OSG_SET_CACHE(OSG_EXTRA_EXTERNAL_MODULES "" STRING
309               "Extra modules that OpenSG will try to import.")
311 OSG_SET_CACHE(OSG_IGNORE_INSTALL "" STRING
312               "Extra modules that OpenSG will build but not installed.")
314 OSG_SET_CACHE(OSG_EXTERNAL_MODULES_INCLUDE "" FILEPATH 
315               "Include file of extra modules")
317 IF(EXISTS "${OSG_EXTERNAL_MODULES_INCLUDE}")
318   INCLUDE("${OSG_EXTERNAL_MODULES_INCLUDE}")
319 ENDIF()
321 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_MODULES})
322     OPTION(OSGBUILD_${EXTERNAL}
323            "Build using ${EXTERNAL} module" OFF)
325     IF(OSGBUILD_${EXTERNAL})
326         FIND_PATH(OSG_${EXTERNAL}_SOURCE_DIR
327                   CMakeLists.Lib.${EXTERNAL}.txt
328                   ${CMAKE_CURRENT_SOURCE_DIR}/../${EXTERNAL})
330         OSG_ADD_OPT(OSG_${EXTERNAL}_SOURCE_DIR)
332         IF(NOT EXISTS
333                 ${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.Lib.${EXTERNAL}.txt)
335             MESSAGE(SEND_ERROR "Cannot find ${EXTERNAL} sources directory: "
336                                "${OSG_${EXTERNAL}_SOURCE_DIR}")              
337         ELSE()
338             LIST(APPEND OSG_EXTERNAL_CONFIGS "${EXTERNAL}")
340             GET_FILENAME_COMPONENT(_EXT_SRC_DIR
341                                    "${OSG_${EXTERNAL}_SOURCE_DIR}/.."
342                                    REALPATH                         )
344             IF(EXISTS "${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.PackagePrepare.cmake")
345               LIST(APPEND OSG_EXTERNAL_PREPARE "${OSG_${EXTERNAL}_SOURCE_DIR}")
346             ENDIF()
348             IF(EXISTS "${_EXT_SRC_DIR}/CMakeLists.PackagePrepare.cmake")
349               LIST(APPEND OSG_EXTERNAL_PREPARE "${_EXT_SRC_DIR}")
350             ENDIF()
351         ENDIF()
352     ENDIF()
353 ENDFOREACH(EXTERNAL)
355 IF(OSG_EXTERNAL_PREPARE)
356   LIST(REMOVE_DUPLICATES OSG_EXTERNAL_PREPARE)
357 ENDIF()
359 ##############
360 # Compiler
361 ##############
363 SET(OSG_PLATFORM_64 0)
364 SET(OSG_PLATFORM_32 0)
365 SET(OSG_APPLE64     0)
366 SET(OSG_APPLE32     0)
367 SET(OSG_LIBDIR_SUFFIX "")
369 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
370   SET(OSG_PLATFORM_64 1)
371   SET(OSG_LIBDIR_SUFFIX "64")
373   IF(NOT WIN32)
374     SET(OSG_LIBDIR_BASE_SUFFIX "64")
375   ENDIF(NOT WIN32)
377   IF(APPLE)
378     SET(OSG_APPLE64 1)
379   ENDIF(APPLE)
380 ELSE()
381   SET(OSG_PLATFORM_32 1)
383   IF(APPLE)
384     SET(OSG_APPLE32 1)
385   ENDIF(APPLE)
386 ENDIF()
389 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
390     SET(LINUX 1)
391 ENDIF()
393 IF(WIN32)
394   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
395                                 CACHE STRING "OpenSG Build Types" FORCE )
396 ELSE()
397   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
398                                 CACHE STRING "OpenSG Build Types" FORCE )
399 ENDIF(WIN32)
400 IF(APPLE AND IOS)
401   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
402                                 CACHE STRING "OpenSG Build Types" FORCE )
403 ENDIF()
405 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
406   SET(CMAKE_BUILD_TYPE Debug CACHE STRING
407       "Choose the type of build, options are: Debug Release."
408       FORCE)
409 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
411 IF(NOT WIN32) 
412   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"          AND 
413      NOT CMAKE_BUILD_TYPE STREQUAL "DebugGV"        AND
414      NOT CMAKE_BUILD_TYPE STREQUAL "Release"        AND
415      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseGV"      AND
416      NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"   )
418     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
419                         "Please use either Release or Debug")
421   ENDIF()
422 ELSEIF(NOT MSVC_IDE)
424   IF(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
425     SET(CMAKE_BUILD_TYPE DebugOpt CACHE STRING
426         "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}."
427         FORCE)  
428   ENDIF()
430   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"    AND 
431      NOT CMAKE_BUILD_TYPE STREQUAL "DebugOpt" AND
432      NOT CMAKE_BUILD_TYPE STREQUAL "Release"  AND
433      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseNoOpt")
435     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
436                         "Please use on of ${CMAKE_CONFIGURATION_TYPES}")
438   ENDIF()
439 ENDIF()
441 IF(NOT OSG_COMPILER_DEFAULTS)
442    INCLUDE(CMake/OSGSetupCompiler.cmake)
443    SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) 
444 ENDIF(NOT OSG_COMPILER_DEFAULTS)
446 INCLUDE(CMake/OSGUpdateCompiler.cmake)
448 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
449    CMAKE_BUILD_TYPE STREQUAL "DebugGV")
451     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
452     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
454 ENDIF()
456 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
458 OSG_CHECK_INSTALL()
460 ##############################################################################
461 # DEPENDENCIES
462 ##############################################################################
464 # Global include/library dirs, libs and definitions
465 SET(OSG_GLOBAL_DEP_INCDIR "")
466 SET(OSG_SYSTEM_DEP_INCDIR "")
467 SET(OSG_GLOBAL_DEP_LIBDIR "")
468 SET(OSG_GLOBAL_DEP_LIBS   "")
469 SET(OSG_GLOBAL_DEP_DEFS   "")
471 IF(NOT WIN32)
472   SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
473 ENDIF()
475 #IF(WIN32)
476   OSG_OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
477   OSG_OPTION(OSG_USE_STATIC_SUPPORT_LIBS "" OFF)
479   IF(OSG_USE_OSGSUPPORT_LIBS)
480     OSG_SET_CACHE(OSG_SUPPORT_ROOT "" PATH "")
481   ENDIF(OSG_USE_OSGSUPPORT_LIBS)
483   IF(EXISTS "${OSG_SUPPORT_ROOT}" AND
484      EXISTS "${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
486     INCLUDE("${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
488     SET(_OSG_FATAL_DMS_COMBO  FALSE)
489     SET(_OSG_FATAL_ITER_COMBO FALSE)
491     IF( NOT OSG_DISABLE_MICROSOFT_SECURE_CXXX AND     OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
492       SET(_OSG_FATAL_DMS_COMBO TRUE)
493     ENDIF()
495     IF(     OSG_DISABLE_MICROSOFT_SECURE_CXXX AND NOT OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
496       SET(_OSG_FATAL_DMS_COMBO TRUE)
497     ENDIF()
499     IF(_OSG_FATAL_DMS_COMBO)
501       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_SECURE settings:\n"
502                           "  Support : ${OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX}\n"
503                           "  OpenSG  : ${OSG_DISABLE_MICROSOFT_SECURE_CXXX}")
505     ENDIF()
508     IF( NOT OSG_DISABLE_MS_ITERATOR_DEBUGGING AND     OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
509       SET(_OSG_FATAL_ITER_COMBO TRUE)
510     ENDIF()
512     IF(     OSG_DISABLE_MS_ITERATOR_DEBUGGING AND NOT OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
513       SET(_OSG_FATAL_ITER_COMBO TRUE)
514     ENDIF()
516     IF(_OSG_FATAL_ITER_COMBO)
518       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_ITER_DEBUG settings:\n"
519                           "  Support : ${OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING}\n"
520                           "  OpenSG  : ${OSG_DISABLE_MS_ITERATOR_DEBUGGING}")
522     ENDIF()
523   ENDIF()
525 IF(WIN32)
526    SET(OSG_INSTALL_SUBDIR "" CACHE STRING "add subdir to installed libs")
527 ENDIF(WIN32)
529 IF(NOT OSG_BUILD_DEPENDEND)
531     ##########
532     #### boost
533     ##########
535     OSG_CONFIGURE_BOOST()
537     #########
538     #### zlib
539     #########
541     OSG_CONFIGURE_ZLIB()
543 #    MESSAGE(STATUS "zlib: ${ZLIB_FOUND}")
545     IF(UNIX AND NOT OSG_APPLE32)
546         #############
547         #### Freetype
548         #############
550         FIND_PACKAGE(Freetype)
552         IF(FREETYPE_FOUND)
553             OSG_SET(OSG_WITH_FT2 1)
555             FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig)
557             IF(FONTCONFIG_LIBRARY MATCHES "fontconfig")
558                 OSG_SET(OSG_WITH_FONTCONFIG 1)
559             ENDIF()
561         ENDIF(FREETYPE_FOUND)
563         OSG_ADD_OPT(FREETYPE_FOUND)
564         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_freetype2)
565         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_ft2build)
566         OSG_ADD_OPT(FONTCONFIG_LIBRARY)
567         OSG_ADD_OPT(FREETYPE_LIBRARIES)
568     ENDIF(UNIX AND NOT OSG_APPLE32)
570     ##############
571     #### ImageLibs
572     ##############
574     OSG_CONFIGURE_TIFF()
575     OSG_CONFIGURE_PNG()
576     OSG_CONFIGURE_JPEG()
577     OSG_CONFIGURE_GDAL()
578     OSG_CONFIGURE_OPENEXR()
580     SET(OSG_EXTERNAL_IMAGELIBS)
581     SET(OSG_EXTERNAL_IMAGEINCS)
583 #    MESSAGE(STATUS "tiff: ${TIFF_FOUND} - png ${PNG_FOUND} - jpg: ${JPEG_FOUND} - exr ${OPENEXR_FOUND}")
585     IF(TIFF_FOUND)
586         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
587         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
588         OSG_SET(OSG_WITH_TIF 1)
589         OSG_ADD_OPT(TIFF_LIBRARIES)
590     ENDIF(TIFF_FOUND)
592     IF(PNG_FOUND)
593         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
594         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
595         OSG_SET(OSG_WITH_PNG 1)
596         OSG_ADD_OPT(PNG_INCLUDE_DIR)
597         OSG_ADD_OPT(PNG_LIBRARIES)
598     ENDIF(PNG_FOUND)
600     IF(JPEG_FOUND)
601         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
602         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
603         OSG_SET(OSG_WITH_JPG 1)
604         OSG_ADD_OPT(JPEG_LIBRARIES)
605     ENDIF(JPEG_FOUND)
607     IF(GDAL_FOUND)
608         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
609         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
610         OSG_SET(OSG_WITH_GDAL 1)
611         OSG_ADD_OPT(GDAL_LIBRARIES)
612     ENDIF(GDAL_FOUND)
614     IF(OPENEXR_FOUND)
615         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
616         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
617         OSG_SET(OSG_WITH_IMF 1)
619         OSG_ADD_OPT(OPENEXR_LIBRARIES)
620         OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
621     ENDIF(OPENEXR_FOUND)
624     OSG_ADD_OPT(OSG_EXTERNAL_IMAGELIBS)
625     OSG_ADD_OPT(OSG_EXTERNAL_IMAGEINCS)
627     #############
628     #### Collada
629     #############
631     #FIND_PACKAGE(Collada)
633     OSG_CONFIGURE_COLLADA()
635     IF(COLLADA_FOUND)
637       OSG_SET(OSG_WITH_COLLADA 1)
639       IF(NOT WIN32)
640         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
641            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
643             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
645         ELSE()
647             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
649         ENDIF()
650       ENDIF(NOT WIN32)
652       OSG_ADD_OPT(COLLADA_DAE_INCLUDE_DIR)
653       OSG_ADD_OPT(COLLADA_DOM_INCLUDE_DIR)
655       IF(WIN32 OR COLLADA_TARGET_FOUND)
656         SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
657       ENDIF(WIN32 OR COLLADA_TARGET_FOUND)
659     ELSE(COLLADA_FOUND)
661       SET(OSG_COLLADA_LIBS "")
663     ENDIF(COLLADA_FOUND)
665     OSG_ADD_OPT(COLLADA_FOUND)
667     #############
668     #### GLUT
669     #############
671     OSG_CONFIGURE_GLUT()
673     IF(GLUT_FOUND)
674       OSG_SET(OSG_WITH_GLUT 1)
675       OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
676       OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
677     ELSE(GLUT_FOUND)
678       OSG_SET(OSG_WITH_GLUT 0)
679       OSG_SET(OSG_GLUT_INC_DIR "")
680       OSG_SET(OSG_GLUT_LIBS "")
681     ENDIF(GLUT_FOUND)
683     #############
684     #### QT
685     #############
687     OSG_CONFIGURE_QT()
689     #############
690     #### OpenGL
691     #############
693     IF(APPLE AND IOS)
694       FIND_PACKAGE(OpenGLES REQUIRED)
696       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
697       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
698     ELSE()
699       FIND_PACKAGE(OpenGL REQUIRED)
701       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
702       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
703     ENDIF()
705     IF(OSG_USE_OGL3_PROTOS OR OSG_USE_OGL4_PROTOS)
706       SET(OSG_OGL_INCDIRS ${CMAKE_SOURCE_DIR}/Source/External/OpenGL)
707       LIST(APPEND OSG_GLOBAL_DEP_INCDIR OSG_OGL_INCDIRS)
709       ADD_DEFINITIONS(-DOSG_USE_GL3_INCLUDES=1)
710     ENDIF()
712     #############
713     #### X11
714     #############
716     FIND_PACKAGE(X11)
718     IF(X11_FOUND)
719         OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
720         OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
721     ENDIF(X11_FOUND)
723     OSG_ADD_OPT(X11_FOUND)
725     #############
726     #### VTK
727     #############
729     IF(OSG_ENABLE_VTK)
730       IF(OSG_USE_OSG_VTK_SETUP)
731         OSG_CONFIGURE_VTK()
732       ELSE(OSG_USE_OSG_VTK_SETUP)
733         FIND_PACKAGE(VTK NO_MODULE)
735         IF(VTK_FOUND)
736           OSG_SET(OSG_WITH_VTK 1)
738           INCLUDE(${VTK_USE_FILE})
739           OSG_SET(OSG_VTK_LIBS "${VTK_LIBRARIES}")
741           OSG_ADD_OPT(OSG_VTK_LIBS)
742           OSG_ADD_OPT(VTK_LIBRARY_DIRS)
743           OSG_ADD_OPT(VTK_INCLUDE_DIRS)
744           OSG_ADD_OPT(VTK_DIR)
745         ENDIF(VTK_FOUND)
746       ENDIF(OSG_USE_OSG_VTK_SETUP)
748       OSG_ADD_OPT(VTK_FOUND)
749     ENDIF()
751     ##############
752     #### GLEW
753     ##############
755     IF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
756       OSG_CONFIGURE_GLEW()
758       IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
759         LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
760       ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
762     ENDIF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
764     ##############
765     #### Mini
766     ##############
768     OSG_CONFIGURE_LIBMINI()
770     OSG_ADD_OPT(OSG_LIBMINI_FOUND)
771     OSG_ADD_OPT(OSG_LIBMINI_INCLUDE_DIR)
772     OSG_ADD_OPT(OSG_LIBMINI_LIBRARIES)
774     ###############
775     #### OpenNurbs
776     ###############
778     OSG_CONFIGURE_OPENNURBS()
780     OSG_ADD_OPT(OPENNURBS_FOUND)
781     OSG_ADD_OPT(OPENNURBS_INCLUDE_DIR)
782     OSG_ADD_OPT(OPENNURBS_LIBRARIES)
784     #################
785     #### AntTweakBar
786     #################
788     OSG_CONFIGURE_ANTTWEAKBAR()
790     OSG_ADD_OPT(OSG_ANTTWEAKBAR_FOUND)
791     OSG_ADD_OPT(OSG_ANTTWEAKBAR_INCLUDE_DIR)
792     OSG_ADD_OPT(OSG_ANTTWEAKBAR_LIBRARIES)
794     ###########
795     #### QHull
796     ###########
798     OSG_CONFIGURE_QHULL()
800     OSG_ADD_OPT(OSG_QHULL_FOUND)
801     OSG_ADD_OPT(OSG_QHULL_INCLUDE_DIR)
802     OSG_ADD_OPT(OSG_QHULL_LIBRARIES)
804     #############
805     #### Python
806     #############
808     FIND_PACKAGE(PythonInterp)
809     FIND_PACKAGE(PythonLibs)
811     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
812     OSG_ADD_OPT(PYTHON_LIBRARY)
813     OSG_ADD_OPT(PYTHONLIBS_FOUND)
815     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
817       FIND_PACKAGE(Boost COMPONENTS python)
819       IF(Boost_FOUND AND WIN32)
821         SET(OSG_BOOST_PYTHON_TARGETS )
822         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
823         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
824       
825       ELSE(Boost_FOUND AND WIN32)
827         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
828            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
830           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
832         ELSE()
833           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
834         ENDIF()
836       ENDIF(Boost_FOUND AND WIN32)
838       # We ignore if boost python fails, we catch that somewhere else
839       # so if we get here Boost_FOUND was true in the first place
840       SET(Boost_FOUND TRUE)
842       FIND_PACKAGE(GCCXML)
844       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
845       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
846       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
848     ENDIF()
851     ###############
852     #### Flex/Bison
853     ###############
855     FIND_PROGRAM(FLEX_EXE flex)
856     FIND_PROGRAM(BISON_EXE bison)
858     OSG_ADD_OPT(FLEX_EXE)
859     OSG_ADD_OPT(BISON_EXE)
861     ##############
862     #### NVPerfSDK
863     ##############
865 #    OSG_FIND_PACKAGE(NVidiaPerfSDK)
867 #    IF(NVIDIAPERFSDK_FOUND)
868 #        OSG_SET(OSG_WITH_NVPERFSDK 1)
869 #        OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
870 #        OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
871 #    ELSE(NVIDIAPERFSDK_FOUND)
872 #        OSG_SET(OSG_WITH_NVPERFSDK 0)
873 #        OSG_SET(OSG_NVPERFSDK_INC_DIR "")
874 #        OSG_SET(OSG_NVPERFSDK_LIBS "")
875 #    ENDIF(NVIDIAPERFSDK_FOUND)
878     #############
879     #### Support
880     #############
882     IF(UNIX)
883         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
884         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
885         FIND_LIBRARY(OSG_RT_LIB     NAMES rt)
887         OSG_ADD_OPT(OSG_THREAD_LIB)
888         OSG_ADD_OPT(OSG_DL_LIB)
889         OSG_ADD_OPT(OSG_RT_LIB)
890     ENDIF(UNIX)
892     IF(APPLE)
893         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
894         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
895         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
896         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
898         OSG_ADD_OPT(OSG_APPLICATIONSERVICES_FRAMEWORK)
899         OSG_ADD_OPT(OSG_CORESERVICES_FRAMEWORK)
900         OSG_ADD_OPT(OSG_CARBON_FRAMEWORK)
901         OSG_ADD_OPT(OSG_COCOA_FRAMEWORK)
902     ENDIF(APPLE)
904     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
906 ENDIF(NOT OSG_BUILD_DEPENDEND)
908 MESSAGE("")
910 SET(CFG_NAME OSG)
911 FOREACH(EXTERNAL_PREPARE ${OSG_EXTERNAL_PREPARE})
912   INCLUDE("${EXTERNAL_PREPARE}/CMakeLists.PackagePrepare.cmake")
913 ENDFOREACH()
915 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
916   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
917     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
918   ENDIF(EXISTS
919   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
920 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
923 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
924   INCLUDE(${OSG_GLOBAL_PREP})
925 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
927 IF(APPLE AND OSG_COCOA_FRAMEWORK)
928     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
929 ELSEIF(WIN32)
930     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
931 ELSEIF(UNIX AND X11_FOUND)
932     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
933 ELSEIF(APPLE AND IOS)
934     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
935 ELSE()
936     OSG_SET(OSG_NATIVE_WINDOW "")
937 ENDIF()
939 ###############
940 #### Doxygen
941 ###############
943 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
944   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
945                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
946 ENDIF()
948 FIND_PACKAGE(Doxygen)
950 ##############################################################################
951 # Overrides if dependend
952 ##############################################################################
954 IF(NOT WIN32)
955     IF(OSG_BUILD_DEPENDEND)
956         MESSAGE(STATUS "Load reference settings")
957         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
958         # Needed to get the correct vtk/boost settings
959         FIND_PACKAGE(VTK)
960         OSG_BOOST_DEP_SETUP()
961         OSG_CONFIGURE_QT()
963         IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
964           LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
965         ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
967     ELSE(OSG_BUILD_DEPENDEND)
968 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
969     ENDIF(OSG_BUILD_DEPENDEND)
970 ENDIF(NOT WIN32)
972 ##############################################################################
973 # MAIN BUILD STEPS
974 ##############################################################################
976 # when adding passes, make sure to add a corresponding pass directory variable
977 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
978 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
980 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
981 SET(OSG_PASSDIR_OSGSETUP   "Build")
983 OSG_COMMON_TARGETS()
985 ###############
986 # Clean
987 ###############
989 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
991 IF(OSG_OLD_BUILD_FILES)
992     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
993 ENDIF(OSG_OLD_BUILD_FILES)
995 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
997 IF(OSG_OLD_CONFIG_FILES)
998     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
999 ENDIF(OSG_OLD_CONFIG_FILES)
1001 ###############
1002 # Tests
1003 ###############
1005 # optional pass for test programs
1006 IF(OSGBUILD_TESTS)
1007     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
1008     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
1009 ENDIF(OSGBUILD_TESTS)
1011 ###############
1012 # UnitTests
1013 ###############
1015 IF(OSGBUILD_UNITTESTS)
1016     ENABLE_TESTING()
1017     INCLUDE(CTest)
1019     # optional pass for unittest programs
1020     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
1021     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
1023     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
1024                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
1026     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
1027     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
1028     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
1030     ADD_CUSTOM_TARGET(OSGAllUnitTests)
1031     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
1032 ENDIF(OSGBUILD_UNITTESTS)
1034 ###############
1035 # Python
1036 ###############
1038 INCLUDE(OSGSetupPython)
1039 SETUP_PYTHON_BUILD()
1041 #################
1042 # Documentation I
1043 #################
1044 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1045 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1047 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1048     ADD_CUSTOM_TARGET(Doc)
1049 ENDIF()
1051 IF(DOXYGEN_EXECUTABLE)
1052     SET(DOXYGEN_VERSION)
1053     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1054                     OUTPUT_VARIABLE DOXYGEN_VERSION
1055                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1056     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1057         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1058                         "when building OpenSG documentation. "
1059                         "Please use a different version, sorry for the inconvenience.")
1060     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1061 ENDIF(DOXYGEN_EXECUTABLE)
1063 IF(NOT OSG_DOXY_INPUTS)
1064     # add a pass for doxygen to run
1065     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1066     SET(OSG_PASSDIR_OSGDOXYDOC "Doc/build")
1067 ELSE()
1068     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC_EXT")
1069     SET(OSG_PASSDIR_OSGDOXYDOC_EXT "DocExt/build")
1070 ENDIF(NOT OSG_DOXY_INPUTS)
1072 # set up variables for the config file
1073 IF(DOXYGEN_DOT_EXECUTABLE)
1074     SET(OSG_DOXY_HAVE_DOT "YES")
1075 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1077 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1078 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1079 SET(OSG_GENDOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/GenDoc/opensg-doxy")
1081 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1083 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1084     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1085     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1086     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1087     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1088     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1089     SET(OSG_DOXY_SEARCHENGINE "NO")
1091 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1092     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1093     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1094     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1095     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1096     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1097     SET(OSG_DOXY_SEARCHENGINE "NO")
1099 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1100     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1101     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1102     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1103     SET(OSG_DOXY_HAVE_DOT "NO")
1104     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1105     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1106     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1107     SET(OSG_DOXY_SEARCHENGINE "NO")
1109 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1111 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1112   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1113 ELSE()
1114   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1115 ENDIF()
1117 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1119 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1120 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1122 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1123   SET(OSG_DOC_SECTION "all_in_one")
1124   SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
1125 ELSE()
1126   SET(OSG_DOC_SECTION "separate")
1127 ENDIF()
1129 # write doxygen config file
1130 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1131                "${OSG_DOXY_CONFIGURATION_FILE}")
1134 # write general doc config file
1136 SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/GenDoc")
1137 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "")
1138 #SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS=${CMAKE_BINARY_DIR}/Doc/html/Full/html")
1140 SET(OSG_DOC_SECTION "${OSG_DOC_SECTION} include_general_doc")
1142 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1143                "${OSG_GENDOXY_CONFIGURATION_FILE}")
1145 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1147 # find/process documentation include files
1148 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1150 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1152   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1154   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1155                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1157 ENDFOREACH()
1159 IF(OSG_DOXY_INPUTS)
1160     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1161                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1162 ENDIF(OSG_DOXY_INPUTS)
1165 IF(DOXYGEN_EXECUTABLE)
1166   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1167   ADD_DEPENDENCIES(DocUpload Doc)
1170   ADD_CUSTOM_TARGET(DocSyncGV
1171                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1172                     WORKING_DIRECTORY Doc)
1174   ADD_CUSTOM_TARGET(DocCompleteGV)
1175   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1176 ENDIF(DOXYGEN_EXECUTABLE)
1178 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1180 ###############
1181 # PrePasses
1182 ###############
1184 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1185   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1186     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1187   ENDIF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1188 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1190 ###############
1191 # Passes
1192 ###############
1194 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1195   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1197   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1198        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1200   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1201     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1202     INCLUDE(${_OSGCORE_EXT_FILE})
1203   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1206 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1208 # Find files describing libraries to build, but make sure base
1209 # and system are processed first
1210 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1211      "Source/CMakeLists.Lib.OSGBase.txt")
1213 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1214      "Source/CMakeLists.Lib.OSGSystem.txt")
1216 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1217      "Source/*CMakeLists.Lib.*.txt")
1219 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1220 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1222 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1223 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1225 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1226   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1228   IF(_OSG_FOUND_CONTRIB_CONFIG)
1229     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1230   ELSE()
1231     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1232   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1233 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1235 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1237 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1239   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1240                          ${_OSG_LIBRARY_CONFIG}
1241                           PATH)
1243   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1244                          ${_OSG_LIBRARY_CONFIG}
1245                           NAME)
1247   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1248                      ${_OSG_LIBCONFIG_BASENAME})
1250   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1251                          ${_OSG_LIBCONFIG_BASENAME_1}
1252                          NAME_WE)
1254   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1255     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1256   ENDIF()
1258 ENDFOREACH()
1260 OSG_COMMON_CUDA()
1262 # run build passes
1263 FOREACH(PASS ${OSG_CMAKE_PASSES})
1264     SET(OSG_CMAKE_PASS ${PASS})
1266     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1268     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1269         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1270         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1271         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1272         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1274         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1276         IF(_OSG_IS_CONTRIBLIB)
1277           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1278         ELSE()
1279           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1280         ENDIF()
1282         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1283     ENDFOREACH(LIBCONFIGFILE)
1285     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1287     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1288         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1289                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1290     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1292 ENDFOREACH()
1294 IF(NOT WIN32)
1295   IF(NOT OSG_BUILD_DEPENDEND)
1296     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1297   ENDIF(NOT OSG_BUILD_DEPENDEND)
1298 ENDIF(NOT WIN32)
1300 ###############
1301 # OSGConfigured
1302 ###############
1305 EXECUTE_PROCESS(
1306     COMMAND "${CMAKE_COMMAND}" -E copy
1307                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1308                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1310 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1311   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1312 ENDFOREACH()
1314 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1316 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1317                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1319 EXECUTE_PROCESS(
1320     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1321                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1322                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1324 #################
1325 # Examples/Simple
1326 #################
1328 ADD_CUSTOM_TARGET(OSGAllExamples)
1329 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1331 IF(OSGBUILD_EXAMPLES_SIMPLE)
1332     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1333     ADD_SUBDIRECTORY("Examples/Simple")
1334     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1335 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1337 ###################
1338 # Examples/Advanced
1339 ###################
1341 IF(OSGBUILD_EXAMPLES_ADVANCED)
1342     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1343     ADD_SUBDIRECTORY("Examples/Advanced")
1344     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1345     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1346     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1347 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1349 ###################
1350 # Examples/Advanced
1351 ###################
1353 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1354     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1355     ADD_SUBDIRECTORY("Examples/Tutorial")
1356     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1357 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1359 ###################
1360 # External Examples
1361 ###################
1363 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1364   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1366   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1367     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1368     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1369   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1370 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1372 ##################
1373 # Documentation II
1374 ##################
1376 SET(OSG_DOC_PIPES "")
1378 IF(OSG_DOXY_STDOUT_LOG)
1379     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1380 ENDIF(OSG_DOXY_STDOUT_LOG)
1382 IF(DOXYGEN_EXECUTABLE)
1383     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1384         ADD_CUSTOM_TARGET(Doc
1385             VERBATIM
1386             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1387     ENDIF()
1388 ENDIF()
1390 IF(DOXYGEN_EXECUTABLE)
1391   ADD_CUSTOM_TARGET(GenDoc
1392                     VERBATIM
1393                     COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_GENDOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1394 ENDIF()
1396 ##################
1397 # Documentation II
1398 ##################
1400 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1401   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1402     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1403   ENDIF()
1404 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1406 ##################
1407 # osg2-config
1408 ##################
1410 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1411 # is generated during the OSGCOLLECT pass.
1413 # substitute variables in static parts
1414 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1415                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1416 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1417                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1419 # read in all parts
1420 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1421 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1422 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1424 # concatenate final file
1425 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1426 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1427 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1429 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1430 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1431 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1433 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1434         DESTINATION bin)
1435 #        COMPONENT development_tools)
1437 ##################
1438 # cmake modules
1439 ##################
1441 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cmake)
1443 STRING(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_UP)
1445 STRING(REPLACE "OpenSG" "OSG" CMAKE_PROJECT_NAME_SHORT ${CMAKE_PROJECT_NAME})
1447 STRING(TOUPPER "OpenSG" ${CMAKE_PROJECT_NAME_SHORT} ${CMAKE_PROJECT_NAME_SHORT_UP})
1449 CONFIGURE_FILE(CMake/FindOpenSG.cmake.in
1450                ${CMAKE_BINARY_DIR}/cmake/Find${CMAKE_PROJECT_NAME}.cmake
1451                @ONLY                                                   )
1453 INSTALL(FILES "${CMAKE_BINARY_DIR}/cmake/FindOpenSG.cmake"
1454         DESTINATION share/OpenSG/cmake)
1455 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake.in"
1456         DESTINATION share/OpenSG/cmake)
1457 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1458         DESTINATION share/OpenSG/cmake)
1459 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1460         DESTINATION share/OpenSG/cmake)
1461 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindExpat_OpenSG.cmake"
1462         DESTINATION share/OpenSG/cmake)
1463 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1464         DESTINATION share/OpenSG/cmake)
1465 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1466         DESTINATION share/OpenSG/cmake)
1467 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLEW_OpenSG.cmake"
1468         DESTINATION share/OpenSG/cmake)
1469 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1470         DESTINATION share/OpenSG/cmake)
1471 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1472         DESTINATION share/OpenSG/cmake)
1473 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1474         DESTINATION share/OpenSG/cmake)
1475 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGSetupCompiler.cmake"
1476         DESTINATION share/OpenSG/cmake)
1477 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGUpdateCompiler.cmake"
1478         DESTINATION share/OpenSG/cmake)
1479 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGBuildFunctions.cmake"
1480         DESTINATION share/OpenSG/cmake)
1481 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGConfigurePackages.cmake"
1482         DESTINATION share/OpenSG/cmake)
1483 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGExternalProjectHelper.cmake"
1484         DESTINATION share/OpenSG/cmake)
1485 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1486         DESTINATION share/OpenSG/cmake)
1487 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1488         DESTINATION share/OpenSG/cmake)
1489 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonOptions.cmake"
1490         DESTINATION share/OpenSG/cmake)
1491 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonConfig.cmake"
1492         DESTINATION share/OpenSG/cmake)
1493 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonSupportConfig.cmake"
1494         DESTINATION share/OpenSG/cmake)
1496 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1497         DESTINATION bin
1498 #        COMPONENT development_tools
1499         PATTERN "*/fcd2code/fcd2code" EXCLUDE
1500         PATTERN "*.pyc" EXCLUDE
1501         PATTERN ".svn"  EXCLUDE)
1502 INSTALL(PROGRAMS "${CMAKE_SOURCE_DIR}/Tools/fcd2code/fcd2code"
1503         DESTINATION bin/fcd2code)
1505 ##################
1506 # Global Python
1507 ##################
1509 IF(OSGBUILD_PYTHON_BINDINGS)
1510   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1511                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1512                   OUTPUT_VARIABLE _OSG_LIBORDER)
1515                  
1516   SET(_OSG_PY_MODNAME_LIST "osg2ModuleNameList = [\n")
1517   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1519   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1520     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1521     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1522     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1523     SET(_OSG_PY_MODNAME_LIST "${_OSG_PY_MODNAME_LIST}  \"${_OSG_LIB}\",\n")
1524   ENDFOREACH()
1526   SET(OSG_PYTHON_ALL_IMPORTS "${_OSG_PY_MODNAME_LIST}  ]\n\n${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1528   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1529   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1532   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1533                  "${_OSG_GEN_INIT_FILE_OUT}")
1535   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1536                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1538   IF(WIN32) 
1540     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1541     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1542     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1543     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1545     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1546             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1547             CONFIGURATIONS Release)
1548 #            COMPONENT      release_runtimes)
1550     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1551             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/osg
1552             CONFIGURATIONS Debug)
1553 #            COMPONENT      debug_runtimes)
1555     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1556             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/osg
1557             CONFIGURATIONS DebugOpt)
1558 #            COMPONENT      debug_opt_runtimes)
1560     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1561             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/osg
1562             CONFIGURATIONS ReleaseNoOpt)
1563 #            COMPONENT      release_no_opt_runtimes)
1566     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1567             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1568             CONFIGURATIONS Release)
1569 #            COMPONENT      release_runtimes)
1571     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1572                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1573                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1574                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1575             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1576             CONFIGURATIONS Release)
1577 #            COMPONENT      release_runtimes)
1580     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1581             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1582             CONFIGURATIONS Debug)
1583 #            COMPONENT      debug_runtimes)
1585     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1586                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1587                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1588                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1589             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1590             CONFIGURATIONS Debug)
1591 #            COMPONENT      debug_runtimes)
1594     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1595             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1596             CONFIGURATIONS DebugOpt)
1597 #            COMPONENT      debug_opt_runtimes)
1599     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1600                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1601                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1602                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1603             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1604             CONFIGURATIONS DebugOpt)
1605 #            COMPONENT      debug_opt_runtimes)
1608     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1609             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1610             CONFIGURATIONS ReleaseNoOpt)
1611 #            COMPONENT      release_no_opt_runtimes)
1613     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1614                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1615                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1616                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1617             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1618             CONFIGURATIONS ReleaseNoOpt)
1619 #            COMPONENT      release_no_opt_runtimes)
1621   ELSE(WIN32)   
1623     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1624     SET(_OSG_PY_INST_BASE 
1625         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1627     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1628             DESTINATION ${_OSG_PY_INST_BASE}/osg)
1629 #            COMPONENT   libraries)
1631     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1632             DESTINATION ${_OSG_PY_INST_BASE})
1633 #            COMPONENT   libraries)
1635     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1636                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1637                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1638                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1639             DESTINATION ${_OSG_PY_INST_BASE}/helpers)
1640 #            COMPONENT   libraries)
1642   ENDIF(WIN32)
1644 ENDIF()
1646 INSTALL_PYTHON_ELEMENTS()
1648 ##################
1649 # Documentation
1650 ##################
1652 IF(DOXYGEN_EXECUTABLE)
1653     IF(OSG_INSTALL_DOXYDOC)
1654         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1655                 DESTINATION share/OpenSG/documentation)
1656 #                COMPONENT documentation)
1657     ENDIF()
1658 ENDIF()
1660 ##################
1661 # Images/Icons
1662 ##################
1664 ##################
1665 # CSM Example
1666 ##################
1668 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
1669         DESTINATION share/OpenSG/Examples/)
1670 #        COMPONENT examples_basic)
1672 ##################
1673 # Packaging
1674 ##################
1676 #IF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1678 #    SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
1680 #    SET(CPACK_PACKAGE_NAME                "OpenSG")
1681 #    SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
1682 #    SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
1683 #    SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
1684 #    SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
1685 #    SET(CPACK_PACKAGE_VENDOR              "OpenSG")
1686 #    SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
1687 #    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
1688 #    SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
1689 #    SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
1691 #    if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
1692 #        set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
1693 #        set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
1694 #    endif ()
1696 #    if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
1697 #        set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
1698 #    endif()
1700 #    #Define Components
1701 #    SET(CPACK_COMPONENTS_ALL development_tools
1702 #        development_configuration
1703 #        code_headers
1704 #        libraries
1705 #        debug_program_db
1706 #        release_program_db
1707 #        debug_libraries
1708 #        release_libraries
1709 #        debug_runtimes
1710 #        release_runtimes
1711 #        data_images
1712 #        examples_basic
1713 #        examples_advanced
1714 #        Unspecified
1715 #        )
1718 #    #Components
1719 #    #Runtime
1720 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
1722 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
1723 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
1724 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
1725 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1727 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
1728 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
1729 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
1730 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1732 #    #Development
1733 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
1735 #    #Libraries
1736 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
1737 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
1738 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
1739 #    set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
1741 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
1742 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
1743 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
1744 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
1746 #    #Program database
1747 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
1748 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
1749 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
1750 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
1752 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
1753 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
1754 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
1755 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
1757 #    #Tools
1758 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
1759 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
1760 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
1761 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
1763 #    #Configuration
1764 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
1765 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
1766 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
1767 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
1769 #    #Headers
1770 #    SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
1771 #    SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
1772 #    SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
1773 #    SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
1775 #    #Examples
1776 #    SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
1778 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
1779 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
1780 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
1781 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
1783 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
1784 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
1785 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
1786 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
1788 #    #Shared Data
1789 #    SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
1791 #    SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
1792 #    SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
1793 #    SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
1794 #    SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
1796 #    #Documentation
1797 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
1799 #    #Dependencies
1800 #    #Boost
1801 #    #Base
1803 #    #NSIS specific configuration
1804 #    IF(WIN32)
1805 #        INCLUDE(InstallRequiredSystemLibraries)
1806 #        IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
1807 #            IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
1808 #                         ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
1809 #                 include(CMakeDetermineVSServicePack)
1810 #                 DetermineVSServicePack( my_service_pack )
1812 #                 IF( my_service_pack )
1813 #                     SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
1814 #                 ENDIF()
1815 #            ENDIF()
1817 #            #Extra install commands
1818 #            SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
1819 #            SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
1822 #            SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1823 #            SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1824 #            FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
1825 #            SET(CPACK_NSIS_MODIFY_PATH         ON)
1826 #            SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
1827 #            SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
1828 #            SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
1829 #            SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
1830 #            SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
1831 #            SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
1832 #            SET(CPACK_NSIS_MENU_LINKS          "")
1833 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
1834 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
1835 #        ENDIF()
1836 #    ENDIF()
1839 #    # Date macro by Benoit RAT (www.neub.co.nr)
1840 #    MACRO (TODAY RESULT)
1841 #        IF (WIN32)
1842 #            EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
1843 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1844 #        ELSEIF(UNIX)
1845 #            EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
1846 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1847 #        ELSE (WIN32)
1848 #            MESSAGE(SEND_ERROR "date not implemented")
1849 #            SET(${RESULT} 000000)
1850 #        ENDIF (WIN32)
1851 #    ENDMACRO (TODAY)
1853 #    TODAY(DATE)
1855 #    # Determine package type
1856 #    IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1857 #        IF(WIN32)
1858 #            SET(OSGBUILD_PACKAGE_TYPE "ZIP")
1859 #        ELSE(WIN32)
1860 #            SET(OSGBUILD_PACKAGE_TYPE "RPM")
1861 #        ENDIF(WIN32)
1862 #    ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1864 #    STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
1866 #    IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
1867 #        SET( PACK_EXT "tar.bz2" )
1868 #    ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
1869 #        SET( PACK_EXT "tar.gz" )
1870 #    ELSE()
1871 #        STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
1872 #    ENDIF()
1874 #    SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
1875 #    SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
1877 #    INCLUDE(CPack)
1880 #    # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
1881 #    IF(WIN32)
1882 #        #TODO: Need a way to do this on Windows
1883 #        #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 )
1884 #        #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1885 #    ELSE(WIN32)
1886 #        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 )
1887 #        ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1888 #    ENDIF(WIN32)
1891 #ENDIF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1893 IF(NOT WIN32)
1894   CONFIGURE_FILE(CMake/CMakeLists.packaging.unix.txt 
1895                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1896                  @ONLY                                      )
1897 ELSE()
1899   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
1900     SET(OSG_WIN_SEC "nosec")
1901   ELSE()
1902     SET(OSG_WIN_SEC "msdefault")
1903   ENDIF()
1905   CONFIGURE_FILE(CMake/CMakeLists.packaging.win.txt 
1906                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1907                  @ONLY                                      )
1908   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico"
1909           DESTINATION share/OpenSG/Packaging
1910 #          COMPONENT packaging
1911           PERMISSIONS OWNER_WRITE OWNER_READ
1912                       GROUP_READ
1913                       WORLD_READ            )
1915   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp"
1916           DESTINATION share/OpenSG/Packaging
1917 #          COMPONENT packaging
1918           PERMISSIONS OWNER_WRITE OWNER_READ
1919                       GROUP_READ
1920                       WORLD_READ            )
1921 ENDIF()
1923 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1924         DESTINATION share/OpenSG/Packaging
1925 #        COMPONENT packaging
1926         PERMISSIONS OWNER_WRITE OWNER_READ
1927                     GROUP_READ
1928                     WORLD_READ
1929         RENAME CMakeLists.txt)
1931 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
1932         DESTINATION share/doc/OpenSG/
1933 #        COMPONENT doc
1934         PERMISSIONS OWNER_WRITE OWNER_READ
1935                     GROUP_READ
1936                     WORLD_READ)
1938 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/PLY/README
1939         DESTINATION share/doc/OpenSG/
1940 #        COMPONENT doc
1941         PERMISSIONS OWNER_WRITE OWNER_READ
1942                     GROUP_READ
1943                     WORLD_READ
1944         RENAME README.ply)
1946 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/TrapezoidalShadowMaps/README
1947         DESTINATION share/doc/OpenSG/
1948 #        COMPONENT doc
1949         PERMISSIONS OWNER_WRITE OWNER_READ
1950                     GROUP_READ
1951                     WORLD_READ
1952         RENAME README.tsm)
1954 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README
1955         DESTINATION share/doc/OpenSG/
1956 #        COMPONENT doc
1957         PERMISSIONS OWNER_WRITE OWNER_READ
1958                     GROUP_READ
1959                     WORLD_READ
1960         RENAME README.rhine)
1962 IF(WIN32)
1963   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
1964                                 CACHE STRING "OpenSG Build Types" FORCE )
1965 ELSE()
1966   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
1967                                 CACHE STRING "OpenSG Build Types" FORCE )
1968 ENDIF(WIN32)
1969 IF(APPLE AND IOS)
1970   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
1971                                 CACHE STRING "OpenSG Build Types" FORCE )
1972 ENDIF()
1974 IF(WIN32)
1975   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1976        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
1978   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1979        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
1981 ENDIF(WIN32)
1983 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1984      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
1986 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1987      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
1989 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1990      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
1992 ###########################
1993 # Component install Setting
1994 ###########################
1996 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
1998 IF(NOT WIN32)
1999   ADD_CUSTOM_TARGET(OSG_preinstall
2000                     make preinstall
2001                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2002 ELSE()
2003 ENDIF()
2005 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
2007   IF(NOT WIN32)
2008     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2009                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
2010                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2011   ELSE()
2013     SET(_OSG_CMP_CONF Release)
2015     IF(${_OSG_CMP} MATCHES ^debug_)
2016       SET(_OSG_CMP_CONF Debug)
2017     ENDIF()
2019     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2020                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
2021                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2023     SET_PROPERTY(TARGET INSTALL_${_OSG_CMP} PROPERTY FOLDER "Packaging")
2024   ENDIF()
2026   IF(NOT WIN32)
2027     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
2028   ELSE()
2029   ENDIF()
2030 ENDFOREACH()
2033 IF(WIN32)
2035   ADD_CUSTOM_TARGET(INSTALL_runtime)
2037   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_runtimes)
2038   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_binaries)
2040   SET_PROPERTY(TARGET INSTALL_runtime PROPERTY FOLDER "Packaging")
2042 ELSE()
2044   ADD_CUSTOM_TARGET(INSTALL_runtime)
2046   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
2047   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_binaries)
2048 ENDIF()
2050 #IF(WIN32)
2051 #  SET_PROPERTY(TARGET ALL_BUILD PROPERTY FOLDER "CMakePredefinedTargets")
2052 #ENDIF()
2054 ################
2055 # Build Setting
2056 ################
2058 IF(NOT WIN32)
2059   IF(NOT OSG_BUILD_DEPENDEND)
2060     OSG_WRITE_OSGBUILD(${CMAKE_BINARY_DIR}/CMake.build.settings)
2061     OSG_WRITE_OSGGLOBALSETUP(${CMAKE_BINARY_DIR}/CMake.global.settings)
2062   ENDIF(NOT OSG_BUILD_DEPENDEND)
2063 ENDIF(NOT WIN32)
2065 IF(OSG_WITH_CUDA)
2066   CUDA_BUILD_CLEAN_TARGET()
2067 ENDIF(OSG_WITH_CUDA)
2070 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2072 FOREACH(_variableName ${_variableNames})
2073   IF(_variableName MATCHES "^OSG")
2074 #    MESSAGE("FOO : ${_variableName}")
2075 #    FILE(APPEND ${FILENAME}
2076 #         "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2077   ENDIF()
2078 ENDFOREACH()