fixed: Windows removed context when exiting from a passive window (thanks to M. Raab...
[opensg.git] / CMakeLists.txt
blob432446f98e422b169c6c4d27afb75263b356a52d
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_OGL2_SHADERFUNCTIONS "" ON)
87 OSG_OPTION(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS "" OFF)
88 OSG_OPTION(OSG_ENABLE_NEW_GEOHANDLER "" OFF)
89 OSG_OPTION(OSG_ENABLE_OGL_COREONLY "" OFF)
90 OSG_OPTION(OSG_ENABLE_OGL_ES2 "" OFF)
91 OSG_OPTION(OSG_ENABLE_OGL_ES2_SIMGL3 "" OFF)
92 OSG_OPTION(OSG_ENABLE_CSM_WIN7_FEATURES "" OFF)
94 OSG_OPTION(OSG_ENABLE_OGL3_PROTOS "" OFF)
95 OSG_OPTION(OSG_ENABLE_OGL4_PROTOS "" OFF)
96 OSG_OPTION(OSG_ENABLE_OGLES_PROTOS "" OFF)
98 OSG_OPTION(OSG_ENABLE_GL_INCLUDE_GLEW "" OFF)
100 OSG_SET_CACHE(OSG_SHADER_CACHE_MODE 5 STRING "")
102 OSG_OPTION(OSG_ENABLE_FCD2CODE "" OFF)
103 OSG_OPTION(OSG_FCD2CODE_WRITE_CLASS "Write class file during cmake run if only
104 the fcd file is found" OFF)
105 OSG_OPTION(OSG_ENABLE_SCANPARSE_REGEN "" OFF)
107 OSG_OPTION(OSG_ENABLE_GLDEFINE_MAPPER "" ON)
108 OSG_OPTION(OSG_ENABLE_NEW_OSB_IO "" ON)
110 OSG_OPTION(OSG_ENABLE_SSE2        "" ON)
111 OSG_OPTION(OSG_USE_OSG2_NAMESPACE "" OFF)
112 OSG_OPTION(OSG_ENABLE_C++11 "" OFF)
114 OSG_OPTION(OSG_ENABLE_TESTCONTAINER "" OFF)
115 OSG_OPTION(OSG_ENABLE_VALGRIND_CHECKS "" OFF)
116 OSG_OPTION(OSG_ENABLE_MEMORY_DEBUGGING "" OFF)
117 OSG_OPTION(OSG_ENABLE_DOUBLE_MATRIX_STACK "" OFF)
118 OSG_OPTION(OSG_ENABLE_DEFAULT_READONLY_CHANGELIST "" OFF)
119 OSG_OPTION(OSG_DISABLE_SOURCE_GROUPS "" OFF)
120 OSG_OPTION(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE "" OFF)
122 OSG_OPTION(OSG_ENABLE_CUDA "" OFF)
123 OSG_OPTION(OSG_ENABLE_VTK  "" ON )
125 IF(WIN32)
126   OPTION(OSG_ENABLE_WIN_LOCALSTORAGE "" ON)
127   OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
129   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
130     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
131   ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
132     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
133   ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
134 ELSEIF(APPLE)
135   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" OFF)
136 ELSEIF(UNIX)
137   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" ON)
138 ENDIF()
140 OSG_OPTION(OSG_ENABLE_AUTOINIT_THREADS "" OFF)
141 OPTION(OSG_DEPENDENT_INCLUDE_BUILD "" OFF)
143 IF(WIN32)
144   OSG_OPTION(OSG_USE_SEPARATE_LIBDIRS "" ON)
145   OSG_OPTION(OSG_INSTALL_PDB_FILES "" OFF)
146 ENDIF(WIN32)
148 OSG_OPTION(OSG_INSTALL_EXAMPLES "" OFF)
149 OSG_OPTION(OSG_INSTALL_EXAMPLES_EXE "" OFF)
150 OSG_OPTION(OSG_INSTALL_APPS "" ON)
152 OSG_OPTION(OSGCOMPAT_ENABLE                  "" OFF)
153 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED       "" OFF)
154 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED_PROPS "" OFF)
156 OSG_SET_CACHE(OSG_RENDERPROPERTY_BITS 64 STRING "")
157 OSG_SET_CACHE(OSG_RENDERPROPERTY_UNIQUE_BITS 16 STRING "")
159 OSG_OPTION(OSG_GENERATE_SEPARATE_LIB_DOC "Generate separate doxygen documentation for contrib libraries" OFF)
160 OSG_OPTION(OSG_INSTALL_DOXYDOC "Install Doxygen documentation" OFF)
162 OSG_OPTION(OSG_LINK_EXTERNAL_MODULES_TO_CSM "" FALSE)
165 #OSG_OPTION(OSGBUILD_ENABLE_PACKAGING "Generate binary packages with CPack" OFF)
166 #SET(OSGBUILD_PACKAGE_TYPE "" CACHE STRING
167 #    "The type of package to generate (empty->default)")
170 SET(OSG_DOXY_DOC_TYPE "User" CACHE STRING
171     "The type of documentation to generate (User, Developer, Trac)")
172 SET(OSG_DOXY_INPUTS CACHE FILEPATH "include given file instead of autogen")
173 SET(OSG_DOXY_STDOUT_LOG CACHE FILEPATH "log std to file")
175 # Not sure
176 #OPTION(OSG_ENABLE_MTCPTR "" ON)
177 #OPTION(OSG_ENABLE_GIF    "" ON)
179 ## prep options for OSGConfigured.h
181 IF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
182   SET(OSG_DISABLE_DEPRECATED 1)
183 ENDIF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
185 IF(OSG_USE_OSG2_NAMESPACE)
186   ADD_DEFINITIONS(-DOSG_USE_OSG2_NAMESPACE=1)
187 ENDIF()
189 IF(OSG_ENABLE_SSE2)
190   SET(OSG_SIMD_SSE 1)
191 ENDIF(OSG_ENABLE_SSE2)
193 IF(OSG_ENABLE_NEW_OSB_IO)
194   SET(OSG_NEW_OSB_IO 1)
195 ENDIF(OSG_ENABLE_NEW_OSB_IO)
197 IF(OSG_ENABLE_GLDEFINE_MAPPER)
198   SET(OSG_GL_DEFMAPPER 1)
199 ENDIF(OSG_ENABLE_GLDEFINE_MAPPER)
201 IF(OSG_ENABLE_MULTISHADER_VARCHUNK)
202   SET(OSG_MULTISHADER_VARCHUNK 1)
203 ENDIF(OSG_ENABLE_MULTISHADER_VARCHUNK)
205 IF(OSG_ENABLE_OGL2_SHADERFUNCTIONS)
206   SET(OSG_OGL2_SHADERFUNCS 1)
207 ENDIF(OSG_ENABLE_OGL2_SHADERFUNCTIONS)
209 IF(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS)
210   SET(OSG_OGL_VERTEXATTRIB_FUNCS 1)
211 ENDIF(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS)
213 IF(OSG_ENABLE_NEW_GEOHANDLER)
214   SET(OSG_NEW_GEOHANDLER 1)
215 ENDIF(OSG_ENABLE_NEW_GEOHANDLER)
217 IF(OSG_ENABLE_OGL_COREONLY)
218   SET(OSG_OGL_COREONLY 1)
219 ENDIF(OSG_ENABLE_OGL_COREONLY)
221 IF(OSG_ENABLE_GL_INCLUDE_GLEW)
222   SET(OSG_GL_INCLUDE_GLEW 1)
223 ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW)
225 IF(OSG_ENABLE_OGL_ES2)
226   SET(OSG_OGL_ES2 1)
227   SET(OSG_OGL_NO_DOUBLE 1)
228 ENDIF(OSG_ENABLE_OGL_ES2)
230 IF(OSG_ENABLE_OGLES_PROTOS)
231   SET(OSG_USE_OGLES_PROTOS 1)
232   SET(GL_GLEXT_PROTOTYPES 1)
233 ENDIF(OSG_ENABLE_OGLES_PROTOS)
235 IF(OSG_ENABLE_OGL3_PROTOS)
236   SET(GL_GLEXT_PROTOTYPES 1)
237   SET(GL3_PROTOTYPES 1)
238   SET(OSG_USE_OGL3_PROTOS 1)
239 ENDIF(OSG_ENABLE_OGL3_PROTOS)
241 IF(OSG_ENABLE_OGL4_PROTOS)
242   SET(GL_GLEXT_PROTOTYPES 1)
243   SET(GL3_PROTOTYPES 1)
244   SET(OSG_USE_OGL3_PROTOS 1)
245   SET(OSG_USE_OGL4_PROTOS 1)
246 ENDIF(OSG_ENABLE_OGL4_PROTOS)
248 IF(OSG_ENABLE_OGL_ES2_SIMGL3)
249   SET(OSG_OGL_ES2_SIMGL3 1)
250 ENDIF(OSG_ENABLE_OGL_ES2_SIMGL3)
252 IF(OSGCOMPAT_ENABLE)
253   SET(OSG_1_COMPAT 1)
254 ENDIF(OSGCOMPAT_ENABLE)
256 IF(NOT OSG_ENABLE_SCANPARSE_REGEN)
257   SET(OSG_PREBUILD_SCANPARSE 1)
258 ENDIF(NOT OSG_ENABLE_SCANPARSE_REGEN)
260 IF(OSG_ENABLE_ELF_LOCALSTORAGE)
261   SET(OSG_PTHREAD_ELF_TLS 1)
262 ENDIF(OSG_ENABLE_ELF_LOCALSTORAGE)
264 IF(OSG_ENABLE_WIN_LOCALSTORAGE)
265   SET(OSG_WIN32_ASPECT_USE_LOCALSTORAGE 1)
266 ENDIF(OSG_ENABLE_WIN_LOCALSTORAGE)
268 IF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
269   SET(OSG_DEPRECATED_PROPS 1)
270 ENDIF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
272 SET(OSG_SHC_MODE_${OSG_SHADER_CACHE_MODE} 1)
274 IF(NOT IOS)
275   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
276   SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
277   SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
278 ENDIF(NOT IOS)
280 INCLUDE(OSGConfigurePackages)
282 LIST(APPEND OSG_ADDITIONAL_CONFIGURE_LINES "")
284 IF(OSGEXCLUDE_TESTS_FROM_ALL)
285   SET(OSGEXCLUDE_TESTS EXCLUDE_FROM_ALL)
286 ELSE()
287   SET(OSGEXCLUDE_TESTS "")
288 ENDIF()
290 IF(OSGEXCLUDE_UNITTESTS_FROM_ALL)
291   SET(OSGEXCLUDE_UNITTESTS EXCLUDE_FROM_ALL)
292 ELSE()
293   SET(OSGEXCLUDE_UNITTESTS "")
294 ENDIF()
296 IF(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL)
297   SET(OSGEXCLUDE_EXAMPLES_SIMPLE EXCLUDE_FROM_ALL)
298 ELSE()
299   SET(OSGEXCLUDE_EXAMPLES_SIMPLE "")
300 ENDIF()
302 IF(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL)
303   SET(OSGEXCLUDE_EXAMPLES_ADVANCED EXCLUDE_FROM_ALL)
304 ELSE()
305   SET(OSGEXCLUDE_EXAMPLES_ADVANCED "")
306 ENDIF()
308 IF(NOT WIN32)
309   IF(OSG_BUILD_DEPENDEND)
310     INCLUDE(${OSG_REFERENCE_DIR}/CMake.global.settings)
311     IF(OSG_DEPENDENT_INCLUDE_BUILD)
312       INCLUDE(${OSG_REFERENCE_DIR}/CMake.build.settings)
313     ENDIF()
314   ENDIF()
315 ENDIF()
317 #####################
318 # External extensions
319 #####################
321 OSG_SET_CACHE(OSG_EXTRA_EXTERNAL_MODULES "" STRING
322               "Extra modules that OpenSG will try to import.")
324 OSG_SET_CACHE(OSG_IGNORE_INSTALL "" STRING
325               "Extra modules that OpenSG will build but not installed.")
327 OSG_SET_CACHE(OSG_EXTERNAL_MODULES_INCLUDE "" FILEPATH 
328               "Include file of extra modules")
330 IF(EXISTS "${OSG_EXTERNAL_MODULES_INCLUDE}")
331   INCLUDE("${OSG_EXTERNAL_MODULES_INCLUDE}")
332 ENDIF()
334 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_MODULES})
335     OPTION(OSGBUILD_${EXTERNAL}
336            "Build using ${EXTERNAL} module" OFF)
338     IF(OSGBUILD_${EXTERNAL})
339         FIND_PATH(OSG_${EXTERNAL}_SOURCE_DIR
340                   CMakeLists.Lib.${EXTERNAL}.txt
341                   ${CMAKE_CURRENT_SOURCE_DIR}/../${EXTERNAL})
343         OSG_ADD_OPT(OSG_${EXTERNAL}_SOURCE_DIR)
345         IF(NOT EXISTS
346                 ${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.Lib.${EXTERNAL}.txt)
348             MESSAGE(SEND_ERROR "Cannot find ${EXTERNAL} sources directory: "
349                                "${OSG_${EXTERNAL}_SOURCE_DIR}")              
350         ELSE()
351             LIST(APPEND OSG_EXTERNAL_CONFIGS "${EXTERNAL}")
353             GET_FILENAME_COMPONENT(_EXT_SRC_DIR
354                                    "${OSG_${EXTERNAL}_SOURCE_DIR}/.."
355                                    REALPATH                         )
357             IF(EXISTS "${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.PackagePrepare.cmake")
358               LIST(APPEND OSG_EXTERNAL_PREPARE "${OSG_${EXTERNAL}_SOURCE_DIR}")
359             ENDIF()
361             IF(EXISTS "${_EXT_SRC_DIR}/CMakeLists.PackagePrepare.cmake")
362               LIST(APPEND OSG_EXTERNAL_PREPARE "${_EXT_SRC_DIR}")
363             ENDIF()
364         ENDIF()
365     ENDIF()
366 ENDFOREACH(EXTERNAL)
368 IF(OSG_EXTERNAL_PREPARE)
369   LIST(REMOVE_DUPLICATES OSG_EXTERNAL_PREPARE)
370 ENDIF()
372 ##############
373 # Compiler
374 ##############
376 SET(OSG_PLATFORM_64 0)
377 SET(OSG_PLATFORM_32 0)
378 SET(OSG_APPLE64     0)
379 SET(OSG_APPLE32     0)
380 SET(OSG_LIBDIR_SUFFIX "")
382 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
383   SET(OSG_PLATFORM_64 1)
384   SET(OSG_LIBDIR_SUFFIX "64")
386   IF(NOT WIN32)
387     SET(OSG_LIBDIR_BASE_SUFFIX "64")
388   ENDIF(NOT WIN32)
390   IF(APPLE)
391     SET(OSG_APPLE64 1)
392   ENDIF(APPLE)
393 ELSE()
394   SET(OSG_PLATFORM_32 1)
396   IF(APPLE)
397     SET(OSG_APPLE32 1)
398   ENDIF(APPLE)
399 ENDIF()
402 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
403     SET(LINUX 1)
404 ENDIF()
406 IF(WIN32)
407   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
408                                 CACHE STRING "OpenSG Build Types" FORCE )
409 ELSE()
410   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
411                                 CACHE STRING "OpenSG Build Types" FORCE )
412 ENDIF(WIN32)
413 IF(APPLE AND IOS)
414   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
415                                 CACHE STRING "OpenSG Build Types" FORCE )
416 ENDIF()
418 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
419   SET(CMAKE_BUILD_TYPE Debug CACHE STRING
420       "Choose the type of build, options are: Debug Release."
421       FORCE)
422 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
424 IF(NOT WIN32) 
425   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"          AND 
426      NOT CMAKE_BUILD_TYPE STREQUAL "DebugGV"        AND
427      NOT CMAKE_BUILD_TYPE STREQUAL "Release"        AND
428      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseGV"      AND
429      NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"   )
431     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
432                         "Please use either Release or Debug")
434   ENDIF()
435 ELSEIF(NOT MSVC_IDE)
437   IF(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
438     SET(CMAKE_BUILD_TYPE DebugOpt CACHE STRING
439         "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}."
440         FORCE)  
441   ENDIF()
443   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"    AND 
444      NOT CMAKE_BUILD_TYPE STREQUAL "DebugOpt" AND
445      NOT CMAKE_BUILD_TYPE STREQUAL "Release"  AND
446      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseNoOpt")
448     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
449                         "Please use on of ${CMAKE_CONFIGURATION_TYPES}")
451   ENDIF()
452 ENDIF()
454 IF(NOT OSG_COMPILER_DEFAULTS)
455    INCLUDE(CMake/OSGSetupCompiler.cmake)
456    SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) 
457 ENDIF(NOT OSG_COMPILER_DEFAULTS)
459 INCLUDE(CMake/OSGUpdateCompiler.cmake)
461 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
462    CMAKE_BUILD_TYPE STREQUAL "DebugGV")
464     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
465     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
467 ENDIF()
469 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
471 OSG_CHECK_INSTALL()
473 ##############################################################################
474 # DEPENDENCIES
475 ##############################################################################
477 # Global include/library dirs, libs and definitions
478 SET(OSG_GLOBAL_DEP_INCDIR "")
479 SET(OSG_SYSTEM_DEP_INCDIR "")
480 SET(OSG_GLOBAL_DEP_LIBDIR "")
481 SET(OSG_GLOBAL_DEP_LIBS   "")
482 SET(OSG_GLOBAL_DEP_DEFS   "")
484 IF(NOT WIN32)
485   SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
486 ENDIF()
488 #IF(WIN32)
489   OSG_OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
490   OSG_OPTION(OSG_USE_STATIC_SUPPORT_LIBS "" OFF)
492   IF(OSG_USE_OSGSUPPORT_LIBS)
493     OSG_SET_CACHE(OSG_SUPPORT_ROOT "" PATH "")
494   ENDIF(OSG_USE_OSGSUPPORT_LIBS)
496   IF(EXISTS "${OSG_SUPPORT_ROOT}" AND
497      EXISTS "${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
499     INCLUDE("${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
501     SET(_OSG_FATAL_DMS_COMBO  FALSE)
502     SET(_OSG_FATAL_ITER_COMBO FALSE)
504     IF( NOT OSG_DISABLE_MICROSOFT_SECURE_CXXX AND     OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
505       SET(_OSG_FATAL_DMS_COMBO TRUE)
506     ENDIF()
508     IF(     OSG_DISABLE_MICROSOFT_SECURE_CXXX AND NOT OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
509       SET(_OSG_FATAL_DMS_COMBO TRUE)
510     ENDIF()
512     IF(_OSG_FATAL_DMS_COMBO)
514       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_SECURE settings:\n"
515                           "  Support : ${OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX}\n"
516                           "  OpenSG  : ${OSG_DISABLE_MICROSOFT_SECURE_CXXX}")
518     ENDIF()
521     IF( NOT OSG_DISABLE_MS_ITERATOR_DEBUGGING AND     OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
522       SET(_OSG_FATAL_ITER_COMBO TRUE)
523     ENDIF()
525     IF(     OSG_DISABLE_MS_ITERATOR_DEBUGGING AND NOT OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
526       SET(_OSG_FATAL_ITER_COMBO TRUE)
527     ENDIF()
529     IF(_OSG_FATAL_ITER_COMBO)
531       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_ITER_DEBUG settings:\n"
532                           "  Support : ${OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING}\n"
533                           "  OpenSG  : ${OSG_DISABLE_MS_ITERATOR_DEBUGGING}")
535     ENDIF()
536   ENDIF()
538 IF(WIN32)
539    SET(OSG_INSTALL_SUBDIR "" CACHE STRING "add subdir to installed libs")
540 ENDIF(WIN32)
542 IF(NOT OSG_BUILD_DEPENDEND)
544     ##########
545     #### boost
546     ##########
548     OSG_CONFIGURE_BOOST()
550     #########
551     #### zlib
552     #########
554     OSG_CONFIGURE_ZLIB()
556 #    MESSAGE(STATUS "zlib: ${ZLIB_FOUND}")
558     IF(UNIX AND NOT OSG_APPLE32)
559         #############
560         #### Freetype
561         #############
563         FIND_PACKAGE(Freetype)
565         IF(FREETYPE_FOUND)
566             OSG_SET(OSG_WITH_FT2 1)
568             FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig)
570             IF(FONTCONFIG_LIBRARY MATCHES "fontconfig")
571                 OSG_SET(OSG_WITH_FONTCONFIG 1)
572             ENDIF()
574         ENDIF(FREETYPE_FOUND)
576         OSG_ADD_OPT(FREETYPE_FOUND)
577         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_freetype2)
578         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_ft2build)
579         OSG_ADD_OPT(FONTCONFIG_LIBRARY)
580         OSG_ADD_OPT(FREETYPE_LIBRARIES)
581     ENDIF(UNIX AND NOT OSG_APPLE32)
583     ##############
584     #### ImageLibs
585     ##############
587     OSG_CONFIGURE_TIFF()
588     OSG_CONFIGURE_PNG()
589     OSG_CONFIGURE_JPEG()
590     OSG_CONFIGURE_GDAL()
591     OSG_CONFIGURE_OPENEXR()
593     SET(OSG_EXTERNAL_IMAGELIBS)
594     SET(OSG_EXTERNAL_IMAGEINCS)
596 #    MESSAGE(STATUS "tiff: ${TIFF_FOUND} - png ${PNG_FOUND} - jpg: ${JPEG_FOUND} - exr ${OPENEXR_FOUND}")
598     IF(TIFF_FOUND)
599         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
600         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
601         OSG_SET(OSG_WITH_TIF 1)
602         OSG_ADD_OPT(TIFF_LIBRARIES)
603     ENDIF(TIFF_FOUND)
605     IF(PNG_FOUND)
606         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
607         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
608         OSG_SET(OSG_WITH_PNG 1)
609         OSG_ADD_OPT(PNG_INCLUDE_DIR)
610         OSG_ADD_OPT(PNG_LIBRARIES)
611     ENDIF(PNG_FOUND)
613     IF(JPEG_FOUND)
614         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
615         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
616         OSG_SET(OSG_WITH_JPG 1)
617         OSG_ADD_OPT(JPEG_LIBRARIES)
618     ENDIF(JPEG_FOUND)
620     IF(GDAL_FOUND)
621         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
622         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
623         OSG_SET(OSG_WITH_GDAL 1)
624         OSG_ADD_OPT(GDAL_LIBRARIES)
625     ENDIF(GDAL_FOUND)
627     IF(OPENEXR_FOUND)
628         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
629         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
630         OSG_SET(OSG_WITH_IMF 1)
632         OSG_ADD_OPT(OPENEXR_LIBRARIES)
633         OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
634     ENDIF(OPENEXR_FOUND)
637     OSG_ADD_OPT(OSG_EXTERNAL_IMAGELIBS)
638     OSG_ADD_OPT(OSG_EXTERNAL_IMAGEINCS)
640     #############
641     #### Collada
642     #############
644     #FIND_PACKAGE(Collada)
646     OSG_CONFIGURE_COLLADA()
648     IF(COLLADA_FOUND)
650       OSG_SET(OSG_WITH_COLLADA 1)
652       IF(NOT WIN32)
653         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
654            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
656             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
658         ELSE()
660             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
662         ENDIF()
663       ENDIF(NOT WIN32)
665       OSG_ADD_OPT(COLLADA_DAE_INCLUDE_DIR)
666       OSG_ADD_OPT(COLLADA_DOM_INCLUDE_DIR)
668       IF(WIN32 OR COLLADA_TARGET_FOUND)
669         SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
670       ENDIF(WIN32 OR COLLADA_TARGET_FOUND)
672     ELSE(COLLADA_FOUND)
674       SET(OSG_COLLADA_LIBS "")
676     ENDIF(COLLADA_FOUND)
678     OSG_ADD_OPT(COLLADA_FOUND)
680     #############
681     #### GLUT
682     #############
684     OSG_CONFIGURE_GLUT()
686     IF(GLUT_FOUND)
687       OSG_SET(OSG_WITH_GLUT 1)
688       OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
689       OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
690     ELSE(GLUT_FOUND)
691       OSG_SET(OSG_WITH_GLUT 0)
692       OSG_SET(OSG_GLUT_INC_DIR "")
693       OSG_SET(OSG_GLUT_LIBS "")
694     ENDIF(GLUT_FOUND)
696     #############
697     #### QT
698     #############
700     OSG_CONFIGURE_QT()
702     #############
703     #### OpenGL
704     #############
706     IF(APPLE AND IOS)
707       FIND_PACKAGE(OpenGLES REQUIRED)
709       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
710       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
711     ELSE()
712       FIND_PACKAGE(OpenGL REQUIRED)
714       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
715       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
716     ENDIF()
718     IF(OSG_USE_OGL3_PROTOS OR OSG_USE_OGL4_PROTOS)
719       SET(OSG_OGL_INCDIRS ${CMAKE_SOURCE_DIR}/Source/External/OpenGL)
720       LIST(APPEND OSG_GLOBAL_DEP_INCDIR OSG_OGL_INCDIRS)
722       ADD_DEFINITIONS(-DOSG_USE_GL3_INCLUDES=1)
723     ENDIF()
725     #############
726     #### X11
727     #############
729     FIND_PACKAGE(X11)
731     IF(X11_FOUND)
732         OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
733         OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
734     ENDIF(X11_FOUND)
736     OSG_ADD_OPT(X11_FOUND)
738     #############
739     #### VTK
740     #############
742     IF(OSG_ENABLE_VTK)
743       IF(OSG_USE_OSG_VTK_SETUP)
744         OSG_CONFIGURE_VTK()
745       ELSE(OSG_USE_OSG_VTK_SETUP)
746         FIND_PACKAGE(VTK)
748         IF(VTK_FOUND)
749           OSG_SET(OSG_WITH_VTK 1)
750           OSG_SET(OSG_VTK_LIBS "vtkCommon;vtkFiltering;vtkGraphics;vtkIO;vtkRendering")
752           OSG_ADD_OPT(OSG_VTK_LIBS)
753           OSG_ADD_OPT(VTK_LIBRARY_DIRS)
754           OSG_ADD_OPT(VTK_INCLUDE_DIRS)
755           OSG_ADD_OPT(VTK_DIR)
756         ENDIF(VTK_FOUND)
757       ENDIF(OSG_USE_OSG_VTK_SETUP)
759       OSG_ADD_OPT(VTK_FOUND)
760     ENDIF()
762     ##############
763     #### GLEW
764     ##############
766     IF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
767       OSG_CONFIGURE_GLEW()
769       IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
770         LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
771       ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
773     ENDIF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
775     ##############
776     #### Mini
777     ##############
779     OSG_CONFIGURE_LIBMINI()
781     OSG_ADD_OPT(OSG_LIBMINI_FOUND)
782     OSG_ADD_OPT(OSG_LIBMINI_INCLUDE_DIR)
783     OSG_ADD_OPT(OSG_LIBMINI_LIBRARIES)
785     ###############
786     #### OpenNurbs
787     ###############
789     OSG_CONFIGURE_OPENNURBS()
791     OSG_ADD_OPT(OPENNURBS_FOUND)
792     OSG_ADD_OPT(OPENNURBS_INCLUDE_DIR)
793     OSG_ADD_OPT(OPENNURBS_LIBRARIES)
795     #############
796     #### Python
797     #############
799     FIND_PACKAGE(PythonInterp)
800     FIND_PACKAGE(PythonLibs)
802     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
803     OSG_ADD_OPT(PYTHON_LIBRARY)
804     OSG_ADD_OPT(PYTHONLIBS_FOUND)
806     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
808       FIND_PACKAGE(Boost COMPONENTS python)
810       IF(Boost_FOUND AND WIN32)
812         SET(OSG_BOOST_PYTHON_TARGETS )
813         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
814         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
815       
816       ELSE(Boost_FOUND AND WIN32)
818         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
819            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
821           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
823         ELSE()
824           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
825         ENDIF()
827       ENDIF(Boost_FOUND AND WIN32)
829       # We ignore if boost python fails, we catch that somewhere else
830       # so if we get here Boost_FOUND was true in the first place
831       SET(Boost_FOUND TRUE)
833       FIND_PACKAGE(GCCXML)
835       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
836       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
837       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
839     ENDIF()
842     ###############
843     #### Flex/Bison
844     ###############
846     FIND_PROGRAM(FLEX_EXE flex)
847     FIND_PROGRAM(BISON_EXE bison)
849     OSG_ADD_OPT(FLEX_EXE)
850     OSG_ADD_OPT(BISON_EXE)
852     ##############
853     #### NVPerfSDK
854     ##############
856 #    OSG_FIND_PACKAGE(NVidiaPerfSDK)
858 #    IF(NVIDIAPERFSDK_FOUND)
859 #        OSG_SET(OSG_WITH_NVPERFSDK 1)
860 #        OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
861 #        OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
862 #    ELSE(NVIDIAPERFSDK_FOUND)
863 #        OSG_SET(OSG_WITH_NVPERFSDK 0)
864 #        OSG_SET(OSG_NVPERFSDK_INC_DIR "")
865 #        OSG_SET(OSG_NVPERFSDK_LIBS "")
866 #    ENDIF(NVIDIAPERFSDK_FOUND)
869     #############
870     #### Support
871     #############
873     IF(UNIX)
874         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
875         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
876         FIND_LIBRARY(OSG_RT_LIB     NAMES rt)
878         OSG_ADD_OPT(OSG_THREAD_LIB)
879         OSG_ADD_OPT(OSG_DL_LIB)
880         OSG_ADD_OPT(OSG_RT_LIB)
881     ENDIF(UNIX)
883     IF(APPLE)
884         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
885         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
886         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
887         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
889         OSG_ADD_OPT(OSG_APPLICATIONSERVICES_FRAMEWORK)
890         OSG_ADD_OPT(OSG_CORESERVICES_FRAMEWORK)
891         OSG_ADD_OPT(OSG_CARBON_FRAMEWORK)
892         OSG_ADD_OPT(OSG_COCOA_FRAMEWORK)
893     ENDIF(APPLE)
895     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
897 ENDIF(NOT OSG_BUILD_DEPENDEND)
899 MESSAGE("")
901 SET(CFG_NAME OSG)
902 FOREACH(EXTERNAL_PREPARE ${OSG_EXTERNAL_PREPARE})
903   INCLUDE("${EXTERNAL_PREPARE}/CMakeLists.PackagePrepare.cmake")
904 ENDFOREACH()
906 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
907   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
908     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
909   ENDIF(EXISTS
910   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
911 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
914 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
915   INCLUDE(${OSG_GLOBAL_PREP})
916 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
918 IF(APPLE AND OSG_COCOA_FRAMEWORK)
919     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
920 ELSEIF(WIN32)
921     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
922 ELSEIF(UNIX AND X11_FOUND)
923     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
924 ELSEIF(APPLE AND IOS)
925     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
926 ELSE()
927     OSG_SET(OSG_NATIVE_WINDOW "")
928 ENDIF()
930 ###############
931 #### Doxygen
932 ###############
934 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
935   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
936                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
937 ENDIF()
939 FIND_PACKAGE(Doxygen)
941 ##############################################################################
942 # Overrides if dependend
943 ##############################################################################
945 IF(NOT WIN32)
946     IF(OSG_BUILD_DEPENDEND)
947         MESSAGE(STATUS "Load reference settings")
948         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
949         # Needed to get the correct vtk/boost settings
950         FIND_PACKAGE(VTK)
951         OSG_BOOST_DEP_SETUP()
952         OSG_CONFIGURE_QT()
954         IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
955           LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
956         ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
958     ELSE(OSG_BUILD_DEPENDEND)
959 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
960     ENDIF(OSG_BUILD_DEPENDEND)
961 ENDIF(NOT WIN32)
963 ##############################################################################
964 # MAIN BUILD STEPS
965 ##############################################################################
967 # when adding passes, make sure to add a corresponding pass directory variable
968 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
969 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
971 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
972 SET(OSG_PASSDIR_OSGSETUP   "Build")
974 OSG_COMMON_TARGETS()
976 ###############
977 # Clean
978 ###############
980 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
982 IF(OSG_OLD_BUILD_FILES)
983     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
984 ENDIF(OSG_OLD_BUILD_FILES)
986 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
988 IF(OSG_OLD_CONFIG_FILES)
989     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
990 ENDIF(OSG_OLD_CONFIG_FILES)
992 ###############
993 # Tests
994 ###############
996 # optional pass for test programs
997 IF(OSGBUILD_TESTS)
998     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
999     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
1000 ENDIF(OSGBUILD_TESTS)
1002 ###############
1003 # UnitTests
1004 ###############
1006 IF(OSGBUILD_UNITTESTS)
1007     ENABLE_TESTING()
1008     INCLUDE(CTest)
1010     # optional pass for unittest programs
1011     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
1012     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
1014     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
1015                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
1017     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
1018     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
1019     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
1021     ADD_CUSTOM_TARGET(OSGAllUnitTests)
1022     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
1023 ENDIF(OSGBUILD_UNITTESTS)
1025 ###############
1026 # Python
1027 ###############
1029 INCLUDE(OSGSetupPython)
1030 SETUP_PYTHON_BUILD()
1032 #################
1033 # Documentation I
1034 #################
1035 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1036 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1038 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1039     ADD_CUSTOM_TARGET(Doc)
1040 ENDIF()
1042 IF(DOXYGEN_EXECUTABLE)
1043     SET(DOXYGEN_VERSION)
1044     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1045                     OUTPUT_VARIABLE DOXYGEN_VERSION
1046                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1047     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1048         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1049                         "when building OpenSG documentation. "
1050                         "Please use a different version, sorry for the inconvenience.")
1051     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1052 ENDIF(DOXYGEN_EXECUTABLE)
1054 IF(NOT OSG_DOXY_INPUTS)
1055     # add a pass for doxygen to run
1056     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1057     SET(OSG_PASSDIR_OSGDOXYDOC "Doc/build")
1058 ELSE()
1059     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC_EXT")
1060     SET(OSG_PASSDIR_OSGDOXYDOC_EXT "DocExt/build")
1061 ENDIF(NOT OSG_DOXY_INPUTS)
1063 # set up variables for the config file
1064 IF(DOXYGEN_DOT_EXECUTABLE)
1065     SET(OSG_DOXY_HAVE_DOT "YES")
1066 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1068 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1069 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1070 SET(OSG_GENDOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/GenDoc/opensg-doxy")
1072 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1074 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1075     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1076     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1077     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1078     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1079     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1080     SET(OSG_DOXY_SEARCHENGINE "NO")
1082 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1083     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1084     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1085     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1086     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1087     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1088     SET(OSG_DOXY_SEARCHENGINE "NO")
1090 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1091     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1092     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1093     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1094     SET(OSG_DOXY_HAVE_DOT "NO")
1095     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1096     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1097     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1098     SET(OSG_DOXY_SEARCHENGINE "NO")
1100 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1102 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1103   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1104 ELSE()
1105   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1106 ENDIF()
1108 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1110 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1111 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1113 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1114   SET(OSG_DOC_SECTION "all_in_one")
1115   SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
1116 ELSE()
1117   SET(OSG_DOC_SECTION "separate")
1118 ENDIF()
1120 # write doxygen config file
1121 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1122                "${OSG_DOXY_CONFIGURATION_FILE}")
1125 # write general doc config file
1127 SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/GenDoc")
1128 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "")
1129 #SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS=${CMAKE_BINARY_DIR}/Doc/html/Full/html")
1131 SET(OSG_DOC_SECTION "${OSG_DOC_SECTION} include_general_doc")
1133 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1134                "${OSG_GENDOXY_CONFIGURATION_FILE}")
1136 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1138 # find/process documentation include files
1139 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1141 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1143   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1145   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1146                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1148 ENDFOREACH()
1150 IF(OSG_DOXY_INPUTS)
1151     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1152                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1153 ENDIF(OSG_DOXY_INPUTS)
1156 IF(DOXYGEN_EXECUTABLE)
1157   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1158   ADD_DEPENDENCIES(DocUpload Doc)
1161   ADD_CUSTOM_TARGET(DocSyncGV
1162                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1163                     WORKING_DIRECTORY Doc)
1165   ADD_CUSTOM_TARGET(DocCompleteGV)
1166   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1167 ENDIF(DOXYGEN_EXECUTABLE)
1169 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1171 ###############
1172 # Passes
1173 ###############
1175 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1176   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1178   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1179        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1181   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1182     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1183     INCLUDE(${_OSGCORE_EXT_FILE})
1184   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1187 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1189 # Find files describing libraries to build, but make sure base
1190 # and system are processed first
1191 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1192      "Source/CMakeLists.Lib.OSGBase.txt")
1194 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1195      "Source/CMakeLists.Lib.OSGSystem.txt")
1197 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1198      "Source/*CMakeLists.Lib.*.txt")
1200 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1201 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1203 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1204 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1206 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1207   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1209   IF(_OSG_FOUND_CONTRIB_CONFIG)
1210     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1211   ELSE()
1212     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1213   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1214 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1216 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1218 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1220   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1221                          ${_OSG_LIBRARY_CONFIG}
1222                           PATH)
1224   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1225                          ${_OSG_LIBRARY_CONFIG}
1226                           NAME)
1228   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1229                      ${_OSG_LIBCONFIG_BASENAME})
1231   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1232                          ${_OSG_LIBCONFIG_BASENAME_1}
1233                          NAME_WE)
1235   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1236     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1237   ENDIF()
1239 ENDFOREACH()
1241 OSG_COMMON_CUDA()
1243 # run build passes
1244 FOREACH(PASS ${OSG_CMAKE_PASSES})
1245     SET(OSG_CMAKE_PASS ${PASS})
1247     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1249     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1250         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1251         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1252         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1253         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1255         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1257         IF(_OSG_IS_CONTRIBLIB)
1258           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1259         ELSE()
1260           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1261         ENDIF()
1263         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1264     ENDFOREACH(LIBCONFIGFILE)
1266     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1268     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1269         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1270                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1271     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1273 ENDFOREACH()
1275 IF(NOT WIN32)
1276   IF(NOT OSG_BUILD_DEPENDEND)
1277     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1278   ENDIF(NOT OSG_BUILD_DEPENDEND)
1279 ENDIF(NOT WIN32)
1281 ###############
1282 # OSGConfigured
1283 ###############
1286 EXECUTE_PROCESS(
1287     COMMAND "${CMAKE_COMMAND}" -E copy
1288                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1289                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1291 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1292   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1293 ENDFOREACH()
1295 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1297 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1298                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1300 EXECUTE_PROCESS(
1301     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1302                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1303                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1305 #################
1306 # Examples/Simple
1307 #################
1309 ADD_CUSTOM_TARGET(OSGAllExamples)
1310 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1312 IF(OSGBUILD_EXAMPLES_SIMPLE)
1313     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1314     ADD_SUBDIRECTORY("Examples/Simple")
1315     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1316 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1318 ###################
1319 # Examples/Advanced
1320 ###################
1322 IF(OSGBUILD_EXAMPLES_ADVANCED)
1323     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1324     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1325     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1326     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1327 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1329 ###################
1330 # Examples/Advanced
1331 ###################
1333 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1334     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1335     ADD_SUBDIRECTORY("Examples/Tutorial")
1336     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1337 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1339 ###################
1340 # External Examples
1341 ###################
1343 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1344   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1346   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1347     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1348     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1349   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1350 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1352 ##################
1353 # Documentation II
1354 ##################
1356 SET(OSG_DOC_PIPES "")
1358 IF(OSG_DOXY_STDOUT_LOG)
1359     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1360 ENDIF(OSG_DOXY_STDOUT_LOG)
1362 IF(DOXYGEN_EXECUTABLE)
1363     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1364         ADD_CUSTOM_TARGET(Doc
1365             VERBATIM
1366             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1367     ENDIF()
1368 ENDIF()
1370 IF(DOXYGEN_EXECUTABLE)
1371   ADD_CUSTOM_TARGET(GenDoc
1372                     VERBATIM
1373                     COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_GENDOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1374 ENDIF()
1376 ##################
1377 # Documentation II
1378 ##################
1380 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1381   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1382     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1383   ENDIF()
1384 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1386 ##################
1387 # osg2-config
1388 ##################
1390 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1391 # is generated during the OSGCOLLECT pass.
1393 # substitute variables in static parts
1394 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1395                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1396 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1397                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1399 # read in all parts
1400 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1401 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1402 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1404 # concatenate final file
1405 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1406 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1407 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1409 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1410 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1411 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1413 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1414         DESTINATION bin)
1415 #        COMPONENT development_tools)
1417 ##################
1418 # cmake modules
1419 ##################
1421 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cmake)
1423 STRING(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_UP)
1425 STRING(REPLACE "OpenSG" "OSG" CMAKE_PROJECT_NAME_SHORT ${CMAKE_PROJECT_NAME})
1427 STRING(TOUPPER "OpenSG" ${CMAKE_PROJECT_NAME_SHORT} ${CMAKE_PROJECT_NAME_SHORT_UP})
1429 CONFIGURE_FILE(CMake/FindOpenSG.cmake.in
1430                ${CMAKE_BINARY_DIR}/cmake/Find${CMAKE_PROJECT_NAME}.cmake
1431                @ONLY                                                   )
1433 INSTALL(FILES "${CMAKE_BINARY_DIR}/cmake/FindOpenSG.cmake"
1434         DESTINATION share/OpenSG/cmake)
1435 #        COMPONENT development_configuration)
1436 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake.in"
1437         DESTINATION share/OpenSG/cmake)
1438 #        COMPONENT development_configuration)
1439 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1440         DESTINATION share/OpenSG/cmake)
1441 #        COMPONENT development_configuration)
1442 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1443         DESTINATION share/OpenSG/cmake)
1444 #        COMPONENT development_configuration)
1445 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindExpat_OpenSG.cmake"
1446         DESTINATION share/OpenSG/cmake)
1447 #        COMPONENT development_configuration)
1448 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1449         DESTINATION share/OpenSG/cmake)
1450 #        COMPONENT development_configuration)
1451 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1452         DESTINATION share/OpenSG/cmake)
1453 #        COMPONENT development_configuration)
1454 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1455         DESTINATION share/OpenSG/cmake)
1456 #        COMPONENT development_configuration)
1457 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1458         DESTINATION share/OpenSG/cmake)
1459 #        COMPONENT development_configuration)
1460 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1461         DESTINATION share/OpenSG/cmake)
1462 #        COMPONENT development_configuration)
1463 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGSetupCompiler.cmake"
1464         DESTINATION share/OpenSG/cmake)
1465 #        COMPONENT development_configuration)
1466 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGUpdateCompiler.cmake"
1467         DESTINATION share/OpenSG/cmake)
1468 #        COMPONENT development_configuration)
1469 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGBuildFunctions.cmake"
1470         DESTINATION share/OpenSG/cmake)
1471 #        COMPONENT development_configuration)
1472 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGConfigurePackages.cmake"
1473         DESTINATION share/OpenSG/cmake)
1474 #        COMPONENT development_configuration)
1475 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGExternalProjectHelper.cmake"
1476         DESTINATION share/OpenSG/cmake)
1477 #        COMPONENT development_configuration)
1478 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1479         DESTINATION share/OpenSG/cmake)
1480 #        COMPONENT development_configuration)
1481 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1482         DESTINATION share/OpenSG/cmake)
1483 #        COMPONENT development_configuration)
1484 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonOptions.cmake"
1485         DESTINATION share/OpenSG/cmake)
1486 #        COMPONENT development_configuration)
1487 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonConfig.cmake"
1488         DESTINATION share/OpenSG/cmake)
1489 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonSupportConfig.cmake"
1490         DESTINATION share/OpenSG/cmake)
1492 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1493         DESTINATION bin
1494 #        COMPONENT development_tools
1495         PATTERN "*/fcd2code/fcd2code" EXCLUDE
1496         PATTERN "*.pyc" EXCLUDE
1497         PATTERN ".svn"  EXCLUDE)
1498 INSTALL(PROGRAMS "${CMAKE_SOURCE_DIR}/Tools/fcd2code/fcd2code"
1499         DESTINATION bin/fcd2code)
1501 ##################
1502 # Global Python
1503 ##################
1505 IF(OSGBUILD_PYTHON_BINDINGS)
1506   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1507                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1508                   OUTPUT_VARIABLE _OSG_LIBORDER)
1511                  
1512   SET(_OSG_PY_MODNAME_LIST "osg2ModuleNameList = [\n")
1513   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1515   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1516     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1517     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1518     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1519     SET(_OSG_PY_MODNAME_LIST "${_OSG_PY_MODNAME_LIST}  \"${_OSG_LIB}\",\n")
1520   ENDFOREACH()
1522   SET(OSG_PYTHON_ALL_IMPORTS "${_OSG_PY_MODNAME_LIST}  ]\n\n${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1524   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1525   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1528   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1529                  "${_OSG_GEN_INIT_FILE_OUT}")
1531   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1532                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1534   IF(WIN32) 
1536     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1537     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1538     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1539     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1541     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1542             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1543             CONFIGURATIONS Release)
1544 #            COMPONENT      release_runtimes)
1546     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1547             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/osg
1548             CONFIGURATIONS Debug)
1549 #            COMPONENT      debug_runtimes)
1551     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1552             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/osg
1553             CONFIGURATIONS DebugOpt)
1554 #            COMPONENT      debug_opt_runtimes)
1556     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1557             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/osg
1558             CONFIGURATIONS ReleaseNoOpt)
1559 #            COMPONENT      release_no_opt_runtimes)
1562     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1563             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1564             CONFIGURATIONS Release)
1565 #            COMPONENT      release_runtimes)
1567     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1568                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1569                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1570                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1571             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1572             CONFIGURATIONS Release)
1573 #            COMPONENT      release_runtimes)
1576     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1577             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1578             CONFIGURATIONS Debug)
1579 #            COMPONENT      debug_runtimes)
1581     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1582                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1583                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1584                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1585             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1586             CONFIGURATIONS Debug)
1587 #            COMPONENT      debug_runtimes)
1590     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1591             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1592             CONFIGURATIONS DebugOpt)
1593 #            COMPONENT      debug_opt_runtimes)
1595     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1596                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1597                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1598                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1599             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1600             CONFIGURATIONS DebugOpt)
1601 #            COMPONENT      debug_opt_runtimes)
1604     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1605             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1606             CONFIGURATIONS ReleaseNoOpt)
1607 #            COMPONENT      release_no_opt_runtimes)
1609     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1610                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1611                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1612                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1613             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1614             CONFIGURATIONS ReleaseNoOpt)
1615 #            COMPONENT      release_no_opt_runtimes)
1617   ELSE(WIN32)   
1619     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1620     SET(_OSG_PY_INST_BASE 
1621         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1623     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1624             DESTINATION ${_OSG_PY_INST_BASE}/osg)
1625 #            COMPONENT   libraries)
1627     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1628             DESTINATION ${_OSG_PY_INST_BASE})
1629 #            COMPONENT   libraries)
1631     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1632                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1633                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1634                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1635             DESTINATION ${_OSG_PY_INST_BASE}/helpers)
1636 #            COMPONENT   libraries)
1638   ENDIF(WIN32)
1640 ENDIF()
1642 INSTALL_PYTHON_ELEMENTS()
1644 ##################
1645 # Documentation
1646 ##################
1648 IF(DOXYGEN_EXECUTABLE)
1649     IF(OSG_INSTALL_DOXYDOC)
1650         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1651                 DESTINATION share/OpenSG/documentation)
1652 #                COMPONENT documentation)
1653     ENDIF()
1654 ENDIF()
1656 ##################
1657 # Images/Icons
1658 ##################
1660 ##################
1661 # CSM Example
1662 ##################
1664 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
1665         DESTINATION share/OpenSG/Examples/)
1666 #        COMPONENT examples_basic)
1668 ##################
1669 # Packaging
1670 ##################
1672 #IF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1674 #    SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
1676 #    SET(CPACK_PACKAGE_NAME                "OpenSG")
1677 #    SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
1678 #    SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
1679 #    SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
1680 #    SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
1681 #    SET(CPACK_PACKAGE_VENDOR              "OpenSG")
1682 #    SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
1683 #    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
1684 #    SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
1685 #    SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
1687 #    if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
1688 #        set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
1689 #        set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
1690 #    endif ()
1692 #    if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
1693 #        set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
1694 #    endif()
1696 #    #Define Components
1697 #    SET(CPACK_COMPONENTS_ALL development_tools
1698 #        development_configuration
1699 #        code_headers
1700 #        libraries
1701 #        debug_program_db
1702 #        release_program_db
1703 #        debug_libraries
1704 #        release_libraries
1705 #        debug_runtimes
1706 #        release_runtimes
1707 #        data_images
1708 #        examples_basic
1709 #        examples_advanced
1710 #        Unspecified
1711 #        )
1714 #    #Components
1715 #    #Runtime
1716 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
1718 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
1719 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
1720 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
1721 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1723 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
1724 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
1725 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
1726 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1728 #    #Development
1729 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
1731 #    #Libraries
1732 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
1733 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
1734 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
1735 #    set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
1737 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
1738 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
1739 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
1740 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
1742 #    #Program database
1743 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
1744 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
1745 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
1746 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
1748 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
1749 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
1750 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
1751 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
1753 #    #Tools
1754 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
1755 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
1756 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
1757 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
1759 #    #Configuration
1760 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
1761 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
1762 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
1763 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
1765 #    #Headers
1766 #    SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
1767 #    SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
1768 #    SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
1769 #    SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
1771 #    #Examples
1772 #    SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
1774 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
1775 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
1776 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
1777 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
1779 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
1780 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
1781 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
1782 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
1784 #    #Shared Data
1785 #    SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
1787 #    SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
1788 #    SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
1789 #    SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
1790 #    SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
1792 #    #Documentation
1793 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
1795 #    #Dependencies
1796 #    #Boost
1797 #    #Base
1799 #    #NSIS specific configuration
1800 #    IF(WIN32)
1801 #        INCLUDE(InstallRequiredSystemLibraries)
1802 #        IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
1803 #            IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
1804 #                         ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
1805 #                 include(CMakeDetermineVSServicePack)
1806 #                 DetermineVSServicePack( my_service_pack )
1808 #                 IF( my_service_pack )
1809 #                     SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
1810 #                 ENDIF()
1811 #            ENDIF()
1813 #            #Extra install commands
1814 #            SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
1815 #            SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
1818 #            SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1819 #            SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1820 #            FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
1821 #            SET(CPACK_NSIS_MODIFY_PATH         ON)
1822 #            SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
1823 #            SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
1824 #            SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
1825 #            SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
1826 #            SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
1827 #            SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
1828 #            SET(CPACK_NSIS_MENU_LINKS          "")
1829 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
1830 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
1831 #        ENDIF()
1832 #    ENDIF()
1835 #    # Date macro by Benoit RAT (www.neub.co.nr)
1836 #    MACRO (TODAY RESULT)
1837 #        IF (WIN32)
1838 #            EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
1839 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1840 #        ELSEIF(UNIX)
1841 #            EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
1842 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1843 #        ELSE (WIN32)
1844 #            MESSAGE(SEND_ERROR "date not implemented")
1845 #            SET(${RESULT} 000000)
1846 #        ENDIF (WIN32)
1847 #    ENDMACRO (TODAY)
1849 #    TODAY(DATE)
1851 #    # Determine package type
1852 #    IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1853 #        IF(WIN32)
1854 #            SET(OSGBUILD_PACKAGE_TYPE "ZIP")
1855 #        ELSE(WIN32)
1856 #            SET(OSGBUILD_PACKAGE_TYPE "RPM")
1857 #        ENDIF(WIN32)
1858 #    ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1860 #    STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
1862 #    IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
1863 #        SET( PACK_EXT "tar.bz2" )
1864 #    ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
1865 #        SET( PACK_EXT "tar.gz" )
1866 #    ELSE()
1867 #        STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
1868 #    ENDIF()
1870 #    SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
1871 #    SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
1873 #    INCLUDE(CPack)
1876 #    # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
1877 #    IF(WIN32)
1878 #        #TODO: Need a way to do this on Windows
1879 #        #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 )
1880 #        #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1881 #    ELSE(WIN32)
1882 #        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 )
1883 #        ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1884 #    ENDIF(WIN32)
1887 #ENDIF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1889 IF(NOT WIN32)
1890   CONFIGURE_FILE(CMake/CMakeLists.packaging.unix.txt 
1891                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1892                  @ONLY                                      )
1893 ELSE()
1895   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
1896     SET(OSG_WIN_SEC "nosec")
1897   ELSE()
1898     SET(OSG_WIN_SEC "msdefault")
1899   ENDIF()
1901   CONFIGURE_FILE(CMake/CMakeLists.packaging.win.txt 
1902                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1903                  @ONLY                                      )
1904   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico"
1905           DESTINATION share/OpenSG/Packaging
1906 #          COMPONENT packaging
1907           PERMISSIONS OWNER_WRITE OWNER_READ
1908                       GROUP_READ
1909                       WORLD_READ            )
1911   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp"
1912           DESTINATION share/OpenSG/Packaging
1913 #          COMPONENT packaging
1914           PERMISSIONS OWNER_WRITE OWNER_READ
1915                       GROUP_READ
1916                       WORLD_READ            )
1917 ENDIF()
1919 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1920         DESTINATION share/OpenSG/Packaging
1921 #        COMPONENT packaging
1922         PERMISSIONS OWNER_WRITE OWNER_READ
1923                     GROUP_READ
1924                     WORLD_READ
1925         RENAME CMakeLists.txt)
1927 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
1928         DESTINATION share/doc/OpenSG/
1929 #        COMPONENT doc
1930         PERMISSIONS OWNER_WRITE OWNER_READ
1931                     GROUP_READ
1932                     WORLD_READ)
1934 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/PLY/README
1935         DESTINATION share/doc/OpenSG/
1936 #        COMPONENT doc
1937         PERMISSIONS OWNER_WRITE OWNER_READ
1938                     GROUP_READ
1939                     WORLD_READ
1940         RENAME README.ply)
1942 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/TrapezoidalShadowMaps/README
1943         DESTINATION share/doc/OpenSG/
1944 #        COMPONENT doc
1945         PERMISSIONS OWNER_WRITE OWNER_READ
1946                     GROUP_READ
1947                     WORLD_READ
1948         RENAME README.tsm)
1950 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README
1951         DESTINATION share/doc/OpenSG/
1952 #        COMPONENT doc
1953         PERMISSIONS OWNER_WRITE OWNER_READ
1954                     GROUP_READ
1955                     WORLD_READ
1956         RENAME README.rhine)
1958 IF(WIN32)
1959   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
1960                                 CACHE STRING "OpenSG Build Types" FORCE )
1961 ELSE()
1962   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
1963                                 CACHE STRING "OpenSG Build Types" FORCE )
1964 ENDIF(WIN32)
1965 IF(APPLE AND IOS)
1966   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
1967                                 CACHE STRING "OpenSG Build Types" FORCE )
1968 ENDIF()
1970 IF(WIN32)
1971   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1972        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
1974   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1975        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
1977 ENDIF(WIN32)
1979 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1980      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
1982 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1983      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
1985 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1986      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
1988 ###########################
1989 # Component install Setting
1990 ###########################
1992 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
1994 IF(NOT WIN32)
1995   ADD_CUSTOM_TARGET(OSG_preinstall
1996                     make preinstall
1997                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
1998 ELSE()
1999 ENDIF()
2001 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
2003   IF(NOT WIN32)
2004     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2005                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
2006                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2007   ELSE()
2009     SET(_OSG_CMP_CONF Release)
2011     IF(${_OSG_CMP} MATCHES ^debug_)
2012       SET(_OSG_CMP_CONF Debug)
2013     ENDIF()
2015     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2016                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
2017                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2019     SET_PROPERTY(TARGET INSTALL_${_OSG_CMP} PROPERTY FOLDER "Packaging")
2020   ENDIF()
2022   IF(NOT WIN32)
2023     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
2024   ELSE()
2025   ENDIF()
2026 ENDFOREACH()
2029 IF(WIN32)
2031   ADD_CUSTOM_TARGET(INSTALL_runtime)
2033   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_runtimes)
2034   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_binaries)
2036   SET_PROPERTY(TARGET INSTALL_runtime PROPERTY FOLDER "Packaging")
2038 ELSE()
2040   ADD_CUSTOM_TARGET(INSTALL_runtime)
2042   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
2043   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_binaries)
2044 ENDIF()
2046 #IF(WIN32)
2047 #  SET_PROPERTY(TARGET ALL_BUILD PROPERTY FOLDER "CMakePredefinedTargets")
2048 #ENDIF()
2050 ################
2051 # Build Setting
2052 ################
2054 IF(NOT WIN32)
2055   IF(NOT OSG_BUILD_DEPENDEND)
2056     OSG_WRITE_OSGBUILD(${CMAKE_BINARY_DIR}/CMake.build.settings)
2057     OSG_WRITE_OSGGLOBALSETUP(${CMAKE_BINARY_DIR}/CMake.global.settings)
2058   ENDIF(NOT OSG_BUILD_DEPENDEND)
2059 ENDIF(NOT WIN32)
2061 IF(OSG_WITH_CUDA)
2062   CUDA_BUILD_CLEAN_TARGET()
2063 ENDIF(OSG_WITH_CUDA)
2066 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2068 FOREACH(_variableName ${_variableNames})
2069   IF(_variableName MATCHES "^OSG")
2070 #    MESSAGE("FOO : ${_variableName}")
2071 #    FILE(APPEND ${FILENAME}
2072 #         "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2073   ENDIF()
2074 ENDFOREACH()