fixed: linux compiler warnings/errors
[opensg.git] / CMakeLists.txt
blob7159ec8730ee62ab0c79872d24ae207c4fbba58f
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     #### Python
784     #############
786     FIND_PACKAGE(PythonInterp)
787     FIND_PACKAGE(PythonLibs)
789     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
790     OSG_ADD_OPT(PYTHON_LIBRARY)
791     OSG_ADD_OPT(PYTHONLIBS_FOUND)
793     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
795       FIND_PACKAGE(Boost COMPONENTS python)
797       IF(Boost_FOUND AND WIN32)
799         SET(OSG_BOOST_PYTHON_TARGETS )
800         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
801         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
802       
803       ELSE(Boost_FOUND AND WIN32)
805         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
806            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
808           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
810         ELSE()
811           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
812         ENDIF()
814       ENDIF(Boost_FOUND AND WIN32)
816       # We ignore if boost python fails, we catch that somewhere else
817       # so if we get here Boost_FOUND was true in the first place
818       SET(Boost_FOUND TRUE)
820       FIND_PACKAGE(GCCXML)
822       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
823       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
824       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
826     ENDIF()
829     ###############
830     #### Flex/Bison
831     ###############
833     FIND_PROGRAM(FLEX_EXE flex)
834     FIND_PROGRAM(BISON_EXE bison)
836     OSG_ADD_OPT(FLEX_EXE)
837     OSG_ADD_OPT(BISON_EXE)
839     ##############
840     #### NVPerfSDK
841     ##############
843 #    OSG_FIND_PACKAGE(NVidiaPerfSDK)
845 #    IF(NVIDIAPERFSDK_FOUND)
846 #        OSG_SET(OSG_WITH_NVPERFSDK 1)
847 #        OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
848 #        OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
849 #    ELSE(NVIDIAPERFSDK_FOUND)
850 #        OSG_SET(OSG_WITH_NVPERFSDK 0)
851 #        OSG_SET(OSG_NVPERFSDK_INC_DIR "")
852 #        OSG_SET(OSG_NVPERFSDK_LIBS "")
853 #    ENDIF(NVIDIAPERFSDK_FOUND)
856     #############
857     #### Support
858     #############
860     IF(UNIX)
861         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
862         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
863         FIND_LIBRARY(OSG_RT_LIB     NAMES rt)
865         OSG_ADD_OPT(OSG_THREAD_LIB)
866         OSG_ADD_OPT(OSG_DL_LIB)
867         OSG_ADD_OPT(OSG_RT_LIB)
868     ENDIF(UNIX)
870     IF(APPLE)
871         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
872         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
873         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
874         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
876         OSG_ADD_OPT(OSG_APPLICATIONSERVICES_FRAMEWORK)
877         OSG_ADD_OPT(OSG_CORESERVICES_FRAMEWORK)
878         OSG_ADD_OPT(OSG_CARBON_FRAMEWORK)
879         OSG_ADD_OPT(OSG_COCOA_FRAMEWORK)
880     ENDIF(APPLE)
882     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
884 ENDIF(NOT OSG_BUILD_DEPENDEND)
886 MESSAGE("")
888 SET(CFG_NAME OSG)
889 FOREACH(EXTERNAL_PREPARE ${OSG_EXTERNAL_PREPARE})
890   INCLUDE("${EXTERNAL_PREPARE}/CMakeLists.PackagePrepare.cmake")
891 ENDFOREACH()
893 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
894   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
895     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
896   ENDIF(EXISTS
897   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
898 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
901 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
902   INCLUDE(${OSG_GLOBAL_PREP})
903 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
905 IF(APPLE AND OSG_COCOA_FRAMEWORK)
906     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
907 ELSEIF(WIN32)
908     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
909 ELSEIF(UNIX AND X11_FOUND)
910     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
911 ELSEIF(APPLE AND IOS)
912     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
913 ELSE()
914     OSG_SET(OSG_NATIVE_WINDOW "")
915 ENDIF()
917 ###############
918 #### Doxygen
919 ###############
921 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
922   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
923                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
924 ENDIF()
926 FIND_PACKAGE(Doxygen)
928 ##############################################################################
929 # Overrides if dependend
930 ##############################################################################
932 IF(NOT WIN32)
933     IF(OSG_BUILD_DEPENDEND)
934         MESSAGE(STATUS "Load reference settings")
935         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
936         # Needed to get the correct vtk/boost settings
937         FIND_PACKAGE(VTK)
938         OSG_BOOST_DEP_SETUP()
939         OSG_CONFIGURE_QT()
941         IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
942           LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
943         ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
945     ELSE(OSG_BUILD_DEPENDEND)
946 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
947     ENDIF(OSG_BUILD_DEPENDEND)
948 ENDIF(NOT WIN32)
950 ##############################################################################
951 # MAIN BUILD STEPS
952 ##############################################################################
954 # when adding passes, make sure to add a corresponding pass directory variable
955 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
956 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
958 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
959 SET(OSG_PASSDIR_OSGSETUP   "Build")
961 OSG_COMMON_TARGETS()
963 ###############
964 # Clean
965 ###############
967 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
969 IF(OSG_OLD_BUILD_FILES)
970     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
971 ENDIF(OSG_OLD_BUILD_FILES)
973 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
975 IF(OSG_OLD_CONFIG_FILES)
976     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
977 ENDIF(OSG_OLD_CONFIG_FILES)
979 ###############
980 # Tests
981 ###############
983 # optional pass for test programs
984 IF(OSGBUILD_TESTS)
985     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
986     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
987 ENDIF(OSGBUILD_TESTS)
989 ###############
990 # UnitTests
991 ###############
993 IF(OSGBUILD_UNITTESTS)
994     ENABLE_TESTING()
995     INCLUDE(CTest)
997     # optional pass for unittest programs
998     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
999     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
1001     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
1002                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
1004     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
1005     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
1006     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
1008     ADD_CUSTOM_TARGET(OSGAllUnitTests)
1009     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
1010 ENDIF(OSGBUILD_UNITTESTS)
1012 ###############
1013 # Python
1014 ###############
1016 INCLUDE(OSGSetupPython)
1017 SETUP_PYTHON_BUILD()
1019 #################
1020 # Documentation I
1021 #################
1022 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1023 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1025 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1026     ADD_CUSTOM_TARGET(Doc)
1027 ENDIF()
1029 IF(DOXYGEN_EXECUTABLE)
1030     SET(DOXYGEN_VERSION)
1031     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1032                     OUTPUT_VARIABLE DOXYGEN_VERSION
1033                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1034     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1035         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1036                         "when building OpenSG documentation. "
1037                         "Please use a different version, sorry for the inconvenience.")
1038     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1039 ENDIF(DOXYGEN_EXECUTABLE)
1041 IF(NOT OSG_DOXY_INPUTS)
1042     # add a pass for doxygen to run
1043     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1044     SET(OSG_PASSDIR_OSGDOXYDOC "Doc/build")
1045 ELSE()
1046     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC_EXT")
1047     SET(OSG_PASSDIR_OSGDOXYDOC_EXT "DocExt/build")
1048 ENDIF(NOT OSG_DOXY_INPUTS)
1050 # set up variables for the config file
1051 IF(DOXYGEN_DOT_EXECUTABLE)
1052     SET(OSG_DOXY_HAVE_DOT "YES")
1053 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1055 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1056 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1057 SET(OSG_GENDOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/GenDoc/opensg-doxy")
1059 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1061 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1062     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1063     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1064     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1065     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1066     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1067     SET(OSG_DOXY_SEARCHENGINE "NO")
1069 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1070     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1071     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1072     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1073     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1074     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1075     SET(OSG_DOXY_SEARCHENGINE "NO")
1077 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1078     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1079     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1080     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1081     SET(OSG_DOXY_HAVE_DOT "NO")
1082     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1083     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1084     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1085     SET(OSG_DOXY_SEARCHENGINE "NO")
1087 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1089 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1090   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1091 ELSE()
1092   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1093 ENDIF()
1095 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1097 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1098 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1100 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1101   SET(OSG_DOC_SECTION "all_in_one")
1102   SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
1103 ELSE()
1104   SET(OSG_DOC_SECTION "separate")
1105 ENDIF()
1107 # write doxygen config file
1108 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1109                "${OSG_DOXY_CONFIGURATION_FILE}")
1112 # write general doc config file
1114 SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/GenDoc")
1115 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "")
1116 #SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS=${CMAKE_BINARY_DIR}/Doc/html/Full/html")
1118 SET(OSG_DOC_SECTION "${OSG_DOC_SECTION} include_general_doc")
1120 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1121                "${OSG_GENDOXY_CONFIGURATION_FILE}")
1123 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1125 # find/process documentation include files
1126 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1128 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1130   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1132   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1133                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1135 ENDFOREACH()
1137 IF(OSG_DOXY_INPUTS)
1138     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1139                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1140 ENDIF(OSG_DOXY_INPUTS)
1143 IF(DOXYGEN_EXECUTABLE)
1144   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1145   ADD_DEPENDENCIES(DocUpload Doc)
1148   ADD_CUSTOM_TARGET(DocSyncGV
1149                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1150                     WORKING_DIRECTORY Doc)
1152   ADD_CUSTOM_TARGET(DocCompleteGV)
1153   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1154 ENDIF(DOXYGEN_EXECUTABLE)
1156 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1158 ###############
1159 # PrePasses
1160 ###############
1162 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1163   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1164     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1165   ENDIF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
1166 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1168 ###############
1169 # Passes
1170 ###############
1172 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1173   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1175   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1176        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1178   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1179     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1180     INCLUDE(${_OSGCORE_EXT_FILE})
1181   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1184 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1186 # Find files describing libraries to build, but make sure base
1187 # and system are processed first
1188 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1189      "Source/CMakeLists.Lib.OSGBase.txt")
1191 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1192      "Source/CMakeLists.Lib.OSGSystem.txt")
1194 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1195      "Source/*CMakeLists.Lib.*.txt")
1197 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1198 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1200 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1201 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1203 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1204   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1206   IF(_OSG_FOUND_CONTRIB_CONFIG)
1207     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1208   ELSE()
1209     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1210   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1211 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1213 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1215 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1217   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1218                          ${_OSG_LIBRARY_CONFIG}
1219                           PATH)
1221   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1222                          ${_OSG_LIBRARY_CONFIG}
1223                           NAME)
1225   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1226                      ${_OSG_LIBCONFIG_BASENAME})
1228   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1229                          ${_OSG_LIBCONFIG_BASENAME_1}
1230                          NAME_WE)
1232   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1233     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1234   ENDIF()
1236 ENDFOREACH()
1238 OSG_COMMON_CUDA()
1240 # run build passes
1241 FOREACH(PASS ${OSG_CMAKE_PASSES})
1242     SET(OSG_CMAKE_PASS ${PASS})
1244     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1246     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1247         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1248         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1249         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1250         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1252         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1254         IF(_OSG_IS_CONTRIBLIB)
1255           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1256         ELSE()
1257           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1258         ENDIF()
1260         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1261     ENDFOREACH(LIBCONFIGFILE)
1263     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1265     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1266         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1267                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1268     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1270 ENDFOREACH()
1272 IF(NOT WIN32)
1273   IF(NOT OSG_BUILD_DEPENDEND)
1274     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1275   ENDIF(NOT OSG_BUILD_DEPENDEND)
1276 ENDIF(NOT WIN32)
1278 ###############
1279 # OSGConfigured
1280 ###############
1283 EXECUTE_PROCESS(
1284     COMMAND "${CMAKE_COMMAND}" -E copy
1285                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1286                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1288 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1289   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1290 ENDFOREACH()
1292 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1294 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1295                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1297 EXECUTE_PROCESS(
1298     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1299                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1300                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1302 #################
1303 # Examples/Simple
1304 #################
1306 ADD_CUSTOM_TARGET(OSGAllExamples)
1307 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1309 IF(OSGBUILD_EXAMPLES_SIMPLE)
1310     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1311     ADD_SUBDIRECTORY("Examples/Simple")
1312     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1313 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1315 ###################
1316 # Examples/Advanced
1317 ###################
1319 IF(OSGBUILD_EXAMPLES_ADVANCED)
1320     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1321     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1322     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1323     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1324 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1326 ###################
1327 # Examples/Advanced
1328 ###################
1330 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1331     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1332     ADD_SUBDIRECTORY("Examples/Tutorial")
1333     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1334 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1336 ###################
1337 # External Examples
1338 ###################
1340 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1341   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1343   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1344     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1345     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1346   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1347 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1349 ##################
1350 # Documentation II
1351 ##################
1353 SET(OSG_DOC_PIPES "")
1355 IF(OSG_DOXY_STDOUT_LOG)
1356     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1357 ENDIF(OSG_DOXY_STDOUT_LOG)
1359 IF(DOXYGEN_EXECUTABLE)
1360     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1361         ADD_CUSTOM_TARGET(Doc
1362             VERBATIM
1363             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1364     ENDIF()
1365 ENDIF()
1367 IF(DOXYGEN_EXECUTABLE)
1368   ADD_CUSTOM_TARGET(GenDoc
1369                     VERBATIM
1370                     COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_GENDOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1371 ENDIF()
1373 ##################
1374 # Documentation II
1375 ##################
1377 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1378   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1379     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
1380   ENDIF()
1381 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1383 ##################
1384 # osg2-config
1385 ##################
1387 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1388 # is generated during the OSGCOLLECT pass.
1390 # substitute variables in static parts
1391 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1392                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1393 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1394                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1396 # read in all parts
1397 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1398 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1399 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1401 # concatenate final file
1402 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1403 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1404 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1406 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1407 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1408 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1410 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1411         DESTINATION bin)
1412 #        COMPONENT development_tools)
1414 ##################
1415 # cmake modules
1416 ##################
1418 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cmake)
1420 STRING(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_UP)
1422 STRING(REPLACE "OpenSG" "OSG" CMAKE_PROJECT_NAME_SHORT ${CMAKE_PROJECT_NAME})
1424 STRING(TOUPPER "OpenSG" ${CMAKE_PROJECT_NAME_SHORT} ${CMAKE_PROJECT_NAME_SHORT_UP})
1426 CONFIGURE_FILE(CMake/FindOpenSG.cmake.in
1427                ${CMAKE_BINARY_DIR}/cmake/Find${CMAKE_PROJECT_NAME}.cmake
1428                @ONLY                                                   )
1430 INSTALL(FILES "${CMAKE_BINARY_DIR}/cmake/FindOpenSG.cmake"
1431         DESTINATION share/OpenSG/cmake)
1432 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake.in"
1433         DESTINATION share/OpenSG/cmake)
1434 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1435         DESTINATION share/OpenSG/cmake)
1436 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1437         DESTINATION share/OpenSG/cmake)
1438 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindExpat_OpenSG.cmake"
1439         DESTINATION share/OpenSG/cmake)
1440 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1441         DESTINATION share/OpenSG/cmake)
1442 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1443         DESTINATION share/OpenSG/cmake)
1444 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLEW_OpenSG.cmake"
1445         DESTINATION share/OpenSG/cmake)
1446 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1447         DESTINATION share/OpenSG/cmake)
1448 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1449         DESTINATION share/OpenSG/cmake)
1450 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1451         DESTINATION share/OpenSG/cmake)
1452 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGSetupCompiler.cmake"
1453         DESTINATION share/OpenSG/cmake)
1454 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGUpdateCompiler.cmake"
1455         DESTINATION share/OpenSG/cmake)
1456 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGBuildFunctions.cmake"
1457         DESTINATION share/OpenSG/cmake)
1458 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGConfigurePackages.cmake"
1459         DESTINATION share/OpenSG/cmake)
1460 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGExternalProjectHelper.cmake"
1461         DESTINATION share/OpenSG/cmake)
1462 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1463         DESTINATION share/OpenSG/cmake)
1464 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1465         DESTINATION share/OpenSG/cmake)
1466 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonOptions.cmake"
1467         DESTINATION share/OpenSG/cmake)
1468 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonConfig.cmake"
1469         DESTINATION share/OpenSG/cmake)
1470 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OSGCommonSupportConfig.cmake"
1471         DESTINATION share/OpenSG/cmake)
1473 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1474         DESTINATION bin
1475 #        COMPONENT development_tools
1476         PATTERN "*/fcd2code/fcd2code" EXCLUDE
1477         PATTERN "*.pyc" EXCLUDE
1478         PATTERN ".svn"  EXCLUDE)
1479 INSTALL(PROGRAMS "${CMAKE_SOURCE_DIR}/Tools/fcd2code/fcd2code"
1480         DESTINATION bin/fcd2code)
1482 ##################
1483 # Global Python
1484 ##################
1486 IF(OSGBUILD_PYTHON_BINDINGS)
1487   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1488                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1489                   OUTPUT_VARIABLE _OSG_LIBORDER)
1492                  
1493   SET(_OSG_PY_MODNAME_LIST "osg2ModuleNameList = [\n")
1494   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1496   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1497     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1498     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1499     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1500     SET(_OSG_PY_MODNAME_LIST "${_OSG_PY_MODNAME_LIST}  \"${_OSG_LIB}\",\n")
1501   ENDFOREACH()
1503   SET(OSG_PYTHON_ALL_IMPORTS "${_OSG_PY_MODNAME_LIST}  ]\n\n${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1505   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1506   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1509   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1510                  "${_OSG_GEN_INIT_FILE_OUT}")
1512   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1513                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1515   IF(WIN32) 
1517     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1518     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1519     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1520     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1522     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1523             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1524             CONFIGURATIONS Release)
1525 #            COMPONENT      release_runtimes)
1527     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1528             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/osg
1529             CONFIGURATIONS Debug)
1530 #            COMPONENT      debug_runtimes)
1532     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1533             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/osg
1534             CONFIGURATIONS DebugOpt)
1535 #            COMPONENT      debug_opt_runtimes)
1537     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1538             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/osg
1539             CONFIGURATIONS ReleaseNoOpt)
1540 #            COMPONENT      release_no_opt_runtimes)
1543     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1544             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1545             CONFIGURATIONS Release)
1546 #            COMPONENT      release_runtimes)
1548     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1549                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1550                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1551                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1552             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1553             CONFIGURATIONS Release)
1554 #            COMPONENT      release_runtimes)
1557     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1558             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1559             CONFIGURATIONS Debug)
1560 #            COMPONENT      debug_runtimes)
1562     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1563                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1564                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1565                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1566             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1567             CONFIGURATIONS Debug)
1568 #            COMPONENT      debug_runtimes)
1571     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1572             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1573             CONFIGURATIONS DebugOpt)
1574 #            COMPONENT      debug_opt_runtimes)
1576     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1577                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1578                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1579                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1580             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1581             CONFIGURATIONS DebugOpt)
1582 #            COMPONENT      debug_opt_runtimes)
1585     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1586             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1587             CONFIGURATIONS ReleaseNoOpt)
1588 #            COMPONENT      release_no_opt_runtimes)
1590     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1591                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1592                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1593                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1594             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1595             CONFIGURATIONS ReleaseNoOpt)
1596 #            COMPONENT      release_no_opt_runtimes)
1598   ELSE(WIN32)   
1600     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1601     SET(_OSG_PY_INST_BASE 
1602         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1604     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1605             DESTINATION ${_OSG_PY_INST_BASE}/osg)
1606 #            COMPONENT   libraries)
1608     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1609             DESTINATION ${_OSG_PY_INST_BASE})
1610 #            COMPONENT   libraries)
1612     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1613                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1614                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1615                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1616             DESTINATION ${_OSG_PY_INST_BASE}/helpers)
1617 #            COMPONENT   libraries)
1619   ENDIF(WIN32)
1621 ENDIF()
1623 INSTALL_PYTHON_ELEMENTS()
1625 ##################
1626 # Documentation
1627 ##################
1629 IF(DOXYGEN_EXECUTABLE)
1630     IF(OSG_INSTALL_DOXYDOC)
1631         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1632                 DESTINATION share/OpenSG/documentation)
1633 #                COMPONENT documentation)
1634     ENDIF()
1635 ENDIF()
1637 ##################
1638 # Images/Icons
1639 ##################
1641 ##################
1642 # CSM Example
1643 ##################
1645 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
1646         DESTINATION share/OpenSG/Examples/)
1647 #        COMPONENT examples_basic)
1649 ##################
1650 # Packaging
1651 ##################
1653 #IF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1655 #    SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
1657 #    SET(CPACK_PACKAGE_NAME                "OpenSG")
1658 #    SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
1659 #    SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
1660 #    SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
1661 #    SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
1662 #    SET(CPACK_PACKAGE_VENDOR              "OpenSG")
1663 #    SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
1664 #    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
1665 #    SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
1666 #    SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
1668 #    if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
1669 #        set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
1670 #        set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
1671 #    endif ()
1673 #    if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
1674 #        set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
1675 #    endif()
1677 #    #Define Components
1678 #    SET(CPACK_COMPONENTS_ALL development_tools
1679 #        development_configuration
1680 #        code_headers
1681 #        libraries
1682 #        debug_program_db
1683 #        release_program_db
1684 #        debug_libraries
1685 #        release_libraries
1686 #        debug_runtimes
1687 #        release_runtimes
1688 #        data_images
1689 #        examples_basic
1690 #        examples_advanced
1691 #        Unspecified
1692 #        )
1695 #    #Components
1696 #    #Runtime
1697 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
1699 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
1700 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
1701 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
1702 #    SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1704 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
1705 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
1706 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
1707 #    SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1709 #    #Development
1710 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
1712 #    #Libraries
1713 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
1714 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
1715 #    SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
1716 #    set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
1718 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
1719 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
1720 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
1721 #    SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
1723 #    #Program database
1724 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
1725 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
1726 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
1727 #    SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
1729 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
1730 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
1731 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
1732 #    SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
1734 #    #Tools
1735 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
1736 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
1737 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
1738 #    SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
1740 #    #Configuration
1741 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
1742 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
1743 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
1744 #    SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
1746 #    #Headers
1747 #    SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
1748 #    SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
1749 #    SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
1750 #    SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
1752 #    #Examples
1753 #    SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
1755 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
1756 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
1757 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
1758 #    SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
1760 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
1761 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
1762 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
1763 #    SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
1765 #    #Shared Data
1766 #    SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
1768 #    SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
1769 #    SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
1770 #    SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
1771 #    SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
1773 #    #Documentation
1774 #    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
1776 #    #Dependencies
1777 #    #Boost
1778 #    #Base
1780 #    #NSIS specific configuration
1781 #    IF(WIN32)
1782 #        INCLUDE(InstallRequiredSystemLibraries)
1783 #        IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
1784 #            IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
1785 #                         ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
1786 #                 include(CMakeDetermineVSServicePack)
1787 #                 DetermineVSServicePack( my_service_pack )
1789 #                 IF( my_service_pack )
1790 #                     SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
1791 #                 ENDIF()
1792 #            ENDIF()
1794 #            #Extra install commands
1795 #            SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
1796 #            SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
1799 #            SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1800 #            SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
1801 #            FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
1802 #            SET(CPACK_NSIS_MODIFY_PATH         ON)
1803 #            SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
1804 #            SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
1805 #            SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
1806 #            SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
1807 #            SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
1808 #            SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
1809 #            SET(CPACK_NSIS_MENU_LINKS          "")
1810 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
1811 #            #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
1812 #        ENDIF()
1813 #    ENDIF()
1816 #    # Date macro by Benoit RAT (www.neub.co.nr)
1817 #    MACRO (TODAY RESULT)
1818 #        IF (WIN32)
1819 #            EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
1820 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1821 #        ELSEIF(UNIX)
1822 #            EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
1823 #            string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
1824 #        ELSE (WIN32)
1825 #            MESSAGE(SEND_ERROR "date not implemented")
1826 #            SET(${RESULT} 000000)
1827 #        ENDIF (WIN32)
1828 #    ENDMACRO (TODAY)
1830 #    TODAY(DATE)
1832 #    # Determine package type
1833 #    IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1834 #        IF(WIN32)
1835 #            SET(OSGBUILD_PACKAGE_TYPE "ZIP")
1836 #        ELSE(WIN32)
1837 #            SET(OSGBUILD_PACKAGE_TYPE "RPM")
1838 #        ENDIF(WIN32)
1839 #    ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
1841 #    STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
1843 #    IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
1844 #        SET( PACK_EXT "tar.bz2" )
1845 #    ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
1846 #        SET( PACK_EXT "tar.gz" )
1847 #    ELSE()
1848 #        STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
1849 #    ENDIF()
1851 #    SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
1852 #    SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
1854 #    INCLUDE(CPack)
1857 #    # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
1858 #    IF(WIN32)
1859 #        #TODO: Need a way to do this on Windows
1860 #        #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 )
1861 #        #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1862 #    ELSE(WIN32)
1863 #        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 )
1864 #        ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
1865 #    ENDIF(WIN32)
1868 #ENDIF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
1870 IF(NOT WIN32)
1871   CONFIGURE_FILE(CMake/CMakeLists.packaging.unix.txt 
1872                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1873                  @ONLY                                      )
1874 ELSE()
1876   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
1877     SET(OSG_WIN_SEC "nosec")
1878   ELSE()
1879     SET(OSG_WIN_SEC "msdefault")
1880   ENDIF()
1882   CONFIGURE_FILE(CMake/CMakeLists.packaging.win.txt 
1883                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1884                  @ONLY                                      )
1885   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico"
1886           DESTINATION share/OpenSG/Packaging
1887 #          COMPONENT packaging
1888           PERMISSIONS OWNER_WRITE OWNER_READ
1889                       GROUP_READ
1890                       WORLD_READ            )
1892   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp"
1893           DESTINATION share/OpenSG/Packaging
1894 #          COMPONENT packaging
1895           PERMISSIONS OWNER_WRITE OWNER_READ
1896                       GROUP_READ
1897                       WORLD_READ            )
1898 ENDIF()
1900 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
1901         DESTINATION share/OpenSG/Packaging
1902 #        COMPONENT packaging
1903         PERMISSIONS OWNER_WRITE OWNER_READ
1904                     GROUP_READ
1905                     WORLD_READ
1906         RENAME CMakeLists.txt)
1908 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
1909         DESTINATION share/doc/OpenSG/
1910 #        COMPONENT doc
1911         PERMISSIONS OWNER_WRITE OWNER_READ
1912                     GROUP_READ
1913                     WORLD_READ)
1915 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/PLY/README
1916         DESTINATION share/doc/OpenSG/
1917 #        COMPONENT doc
1918         PERMISSIONS OWNER_WRITE OWNER_READ
1919                     GROUP_READ
1920                     WORLD_READ
1921         RENAME README.ply)
1923 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/TrapezoidalShadowMaps/README
1924         DESTINATION share/doc/OpenSG/
1925 #        COMPONENT doc
1926         PERMISSIONS OWNER_WRITE OWNER_READ
1927                     GROUP_READ
1928                     WORLD_READ
1929         RENAME README.tsm)
1931 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README
1932         DESTINATION share/doc/OpenSG/
1933 #        COMPONENT doc
1934         PERMISSIONS OWNER_WRITE OWNER_READ
1935                     GROUP_READ
1936                     WORLD_READ
1937         RENAME README.rhine)
1939 IF(WIN32)
1940   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
1941                                 CACHE STRING "OpenSG Build Types" FORCE )
1942 ELSE()
1943   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
1944                                 CACHE STRING "OpenSG Build Types" FORCE )
1945 ENDIF(WIN32)
1946 IF(APPLE AND IOS)
1947   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
1948                                 CACHE STRING "OpenSG Build Types" FORCE )
1949 ENDIF()
1951 IF(WIN32)
1952   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1953        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
1955   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1956        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
1958 ENDIF(WIN32)
1960 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1961      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
1963 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1964      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
1966 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1967      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
1969 ###########################
1970 # Component install Setting
1971 ###########################
1973 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
1975 IF(NOT WIN32)
1976   ADD_CUSTOM_TARGET(OSG_preinstall
1977                     make preinstall
1978                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
1979 ELSE()
1980 ENDIF()
1982 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
1984   IF(NOT WIN32)
1985     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
1986                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
1987                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
1988   ELSE()
1990     SET(_OSG_CMP_CONF Release)
1992     IF(${_OSG_CMP} MATCHES ^debug_)
1993       SET(_OSG_CMP_CONF Debug)
1994     ENDIF()
1996     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
1997                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
1998                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2000     SET_PROPERTY(TARGET INSTALL_${_OSG_CMP} PROPERTY FOLDER "Packaging")
2001   ENDIF()
2003   IF(NOT WIN32)
2004     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
2005   ELSE()
2006   ENDIF()
2007 ENDFOREACH()
2010 IF(WIN32)
2012   ADD_CUSTOM_TARGET(INSTALL_runtime)
2014   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_runtimes)
2015   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_binaries)
2017   SET_PROPERTY(TARGET INSTALL_runtime PROPERTY FOLDER "Packaging")
2019 ELSE()
2021   ADD_CUSTOM_TARGET(INSTALL_runtime)
2023   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
2024   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_binaries)
2025 ENDIF()
2027 #IF(WIN32)
2028 #  SET_PROPERTY(TARGET ALL_BUILD PROPERTY FOLDER "CMakePredefinedTargets")
2029 #ENDIF()
2031 ################
2032 # Build Setting
2033 ################
2035 IF(NOT WIN32)
2036   IF(NOT OSG_BUILD_DEPENDEND)
2037     OSG_WRITE_OSGBUILD(${CMAKE_BINARY_DIR}/CMake.build.settings)
2038     OSG_WRITE_OSGGLOBALSETUP(${CMAKE_BINARY_DIR}/CMake.global.settings)
2039   ENDIF(NOT OSG_BUILD_DEPENDEND)
2040 ENDIF(NOT WIN32)
2042 IF(OSG_WITH_CUDA)
2043   CUDA_BUILD_CLEAN_TARGET()
2044 ENDIF(OSG_WITH_CUDA)
2047 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2049 FOREACH(_variableName ${_variableNames})
2050   IF(_variableName MATCHES "^OSG")
2051 #    MESSAGE("FOO : ${_variableName}")
2052 #    FILE(APPEND ${FILENAME}
2053 #         "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2054   ENDIF()
2055 ENDFOREACH()