fixed: config type restrictions
[opensg.git] / CMakeLists.txt
blob89a1e67c9fb94a3a95f42d78c29e3d302ae21d31
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3 PROJECT(OpenSG)
5 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenSG_SOURCE_DIR}/CMake")
6 IF(APPLE AND IOS)
7   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenSG_SOURCE_DIR}/CMake/IOS")
8 ENDIF()
9 INCLUDE(OpenSGVersion)
11 # Disable boost cmake config, as it screws up OpenSG's boost config
13 SET(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "" FORCE)
15 IF(WIN32)
16   SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
17 ENDIF()
19 ##############################################
20 # Initial cache to make life easier on Windows
21 ##############################################
23 IF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt AND NOT OSG_BUILD_DEPENDEND)
24   INCLUDE(${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt)
25   SET(_OSGINITCACHELOADED TRUE CACHE INTERNAL "")
26 ENDIF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt AND NOT OSG_BUILD_DEPENDEND)
29 INCLUDE(BuildFunctions)
31 ##########################
32 # Disallow in-source build
33 ##########################
35 IF("${OpenSG_SOURCE_DIR}"  STREQUAL "${OpenSG_BINARY_DIR}")
36   MESSAGE(FATAL_ERROR "OpenSG requires an out of source Build. \n"
37                       "Please create a separate binary directory and run "
38                       "CMake there.")
39 ENDIF("${OpenSG_SOURCE_DIR}"  STREQUAL "${OpenSG_BINARY_DIR}")
41 SET(OSG_BUILD_ACTIVE TRUE)
43 ##############################################################################
44 # BUILD OPTIONS
45 ##############################################################################
47 IF(NOT WIN32)
48     IF(OSG_BUILD_DEPENDEND)
49         # Hide it from further manipulation
50         SET(OSG_BUILD_DEPENDEND ${OSG_BUILD_DEPENDEND} CACHE INTERNAL "")
51     ENDIF(OSG_BUILD_DEPENDEND)
52 ENDIF(NOT WIN32)
54 OPTION(OSG_VERBOSE_BUILD_MESSAGES "Print verbose messages when generating the build system" OFF)
55 MARK_AS_ADVANCED(OSG_VERBOSE_BUILD_MESSAGES)
57 OSG_OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
59 OSG_OPTION(OSGBUILD_TESTS                        "Build test programs" ON)
60 OSG_OPTION(OSGBUILD_UNITTESTS                    "Build/run unit test programs" OFF)
61 OSG_OPTION(OSGBUILD_EXAMPLES_SIMPLE              "Build example programs during system build" OFF)
62 OSG_OPTION(OSGBUILD_EXAMPLES_ADVANCED            "Build advanced example programs during system build" OFF)
63 OSG_OPTION(OSGBUILD_EXAMPLES_TUTORIAL            "Build tutorial example programs during system build" OFF)
64 OSG_OPTION(OSGBUILD_PYTHON_BINDINGS              "Build python bindings" OFF)
65 OSG_OPTION(OSGBUILD_PYTHON_DUMP_DECLS            "Dump decls while building python" FALSE)
67 OSG_OPTION(OSGEXCLUDE_TESTS_FROM_ALL             "Exclude test programs from all target" OFF)
68 OSG_OPTION(OSGEXCLUDE_UNITTESTS_FROM_ALL         "Build/run unit test programs" OFF)
69 OSG_OPTION(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL   "Build example programs during system build" OFF)
70 OSG_OPTION(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL "Build advanced example programs during system build" OFF)
72 OSG_OPTION(OSGBUILD_ENABLE_PACKAGING "Generate binary packages with CPack" OFF)
73 SET(OSGBUILD_PACKAGE_TYPE "" CACHE STRING
74     "The type of package to generate (empty->default)")
76 OSG_OPTION(OSG_ENABLE_NEW_SHADER "" ON)
77 OSG_OPTION(OSG_ENABLE_OGL2_SHADERFUNCTIONS "" ON)
78 OSG_OPTION(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS "" OFF)
79 OSG_OPTION(OSG_ENABLE_NEW_GEOHANDLER "" OFF)
80 OSG_OPTION(OSG_ENABLE_OGL_COREONLY "" OFF)
81 OSG_OPTION(OSG_ENABLE_OGL_ES2 "" OFF)
82 OSG_OPTION(OSG_ENABLE_OGL_ES2_SIMGL3 "" OFF)
83 OSG_OPTION(OSG_ENABLE_CSM_WIN7_FEATURES "" OFF)
85 OSG_OPTION(OSG_ENABLE_OGL3_PROTOS "" OFF)
86 OSG_OPTION(OSG_ENABLE_OGL4_PROTOS "" OFF)
87 OSG_OPTION(OSG_ENABLE_OGLES_PROTOS "" OFF)
89 OSG_OPTION(OSG_ENABLE_GL_INCLUDE_GLEW "" OFF)
91 OSG_SET_CACHE(OSG_SHADER_CACHE_MODE 5 STRING "")
93 OSG_OPTION(OSG_ENABLE_FCD2CODE "" OFF)
94 OSG_OPTION(OSG_FCD2CODE_WRITE_CLASS "Write class file during cmake run if only
95 the fcd file is found" OFF)
96 OSG_OPTION(OSG_ENABLE_SCANPARSE_REGEN "" OFF)
98 OSG_OPTION(OSG_ENABLE_GLDEFINE_MAPPER "" ON)
99 OSG_OPTION(OSG_ENABLE_NEW_OSB_IO "" ON)
101 OSG_OPTION(OSG_ENABLE_SSE2        "" ON)
102 OSG_OPTION(OSG_USE_OSG2_NAMESPACE "" OFF)
103 OSG_OPTION(OSG_ENABLE_CUDA "Build OpenSG with CUDA support" ON)
105 OSG_OPTION(OSG_ENABLE_TESTCONTAINER "" OFF)
106 OSG_OPTION(OSG_ENABLE_VALGRIND_CHECKS "" OFF)
107 OSG_OPTION(OSG_ENABLE_MEMORY_DEBUGGING "" OFF)
108 OSG_OPTION(OSG_ENABLE_DOUBLE_MATRIX_STACK "" OFF)
109 OSG_OPTION(OSG_ENABLE_DEFAULT_READONLY_CHANGELIST "" OFF)
110 OSG_OPTION(OSG_ENABLE_PAR_PARTITION_DRAWING "" OFF)
111 OSG_OPTION(OSG_DISABLE_SOURCE_GROUPS "" OFF)
112 OSG_OPTION(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE "" OFF)
114 OSG_SET_CACHE(OSG_PYTHON_MODULE_BASE_DIR "" PATH "")
116 IF(WIN32)
117   OPTION(OSG_ENABLE_WIN_LOCALSTORAGE "" ON)
118   OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
120   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
121     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
122   ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
123     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
124   ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
125 ELSEIF(APPLE)
126   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" OFF)
127 ELSEIF(UNIX)
128   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" ON)
129 ENDIF()
131 OSG_OPTION(OSG_ENABLE_AUTOINIT_THREADS "" OFF)
132 OPTION(OSG_DEPENDENT_INCLUDE_BUILD "" OFF)
134 IF(WIN32)
135   OSG_OPTION(OSG_USE_SEPARATE_LIBDIRS "" ON)
136   OSG_OPTION(OSG_INSTALL_PDB_FILES "" OFF)
137 ENDIF(WIN32)
139 OSG_OPTION(OSG_INSTALL_EXAMPLES "" OFF)
140 OSG_OPTION(OSG_INSTALL_EXAMPLES_EXE "" OFF)
141 OSG_OPTION(OSG_INSTALL_APPS "" ON)
143 OSG_OPTION(OSGCOMPAT_ENABLE                  "" OFF)
144 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED       "" OFF)
145 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED_PROPS "" OFF)
147 OSG_SET_CACHE(OSG_RENDERPROPERTY_BITS 64 STRING "")
148 OSG_SET_CACHE(OSG_RENDERPROPERTY_UNIQUE_BITS 16 STRING "")
150 OSG_OPTION(OSG_GENERATE_SEPARATE_LIB_DOC "Generate separate doxygen documentation for contrib libraries" OFF)
151 OSG_OPTION(OSG_INSTALL_DOXYDOC "Install Doxygen documentation" OFF)
153 SET(OSG_DOXY_DOC_TYPE "User" CACHE STRING
154     "The type of documentation to generate (User, Developer, Trac)")
155 SET(OSG_DOXY_INPUTS CACHE FILEPATH "include given file instead of autogen")
156 SET(OSG_DOXY_STDOUT_LOG CACHE FILEPATH "log std to file")
158 # Not sure
159 #OPTION(OSG_ENABLE_MTCPTR "" ON)
160 #OPTION(OSG_ENABLE_GIF    "" ON)
162 ## prep options for OSGConfigured.h
164 IF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
165   SET(OSG_DISABLE_DEPRECATED 1)
166 ENDIF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
168 IF(OSG_USE_OSG2_NAMESPACE)
169   ADD_DEFINITIONS(-DOSG_USE_OSG2_NAMESPACE=1)
170 ENDIF()
172 IF(OSG_ENABLE_SSE2)
173   SET(OSG_SIMD_SSE 1)
174 ENDIF(OSG_ENABLE_SSE2)
176 IF(OSG_ENABLE_NEW_OSB_IO)
177   SET(OSG_NEW_OSB_IO 1)
178 ENDIF(OSG_ENABLE_NEW_OSB_IO)
180 IF(OSG_ENABLE_GLDEFINE_MAPPER)
181   SET(OSG_GL_DEFMAPPER 1)
182 ENDIF(OSG_ENABLE_GLDEFINE_MAPPER)
184 IF(OSG_ENABLE_OGL2_SHADERFUNCTIONS)
185   SET(OSG_OGL2_SHADERFUNCS 1)
186 ENDIF(OSG_ENABLE_OGL2_SHADERFUNCTIONS)
188 IF(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS)
189   SET(OSG_OGL_VERTEXATTRIB_FUNCS 1)
190 ENDIF(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS)
192 IF(OSG_ENABLE_NEW_GEOHANDLER)
193   SET(OSG_NEW_GEOHANDLER 1)
194 ENDIF(OSG_ENABLE_NEW_GEOHANDLER)
196 IF(OSG_ENABLE_OGL_COREONLY)
197   SET(OSG_OGL_COREONLY 1)
198 ENDIF(OSG_ENABLE_OGL_COREONLY)
200 IF(OSG_ENABLE_GL_INCLUDE_GLEW)
201   SET(OSG_GL_INCLUDE_GLEW 1)
202 ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW)
204 IF(OSG_ENABLE_OGL_ES2)
205   SET(OSG_OGL_ES2 1)
206   SET(OSG_OGL_NO_DOUBLE 1)
207 ENDIF(OSG_ENABLE_OGL_ES2)
209 IF(OSG_ENABLE_OGLES_PROTOS)
210   SET(OSG_USE_OGLES_PROTOS 1)
211   SET(GL_GLEXT_PROTOTYPES 1)
212 ENDIF(OSG_ENABLE_OGLES_PROTOS)
214 IF(OSG_ENABLE_OGL3_PROTOS)
215   SET(GL_GLEXT_PROTOTYPES 1)
216   SET(GL3_PROTOTYPES 1)
217   SET(OSG_USE_OGL3_PROTOS 1)
218 ENDIF(OSG_ENABLE_OGL3_PROTOS)
220 IF(OSG_ENABLE_OGL4_PROTOS)
221   SET(GL_GLEXT_PROTOTYPES 1)
222   SET(GL3_PROTOTYPES 1)
223   SET(OSG_USE_OGL3_PROTOS 1)
224   SET(OSG_USE_OGL4_PROTOS 1)
225 ENDIF(OSG_ENABLE_OGL4_PROTOS)
227 IF(OSG_ENABLE_OGL_ES2_SIMGL3)
228   SET(OSG_OGL_ES2_SIMGL3 1)
229 ENDIF(OSG_ENABLE_OGL_ES2_SIMGL3)
231 IF(OSG_ENABLE_NEW_SHADER)
232   SET(OSG_NEW_SHADER 1)
233 ENDIF(OSG_ENABLE_NEW_SHADER)
235 IF(OSGCOMPAT_ENABLE)
236   SET(OSG_1_COMPAT 1)
237 ENDIF(OSGCOMPAT_ENABLE)
239 IF(NOT OSG_ENABLE_SCANPARSE_REGEN)
240   SET(OSG_PREBUILD_SCANPARSE 1)
241 ENDIF(NOT OSG_ENABLE_SCANPARSE_REGEN)
243 IF(OSG_ENABLE_ELF_LOCALSTORAGE)
244   SET(OSG_PTHREAD_ELF_TLS 1)
245 ENDIF(OSG_ENABLE_ELF_LOCALSTORAGE)
247 IF(OSG_ENABLE_WIN_LOCALSTORAGE)
248   SET(OSG_WIN32_ASPECT_USE_LOCALSTORAGE 1)
249 ENDIF(OSG_ENABLE_WIN_LOCALSTORAGE)
251 IF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
252   SET(OSG_DEPRECATED_PROPS 1)
253 ENDIF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
255 SET(OSG_SHC_MODE_${OSG_SHADER_CACHE_MODE} 1)
257 IF(NOT IOS)
258   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
259   SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
260   SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
261 ENDIF(NOT IOS)
263 INCLUDE(ConfigurePackages)
265 LIST(APPEND OSG_ADDITIONAL_CONFIGURE_LINES "")
267 IF(OSGEXCLUDE_TESTS_FROM_ALL)
268   SET(OSGEXCLUDE_TESTS EXCLUDE_FROM_ALL)
269 ELSE()
270   SET(OSGEXCLUDE_TESTS "")
271 ENDIF()
273 IF(OSGEXCLUDE_UNITTESTS_FROM_ALL)
274   SET(OSGEXCLUDE_UNITTESTS EXCLUDE_FROM_ALL)
275 ELSE()
276   SET(OSGEXCLUDE_UNITTESTS "")
277 ENDIF()
279 IF(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL)
280   SET(OSGEXCLUDE_EXAMPLES_SIMPLE EXCLUDE_FROM_ALL)
281 ELSE()
282   SET(OSGEXCLUDE_EXAMPLES_SIMPLE "")
283 ENDIF()
285 IF(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL)
286   SET(OSGEXCLUDE_EXAMPLES_ADVANCED EXCLUDE_FROM_ALL)
287 ELSE()
288   SET(OSGEXCLUDE_EXAMPLES_ADVANCED "")
289 ENDIF()
291 IF(NOT WIN32)
292   IF(OSG_BUILD_DEPENDEND)
293     IF(OSG_DEPENDENT_INCLUDE_BUILD)
294       INCLUDE(${OSG_REFERENCE_DIR}/CMake.build.settings)
295     ENDIF()
296   ENDIF()
297 ENDIF()
299 #####################
300 # External extensions
301 #####################
303 OSG_SET_CACHE(OSG_EXTRA_EXTERNAL_MODULES "" STRING
304               "Extra modules that OpenSG will try to import.")
306 OSG_SET_CACHE(OSG_IGNORE_INSTALL "" STRING
307               "Extra modules that OpenSG will build but not installed.")
309 OSG_SET_CACHE(OSG_EXTERNAL_MODULES_INCLUDE "" FILEPATH 
310               "Include file of extra modules")
312 IF(EXISTS "${OSG_EXTERNAL_MODULES_INCLUDE}")
313   INCLUDE("${OSG_EXTERNAL_MODULES_INCLUDE}")
314 ENDIF()
316 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_MODULES})
317     OPTION(OSGBUILD_${EXTERNAL}
318            "Build using ${EXTERNAL} module" OFF)
320     IF(OSGBUILD_${EXTERNAL})
321         FIND_PATH(OSG_${EXTERNAL}_SOURCE_DIR
322                   CMakeLists.Lib.${EXTERNAL}.txt
323                   ${CMAKE_CURRENT_SOURCE_DIR}/../${EXTERNAL})
325         OSG_ADD_OPT(OSG_${EXTERNAL}_SOURCE_DIR)
327         IF(NOT EXISTS
328                 ${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.Lib.${EXTERNAL}.txt)
330             MESSAGE(SEND_ERROR "Cannot find ${EXTERNAL} sources directory: "
331                                "${OSG_${EXTERNAL}_SOURCE_DIR}")
332         ELSE()
333             LIST(APPEND OSG_EXTERNAL_CONFIGS "${EXTERNAL}")
334         ENDIF()
335     ENDIF()
336 ENDFOREACH(EXTERNAL)
338 OSG_OPTION(OSG_LINK_EXTERNAL_MODULES_TO_CSM "" FALSE)
341 ##############
342 # Compiler
343 ##############
345 SET(OSG_PLATFORM_64 0)
346 SET(OSG_PLATFORM_32 0)
347 SET(OSG_APPLE64     0)
348 SET(OSG_APPLE32     0)
349 SET(OSG_LIBDIR_SUFFIX "")
351 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
352   SET(OSG_PLATFORM_64 1)
353   SET(OSG_LIBDIR_SUFFIX "64")
355   IF(NOT WIN32)
356     SET(OSG_LIBDIR_BASE_SUFFIX "64")
357   ENDIF(NOT WIN32)
359   IF(APPLE)
360     SET(OSG_APPLE64 1)
361   ENDIF(APPLE)
362 ELSE()
363   SET(OSG_PLATFORM_32 1)
365   IF(APPLE)
366     SET(OSG_APPLE32 1)
367   ENDIF(APPLE)
368 ENDIF()
371 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
372     SET(LINUX 1)
373 ENDIF()
375 IF(WIN32)
376   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
377                                 CACHE STRING "OpenSG Build Types" FORCE )
378 ELSE()
379   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
380                                 CACHE STRING "OpenSG Build Types" FORCE )
381 ENDIF(WIN32)
382 IF(APPLE AND IOS)
383   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
384                                 CACHE STRING "OpenSG Build Types" FORCE )
385 ENDIF()
387 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
388   SET(CMAKE_BUILD_TYPE Debug CACHE STRING
389       "Choose the type of build, options are: Debug Release."
390       FORCE)
391 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
393 IF(NOT WIN32) 
394   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"          AND 
395      NOT CMAKE_BUILD_TYPE STREQUAL "DebugGV"        AND
396      NOT CMAKE_BUILD_TYPE STREQUAL "Release"        AND
397      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseGV"      AND
398      NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"   )
400     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
401                         "Please use either Release or Debug")
403   ENDIF()
404 ELSEIF(NOT MSVC_IDE)
406   IF(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
407     SET(CMAKE_BUILD_TYPE DebugOpt CACHE STRING
408         "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}."
409         FORCE)  
410   ENDIF()
412   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"    AND 
413      NOT CMAKE_BUILD_TYPE STREQUAL "DebugOpt" AND
414      NOT CMAKE_BUILD_TYPE STREQUAL "Release"  AND
415      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseNoOpt")
417     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
418                         "Please use on of ${CMAKE_CONFIGURATION_TYPES}")
420   ENDIF()
421 ENDIF()
423 IF(NOT OSG_COMPILER_DEFAULTS)
424    INCLUDE(CMake/SetupCompiler.cmake)
425    SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) #INTERNAL
426 ENDIF(NOT OSG_COMPILER_DEFAULTS)
428 INCLUDE(CMake/UpdateCompiler.cmake)
430 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
431    CMAKE_BUILD_TYPE STREQUAL "DebugGV")
433     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
434     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
436 ENDIF()
438 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
440 OSG_CHECK_INSTALL()
442 ##############################################################################
443 # DEPENDENCIES
444 ##############################################################################
446 # Global include/library dirs, libs and definitions
447 SET(OSG_GLOBAL_DEP_INCDIR "")
448 SET(OSG_GLOBAL_DEP_LIBDIR "")
449 SET(OSG_GLOBAL_DEP_LIBS   "")
450 SET(OSG_GLOBAL_DEP_DEFS   "")
452 IF(NOT WIN32)
453   SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
454 ENDIF()
456 #IF(WIN32)
457   OSG_OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
458   OSG_OPTION(OSG_USE_STATIC_SUPPORT_LIBS "" OFF)
460   IF(OSG_USE_OSGSUPPORT_LIBS)
461     OSG_SET_CACHE(OSG_SUPPORT_ROOT "" PATH "")
462   ENDIF(OSG_USE_OSGSUPPORT_LIBS)
464   IF(EXISTS "${OSG_SUPPORT_ROOT}" AND
465      EXISTS "${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
467     INCLUDE("${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
469     SET(_OSG_FATAL_DMS_COMBO  FALSE)
470     SET(_OSG_FATAL_ITER_COMBO FALSE)
472     IF( NOT OSG_DISABLE_MICROSOFT_SECURE_CXXX AND     OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
473       SET(_OSG_FATAL_DMS_COMBO TRUE)
474     ENDIF()
476     IF(     OSG_DISABLE_MICROSOFT_SECURE_CXXX AND NOT OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
477       SET(_OSG_FATAL_DMS_COMBO TRUE)
478     ENDIF()
480     IF(_OSG_FATAL_DMS_COMBO)
482       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_SECURE settings:\n"
483                           "  Support : ${OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX}\n"
484                           "  OpenSG  : ${OSG_DISABLE_MICROSOFT_SECURE_CXXX}")
486     ENDIF()
489     IF( NOT OSG_DISABLE_MS_ITERATOR_DEBUGGING AND     OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
490       SET(_OSG_FATAL_ITER_COMBO TRUE)
491     ENDIF()
493     IF(     OSG_DISABLE_MS_ITERATOR_DEBUGGING AND NOT OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
494       SET(_OSG_FATAL_ITER_COMBO TRUE)
495     ENDIF()
497     IF(_OSG_FATAL_ITER_COMBO)
499       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_ITER_DEBUG settings:\n"
500                           "  Support : ${OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING}\n"
501                           "  OpenSG  : ${OSG_DISABLE_MS_ITERATOR_DEBUGGING}")
503     ENDIF()
504   ENDIF()
506 IF(WIN32)
507    SET(OSG_INSTALL_SUBDIR "" CACHE STRING "add subdir to installed libs")
508 ENDIF(WIN32)
510 IF(NOT OSG_BUILD_DEPENDEND)
512     ##########
513     #### boost
514     ##########
516     OSG_CONFIGURE_BOOST()
518     #########
519     #### zlib
520     #########
522     OSG_CONFIGURE_ZLIB()
524 #    MESSAGE(STATUS "zlib: ${ZLIB_FOUND}")
526     IF(UNIX AND NOT OSG_APPLE32)
527         #############
528         #### Freetype
529         #############
531         FIND_PACKAGE(Freetype)
533         IF(FREETYPE_FOUND)
534             OSG_SET(OSG_WITH_FT2 1)
536             FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig)
538             IF(FONTCONFIG_LIBRARY MATCHES "fontconfig")
539                 OSG_SET(OSG_WITH_FONTCONFIG 1)
540             ENDIF()
542         ENDIF(FREETYPE_FOUND)
544         OSG_ADD_OPT(FREETYPE_FOUND)
545         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_freetype2)
546         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_ft2build)
547         OSG_ADD_OPT(FONTCONFIG_LIBRARY)
548         OSG_ADD_OPT(FREETYPE_LIBRARIES)
549     ENDIF(UNIX AND NOT OSG_APPLE32)
551     ##############
552     #### ImageLibs
553     ##############
555     OSG_CONFIGURE_TIFF()
556     OSG_CONFIGURE_PNG()
557     OSG_CONFIGURE_JPEG()
558     OSG_CONFIGURE_GDAL()
559     OSG_CONFIGURE_OPENEXR()
561     SET(OSG_EXTERNAL_IMAGELIBS)
562     SET(OSG_EXTERNAL_IMAGEINCS)
564 #    MESSAGE(STATUS "tiff: ${TIFF_FOUND} - png ${PNG_FOUND} - jpg: ${JPEG_FOUND} - exr ${OPENEXR_FOUND}")
566     IF(TIFF_FOUND)
567         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
568         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
569         OSG_SET(OSG_WITH_TIF 1)
570         OSG_ADD_OPT(TIFF_LIBRARIES)
571     ENDIF(TIFF_FOUND)
573     IF(PNG_FOUND)
574         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
575         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
576         OSG_SET(OSG_WITH_PNG 1)
577         OSG_ADD_OPT(PNG_INCLUDE_DIR)
578         OSG_ADD_OPT(PNG_LIBRARIES)
579     ENDIF(PNG_FOUND)
581     IF(JPEG_FOUND)
582         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
583         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
584         OSG_SET(OSG_WITH_JPG 1)
585         OSG_ADD_OPT(JPEG_LIBRARIES)
586     ENDIF(JPEG_FOUND)
588     IF(GDAL_FOUND)
589         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
590         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
591         OSG_SET(OSG_WITH_GDAL 1)
592         OSG_ADD_OPT(GDAL_LIBRARIES)
593     ENDIF(GDAL_FOUND)
595     IF(OPENEXR_FOUND)
596         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
597         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
598         OSG_SET(OSG_WITH_IMF 1)
600         OSG_ADD_OPT(OPENEXR_LIBRARIES)
601         OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
602     ENDIF(OPENEXR_FOUND)
605     OSG_ADD_OPT(OSG_EXTERNAL_IMAGELIBS)
606     OSG_ADD_OPT(OSG_EXTERNAL_IMAGEINCS)
608     #############
609     #### Collada
610     #############
612     #FIND_PACKAGE(Collada)
614     OSG_CONFIGURE_COLLADA()
616     IF(COLLADA_FOUND)
618       OSG_SET(OSG_WITH_COLLADA 1)
620       IF(NOT WIN32)
621         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
622            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
624             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
626         ELSE()
628             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
630         ENDIF()
631       ENDIF(NOT WIN32)
633       OSG_ADD_OPT(COLLADA_DAE_INCLUDE_DIR)
634       OSG_ADD_OPT(COLLADA_DOM_INCLUDE_DIR)
636       IF(WIN32 OR COLLADA_TARGET_FOUND)
637         SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
638       ENDIF(WIN32 OR COLLADA_TARGET_FOUND)
640     ELSE(COLLADA_FOUND)
642       SET(OSG_COLLADA_LIBS "")
644     ENDIF(COLLADA_FOUND)
646     OSG_ADD_OPT(COLLADA_FOUND)
648     #############
649     #### GLUT
650     #############
652     OSG_CONFIGURE_GLUT()
654     IF(GLUT_FOUND)
655       OSG_SET(OSG_WITH_GLUT 1)
656       OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
657       OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
658     ELSE(GLUT_FOUND)
659       OSG_SET(OSG_WITH_GLUT 0)
660       OSG_SET(OSG_GLUT_INC_DIR "")
661       OSG_SET(OSG_GLUT_LIBS "")
662     ENDIF(GLUT_FOUND)
664     #############
665     #### QT
666     #############
668     OSG_CONFIGURE_QT()
670     #############
671     #### OpenGL
672     #############
674     IF(APPLE AND IOS)
675       FIND_PACKAGE(OpenGLES REQUIRED)
677       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
678       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
679     ELSE()
680       FIND_PACKAGE(OpenGL REQUIRED)
682       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
683       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
684     ENDIF()
686     IF(OSG_USE_OGL3_PROTOS OR OSG_USE_OGL4_PROTOS)
687       SET(OSG_OGL_INCDIRS ${CMAKE_SOURCE_DIR}/Source/External/OpenGL)
688       LIST(APPEND OSG_GLOBAL_DEP_INCDIR OSG_OGL_INCDIRS)
690       ADD_DEFINITIONS(-DOSG_USE_GL3_INCLUDES=1)
691     ENDIF()
693     #############
694     #### X11
695     #############
697     FIND_PACKAGE(X11)
699     IF(X11_FOUND)
700         OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
701         OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
702     ENDIF(X11_FOUND)
704     OSG_ADD_OPT(X11_FOUND)
706     #############
707     #### VTK
708     #############
710     IF(OSG_USE_OSG_VTK_SETUP)
711       OSG_CONFIGURE_VTK()
712     ELSE(OSG_USE_OSG_VTK_SETUP)
713       FIND_PACKAGE(VTK)
715       IF(VTK_FOUND)
716           OSG_SET(OSG_WITH_VTK 1)
717           OSG_SET(OSG_VTK_LIBS "vtkCommon;vtkFiltering;vtkGraphics;vtkIO;vtkRendering")
719           OSG_ADD_OPT(OSG_VTK_LIBS)
720           OSG_ADD_OPT(VTK_LIBRARY_DIRS)
721           OSG_ADD_OPT(VTK_INCLUDE_DIRS)
722           OSG_ADD_OPT(VTK_DIR)
723       ENDIF(VTK_FOUND)
724     ENDIF(OSG_USE_OSG_VTK_SETUP)
726     OSG_ADD_OPT(VTK_FOUND)
728     ##############
729     #### GLEW
730     ##############
732     IF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
733       OSG_CONFIGURE_GLEW()
735       IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
736         LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
737       ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
739     ENDIF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
741     ##############
742     #### Mini
743     ##############
745     OSG_CONFIGURE_LIBMINI()
747     OSG_ADD_OPT(OSG_LIBMINI_FOUND)
748     OSG_ADD_OPT(OSG_LIBMINI_INCLUDE_DIR)
749     OSG_ADD_OPT(OSG_LIBMINI_LIBRARIES)
751     ###############
752     #### OpenNurbs
753     ###############
755     OSG_CONFIGURE_OPENNURBS()
757     OSG_ADD_OPT(OPENNURBS_FOUND)
758     OSG_ADD_OPT(OPENNURBS_INCLUDE_DIR)
759     OSG_ADD_OPT(OPENNURBS_LIBRARIES)
761     #############
762     #### Python
763     #############
765     FIND_PACKAGE(PythonInterp)
766     FIND_PACKAGE(PythonLibs)
768     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
769     OSG_ADD_OPT(PYTHON_LIBRARY)
771     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
773       FIND_PACKAGE(Boost COMPONENTS python)
775       IF(Boost_FOUND AND WIN32)
777         SET(OSG_BOOST_PYTHON_TARGETS )
778         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
779         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
780       
781       ELSE(Boost_FOUND AND WIN32)
783         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
784            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
786           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
788         ELSE()
789           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
790         ENDIF()
792       ENDIF(Boost_FOUND AND WIN32)
794       # We ignore if boost python fails, we catch that somewhere else
795       # so if we get here Boost_FOUND was true in the first place
796       SET(Boost_FOUND TRUE)
798       FIND_PACKAGE(GCCXML)
800       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
801       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
802       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
804     ENDIF()
807     ###############
808     #### Flex/Bison
809     ###############
811     FIND_PROGRAM(FLEX_EXE flex)
812     FIND_PROGRAM(BISON_EXE bison)
814     OSG_ADD_OPT(FLEX_EXE)
815     OSG_ADD_OPT(BISON_EXE)
817     ##############
818     #### NVPerfSDK
819     ##############
821     OSG_FIND_PACKAGE(NVidiaPerfSDK)
823     IF(NVIDIAPERFSDK_FOUND)
824         OSG_SET(OSG_WITH_NVPERFSDK 1)
825         OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
826         OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
827     ELSE(NVIDIAPERFSDK_FOUND)
828         OSG_SET(OSG_WITH_NVPERFSDK 0)
829         OSG_SET(OSG_NVPERFSDK_INC_DIR "")
830         OSG_SET(OSG_NVPERFSDK_LIBS "")
831     ENDIF(NVIDIAPERFSDK_FOUND)
834     #############
835     #### Support
836     #############
838     IF(UNIX)
839         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
840         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
842         OSG_ADD_OPT(OSG_THREAD_LIB)
843         OSG_ADD_OPT(OSG_DL_LIB)
844     ENDIF(UNIX)
846     IF(APPLE)
847         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
848         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
849         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
850         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
852         OSG_ADD_OPT(OSG_APPLICATIONSERVICES_FRAMEWORK)
853         OSG_ADD_OPT(OSG_CORESERVICES_FRAMEWORK)
854         OSG_ADD_OPT(OSG_CARBON_FRAMEWORK)
855         OSG_ADD_OPT(OSG_COCOA_FRAMEWORK)
856     ENDIF(APPLE)
858     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
860 ENDIF(NOT OSG_BUILD_DEPENDEND)
862 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
863   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
864     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
865   ENDIF(EXISTS
866   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
867 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
869 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
870   INCLUDE(${OSG_GLOBAL_PREP})
871 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
873 IF(APPLE AND OSG_COCOA_FRAMEWORK)
874     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
875 ELSEIF(WIN32)
876     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
877 ELSEIF(UNIX AND X11_FOUND)
878     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
879 ELSEIF(APPLE AND IOS)
880     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
881 ELSE()
882     OSG_SET(OSG_NATIVE_WINDOW "")
883 ENDIF()
885 ###############
886 #### Doxygen
887 ###############
889 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
890   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
891                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
892 ENDIF()
894 FIND_PACKAGE(Doxygen)
896 ##############################################################################
897 # Overrides if dependend
898 ##############################################################################
900 IF(NOT WIN32)
901     IF(OSG_BUILD_DEPENDEND)
902         MESSAGE(STATUS "Load reference settings")
903         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
904         # Needed to get the correct vtk/boost settings
905         FIND_PACKAGE(VTK)
906         OSG_BOOST_DEP_SETUP()
907         OSG_CONFIGURE_QT()
908     ELSE(OSG_BUILD_DEPENDEND)
909 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
910     ENDIF(OSG_BUILD_DEPENDEND)
911 ENDIF(NOT WIN32)
913 ##############################################################################
914 # MAIN BUILD STEPS
915 ##############################################################################
917 # when adding passes, make sure to add a corresponding pass directory variable
918 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
919 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
921 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
922 SET(OSG_PASSDIR_OSGSETUP   "Build")
924 ADD_CUSTOM_TARGET(OSGAll)
926 ###############
927 # Clean
928 ###############
930 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
932 IF(OSG_OLD_BUILD_FILES)
933     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
934 ENDIF(OSG_OLD_BUILD_FILES)
936 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
938 IF(OSG_OLD_CONFIG_FILES)
939     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
940 ENDIF(OSG_OLD_CONFIG_FILES)
942 ###############
943 # Tests
944 ###############
946 ADD_CUSTOM_TARGET(OSGAllApps)
947 ADD_DEPENDENCIES(OSGAll OSGAllApps)
949 # optional pass for test programs
950 IF(OSGBUILD_TESTS)
951     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
952     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
954     ADD_CUSTOM_TARGET(OSGAllTests)
955     ADD_DEPENDENCIES(OSGAll OSGAllTests)
956 ENDIF(OSGBUILD_TESTS)
958 ###############
959 # UnitTests
960 ###############
962 IF(OSGBUILD_UNITTESTS)
963     ENABLE_TESTING()
964     INCLUDE(CTest)
966     # optional pass for unittest programs
967     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
968     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
970     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
971                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
973     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
974     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
975     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
977     ADD_CUSTOM_TARGET(OSGAllUnitTests)
978     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
979 ENDIF(OSGBUILD_UNITTESTS)
981 ###############
982 # Python
983 ###############
985 # optional pass for test programs
986 IF(OSGBUILD_PYTHON_BINDINGS)
987     LIST(APPEND OSG_CMAKE_PASSES "OSGPYTHON")
988     SET(OSG_PASSDIR_OSGPYTHON "Python")
990     IF(EXISTS ${PYOSG_PYPLUSPLUS_DIR})
991       SET(OSG_HAS_PYOSG_PYPLUSPLUS_DIR "True")
992     ELSE()
993       SET(OSG_HAS_PYOSG_PYPLUSPLUS_DIR "False")
994     ENDIF()
996     IF(EXISTS ${PYOSG_PYPLUSPLUS_GOODIES_DIR})
997       SET(OSG_HAS_PYOSG_PYPLUSPLUS_GOODIES_DIR "True")
998     ELSE()
999       SET(OSG_HAS_PYOSG_PYPLUSPLUS_GOODIES_DIR "False")
1000     ENDIF()
1002     SET(OSG_CAN_REGEN_PYTHON_BINDINGS FALSE)
1004     IF(GCCXML                       AND
1005        PYOSG_DIR                    AND
1006        PYOSG_PYPLUSPLUS_DIR         AND 
1007        PYOSG_PYPLUSPLUS_GOODIES_DIR)
1009      IF(EXISTS ${GCCXML}                       AND
1010         EXISTS ${PYOSG_DIR}                    AND
1011         EXISTS ${PYOSG_PYPLUSPLUS_DIR}         AND 
1012         EXISTS ${PYOSG_PYPLUSPLUS_GOODIES_DIR})
1014         SET(OSG_CAN_REGEN_PYTHON_BINDINGS TRUE)
1016       ENDIF()
1017     ENDIF()
1019     EXECUTE_PROCESS(
1020       COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1021                 "${CMAKE_SOURCE_DIR}/Bindings/Python/genLibOrder.py"
1022                 "${CMAKE_BINARY_DIR}/Python/Helper/genLibOrder.py")
1024     FILE(WRITE  "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "# Lib order information\n\n\nlibInfo = {}\n\n")
1025     FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "fullLibInfo = {}\n\n")
1027     IF(EXISTS ${PYOSG_DIR})
1028       FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper")
1030       #########################
1031       # osggen.py
1032       #########################
1034       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osggen.py")
1035       SET(_OSG_FILE_OUT_PROC "${CMAKE_BINARY_DIR}/Python/Helper/processed/osggen.py.proc")
1036       SET(_OSG_FILE_OUT      "${CMAKE_BINARY_DIR}/Python/Helper/osggen.py")
1037       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/osggen.py.patch")
1039       EXECUTE_PROCESS(
1040         COMMAND "${CMAKE_COMMAND}" -E copy
1041                   "${_OSG_FILE_IN}"
1042                   "${_OSG_FILE_OUT_PROC}")
1044       EXECUTE_PROCESS(COMMAND "patch" 
1045                       INPUT_FILE "${_OSG_PATCH_FILE}"
1046                       WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper/processed")
1048       EXECUTE_PROCESS(
1049         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1050                   "${_OSG_FILE_OUT_PROC}"
1051                   "${_OSG_FILE_OUT}")
1054       #########################
1055       # splitGenHelper.py
1056       #########################
1058       EXECUTE_PROCESS(
1059         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1060                   "${CMAKE_SOURCE_DIR}/Bindings/Python/splitGenHelper.py"
1061                   "${CMAKE_BINARY_DIR}/Python/Helper/splitGenHelper.py")
1062      
1063       #########################
1064       # settings.py
1065       #########################
1067       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/settings.py")
1068       SET(_OSG_FILE_OUT_PROC "${CMAKE_BINARY_DIR}/Python/Helper/processed/settings.py.proc")
1069       SET(_OSG_FILE_OUT      "${CMAKE_BINARY_DIR}/Python/Helper/settings.py")
1070       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/settings.py.patch")
1072       EXECUTE_PROCESS(
1073         COMMAND "${CMAKE_COMMAND}" -E copy
1074                   "${_OSG_FILE_IN}"
1075                   "${_OSG_FILE_OUT_PROC}")
1077       EXECUTE_PROCESS(COMMAND "patch" 
1078                       INPUT_FILE "${_OSG_PATCH_FILE}"
1079                       WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper/processed")
1081       EXECUTE_PROCESS(
1082         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1083                   "${_OSG_FILE_OUT_PROC}"
1084                   "${_OSG_FILE_OUT}")
1086       #########################
1087       # PreBoostPython.h
1088       #########################
1090       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/PreBoostPython.h")
1091       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/PreBoostPython.h.proc")
1092       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/PreBoostPython.h")
1094       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1096       STRING(REPLACE "<OpenSG/"
1097                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1099       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1101       EXECUTE_PROCESS(
1102         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1103                   "${_OSG_FILE_OUT_PROC}"
1104                   "${_OSG_FILE_OUT}")
1107       #########################
1108       # OsgPtrHelpers.h
1109       #########################
1111       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/OsgPtrHelpers.h")
1112       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/OsgPtrHelpers.h.proc")
1113       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/OsgPtrHelpers.h")
1115       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1117       STRING(REPLACE "<OpenSG/"
1118                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1120       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1122       EXECUTE_PROCESS(
1123         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1124                   "${_OSG_FILE_OUT_PROC}"
1125                   "${_OSG_FILE_OUT}")
1128       #########################
1129       # pypp_OSGBase_aliases.h
1130       #########################
1132       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/aliases.h")
1133       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/pypp_aliases.h.proc")
1134       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/pypp_aliases.h")
1135       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/pypp_aliases.h.patch")
1137       EXECUTE_PROCESS(
1138         COMMAND "${CMAKE_COMMAND}" -E copy
1139                   "${_OSG_FILE_IN}"
1140                   "${_OSG_FILE_OUT_PROC}")
1142       EXECUTE_PROCESS(COMMAND "patch" 
1143                       INPUT_FILE "${_OSG_PATCH_FILE}"
1144                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed")
1146       EXECUTE_PROCESS(
1147         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1148                   "${_OSG_FILE_OUT_PROC}"
1149                   "${_OSG_FILE_OUT}")
1152       #########################
1153       # ColorWrapper.h
1154       #########################
1156       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/ColorWrapper.h")
1157       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/ColorWrapper.h.proc")
1158       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/ColorWrapper.h")
1160       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1162       STRING(REPLACE "<OpenSG/"
1163                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1165       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1167       EXECUTE_PROCESS(
1168         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1169                   "${_OSG_FILE_OUT_PROC}"
1170                   "${_OSG_FILE_OUT}")
1173       #########################
1174       # VecStorageWrappers.h
1175       #########################
1177       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/VecStorageWrappers.h")
1178       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/VecStorageWrappers.h.proc")
1179       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/VecStorageWrappers.h")
1181       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1183       STRING(REPLACE "<OpenSG/"
1184                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1186       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1188       EXECUTE_PROCESS(
1189         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1190                   "${_OSG_FILE_OUT_PROC}"
1191                   "${_OSG_FILE_OUT}")
1194       #########################
1195       # BaseWrappers.h
1196       #########################
1198       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.h")
1199       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/BaseWrappers.h.proc")
1200       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/BaseWrappers.h")
1201       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Patches/wrappers.h.patch")
1203       EXECUTE_PROCESS(
1204         COMMAND "${CMAKE_COMMAND}" -E copy
1205                   "${_OSG_FILE_IN}"
1206                   "${_OSG_FILE_OUT_PROC}")
1208       EXECUTE_PROCESS(COMMAND "patch" 
1209                       INPUT_FILE "${_OSG_PATCH_FILE}"
1210                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed")
1212       EXECUTE_PROCESS(
1213         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1214                   "${_OSG_FILE_OUT_PROC}"
1215                   "${_OSG_FILE_OUT}")
1218       #########################
1219       # BaseWrappers.cpp
1220       #########################
1222       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.cpp")
1223       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/BaseWrappers.cpp.proc")
1224       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/BaseWrappers.cpp")
1225       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Patches/wrappers.cpp.patch")
1227       EXECUTE_PROCESS(
1228         COMMAND "${CMAKE_COMMAND}" -E copy
1229                   "${_OSG_FILE_IN}"
1230                   "${_OSG_FILE_OUT_PROC}")
1232       EXECUTE_PROCESS(COMMAND "patch" 
1233                       INPUT_FILE "${_OSG_PATCH_FILE}"
1234                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed")
1236       EXECUTE_PROCESS(
1237         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1238                   "${_OSG_FILE_OUT_PROC}"
1239                   "${_OSG_FILE_OUT}")
1243       #########################
1244       # SystemWrappers.h
1245       #########################
1247       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.h")
1248       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed/SystemWrappers.h.proc")
1249       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/SystemWrappers.h")
1250       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Patches/wrappers.h.patch")
1252       EXECUTE_PROCESS(
1253         COMMAND "${CMAKE_COMMAND}" -E copy
1254                   "${_OSG_FILE_IN}"
1255                   "${_OSG_FILE_OUT_PROC}")
1257       EXECUTE_PROCESS(COMMAND "patch" 
1258                       INPUT_FILE "${_OSG_PATCH_FILE}"
1259                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed")
1261       EXECUTE_PROCESS(
1262         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1263                   "${_OSG_FILE_OUT_PROC}"
1264                   "${_OSG_FILE_OUT}")
1267       #########################
1268       # SystemWrappers.cpp
1269       #########################
1271       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.cpp")
1272       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed/SystemWrappers.cpp.proc")
1273       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/SystemWrappers.cpp")
1274       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Patches/wrappers.cpp.patch")
1276       EXECUTE_PROCESS(
1277         COMMAND "${CMAKE_COMMAND}" -E copy
1278                   "${_OSG_FILE_IN}"
1279                   "${_OSG_FILE_OUT_PROC}")
1281       EXECUTE_PROCESS(COMMAND "patch" 
1282                       INPUT_FILE "${_OSG_PATCH_FILE}"
1283                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed")
1285       EXECUTE_PROCESS(
1286         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1287                   "${_OSG_FILE_OUT_PROC}"
1288                   "${_OSG_FILE_OUT}")
1291       #########################
1292       # helpers.py
1293       #########################
1295       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/helpers.py")
1296       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/helpers.py.proc")
1297       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py")
1298       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/helpers.py.patch")
1300       EXECUTE_PROCESS(
1301         COMMAND "${CMAKE_COMMAND}" -E copy
1302                   "${_OSG_FILE_IN}"
1303                   "${_OSG_FILE_OUT_PROC}")
1305       EXECUTE_PROCESS(COMMAND "patch" 
1306                       INPUT_FILE "${_OSG_PATCH_FILE}"
1307                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1309       EXECUTE_PROCESS(
1310         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1311                   "${_OSG_FILE_OUT_PROC}"
1312                   "${_OSG_FILE_OUT}")
1315       #########################
1316       # cored_node.py
1317       #########################
1319       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/cored_node.py")
1320       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/cored_node.py.proc")
1321       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py")
1322       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/cored_node.py.patch")
1324       EXECUTE_PROCESS(
1325         COMMAND "${CMAKE_COMMAND}" -E copy
1326                   "${_OSG_FILE_IN}"
1327                   "${_OSG_FILE_OUT_PROC}")
1329       EXECUTE_PROCESS(COMMAND "patch" 
1330                       INPUT_FILE "${_OSG_PATCH_FILE}"
1331                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1333       EXECUTE_PROCESS(
1334         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1335                   "${_OSG_FILE_OUT_PROC}"
1336                   "${_OSG_FILE_OUT}")
1339       #########################
1340       # fcd_reflector.py
1341       #########################
1343       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/fcd_reflector.py")
1344       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/fcd_reflector.py.proc")
1345       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py")
1346       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/fcd_reflector.py.patch")
1348       EXECUTE_PROCESS(
1349         COMMAND "${CMAKE_COMMAND}" -E copy
1350                   "${_OSG_FILE_IN}"
1351                   "${_OSG_FILE_OUT_PROC}")
1353       EXECUTE_PROCESS(COMMAND "patch" 
1354                       INPUT_FILE "${_OSG_PATCH_FILE}"
1355                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1357       EXECUTE_PROCESS(
1358         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1359                   "${_OSG_FILE_OUT_PROC}"
1360                   "${_OSG_FILE_OUT}")
1362     ENDIF(EXISTS ${PYOSG_DIR})
1364     SET(_OSG_SRC_PYPATH_HELPERS ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers)
1365     SET(_OSG_SRC_PYPATH_OSG     ${CMAKE_BINARY_DIR}/Python/lib/osg2/helpers)
1367     SET(_OSG_DST_PYPATH_HELPERS ${CMAKE_BINARY_DIR}/Python/lib/osg2/helpers)
1368     SET(_OSG_DST_PYPATH_OSG     ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg)
1370     FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Python/lib/osg2)
1371     FILE(MAKE_DIRECTORY ${_OSG_DST_PYPATH_HELPERS})
1372     FILE(MAKE_DIRECTORY ${_OSG_DST_PYPATH_OSG})
1374     OSG_SYMLINK_CHECKED(${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1375                         ${CMAKE_BINARY_DIR}/Python/lib/osg2/__init__.py)
1377     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/cored_node.py
1378                         ${_OSG_DST_PYPATH_HELPERS}/cored_node.py)
1379     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/fcd_reflector.py
1380                         ${_OSG_DST_PYPATH_HELPERS}/fcd_reflector.py)
1381     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/helpers.py
1382                         ${_OSG_DST_PYPATH_HELPERS}/helpers.py)
1383     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/__init__.py
1384                         ${_OSG_DST_PYPATH_HELPERS}/__init__.py)
1386     SET(OSG_PYTHON_COMMON_INCDIR "${CMAKE_SOURCE_DIR}/Bindings/Python/Common" CACHE PATH "" FORCE)
1388     ADD_CUSTOM_TARGET(OSGPy)
1389     IF(OSG_CAN_REGEN_PYTHON_BINDINGS)
1390       ADD_CUSTOM_TARGET(OSGPyGen)
1391     ENDIF()
1392 #    ADD_CUSTOM_TARGET(OSGPyBuild)
1394 ENDIF(OSGBUILD_PYTHON_BINDINGS)
1396 # Neverthless install bindings common headers
1397 INSTALL(FILES "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/PreBoostPython.h"
1398               "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/OsgPtrHelpers.h"
1399               "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/pypp_aliases.h"
1400         DESTINATION include/OpenSG/Bindings/Python/Common
1401         COMPONENT code_headers)
1405 #################
1406 # Documentation I
1407 #################
1408 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1409 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1411 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1412     ADD_CUSTOM_TARGET(Doc)
1413 ENDIF()
1415 IF(DOXYGEN_EXECUTABLE)
1416     SET(DOXYGEN_VERSION)
1417     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1418                     OUTPUT_VARIABLE DOXYGEN_VERSION
1419                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1420     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1421         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1422                         "when building OpenSG documentation. "
1423                         "Please use a different version, sorry for the inconvenience.")
1424     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1425 ENDIF(DOXYGEN_EXECUTABLE)
1427 IF(NOT OSG_DOXY_INPUTS)
1428     # add a pass for doxygen to run
1429     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1430     SET(OSG_PASSDIR_OSGDOXYDOC "Doc")
1431 ENDIF(NOT OSG_DOXY_INPUTS)
1433 # set up variables for the config file
1434 IF(DOXYGEN_DOT_EXECUTABLE)
1435     SET(OSG_DOXY_HAVE_DOT "YES")
1436 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1438 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1439 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1440 SET(OSG_GENDOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/GenDoc/opensg-doxy")
1442 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1444 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1445     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1446     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1447     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1448     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1449     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1450     SET(OSG_DOXY_SEARCHENGINE "NO")
1452 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1453     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1454     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1455     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1456     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1457     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1458     SET(OSG_DOXY_SEARCHENGINE "NO")
1460 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1461     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1462     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1463     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1464     SET(OSG_DOXY_HAVE_DOT "NO")
1465     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1466     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1467     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1468     SET(OSG_DOXY_SEARCHENGINE "NO")
1470 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1472 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1473   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1474 ELSE()
1475   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1476 ENDIF()
1478 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1480 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1481 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1483 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1484   SET(OSG_DOC_SECTION "all_in_one")
1485   SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
1486 ELSE()
1487   SET(OSG_DOC_SECTION "separate")
1488 ENDIF()
1490 # write doxygen config file
1491 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1492                "${OSG_DOXY_CONFIGURATION_FILE}")
1495 # write general doc config file
1497 SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/GenDoc")
1498 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "")
1499 #SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS=${CMAKE_BINARY_DIR}/Doc/html/Full/html")
1501 SET(OSG_DOC_SECTION "${OSG_DOC_SECTION} include_general_doc")
1503 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1504                "${OSG_GENDOXY_CONFIGURATION_FILE}")
1506 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1508 # find/process documentation include files
1509 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1511 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1513   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1515   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1516                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1518 ENDFOREACH()
1520 IF(OSG_DOXY_INPUTS)
1521     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1522                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1523 ENDIF(OSG_DOXY_INPUTS)
1526 IF(DOXYGEN_EXECUTABLE)
1527   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1528   ADD_DEPENDENCIES(DocUpload Doc)
1531   ADD_CUSTOM_TARGET(DocSyncGV
1532                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1533                     WORKING_DIRECTORY Doc)
1535   ADD_CUSTOM_TARGET(DocCompleteGV)
1536   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1537 ENDIF(DOXYGEN_EXECUTABLE)
1539 ADD_CUSTOM_TARGET(OSGAllLibs)
1540 ADD_DEPENDENCIES(OSGAll OSGAllLibs)
1542 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1543 ADD_CUSTOM_TARGET(OSGAllContribLibs)
1545 ###############
1546 # Passes
1547 ###############
1549 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1550   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1552   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1553        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1555   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1556     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1557     INCLUDE(${_OSGCORE_EXT_FILE})
1558   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1561 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1563 # Find files describing libraries to build, but make sure base
1564 # and system are processed first
1565 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1566      "Source/CMakeLists.Lib.OSGBase.txt")
1568 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1569      "Source/CMakeLists.Lib.OSGSystem.txt")
1571 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1572      "Source/*CMakeLists.Lib.*.txt")
1574 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1575 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1577 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1578 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1580 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1581   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1583   IF(_OSG_FOUND_CONTRIB_CONFIG)
1584     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1585   ELSE()
1586     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1587   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1588 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1590 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1592 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1594   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1595                          ${_OSG_LIBRARY_CONFIG}
1596                           PATH)
1598   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1599                          ${_OSG_LIBRARY_CONFIG}
1600                           NAME)
1602   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1603                      ${_OSG_LIBCONFIG_BASENAME})
1605   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1606                          ${_OSG_LIBCONFIG_BASENAME_1}
1607                          NAME_WE)
1609   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1610     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1611   ENDIF()
1613 ENDFOREACH()
1615 IF(OSG_ENABLE_CUDA)
1616   IF(CUDA_FOUND)
1617     SET(OSG_WITH_CUDA 1)
1618   ENDIF(CUDA_FOUND)
1619 ELSE(OSG_ENABLE_CUDA)
1620   SET(OSG_WITH_CUDA 0)
1621 ENDIF(OSG_ENABLE_CUDA)
1622 IF(OPENCL_FOUND)
1623   SET(OSG_WITH_OPENCL)
1624 ENDIF(OPENCL_FOUND)
1626 # run build passes
1627 FOREACH(PASS ${OSG_CMAKE_PASSES})
1628     SET(OSG_CMAKE_PASS ${PASS})
1630     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1632     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1633         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1634         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1635         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1636         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1638         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1640         IF(_OSG_IS_CONTRIBLIB)
1641           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1642         ELSE()
1643           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1644         ENDIF()
1646         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1647     ENDFOREACH(LIBCONFIGFILE)
1649     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1651     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1652         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1653                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1654     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1656 ENDFOREACH()
1658 IF(NOT WIN32)
1659   IF(NOT OSG_BUILD_DEPENDEND)
1660     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1661   ENDIF(NOT OSG_BUILD_DEPENDEND)
1662 ENDIF(NOT WIN32)
1664 ###############
1665 # OSGConfigured
1666 ###############
1669 EXECUTE_PROCESS(
1670     COMMAND "${CMAKE_COMMAND}" -E copy
1671                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1672                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1674 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1675   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1676 ENDFOREACH()
1678 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1680 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1681                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1683 EXECUTE_PROCESS(
1684     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1685                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1686                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1688 #################
1689 # Examples/Simple
1690 #################
1692 ADD_CUSTOM_TARGET(OSGAllExamples)
1693 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1695 IF(OSGBUILD_EXAMPLES_SIMPLE)
1696     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1697     ADD_SUBDIRECTORY("Examples/Simple")
1698     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1699 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1701 ###################
1702 # Examples/Advanced
1703 ###################
1705 IF(OSGBUILD_EXAMPLES_ADVANCED)
1706     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1707     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1708     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1709     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1710 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1712 ###################
1713 # Examples/Advanced
1714 ###################
1716 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1717     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1718     ADD_SUBDIRECTORY("Examples/Tutorial")
1719     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1720 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1722 ###################
1723 # External Examples
1724 ###################
1726 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1727   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1729   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1730     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1731     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1732   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1733 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1735 ##################
1736 # Documentation II
1737 ##################
1739 SET(OSG_DOC_PIPES "")
1741 IF(OSG_DOXY_STDOUT_LOG)
1742     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1743 ENDIF(OSG_DOXY_STDOUT_LOG)
1745 IF(DOXYGEN_EXECUTABLE)
1746     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1747         ADD_CUSTOM_TARGET(Doc
1748             VERBATIM
1749             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1750     ENDIF()
1751 ENDIF()
1753 IF(DOXYGEN_EXECUTABLE)
1754   ADD_CUSTOM_TARGET(GenDoc
1755                     VERBATIM
1756                     COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_GENDOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1757 ENDIF()
1759 ##################
1760 # osg2-config
1761 ##################
1763 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1764 # is generated during the OSGCOLLECT pass.
1766 # substitute variables in static parts
1767 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1768                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1769 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1770                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1772 # read in all parts
1773 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1774 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1775 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1777 # concatenate final file
1778 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1779 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1780 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1782 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1783 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1784 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1786 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1787         DESTINATION bin
1788         COMPONENT development_tools)
1790 ##################
1791 # cmake modules
1792 ##################
1794 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake"
1795         DESTINATION share/OpenSG/cmake
1796         COMPONENT development_configuration)
1797 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1798         DESTINATION share/OpenSG/cmake
1799         COMPONENT development_configuration)
1800 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1801         DESTINATION share/OpenSG/cmake
1802         COMPONENT development_configuration)
1803 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1804         DESTINATION share/OpenSG/cmake
1805         COMPONENT development_configuration)
1806 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1807         DESTINATION share/OpenSG/cmake
1808         COMPONENT development_configuration)
1809 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1810         DESTINATION share/OpenSG/cmake
1811         COMPONENT development_configuration)
1812 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1813         DESTINATION share/OpenSG/cmake
1814         COMPONENT development_configuration)
1815 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1816         DESTINATION share/OpenSG/cmake
1817         COMPONENT development_configuration)
1818 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/SetupCompiler.cmake"
1819         DESTINATION share/OpenSG/cmake
1820         COMPONENT development_configuration)
1821 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/UpdateCompiler.cmake"
1822         DESTINATION share/OpenSG/cmake
1823         COMPONENT development_configuration)
1824 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/BuildFunctions.cmake"
1825         DESTINATION share/OpenSG/cmake
1826         COMPONENT development_configuration)
1827 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/ConfigurePackages.cmake"
1828         DESTINATION share/OpenSG/cmake
1829         COMPONENT development_configuration)
1830 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/ExternalProjectHelper.cmake"
1831         DESTINATION share/OpenSG/cmake
1832         COMPONENT development_configuration)
1833 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1834         DESTINATION share/OpenSG/cmake
1835         COMPONENT development_configuration)
1836 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1837         DESTINATION share/OpenSG/cmake
1838         COMPONENT development_configuration)
1839 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1840         DESTINATION bin
1841         COMPONENT development_tools
1842         PATTERN "*.pyc" EXCLUDE
1843         PATTERN ".svn"  EXCLUDE)
1845 ##################
1846 # Global Python
1847 ##################
1849 IF(OSGBUILD_PYTHON_BINDINGS)
1850   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1851                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1852                   OUTPUT_VARIABLE _OSG_LIBORDER)
1855                  
1856   SET(_OSG_PY_MODNAME_LIST "osg2ModuleNameList = [\n")
1857   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1859   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1860     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1861     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1862     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1863     SET(_OSG_PY_MODNAME_LIST "${_OSG_PY_MODNAME_LIST}  \"${_OSG_LIB}\",\n")
1864   ENDFOREACH()
1866   SET(OSG_PYTHON_ALL_IMPORTS "${_OSG_PY_MODNAME_LIST}  ]\n\n${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1868   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1869   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1872   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1873                  "${_OSG_GEN_INIT_FILE_OUT}")
1875   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1876                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1878   IF(WIN32) 
1880     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1881     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1882     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1883     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1885     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1886             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1887             CONFIGURATIONS Release
1888             COMPONENT      release_runtimes)
1890     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1891             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/osg
1892             CONFIGURATIONS Debug
1893             COMPONENT      debug_runtimes)
1895     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1896             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/osg
1897             CONFIGURATIONS DebugOpt
1898             COMPONENT      debug_opt_runtimes)
1900     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1901             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/osg
1902             CONFIGURATIONS ReleaseNoOpt
1903             COMPONENT      release_no_opt_runtimes)
1906     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1907             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1908             CONFIGURATIONS Release
1909             COMPONENT      release_runtimes)
1911     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1912                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1913                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1914                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1915             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1916             CONFIGURATIONS Release
1917             COMPONENT      release_runtimes)
1920     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1921             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1922             CONFIGURATIONS Debug
1923             COMPONENT      debug_runtimes)
1925     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1926                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1927                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1928                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1929             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1930             CONFIGURATIONS Debug
1931             COMPONENT      debug_runtimes)
1934     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1935             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1936             CONFIGURATIONS DebugOpt
1937             COMPONENT      debug_opt_runtimes)
1939     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1940                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1941                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1942                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1943             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1944             CONFIGURATIONS DebugOpt
1945             COMPONENT      debug_opt_runtimes)
1948     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1949             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1950             CONFIGURATIONS ReleaseNoOpt
1951             COMPONENT      release_no_opt_runtimes)
1953     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1954                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1955                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1956                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1957             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1958             CONFIGURATIONS ReleaseNoOpt
1959             COMPONENT      release_no_opt_runtimes)
1961   ELSE(WIN32)   
1963     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1964     SET(_OSG_PY_INST_BASE 
1965         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1967     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1968             DESTINATION ${_OSG_PY_INST_BASE}/osg
1969             COMPONENT   libraries)
1971     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1972             DESTINATION ${_OSG_PY_INST_BASE}
1973             COMPONENT   libraries)
1975     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1976                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1977                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1978                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1979             DESTINATION ${_OSG_PY_INST_BASE}/helpers
1980             COMPONENT   libraries)
1982   ENDIF(WIN32)
1984 ENDIF()
1986 ##################
1987 # Documentation
1988 ##################
1990 IF(DOXYGEN_EXECUTABLE)
1991     IF(OSG_INSTALL_DOXYDOC)
1992         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1993                 DESTINATION share/OpenSG/documentation
1994                 COMPONENT documentation)
1995     ENDIF()
1996 ENDIF()
1998 ##################
1999 # Images/Icons
2000 ##################
2002 ##################
2003 # CSM Example
2004 ##################
2006 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
2007         DESTINATION share/OpenSG/Examples/
2008         COMPONENT examples_basic)
2010 ##################
2011 # Packaging
2012 ##################
2014 IF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
2016     SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
2018     SET(CPACK_PACKAGE_NAME                "OpenSG")
2019     SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
2020     SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
2021     SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
2022     SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
2023     SET(CPACK_PACKAGE_VENDOR              "OpenSG")
2024     SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
2025     SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
2026     SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
2027     SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
2029     if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
2030         set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
2031         set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
2032     endif ()
2034     if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
2035         set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
2036     endif()
2038     #Define Components
2039     SET(CPACK_COMPONENTS_ALL development_tools
2040         development_configuration
2041         code_headers
2042         libraries
2043         debug_program_db
2044         release_program_db
2045         debug_libraries
2046         release_libraries
2047         debug_runtimes
2048         release_runtimes
2049         data_images
2050         examples_basic
2051         examples_advanced
2052         Unspecified
2053         )
2056     #Components
2057     #Runtime
2058     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
2060     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
2061     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
2062     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
2063     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
2065     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
2066     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
2067     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
2068     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
2070     #Development
2071     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
2073     #Libraries
2074     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
2075     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
2076     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
2077     set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
2079     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
2080     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
2081     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
2082     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
2084     #Program database
2085     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
2086     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
2087     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
2088     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
2090     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
2091     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
2092     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
2093     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
2095     #Tools
2096     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
2097     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
2098     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
2099     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
2101     #Configuration
2102     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
2103     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
2104     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
2105     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
2107     #Headers
2108     SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
2109     SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
2110     SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
2111     SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
2113     #Examples
2114     SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
2116     SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
2117     SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
2118     SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
2119     SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
2121     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
2122     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
2123     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
2124     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
2126     #Shared Data
2127     SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
2129     SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
2130     SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
2131     SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
2132     SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
2134     #Documentation
2135     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
2137     #Dependencies
2138     #Boost
2139     #Base
2141     #NSIS specific configuration
2142     IF(WIN32)
2143         INCLUDE(InstallRequiredSystemLibraries)
2144         IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
2145             IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
2146                          ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
2147                  include(CMakeDetermineVSServicePack)
2148                  DetermineVSServicePack( my_service_pack )
2150                  IF( my_service_pack )
2151                      SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
2152                  ENDIF()
2153             ENDIF()
2155             #Extra install commands
2156             SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
2157             SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
2160             SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
2161             SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
2162             FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
2163             SET(CPACK_NSIS_MODIFY_PATH         ON)
2164             SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
2165             SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
2166             SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
2167             SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
2168             SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
2169             SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
2170             SET(CPACK_NSIS_MENU_LINKS          "")
2171             #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
2172             #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
2173         ENDIF()
2174     ENDIF()
2177     # Date macro by Benoit RAT (www.neub.co.nr)
2178     MACRO (TODAY RESULT)
2179         IF (WIN32)
2180             EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
2181             string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
2182         ELSEIF(UNIX)
2183             EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
2184             string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
2185         ELSE (WIN32)
2186             MESSAGE(SEND_ERROR "date not implemented")
2187             SET(${RESULT} 000000)
2188         ENDIF (WIN32)
2189     ENDMACRO (TODAY)
2191     TODAY(DATE)
2193     # Determine package type
2194     IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
2195         IF(WIN32)
2196             SET(OSGBUILD_PACKAGE_TYPE "ZIP")
2197         ELSE(WIN32)
2198             SET(OSGBUILD_PACKAGE_TYPE "RPM")
2199         ENDIF(WIN32)
2200     ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
2202     STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
2204     IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
2205         SET( PACK_EXT "tar.bz2" )
2206     ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
2207         SET( PACK_EXT "tar.gz" )
2208     ELSE()
2209         STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
2210     ENDIF()
2212     SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
2213     SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
2215     INCLUDE(CPack)
2218     # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
2219     IF(WIN32)
2220         #TODO: Need a way to do this on Windows
2221         #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 )
2222         #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
2223     ELSE(WIN32)
2224         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 )
2225         ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
2226     ENDIF(WIN32)
2229 ENDIF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
2231 IF(NOT WIN32)
2232   CONFIGURE_FILE(CMake/CMakeLists.packaging.unix.txt 
2233                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
2234                  @ONLY                                      )
2235 ELSE()
2237   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
2238     SET(OSG_WIN_SEC "nosec")
2239   ELSE()
2240     SET(OSG_WIN_SEC "msdefault")
2241   ENDIF()
2243   CONFIGURE_FILE(CMake/CMakeLists.packaging.win.txt 
2244                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
2245                  @ONLY                                      )
2246   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico"
2247           DESTINATION share/OpenSG/Packaging
2248           COMPONENT packaging
2249           PERMISSIONS OWNER_WRITE OWNER_READ
2250                       GROUP_READ
2251                       WORLD_READ            )
2253   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp"
2254           DESTINATION share/OpenSG/Packaging
2255           COMPONENT packaging
2256           PERMISSIONS OWNER_WRITE OWNER_READ
2257                       GROUP_READ
2258                       WORLD_READ            )
2259 ENDIF()
2261 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
2262         DESTINATION share/OpenSG/Packaging
2263         COMPONENT packaging
2264         PERMISSIONS OWNER_WRITE OWNER_READ
2265                     GROUP_READ
2266                     WORLD_READ
2267         RENAME CMakeLists.txt)
2269 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
2270         DESTINATION share/doc/OpenSG/
2271         COMPONENT doc
2272         PERMISSIONS OWNER_WRITE OWNER_READ
2273                     GROUP_READ
2274                     WORLD_READ)
2276 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/PLY/README
2277         DESTINATION share/doc/OpenSG/
2278         COMPONENT doc
2279         PERMISSIONS OWNER_WRITE OWNER_READ
2280                     GROUP_READ
2281                     WORLD_READ
2282         RENAME README.ply)
2284 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/TrapezoidalShadowMaps/README
2285         DESTINATION share/doc/OpenSG/
2286         COMPONENT doc
2287         PERMISSIONS OWNER_WRITE OWNER_READ
2288                     GROUP_READ
2289                     WORLD_READ
2290         RENAME README.tsm)
2292 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README
2293         DESTINATION share/doc/OpenSG/
2294         COMPONENT doc
2295         PERMISSIONS OWNER_WRITE OWNER_READ
2296                     GROUP_READ
2297                     WORLD_READ
2298         RENAME README.rhine)
2300 IF(WIN32)
2301   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
2302                                 CACHE STRING "OpenSG Build Types" FORCE )
2303 ELSE()
2304   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
2305                                 CACHE STRING "OpenSG Build Types" FORCE )
2306 ENDIF(WIN32)
2307 IF(APPLE AND IOS)
2308   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
2309                                 CACHE STRING "OpenSG Build Types" FORCE )
2310 ENDIF()
2312 IF(WIN32)
2313   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2314        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
2316   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2317        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
2319 ENDIF(WIN32)
2321 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2322      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
2324 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2325      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
2327 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2328      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
2330 ###########################
2331 # Component install Setting
2332 ###########################
2334 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
2336 IF(NOT WIN32)
2337   ADD_CUSTOM_TARGET(OSG_preinstall
2338                     make preinstall
2339                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2340 ELSE()
2341 ENDIF()
2343 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
2345   IF(NOT WIN32)
2346     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2347                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
2348                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2349   ELSE()
2351     SET(_OSG_CMP_CONF Release)
2353     IF(${_OSG_CMP} MATCHES ^debug_)
2354       SET(_OSG_CMP_CONF Debug)
2355     ENDIF()
2357     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2358                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
2359                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2361     SET_PROPERTY(TARGET INSTALL_${_OSG_CMP} PROPERTY FOLDER "Packaging")
2362   ENDIF()
2364   IF(NOT WIN32)
2365     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
2366   ELSE()
2367   ENDIF()
2368 ENDFOREACH()
2371 IF(WIN32)
2373   ADD_CUSTOM_TARGET(INSTALL_runtime)
2375   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_runtimes)
2376   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_binaries)
2378   SET_PROPERTY(TARGET INSTALL_runtime PROPERTY FOLDER "Packaging")
2380 ELSE()
2382   ADD_CUSTOM_TARGET(INSTALL_runtime)
2384   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
2385   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_binaries)
2386 ENDIF()
2388 #IF(WIN32)
2389 #  SET_PROPERTY(TARGET ALL_BUILD PROPERTY FOLDER "CMakePredefinedTargets")
2390 #ENDIF()
2392 ################
2393 # Build Setting
2394 ################
2396 IF(NOT WIN32)
2397   IF(NOT OSG_BUILD_DEPENDEND)
2398     OSG_WRITE_OSGBUILD(${CMAKE_BINARY_DIR}/CMake.build.settings)
2399   ENDIF(NOT OSG_BUILD_DEPENDEND)
2400 ENDIF(NOT WIN32)
2402 IF(OSG_WITH_CUDA)
2403   CUDA_BUILD_CLEAN_TARGET()
2404 ENDIF(OSG_WITH_CUDA)
2407 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2409 FOREACH(_variableName ${_variableNames})
2410   IF(_variableName MATCHES "^OSG")
2411 #    MESSAGE("FOO : ${_variableName}")
2412 #    FILE(APPEND ${FILENAME}
2413 #         "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2414   ENDIF()
2415 ENDFOREACH()