change: osg include statement to ""
[opensg.git] / CMakeLists.txt
blobc05429b63840c734093c7b959f49b4dc3ad401c9
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)
111 OSG_OPTION(OSG_ENABLE_TESTCONTAINER "" OFF)
112 OSG_OPTION(OSG_ENABLE_VALGRIND_CHECKS "" OFF)
113 OSG_OPTION(OSG_ENABLE_MEMORY_DEBUGGING "" OFF)
114 OSG_OPTION(OSG_ENABLE_DOUBLE_MATRIX_STACK "" OFF)
115 OSG_OPTION(OSG_ENABLE_DEFAULT_READONLY_CHANGELIST "" OFF)
116 OSG_OPTION(OSG_DISABLE_SOURCE_GROUPS "" OFF)
117 OSG_OPTION(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE "" OFF)
119 OSG_OPTION(OSG_ENABLE_CUDA "" OFF)
120 OSG_OPTION(OSG_ENABLE_VTK  "" ON )
122 IF(WIN32)
123   OPTION(OSG_ENABLE_WIN_LOCALSTORAGE "" ON)
124   OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
126   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
127     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
128   ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
129     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
130   ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
131 ELSEIF(APPLE)
132   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" OFF)
133 ELSEIF(UNIX)
134   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" ON)
135 ENDIF()
137 OSG_OPTION(OSG_ENABLE_AUTOINIT_THREADS "" OFF)
138 OPTION(OSG_DEPENDENT_INCLUDE_BUILD "" OFF)
140 IF(WIN32)
141   OSG_OPTION(OSG_USE_SEPARATE_LIBDIRS "" ON)
142   OSG_OPTION(OSG_INSTALL_PDB_FILES "" OFF)
143 ENDIF(WIN32)
145 OSG_OPTION(OSG_INSTALL_EXAMPLES "" OFF)
146 OSG_OPTION(OSG_INSTALL_EXAMPLES_EXE "" OFF)
147 OSG_OPTION(OSG_INSTALL_APPS "" ON)
149 OSG_OPTION(OSGCOMPAT_ENABLE                  "" OFF)
150 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED       "" OFF)
151 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED_PROPS "" OFF)
153 OSG_SET_CACHE(OSG_RENDERPROPERTY_BITS 64 STRING "")
154 OSG_SET_CACHE(OSG_RENDERPROPERTY_UNIQUE_BITS 16 STRING "")
156 OSG_OPTION(OSG_GENERATE_SEPARATE_LIB_DOC "Generate separate doxygen documentation for contrib libraries" OFF)
157 OSG_OPTION(OSG_INSTALL_DOXYDOC "Install Doxygen documentation" OFF)
159 OSG_OPTION(OSG_LINK_EXTERNAL_MODULES_TO_CSM "" FALSE)
162 #OSG_OPTION(OSGBUILD_ENABLE_PACKAGING "Generate binary packages with CPack" OFF)
163 #SET(OSGBUILD_PACKAGE_TYPE "" CACHE STRING
164 #    "The type of package to generate (empty->default)")
167 SET(OSG_DOXY_DOC_TYPE "User" CACHE STRING
168     "The type of documentation to generate (User, Developer, Trac)")
169 SET(OSG_DOXY_INPUTS CACHE FILEPATH "include given file instead of autogen")
170 SET(OSG_DOXY_STDOUT_LOG CACHE FILEPATH "log std to file")
172 # Not sure
173 #OPTION(OSG_ENABLE_MTCPTR "" ON)
174 #OPTION(OSG_ENABLE_GIF    "" ON)
176 ## prep options for OSGConfigured.h
178 IF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
179   SET(OSG_DISABLE_DEPRECATED 1)
180 ENDIF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
182 IF(OSG_USE_OSG2_NAMESPACE)
183   ADD_DEFINITIONS(-DOSG_USE_OSG2_NAMESPACE=1)
184 ENDIF()
186 IF(OSG_ENABLE_SSE2)
187   SET(OSG_SIMD_SSE 1)
188 ENDIF(OSG_ENABLE_SSE2)
190 IF(OSG_ENABLE_NEW_OSB_IO)
191   SET(OSG_NEW_OSB_IO 1)
192 ENDIF(OSG_ENABLE_NEW_OSB_IO)
194 IF(OSG_ENABLE_GLDEFINE_MAPPER)
195   SET(OSG_GL_DEFMAPPER 1)
196 ENDIF(OSG_ENABLE_GLDEFINE_MAPPER)
198 IF(OSG_ENABLE_MULTISHADER_VARCHUNK)
199   SET(OSG_MULTISHADER_VARCHUNK 1)
200 ENDIF(OSG_ENABLE_MULTISHADER_VARCHUNK)
202 IF(OSG_ENABLE_OGL_COREONLY)
203   SET(OSG_OGL_COREONLY 1)
204 ENDIF(OSG_ENABLE_OGL_COREONLY)
206 IF(OSG_ENABLE_GL_INCLUDE_GLEW)
207   SET(OSG_GL_INCLUDE_GLEW 1)
208 ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW)
210 IF(OSG_ENABLE_OGL_ES2)
211   SET(OSG_OGL_ES2 1)
212   SET(OSG_OGL_NO_DOUBLE 1)
213 ENDIF(OSG_ENABLE_OGL_ES2)
215 IF(OSG_ENABLE_OGLES_PROTOS)
216   SET(OSG_USE_OGLES_PROTOS 1)
217   SET(GL_GLEXT_PROTOTYPES 1)
218 ENDIF(OSG_ENABLE_OGLES_PROTOS)
220 IF(OSG_ENABLE_OGL3_PROTOS)
221   SET(GL_GLEXT_PROTOTYPES 1)
222   SET(GL3_PROTOTYPES 1)
223   SET(OSG_USE_OGL3_PROTOS 1)
224 ENDIF(OSG_ENABLE_OGL3_PROTOS)
226 IF(OSG_ENABLE_OGL4_PROTOS)
227   SET(GL_GLEXT_PROTOTYPES 1)
228   SET(GL3_PROTOTYPES 1)
229   SET(OSG_USE_OGL3_PROTOS 1)
230   SET(OSG_USE_OGL4_PROTOS 1)
231 ENDIF(OSG_ENABLE_OGL4_PROTOS)
233 IF(OSG_ENABLE_OGL_ES2_SIMGL3)
234   SET(OSG_OGL_ES2_SIMGL3 1)
235 ENDIF(OSG_ENABLE_OGL_ES2_SIMGL3)
237 IF(OSGCOMPAT_ENABLE)
238   SET(OSG_1_COMPAT 1)
239 ENDIF(OSGCOMPAT_ENABLE)
241 IF(NOT OSG_ENABLE_SCANPARSE_REGEN)
242   SET(OSG_PREBUILD_SCANPARSE 1)
243 ENDIF(NOT OSG_ENABLE_SCANPARSE_REGEN)
245 IF(OSG_ENABLE_ELF_LOCALSTORAGE)
246   SET(OSG_PTHREAD_ELF_TLS 1)
247 ENDIF(OSG_ENABLE_ELF_LOCALSTORAGE)
249 IF(OSG_ENABLE_WIN_LOCALSTORAGE)
250   SET(OSG_WIN32_ASPECT_USE_LOCALSTORAGE 1)
251 ENDIF(OSG_ENABLE_WIN_LOCALSTORAGE)
253 IF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
254   SET(OSG_DEPRECATED_PROPS 1)
255 ENDIF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
257 SET(OSG_SHC_MODE_${OSG_SHADER_CACHE_MODE} 1)
259 IF(NOT IOS)
260   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
261   SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
262   SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
263 ENDIF(NOT IOS)
265 INCLUDE(OSGConfigurePackages)
267 LIST(APPEND OSG_ADDITIONAL_CONFIGURE_LINES "")
269 IF(OSGEXCLUDE_TESTS_FROM_ALL)
270   SET(OSGEXCLUDE_TESTS EXCLUDE_FROM_ALL)
271 ELSE()
272   SET(OSGEXCLUDE_TESTS "")
273 ENDIF()
275 IF(OSGEXCLUDE_UNITTESTS_FROM_ALL)
276   SET(OSGEXCLUDE_UNITTESTS EXCLUDE_FROM_ALL)
277 ELSE()
278   SET(OSGEXCLUDE_UNITTESTS "")
279 ENDIF()
281 IF(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL)
282   SET(OSGEXCLUDE_EXAMPLES_SIMPLE EXCLUDE_FROM_ALL)
283 ELSE()
284   SET(OSGEXCLUDE_EXAMPLES_SIMPLE "")
285 ENDIF()
287 IF(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL)
288   SET(OSGEXCLUDE_EXAMPLES_ADVANCED EXCLUDE_FROM_ALL)
289 ELSE()
290   SET(OSGEXCLUDE_EXAMPLES_ADVANCED "")
291 ENDIF()
293 IF(NOT WIN32)
294   IF(OSG_BUILD_DEPENDEND)
295     INCLUDE(${OSG_REFERENCE_DIR}/CMake.global.settings)
296     IF(OSG_DEPENDENT_INCLUDE_BUILD)
297       INCLUDE(${OSG_REFERENCE_DIR}/CMake.build.settings)
298     ENDIF()
299   ENDIF()
300 ENDIF()
302 #####################
303 # External extensions
304 #####################
306 OSG_SET_CACHE(OSG_EXTRA_EXTERNAL_MODULES "" STRING
307               "Extra modules that OpenSG will try to import.")
309 OSG_SET_CACHE(OSG_IGNORE_INSTALL "" STRING
310               "Extra modules that OpenSG will build but not installed.")
312 OSG_SET_CACHE(OSG_EXTERNAL_MODULES_INCLUDE "" FILEPATH 
313               "Include file of extra modules")
315 IF(EXISTS "${OSG_EXTERNAL_MODULES_INCLUDE}")
316   INCLUDE("${OSG_EXTERNAL_MODULES_INCLUDE}")
317 ENDIF()
319 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_MODULES})
320     OPTION(OSGBUILD_${EXTERNAL}
321            "Build using ${EXTERNAL} module" OFF)
323     IF(OSGBUILD_${EXTERNAL})
324         FIND_PATH(OSG_${EXTERNAL}_SOURCE_DIR
325                   CMakeLists.Lib.${EXTERNAL}.txt
326                   ${CMAKE_CURRENT_SOURCE_DIR}/../${EXTERNAL})
328         OSG_ADD_OPT(OSG_${EXTERNAL}_SOURCE_DIR)
330         IF(NOT EXISTS
331                 ${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.Lib.${EXTERNAL}.txt)
333             MESSAGE(SEND_ERROR "Cannot find ${EXTERNAL} sources directory: "
334                                "${OSG_${EXTERNAL}_SOURCE_DIR}")              
335         ELSE()
336             LIST(APPEND OSG_EXTERNAL_CONFIGS "${EXTERNAL}")
338             GET_FILENAME_COMPONENT(_EXT_SRC_DIR
339                                    "${OSG_${EXTERNAL}_SOURCE_DIR}/.."
340                                    REALPATH                         )
342             IF(EXISTS "${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.PackagePrepare.cmake")
343               LIST(APPEND OSG_EXTERNAL_PREPARE "${OSG_${EXTERNAL}_SOURCE_DIR}")
344             ENDIF()
346             IF(EXISTS "${_EXT_SRC_DIR}/CMakeLists.PackagePrepare.cmake")
347               LIST(APPEND OSG_EXTERNAL_PREPARE "${_EXT_SRC_DIR}")
348             ENDIF()
349         ENDIF()
350     ENDIF()
351 ENDFOREACH(EXTERNAL)
353 IF(OSG_EXTERNAL_PREPARE)
354   LIST(REMOVE_DUPLICATES OSG_EXTERNAL_PREPARE)
355 ENDIF()
357 ##############
358 # Compiler
359 ##############
361 SET(OSG_PLATFORM_64 0)
362 SET(OSG_PLATFORM_32 0)
363 SET(OSG_APPLE64     0)
364 SET(OSG_APPLE32     0)
365 SET(OSG_LIBDIR_SUFFIX "")
367 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
368   SET(OSG_PLATFORM_64 1)
369   SET(OSG_LIBDIR_SUFFIX "64")
371   IF(NOT WIN32)
372     SET(OSG_LIBDIR_BASE_SUFFIX "64")
373   ENDIF(NOT WIN32)
375   IF(APPLE)
376     SET(OSG_APPLE64 1)
377   ENDIF(APPLE)
378 ELSE()
379   SET(OSG_PLATFORM_32 1)
381   IF(APPLE)
382     SET(OSG_APPLE32 1)
383   ENDIF(APPLE)
384 ENDIF()
387 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
388     SET(LINUX 1)
389 ENDIF()
391 IF(WIN32)
392   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
393                                 CACHE STRING "OpenSG Build Types" FORCE )
394 ELSE()
395   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
396                                 CACHE STRING "OpenSG Build Types" FORCE )
397 ENDIF(WIN32)
398 IF(APPLE AND IOS)
399   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
400                                 CACHE STRING "OpenSG Build Types" FORCE )
401 ENDIF()
403 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
404   SET(CMAKE_BUILD_TYPE Debug CACHE STRING
405       "Choose the type of build, options are: Debug Release."
406       FORCE)
407 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
409 IF(NOT WIN32) 
410   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"          AND 
411      NOT CMAKE_BUILD_TYPE STREQUAL "DebugGV"        AND
412      NOT CMAKE_BUILD_TYPE STREQUAL "Release"        AND
413      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseGV"      AND
414      NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"   )
416     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
417                         "Please use either Release or Debug")
419   ENDIF()
420 ELSEIF(NOT MSVC_IDE)
422   IF(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
423     SET(CMAKE_BUILD_TYPE DebugOpt CACHE STRING
424         "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}."
425         FORCE)  
426   ENDIF()
428   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"    AND 
429      NOT CMAKE_BUILD_TYPE STREQUAL "DebugOpt" AND
430      NOT CMAKE_BUILD_TYPE STREQUAL "Release"  AND
431      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseNoOpt")
433     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
434                         "Please use on of ${CMAKE_CONFIGURATION_TYPES}")
436   ENDIF()
437 ENDIF()
439 IF(NOT OSG_COMPILER_DEFAULTS)
440    INCLUDE(CMake/OSGSetupCompiler.cmake)
441    SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) 
442 ENDIF(NOT OSG_COMPILER_DEFAULTS)
444 INCLUDE(CMake/OSGUpdateCompiler.cmake)
446 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
447    CMAKE_BUILD_TYPE STREQUAL "DebugGV")
449     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
450     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
452 ENDIF()
454 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
456 OSG_CHECK_INSTALL()
458 ##############################################################################
459 # DEPENDENCIES
460 ##############################################################################
462 # Global include/library dirs, libs and definitions
463 SET(OSG_GLOBAL_DEP_INCDIR "")
464 SET(OSG_SYSTEM_DEP_INCDIR "")
465 SET(OSG_GLOBAL_DEP_LIBDIR "")
466 SET(OSG_GLOBAL_DEP_LIBS   "")
467 SET(OSG_GLOBAL_DEP_DEFS   "")
469 IF(NOT WIN32)
470   SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
471 ENDIF()
473 #IF(WIN32)
474   OSG_OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
475   OSG_OPTION(OSG_USE_STATIC_SUPPORT_LIBS "" OFF)
477   IF(OSG_USE_OSGSUPPORT_LIBS)
478     OSG_SET_CACHE(OSG_SUPPORT_ROOT "" PATH "")
479   ENDIF(OSG_USE_OSGSUPPORT_LIBS)
481   IF(EXISTS "${OSG_SUPPORT_ROOT}" AND
482      EXISTS "${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
484     INCLUDE("${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
486     SET(_OSG_FATAL_DMS_COMBO  FALSE)
487     SET(_OSG_FATAL_ITER_COMBO FALSE)
489     IF( NOT OSG_DISABLE_MICROSOFT_SECURE_CXXX AND     OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
490       SET(_OSG_FATAL_DMS_COMBO TRUE)
491     ENDIF()
493     IF(     OSG_DISABLE_MICROSOFT_SECURE_CXXX AND NOT OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
494       SET(_OSG_FATAL_DMS_COMBO TRUE)
495     ENDIF()
497     IF(_OSG_FATAL_DMS_COMBO)
499       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_SECURE settings:\n"
500                           "  Support : ${OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX}\n"
501                           "  OpenSG  : ${OSG_DISABLE_MICROSOFT_SECURE_CXXX}")
503     ENDIF()
506     IF( NOT OSG_DISABLE_MS_ITERATOR_DEBUGGING AND     OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
507       SET(_OSG_FATAL_ITER_COMBO TRUE)
508     ENDIF()
510     IF(     OSG_DISABLE_MS_ITERATOR_DEBUGGING AND NOT OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
511       SET(_OSG_FATAL_ITER_COMBO TRUE)
512     ENDIF()
514     IF(_OSG_FATAL_ITER_COMBO)
516       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_ITER_DEBUG settings:\n"
517                           "  Support : ${OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING}\n"
518                           "  OpenSG  : ${OSG_DISABLE_MS_ITERATOR_DEBUGGING}")
520     ENDIF()
521   ENDIF()
523 IF(WIN32)
524    SET(OSG_INSTALL_SUBDIR "" CACHE STRING "add subdir to installed libs")
525 ENDIF(WIN32)
527 IF(NOT OSG_BUILD_DEPENDEND)
529     ##########
530     #### boost
531     ##########
533     OSG_CONFIGURE_BOOST()
535     #########
536     #### zlib
537     #########
539     OSG_CONFIGURE_ZLIB()
541 #    MESSAGE(STATUS "zlib: ${ZLIB_FOUND}")
543     IF(UNIX AND NOT OSG_APPLE32)
544         #############
545         #### Freetype
546         #############
548         FIND_PACKAGE(Freetype)
550         IF(FREETYPE_FOUND)
551             OSG_SET(OSG_WITH_FT2 1)
553             FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig)
555             IF(FONTCONFIG_LIBRARY MATCHES "fontconfig")
556                 OSG_SET(OSG_WITH_FONTCONFIG 1)
557             ENDIF()
559         ENDIF(FREETYPE_FOUND)
561         OSG_ADD_OPT(FREETYPE_FOUND)
562         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_freetype2)
563         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_ft2build)
564         OSG_ADD_OPT(FONTCONFIG_LIBRARY)
565         OSG_ADD_OPT(FREETYPE_LIBRARIES)
566     ENDIF(UNIX AND NOT OSG_APPLE32)
568     ##############
569     #### ImageLibs
570     ##############
572     OSG_CONFIGURE_TIFF()
573     OSG_CONFIGURE_PNG()
574     OSG_CONFIGURE_JPEG()
575     OSG_CONFIGURE_GDAL()
576     OSG_CONFIGURE_OPENEXR()
578     SET(OSG_EXTERNAL_IMAGELIBS)
579     SET(OSG_EXTERNAL_IMAGEINCS)
581 #    MESSAGE(STATUS "tiff: ${TIFF_FOUND} - png ${PNG_FOUND} - jpg: ${JPEG_FOUND} - exr ${OPENEXR_FOUND}")
583     IF(TIFF_FOUND)
584         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
585         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
586         OSG_SET(OSG_WITH_TIF 1)
587         OSG_ADD_OPT(TIFF_LIBRARIES)
588     ENDIF(TIFF_FOUND)
590     IF(PNG_FOUND)
591         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
592         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
593         OSG_SET(OSG_WITH_PNG 1)
594         OSG_ADD_OPT(PNG_INCLUDE_DIR)
595         OSG_ADD_OPT(PNG_LIBRARIES)
596     ENDIF(PNG_FOUND)
598     IF(JPEG_FOUND)
599         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
600         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
601         OSG_SET(OSG_WITH_JPG 1)
602         OSG_ADD_OPT(JPEG_LIBRARIES)
603     ENDIF(JPEG_FOUND)
605     IF(GDAL_FOUND)
606         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
607         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
608         OSG_SET(OSG_WITH_GDAL 1)
609         OSG_ADD_OPT(GDAL_LIBRARIES)
610     ENDIF(GDAL_FOUND)
612     IF(OPENEXR_FOUND)
613         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
614         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
615         OSG_SET(OSG_WITH_IMF 1)
617         OSG_ADD_OPT(OPENEXR_LIBRARIES)
618         OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
619     ENDIF(OPENEXR_FOUND)
622     OSG_ADD_OPT(OSG_EXTERNAL_IMAGELIBS)
623     OSG_ADD_OPT(OSG_EXTERNAL_IMAGEINCS)
625     #############
626     #### Collada
627     #############
629     #FIND_PACKAGE(Collada)
631     OSG_CONFIGURE_COLLADA()
633     IF(COLLADA_FOUND)
635       OSG_SET(OSG_WITH_COLLADA 1)
637       IF(NOT WIN32)
638         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
639            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
641             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
643         ELSE()
645             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
647         ENDIF()
648       ENDIF(NOT WIN32)
650       OSG_ADD_OPT(COLLADA_DAE_INCLUDE_DIR)
651       OSG_ADD_OPT(COLLADA_DOM_INCLUDE_DIR)
653       IF(WIN32 OR COLLADA_TARGET_FOUND)
654         SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
655       ENDIF(WIN32 OR COLLADA_TARGET_FOUND)
657     ELSE(COLLADA_FOUND)
659       SET(OSG_COLLADA_LIBS "")
661     ENDIF(COLLADA_FOUND)
663     OSG_ADD_OPT(COLLADA_FOUND)
665     #############
666     #### GLUT
667     #############
669     OSG_CONFIGURE_GLUT()
671     IF(GLUT_FOUND)
672       OSG_SET(OSG_WITH_GLUT 1)
673       OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
674       OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
675     ELSE(GLUT_FOUND)
676       OSG_SET(OSG_WITH_GLUT 0)
677       OSG_SET(OSG_GLUT_INC_DIR "")
678       OSG_SET(OSG_GLUT_LIBS "")
679     ENDIF(GLUT_FOUND)
681     #############
682     #### QT
683     #############
685     OSG_CONFIGURE_QT()
687     #############
688     #### OpenGL
689     #############
691     IF(APPLE AND IOS)
692       FIND_PACKAGE(OpenGLES REQUIRED)
694       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
695       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
696     ELSE()
697       FIND_PACKAGE(OpenGL REQUIRED)
699       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
700       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
701     ENDIF()
703     IF(OSG_USE_OGL3_PROTOS OR OSG_USE_OGL4_PROTOS)
704       SET(OSG_OGL_INCDIRS ${CMAKE_SOURCE_DIR}/Source/External/OpenGL)
705       LIST(APPEND OSG_GLOBAL_DEP_INCDIR OSG_OGL_INCDIRS)
707       ADD_DEFINITIONS(-DOSG_USE_GL3_INCLUDES=1)
708     ENDIF()
710     #############
711     #### X11
712     #############
714     FIND_PACKAGE(X11)
716     IF(X11_FOUND)
717         OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
718         OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
719     ENDIF(X11_FOUND)
721     OSG_ADD_OPT(X11_FOUND)
723     #############
724     #### VTK
725     #############
727     IF(OSG_ENABLE_VTK)
728       IF(OSG_USE_OSG_VTK_SETUP)
729         OSG_CONFIGURE_VTK()
730       ELSE(OSG_USE_OSG_VTK_SETUP)
731         FIND_PACKAGE(VTK NO_MODULE)
733         IF(VTK_FOUND)
734           OSG_SET(OSG_WITH_VTK 1)
736           INCLUDE(${VTK_USE_FILE})
737           OSG_SET(OSG_VTK_LIBS "${VTK_LIBRARIES}")
739           OSG_ADD_OPT(OSG_VTK_LIBS)
740           OSG_ADD_OPT(VTK_LIBRARY_DIRS)
741           OSG_ADD_OPT(VTK_INCLUDE_DIRS)
742           OSG_ADD_OPT(VTK_DIR)
743         ENDIF(VTK_FOUND)
744       ENDIF(OSG_USE_OSG_VTK_SETUP)
746       OSG_ADD_OPT(VTK_FOUND)
747     ENDIF()
749     ##############
750     #### GLEW
751     ##############
753     IF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
754       OSG_CONFIGURE_GLEW()
756       IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
757         LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
758       ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
760     ENDIF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
762     ##############
763     #### Mini
764     ##############
766     OSG_CONFIGURE_LIBMINI()
768     OSG_ADD_OPT(OSG_LIBMINI_FOUND)
769     OSG_ADD_OPT(OSG_LIBMINI_INCLUDE_DIR)
770     OSG_ADD_OPT(OSG_LIBMINI_LIBRARIES)
772     ###############
773     #### OpenNurbs
774     ###############
776     OSG_CONFIGURE_OPENNURBS()
778     OSG_ADD_OPT(OPENNURBS_FOUND)
779     OSG_ADD_OPT(OPENNURBS_INCLUDE_DIR)
780     OSG_ADD_OPT(OPENNURBS_LIBRARIES)
782     #################
783     #### AntTweakBar
784     #################
786     OSG_CONFIGURE_ANTTWEAKBAR()
788     OSG_ADD_OPT(OSG_ANTTWEAKBAR_FOUND)
789     OSG_ADD_OPT(OSG_ANTTWEAKBAR_INCLUDE_DIR)
790     OSG_ADD_OPT(OSG_ANTTWEAKBAR_LIBRARIES)
792     #############
793     #### Python
794     #############
796     FIND_PACKAGE(PythonInterp)
797     FIND_PACKAGE(PythonLibs)
799     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
800     OSG_ADD_OPT(PYTHON_LIBRARY)
801     OSG_ADD_OPT(PYTHONLIBS_FOUND)
803     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
805       FIND_PACKAGE(Boost COMPONENTS python)
807       IF(Boost_FOUND AND WIN32)
809         SET(OSG_BOOST_PYTHON_TARGETS )
810         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
811         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
812       
813       ELSE(Boost_FOUND AND WIN32)
815         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
816            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
818           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
820         ELSE()
821           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
822         ENDIF()
824       ENDIF(Boost_FOUND AND WIN32)
826       # We ignore if boost python fails, we catch that somewhere else
827       # so if we get here Boost_FOUND was true in the first place
828       SET(Boost_FOUND TRUE)
830       FIND_PACKAGE(GCCXML)
832       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
833       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
834       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
836     ENDIF()
839     ###############
840     #### Flex/Bison
841     ###############
843     FIND_PROGRAM(FLEX_EXE flex)
844     FIND_PROGRAM(BISON_EXE bison)
846     OSG_ADD_OPT(FLEX_EXE)
847     OSG_ADD_OPT(BISON_EXE)
849     ##############
850     #### NVPerfSDK
851     ##############
853 #    OSG_FIND_PACKAGE(NVidiaPerfSDK)
855 #    IF(NVIDIAPERFSDK_FOUND)
856 #        OSG_SET(OSG_WITH_NVPERFSDK 1)
857 #        OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
858 #        OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
859 #    ELSE(NVIDIAPERFSDK_FOUND)
860 #        OSG_SET(OSG_WITH_NVPERFSDK 0)
861 #        OSG_SET(OSG_NVPERFSDK_INC_DIR "")
862 #        OSG_SET(OSG_NVPERFSDK_LIBS "")
863 #    ENDIF(NVIDIAPERFSDK_FOUND)
866     #############
867     #### Support
868     #############
870     IF(UNIX)
871         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
872         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
873         FIND_LIBRARY(OSG_RT_LIB     NAMES rt)
875         OSG_ADD_OPT(OSG_THREAD_LIB)
876         OSG_ADD_OPT(OSG_DL_LIB)
877         OSG_ADD_OPT(OSG_RT_LIB)
878     ENDIF(UNIX)
880     IF(APPLE)
881         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
882         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
883         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
884         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
886         OSG_ADD_OPT(OSG_APPLICATIONSERVICES_FRAMEWORK)
887         OSG_ADD_OPT(OSG_CORESERVICES_FRAMEWORK)
888         OSG_ADD_OPT(OSG_CARBON_FRAMEWORK)
889         OSG_ADD_OPT(OSG_COCOA_FRAMEWORK)
890     ENDIF(APPLE)
892     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
894 ENDIF(NOT OSG_BUILD_DEPENDEND)
896 MESSAGE("")
898 SET(CFG_NAME OSG)
899 FOREACH(EXTERNAL_PREPARE ${OSG_EXTERNAL_PREPARE})
900   INCLUDE("${EXTERNAL_PREPARE}/CMakeLists.PackagePrepare.cmake")
901 ENDFOREACH()
903 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
904   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
905     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
906   ENDIF(EXISTS
907   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
908 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
911 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
912   INCLUDE(${OSG_GLOBAL_PREP})
913 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
915 IF(APPLE AND OSG_COCOA_FRAMEWORK)
916     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
917 ELSEIF(WIN32)
918     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
919 ELSEIF(UNIX AND X11_FOUND)
920     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
921 ELSEIF(APPLE AND IOS)
922     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
923 ELSE()
924     OSG_SET(OSG_NATIVE_WINDOW "")
925 ENDIF()
927 ###############
928 #### Doxygen
929 ###############
931 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
932   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
933                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
934 ENDIF()
936 FIND_PACKAGE(Doxygen)
938 ##############################################################################
939 # Overrides if dependend
940 ##############################################################################
942 IF(NOT WIN32)
943     IF(OSG_BUILD_DEPENDEND)
944         MESSAGE(STATUS "Load reference settings")
945         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
946         # Needed to get the correct vtk/boost settings
947         FIND_PACKAGE(VTK)
948         OSG_BOOST_DEP_SETUP()
949         OSG_CONFIGURE_QT()
951         IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
952           LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
953         ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
955     ELSE(OSG_BUILD_DEPENDEND)
956 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
957     ENDIF(OSG_BUILD_DEPENDEND)
958 ENDIF(NOT WIN32)
960 ##############################################################################
961 # MAIN BUILD STEPS
962 ##############################################################################
964 # when adding passes, make sure to add a corresponding pass directory variable
965 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
966 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
968 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
969 SET(OSG_PASSDIR_OSGSETUP   "Build")
971 OSG_COMMON_TARGETS()
973 ###############
974 # Clean
975 ###############
977 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
979 IF(OSG_OLD_BUILD_FILES)
980     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
981 ENDIF(OSG_OLD_BUILD_FILES)
983 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
985 IF(OSG_OLD_CONFIG_FILES)
986     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
987 ENDIF(OSG_OLD_CONFIG_FILES)
989 ###############
990 # Tests
991 ###############
993 # optional pass for test programs
994 IF(OSGBUILD_TESTS)
995     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
996     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
997 ENDIF(OSGBUILD_TESTS)
999 ###############
1000 # UnitTests
1001 ###############
1003 IF(OSGBUILD_UNITTESTS)
1004     ENABLE_TESTING()
1005     INCLUDE(CTest)
1007     # optional pass for unittest programs
1008     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
1009     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
1011     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
1012                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
1014     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
1015     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
1016     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
1018     ADD_CUSTOM_TARGET(OSGAllUnitTests)
1019     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
1020 ENDIF(OSGBUILD_UNITTESTS)
1022 ###############
1023 # Python
1024 ###############
1026 INCLUDE(OSGSetupPython)
1027 SETUP_PYTHON_BUILD()
1029 #################
1030 # Documentation I
1031 #################
1032 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1033 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1035 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1036     ADD_CUSTOM_TARGET(Doc)
1037 ENDIF()
1039 IF(DOXYGEN_EXECUTABLE)
1040     SET(DOXYGEN_VERSION)
1041     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1042                     OUTPUT_VARIABLE DOXYGEN_VERSION
1043                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1044     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1045         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1046                         "when building OpenSG documentation. "
1047                         "Please use a different version, sorry for the inconvenience.")
1048     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1049 ENDIF(DOXYGEN_EXECUTABLE)
1051 IF(NOT OSG_DOXY_INPUTS)
1052     # add a pass for doxygen to run
1053     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1054     SET(OSG_PASSDIR_OSGDOXYDOC "Doc/build")
1055 ELSE()
1056     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC_EXT")
1057     SET(OSG_PASSDIR_OSGDOXYDOC_EXT "DocExt/build")
1058 ENDIF(NOT OSG_DOXY_INPUTS)
1060 # set up variables for the config file
1061 IF(DOXYGEN_DOT_EXECUTABLE)
1062     SET(OSG_DOXY_HAVE_DOT "YES")
1063 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1065 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1066 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1067 SET(OSG_GENDOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/GenDoc/opensg-doxy")
1069 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1071 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1072     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1073     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1074     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1075     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1076     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1077     SET(OSG_DOXY_SEARCHENGINE "NO")
1079 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1080     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1081     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1082     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1083     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1084     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1085     SET(OSG_DOXY_SEARCHENGINE "NO")
1087 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1088     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1089     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1090     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1091     SET(OSG_DOXY_HAVE_DOT "NO")
1092     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1093     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1094     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1095     SET(OSG_DOXY_SEARCHENGINE "NO")
1097 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1099 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1100   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1101 ELSE()
1102   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1103 ENDIF()
1105 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1107 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1108 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1110 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1111   SET(OSG_DOC_SECTION "all_in_one")
1112   SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
1113 ELSE()
1114   SET(OSG_DOC_SECTION "separate")
1115 ENDIF()
1117 # write doxygen config file
1118 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1119                "${OSG_DOXY_CONFIGURATION_FILE}")
1122 # write general doc config file
1124 SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/GenDoc")
1125 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "")
1126 #SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS=${CMAKE_BINARY_DIR}/Doc/html/Full/html")
1128 SET(OSG_DOC_SECTION "${OSG_DOC_SECTION} include_general_doc")
1130 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1131                "${OSG_GENDOXY_CONFIGURATION_FILE}")
1133 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1135 # find/process documentation include files
1136 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1138 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1140   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1142   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1143                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1145 ENDFOREACH()
1147 IF(OSG_DOXY_INPUTS)
1148     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1149                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1150 ENDIF(OSG_DOXY_INPUTS)
1153 IF(DOXYGEN_EXECUTABLE)
1154   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1155   ADD_DEPENDENCIES(DocUpload Doc)
1158   ADD_CUSTOM_TARGET(DocSyncGV
1159                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1160                     WORKING_DIRECTORY Doc)
1162   ADD_CUSTOM_TARGET(DocCompleteGV)
1163   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1164 ENDIF(DOXYGEN_EXECUTABLE)
1166 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1168 ###############
1169 # PrePasses
1170 ###############
1172 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1173   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1174     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1175   ENDIF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1176 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1178 ###############
1179 # Passes
1180 ###############
1182 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1183   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1185   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1186        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1188   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1189     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1190     INCLUDE(${_OSGCORE_EXT_FILE})
1191   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1194 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1196 # Find files describing libraries to build, but make sure base
1197 # and system are processed first
1198 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1199      "Source/CMakeLists.Lib.OSGBase.txt")
1201 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1202      "Source/CMakeLists.Lib.OSGSystem.txt")
1204 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1205      "Source/*CMakeLists.Lib.*.txt")
1207 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1208 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1210 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1211 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1213 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1214   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1216   IF(_OSG_FOUND_CONTRIB_CONFIG)
1217     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1218   ELSE()
1219     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1220   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1221 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1223 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1225 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1227   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1228                          ${_OSG_LIBRARY_CONFIG}
1229                           PATH)
1231   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1232                          ${_OSG_LIBRARY_CONFIG}
1233                           NAME)
1235   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1236                      ${_OSG_LIBCONFIG_BASENAME})
1238   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1239                          ${_OSG_LIBCONFIG_BASENAME_1}
1240                          NAME_WE)
1242   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1243     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1244   ENDIF()
1246 ENDFOREACH()
1248 OSG_COMMON_CUDA()
1250 # run build passes
1251 FOREACH(PASS ${OSG_CMAKE_PASSES})
1252     SET(OSG_CMAKE_PASS ${PASS})
1254     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1256     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1257         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1258         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1259         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1260         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1262         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1264         IF(_OSG_IS_CONTRIBLIB)
1265           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1266         ELSE()
1267           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1268         ENDIF()
1270         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1271     ENDFOREACH(LIBCONFIGFILE)
1273     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1275     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1276         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1277                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1278     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1280 ENDFOREACH()
1282 IF(NOT WIN32)
1283   IF(NOT OSG_BUILD_DEPENDEND)
1284     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1285   ENDIF(NOT OSG_BUILD_DEPENDEND)
1286 ENDIF(NOT WIN32)
1288 ###############
1289 # OSGConfigured
1290 ###############
1293 EXECUTE_PROCESS(
1294     COMMAND "${CMAKE_COMMAND}" -E copy
1295                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1296                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1298 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1299   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1300 ENDFOREACH()
1302 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1304 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1305                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1307 EXECUTE_PROCESS(
1308     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1309                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1310                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1312 #################
1313 # Examples/Simple
1314 #################
1316 ADD_CUSTOM_TARGET(OSGAllExamples)
1317 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1319 IF(OSGBUILD_EXAMPLES_SIMPLE)
1320     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1321     ADD_SUBDIRECTORY("Examples/Simple")
1322     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1323 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1325 ###################
1326 # Examples/Advanced
1327 ###################
1329 IF(OSGBUILD_EXAMPLES_ADVANCED)
1330     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1331     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1332     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1333     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1334 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1336 ###################
1337 # Examples/Advanced
1338 ###################
1340 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1341     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1342     ADD_SUBDIRECTORY("Examples/Tutorial")
1343     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1344 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1346 ###################
1347 # External Examples
1348 ###################
1350 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1351   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1353   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1354     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1355     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1356   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1357 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1359 ##################
1360 # Documentation II
1361 ##################
1363 SET(OSG_DOC_PIPES "")
1365 IF(OSG_DOXY_STDOUT_LOG)
1366     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1367 ENDIF(OSG_DOXY_STDOUT_LOG)
1369 IF(DOXYGEN_EXECUTABLE)
1370     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1371         ADD_CUSTOM_TARGET(Doc
1372             VERBATIM
1373             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1374     ENDIF()
1375 ENDIF()
1377 IF(DOXYGEN_EXECUTABLE)
1378   ADD_CUSTOM_TARGET(GenDoc
1379                     VERBATIM
1380                     COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_GENDOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1381 ENDIF()
1383 ##################
1384 # Documentation II
1385 ##################
1387 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1388   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1389     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1390   ENDIF()
1391 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1393 ##################
1394 # osg2-config
1395 ##################
1397 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1398 # is generated during the OSGCOLLECT pass.
1400 # substitute variables in static parts
1401 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1402                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1403 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1404                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1406 # read in all parts
1407 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1408 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1409 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1411 # concatenate final file
1412 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1413 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1414 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1416 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1417 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1418 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1420 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1421         DESTINATION bin)
1422 #        COMPONENT development_tools)
1424 ##################
1425 # cmake modules
1426 ##################
1428 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cmake)
1430 STRING(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_UP)
1432 STRING(REPLACE "OpenSG" "OSG" CMAKE_PROJECT_NAME_SHORT ${CMAKE_PROJECT_NAME})
1434 STRING(TOUPPER "OpenSG" ${CMAKE_PROJECT_NAME_SHORT} ${CMAKE_PROJECT_NAME_SHORT_UP})
1436 CONFIGURE_FILE(CMake/FindOpenSG.cmake.in
1437                ${CMAKE_BINARY_DIR}/cmake/Find${CMAKE_PROJECT_NAME}.cmake
1438                @ONLY                                                   )
1440 INSTALL(FILES "${CMAKE_BINARY_DIR}/cmake/FindOpenSG.cmake"
1441         DESTINATION share/OpenSG/cmake)
1442 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake.in"
1443         DESTINATION share/OpenSG/cmake)
1444 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1445         DESTINATION share/OpenSG/cmake)
1446 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1447         DESTINATION share/OpenSG/cmake)
1448 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindExpat_OpenSG.cmake"
1449         DESTINATION share/OpenSG/cmake)
1450 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1451         DESTINATION share/OpenSG/cmake)
1452 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1453         DESTINATION share/OpenSG/cmake)
1454 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLEW_OpenSG.cmake"
1455         DESTINATION share/OpenSG/cmake)
1456 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1457         DESTINATION share/OpenSG/cmake)
1458 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1459         DESTINATION share/OpenSG/cmake)
1460 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1461         DESTINATION share/OpenSG/cmake)
1462 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGSetupCompiler.cmake"
1463         DESTINATION share/OpenSG/cmake)
1464 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGUpdateCompiler.cmake"
1465         DESTINATION share/OpenSG/cmake)
1466 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGBuildFunctions.cmake"
1467         DESTINATION share/OpenSG/cmake)
1468 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGConfigurePackages.cmake"
1469         DESTINATION share/OpenSG/cmake)
1470 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGExternalProjectHelper.cmake"
1471         DESTINATION share/OpenSG/cmake)
1472 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1473         DESTINATION share/OpenSG/cmake)
1474 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1475         DESTINATION share/OpenSG/cmake)
1476 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonOptions.cmake"
1477         DESTINATION share/OpenSG/cmake)
1478 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonConfig.cmake"
1479         DESTINATION share/OpenSG/cmake)
1480 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonSupportConfig.cmake"
1481         DESTINATION share/OpenSG/cmake)
1483 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1484         DESTINATION bin
1485 #        COMPONENT development_tools
1486         PATTERN "*/fcd2code/fcd2code" EXCLUDE
1487         PATTERN "*.pyc" EXCLUDE
1488         PATTERN ".svn"  EXCLUDE)
1489 INSTALL(PROGRAMS "${CMAKE_SOURCE_DIR}/Tools/fcd2code/fcd2code"
1490         DESTINATION bin/fcd2code)
1492 ##################
1493 # Global Python
1494 ##################
1496 IF(OSGBUILD_PYTHON_BINDINGS)
1497   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1498                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1499                   OUTPUT_VARIABLE _OSG_LIBORDER)
1502                  
1503   SET(_OSG_PY_MODNAME_LIST "osg2ModuleNameList = [\n")
1504   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1506   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1507     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1508     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1509     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1510     SET(_OSG_PY_MODNAME_LIST "${_OSG_PY_MODNAME_LIST}  \"${_OSG_LIB}\",\n")
1511   ENDFOREACH()
1513   SET(OSG_PYTHON_ALL_IMPORTS "${_OSG_PY_MODNAME_LIST}  ]\n\n${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1515   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1516   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1519   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1520                  "${_OSG_GEN_INIT_FILE_OUT}")
1522   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1523                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1525   IF(WIN32) 
1527     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1528     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1529     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1530     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1532     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1533             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1534             CONFIGURATIONS Release)
1535 #            COMPONENT      release_runtimes)
1537     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1538             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/osg
1539             CONFIGURATIONS Debug)
1540 #            COMPONENT      debug_runtimes)
1542     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1543             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/osg
1544             CONFIGURATIONS DebugOpt)
1545 #            COMPONENT      debug_opt_runtimes)
1547     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1548             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/osg
1549             CONFIGURATIONS ReleaseNoOpt)
1550 #            COMPONENT      release_no_opt_runtimes)
1553     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1554             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1555             CONFIGURATIONS Release)
1556 #            COMPONENT      release_runtimes)
1558     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1559                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1560                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1561                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1562             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1563             CONFIGURATIONS Release)
1564 #            COMPONENT      release_runtimes)
1567     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1568             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1569             CONFIGURATIONS Debug)
1570 #            COMPONENT      debug_runtimes)
1572     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1573                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1574                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1575                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1576             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1577             CONFIGURATIONS Debug)
1578 #            COMPONENT      debug_runtimes)
1581     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1582             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1583             CONFIGURATIONS DebugOpt)
1584 #            COMPONENT      debug_opt_runtimes)
1586     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1587                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1588                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1589                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1590             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1591             CONFIGURATIONS DebugOpt)
1592 #            COMPONENT      debug_opt_runtimes)
1595     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1596             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1597             CONFIGURATIONS ReleaseNoOpt)
1598 #            COMPONENT      release_no_opt_runtimes)
1600     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1601                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1602                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1603                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1604             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1605             CONFIGURATIONS ReleaseNoOpt)
1606 #            COMPONENT      release_no_opt_runtimes)
1608   ELSE(WIN32)   
1610     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1611     SET(_OSG_PY_INST_BASE 
1612         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1614     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1615             DESTINATION ${_OSG_PY_INST_BASE}/osg)
1616 #            COMPONENT   libraries)
1618     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1619             DESTINATION ${_OSG_PY_INST_BASE})
1620 #            COMPONENT   libraries)
1622     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1623                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1624                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1625                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1626             DESTINATION ${_OSG_PY_INST_BASE}/helpers)
1627 #            COMPONENT   libraries)
1629   ENDIF(WIN32)
1631 ENDIF()
1633 INSTALL_PYTHON_ELEMENTS()
1635 ##################
1636 # Documentation
1637 ##################
1639 IF(DOXYGEN_EXECUTABLE)
1640     IF(OSG_INSTALL_DOXYDOC)
1641         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1642                 DESTINATION share/OpenSG/documentation)
1643 #                COMPONENT documentation)
1644     ENDIF()
1645 ENDIF()
1647 ##################
1648 # Images/Icons
1649 ##################
1651 ##################
1652 # CSM Example
1653 ##################
1655 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
1656         DESTINATION share/OpenSG/Examples/)
1657 #        COMPONENT examples_basic)
1659 ##################
1660 # Packaging
1661 ##################
1663 #IF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1665 #    SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
1667 #    SET(CPACK_PACKAGE_NAME                "OpenSG")
1668 #    SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
1669 #    SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
1670 #    SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
1671 #    SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
1672 #    SET(CPACK_PACKAGE_VENDOR              "OpenSG")
1673 #    SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
1674 #    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
1675 #    SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
1676 #    SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
1678 #    if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
1679 #        set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
1680 #        set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
1681 #    endif ()
1683 #    if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
1684 #        set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
1685 #    endif()
1687 #    #Define Components
1688 #    SET(CPACK_COMPONENTS_ALL development_tools
1689 #        development_configuration
1690 #        code_headers
1691 #        libraries
1692 #        debug_program_db
1693 #        release_program_db
1694 #        debug_libraries
1695 #        release_libraries
1696 #        debug_runtimes
1697 #        release_runtimes
1698 #        data_images
1699 #        examples_basic
1700 #        examples_advanced
1701 #        Unspecified
1702 #        )
1705 #    #Components
1706 #    #Runtime
1707 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
1709 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
1710 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
1711 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
1712 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1714 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
1715 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
1716 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
1717 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1719 #    #Development
1720 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
1722 #    #Libraries
1723 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
1724 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
1725 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
1726 #    set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
1728 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
1729 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
1730 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
1731 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
1733 #    #Program database
1734 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
1735 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
1736 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
1737 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
1739 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
1740 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
1741 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
1742 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
1744 #    #Tools
1745 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
1746 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
1747 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
1748 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
1750 #    #Configuration
1751 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
1752 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
1753 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
1754 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
1756 #    #Headers
1757 #    SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
1758 #    SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
1759 #    SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
1760 #    SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
1762 #    #Examples
1763 #    SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
1765 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
1766 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
1767 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
1768 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
1770 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
1771 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
1772 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
1773 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
1775 #    #Shared Data
1776 #    SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
1778 #    SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
1779 #    SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
1780 #    SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
1781 #    SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
1783 #    #Documentation
1784 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
1786 #    #Dependencies
1787 #    #Boost
1788 #    #Base
1790 #    #NSIS specific configuration
1791 #    IF(WIN32)
1792 #        INCLUDE(InstallRequiredSystemLibraries)
1793 #        IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
1794 #            IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
1795 #                         ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
1796 #                 include(CMakeDetermineVSServicePack)
1797 #                 DetermineVSServicePack( my_service_pack )
1799 #                 IF( my_service_pack )
1800 #                     SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
1801 #                 ENDIF()
1802 #            ENDIF()
1804 #            #Extra install commands
1805 #            SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
1806 #            SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
1809 #            SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1810 #            SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1811 #            FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
1812 #            SET(CPACK_NSIS_MODIFY_PATH         ON)
1813 #            SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
1814 #            SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
1815 #            SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
1816 #            SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
1817 #            SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
1818 #            SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
1819 #            SET(CPACK_NSIS_MENU_LINKS          "")
1820 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
1821 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
1822 #        ENDIF()
1823 #    ENDIF()
1826 #    # Date macro by Benoit RAT (www.neub.co.nr)
1827 #    MACRO (TODAY RESULT)
1828 #        IF (WIN32)
1829 #            EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
1830 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1831 #        ELSEIF(UNIX)
1832 #            EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
1833 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1834 #        ELSE (WIN32)
1835 #            MESSAGE(SEND_ERROR "date not implemented")
1836 #            SET(${RESULT} 000000)
1837 #        ENDIF (WIN32)
1838 #    ENDMACRO (TODAY)
1840 #    TODAY(DATE)
1842 #    # Determine package type
1843 #    IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1844 #        IF(WIN32)
1845 #            SET(OSGBUILD_PACKAGE_TYPE "ZIP")
1846 #        ELSE(WIN32)
1847 #            SET(OSGBUILD_PACKAGE_TYPE "RPM")
1848 #        ENDIF(WIN32)
1849 #    ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1851 #    STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
1853 #    IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
1854 #        SET( PACK_EXT "tar.bz2" )
1855 #    ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
1856 #        SET( PACK_EXT "tar.gz" )
1857 #    ELSE()
1858 #        STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
1859 #    ENDIF()
1861 #    SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
1862 #    SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
1864 #    INCLUDE(CPack)
1867 #    # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
1868 #    IF(WIN32)
1869 #        #TODO: Need a way to do this on Windows
1870 #        #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 )
1871 #        #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1872 #    ELSE(WIN32)
1873 #        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 )
1874 #        ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1875 #    ENDIF(WIN32)
1878 #ENDIF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1880 IF(NOT WIN32)
1881   CONFIGURE_FILE(CMake/CMakeLists.packaging.unix.txt 
1882                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1883                  @ONLY                                      )
1884 ELSE()
1886   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
1887     SET(OSG_WIN_SEC "nosec")
1888   ELSE()
1889     SET(OSG_WIN_SEC "msdefault")
1890   ENDIF()
1892   CONFIGURE_FILE(CMake/CMakeLists.packaging.win.txt 
1893                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1894                  @ONLY                                      )
1895   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico"
1896           DESTINATION share/OpenSG/Packaging
1897 #          COMPONENT packaging
1898           PERMISSIONS OWNER_WRITE OWNER_READ
1899                       GROUP_READ
1900                       WORLD_READ            )
1902   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp"
1903           DESTINATION share/OpenSG/Packaging
1904 #          COMPONENT packaging
1905           PERMISSIONS OWNER_WRITE OWNER_READ
1906                       GROUP_READ
1907                       WORLD_READ            )
1908 ENDIF()
1910 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1911         DESTINATION share/OpenSG/Packaging
1912 #        COMPONENT packaging
1913         PERMISSIONS OWNER_WRITE OWNER_READ
1914                     GROUP_READ
1915                     WORLD_READ
1916         RENAME CMakeLists.txt)
1918 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
1919         DESTINATION share/doc/OpenSG/
1920 #        COMPONENT doc
1921         PERMISSIONS OWNER_WRITE OWNER_READ
1922                     GROUP_READ
1923                     WORLD_READ)
1925 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/PLY/README
1926         DESTINATION share/doc/OpenSG/
1927 #        COMPONENT doc
1928         PERMISSIONS OWNER_WRITE OWNER_READ
1929                     GROUP_READ
1930                     WORLD_READ
1931         RENAME README.ply)
1933 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/TrapezoidalShadowMaps/README
1934         DESTINATION share/doc/OpenSG/
1935 #        COMPONENT doc
1936         PERMISSIONS OWNER_WRITE OWNER_READ
1937                     GROUP_READ
1938                     WORLD_READ
1939         RENAME README.tsm)
1941 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README
1942         DESTINATION share/doc/OpenSG/
1943 #        COMPONENT doc
1944         PERMISSIONS OWNER_WRITE OWNER_READ
1945                     GROUP_READ
1946                     WORLD_READ
1947         RENAME README.rhine)
1949 IF(WIN32)
1950   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
1951                                 CACHE STRING "OpenSG Build Types" FORCE )
1952 ELSE()
1953   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
1954                                 CACHE STRING "OpenSG Build Types" FORCE )
1955 ENDIF(WIN32)
1956 IF(APPLE AND IOS)
1957   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
1958                                 CACHE STRING "OpenSG Build Types" FORCE )
1959 ENDIF()
1961 IF(WIN32)
1962   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1963        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
1965   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1966        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
1968 ENDIF(WIN32)
1970 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1971      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
1973 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1974      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
1976 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1977      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
1979 ###########################
1980 # Component install Setting
1981 ###########################
1983 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
1985 IF(NOT WIN32)
1986   ADD_CUSTOM_TARGET(OSG_preinstall
1987                     make preinstall
1988                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
1989 ELSE()
1990 ENDIF()
1992 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
1994   IF(NOT WIN32)
1995     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
1996                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
1997                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
1998   ELSE()
2000     SET(_OSG_CMP_CONF Release)
2002     IF(${_OSG_CMP} MATCHES ^debug_)
2003       SET(_OSG_CMP_CONF Debug)
2004     ENDIF()
2006     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2007                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
2008                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2010     SET_PROPERTY(TARGET INSTALL_${_OSG_CMP} PROPERTY FOLDER "Packaging")
2011   ENDIF()
2013   IF(NOT WIN32)
2014     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
2015   ELSE()
2016   ENDIF()
2017 ENDFOREACH()
2020 IF(WIN32)
2022   ADD_CUSTOM_TARGET(INSTALL_runtime)
2024   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_runtimes)
2025   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_binaries)
2027   SET_PROPERTY(TARGET INSTALL_runtime PROPERTY FOLDER "Packaging")
2029 ELSE()
2031   ADD_CUSTOM_TARGET(INSTALL_runtime)
2033   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
2034   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_binaries)
2035 ENDIF()
2037 #IF(WIN32)
2038 #  SET_PROPERTY(TARGET ALL_BUILD PROPERTY FOLDER "CMakePredefinedTargets")
2039 #ENDIF()
2041 ################
2042 # Build Setting
2043 ################
2045 IF(NOT WIN32)
2046   IF(NOT OSG_BUILD_DEPENDEND)
2047     OSG_WRITE_OSGBUILD(${CMAKE_BINARY_DIR}/CMake.build.settings)
2048     OSG_WRITE_OSGGLOBALSETUP(${CMAKE_BINARY_DIR}/CMake.global.settings)
2049   ENDIF(NOT OSG_BUILD_DEPENDEND)
2050 ENDIF(NOT WIN32)
2052 IF(OSG_WITH_CUDA)
2053   CUDA_BUILD_CLEAN_TARGET()
2054 ENDIF(OSG_WITH_CUDA)
2057 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2059 FOREACH(_variableName ${_variableNames})
2060   IF(_variableName MATCHES "^OSG")
2061 #    MESSAGE("FOO : ${_variableName}")
2062 #    FILE(APPEND ${FILENAME}
2063 #         "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2064   ENDIF()
2065 ENDFOREACH()