changed: example install, installed example build
[opensg.git] / CMakeLists.txt
blob73a3aa8900abdcb5db343c3472e1df190aca2b30
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 # Diable boost cmake config, as it screws up OpenSG's boost config
13 SET(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "" FORCE)
15 ##############################################
16 # Initial cache to make life easier on Windows
17 ##############################################
19 IF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt AND NOT OSG_BUILD_DEPENDEND)
20   INCLUDE(${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt)
21   SET(_OSGINITCACHELOADED TRUE CACHE INTERNAL "")
22 ENDIF(NOT _OSGINITCACHELOADED AND EXISTS ${CMAKE_SOURCE_DIR}/CMakeCacheInitial.txt AND NOT OSG_BUILD_DEPENDEND)
25 INCLUDE(BuildFunctions)
27 ##########################
28 # Disallow in-source build
29 ##########################
31 IF("${OpenSG_SOURCE_DIR}"  STREQUAL "${OpenSG_BINARY_DIR}")
32   MESSAGE(FATAL_ERROR "OpenSG requires an out of source Build. \n"
33                       "Please create a separate binary directory and run "
34                       "CMake there.")
35 ENDIF("${OpenSG_SOURCE_DIR}"  STREQUAL "${OpenSG_BINARY_DIR}")
37 SET(OSG_BUILD_ACTIVE TRUE)
39 ##############################################################################
40 # BUILD OPTIONS
41 ##############################################################################
43 IF(NOT WIN32)
44     IF(OSG_BUILD_DEPENDEND)
45         # Hide it from further manipulation
46         SET(OSG_BUILD_DEPENDEND ${OSG_BUILD_DEPENDEND} CACHE INTERNAL "")
47     ENDIF(OSG_BUILD_DEPENDEND)
48 ENDIF(NOT WIN32)
50 OPTION(OSG_VERBOSE_BUILD_MESSAGES "Print verbose messages when generating the build system" OFF)
51 MARK_AS_ADVANCED(OSG_VERBOSE_BUILD_MESSAGES)
53 OSG_OPTION(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
55 OSG_OPTION(OSGBUILD_TESTS                        "Build test programs" ON)
56 OSG_OPTION(OSGBUILD_UNITTESTS                    "Build/run unit test programs" OFF)
57 OSG_OPTION(OSGBUILD_EXAMPLES_SIMPLE              "Build example programs during system build" OFF)
58 OSG_OPTION(OSGBUILD_EXAMPLES_ADVANCED            "Build advanced example programs during system build" OFF)
59 OSG_OPTION(OSGBUILD_EXAMPLES_TUTORIAL            "Build tutorial example programs during system build" OFF)
60 OSG_OPTION(OSGBUILD_PYTHON_BINDINGS              "Build python bindings" OFF)
61 OSG_OPTION(OSGBUILD_PYTHON_DUMP_DECLS            "Dump decls while building python" FALSE)
63 OSG_OPTION(OSGEXCLUDE_TESTS_FROM_ALL             "Exclude test programs from all target" OFF)
64 OSG_OPTION(OSGEXCLUDE_UNITTESTS_FROM_ALL         "Build/run unit test programs" OFF)
65 OSG_OPTION(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL   "Build example programs during system build" OFF)
66 OSG_OPTION(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL "Build advanced example programs during system build" OFF)
68 OSG_OPTION(OSGBUILD_ENABLE_PACKAGING "Generate binary packages with CPack" OFF)
69 SET(OSGBUILD_PACKAGE_TYPE "" CACHE STRING
70     "The type of package to generate (empty->default)")
72 OSG_OPTION(OSG_ENABLE_NEW_SHADER "" ON)
73 OSG_OPTION(OSG_ENABLE_OGL2_SHADERFUNCTIONS "" ON)
74 OSG_OPTION(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS "" OFF)
75 OSG_OPTION(OSG_ENABLE_NEW_GEOHANDLER "" OFF)
76 OSG_OPTION(OSG_ENABLE_OGL_COREONLY "" OFF)
77 OSG_OPTION(OSG_ENABLE_OGL_ES2 "" OFF)
78 OSG_OPTION(OSG_ENABLE_OGL_ES2_SIMGL3 "" OFF)
79 OSG_OPTION(OSG_ENABLE_CSM_WIN7_FEATURES "" OFF)
81 OSG_OPTION(OSG_ENABLE_OGL3_PROTOS "" OFF)
82 OSG_OPTION(OSG_ENABLE_OGL4_PROTOS "" OFF)
83 OSG_OPTION(OSG_ENABLE_OGLES_PROTOS "" OFF)
85 OSG_OPTION(OSG_ENABLE_GL_INCLUDE_GLEW "" OFF)
87 OSG_SET_CACHE(OSG_SHADER_CACHE_MODE 5 STRING "")
89 OSG_OPTION(OSG_ENABLE_FCD2CODE "" OFF)
90 OSG_OPTION(OSG_FCD2CODE_WRITE_CLASS "Write class file during cmake run if only
91 the fcd file is found" OFF)
92 OSG_OPTION(OSG_ENABLE_SCANPARSE_REGEN "" OFF)
94 OSG_OPTION(OSG_ENABLE_GLDEFINE_MAPPER "" ON)
95 OSG_OPTION(OSG_ENABLE_NEW_OSB_IO "" ON)
97 OSG_OPTION(OSG_ENABLE_SSE2        "" ON)
98 OSG_OPTION(OSG_USE_OSG2_NAMESPACE "" OFF)
99 OSG_OPTION(OSG_ENABLE_CUDA "Build OpenSG with CUDA support" ON)
101 OSG_OPTION(OSG_ENABLE_TESTCONTAINER "" OFF)
102 OSG_OPTION(OSG_ENABLE_VALGRIND_CHECKS "" OFF)
103 OSG_OPTION(OSG_ENABLE_MEMORY_DEBUGGING "" OFF)
104 OSG_OPTION(OSG_ENABLE_DOUBLE_MATRIX_STACK "" OFF)
105 OSG_OPTION(OSG_ENABLE_DEFAULT_READONLY_CHANGELIST "" OFF)
106 OSG_OPTION(OSG_ENABLE_PAR_PARTITION_DRAWING "" OFF)
107 OSG_OPTION(OSG_DISABLE_SOURCE_GROUPS "" OFF)
108 OSG_OPTION(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE "" OFF)
110 OSG_SET_CACHE(OSG_PYTHON_MODULE_BASE_DIR "" PATH "")
112 IF(WIN32)
113   OPTION(OSG_ENABLE_WIN_LOCALSTORAGE "" ON)
114   OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
116   IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
117     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
118   ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
119     OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
120   ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
121 ELSEIF(APPLE)
122   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" OFF)
123 ELSEIF(UNIX)
124   OPTION(OSG_ENABLE_ELF_LOCALSTORAGE "" ON)
125 ENDIF()
127 OPTION(OSG_ENABLE_AUTOINIT_THREADS "" OFF)
129 IF(WIN32)
130   OSG_OPTION(OSG_USE_SEPARATE_LIBDIRS "" ON)
131   OSG_OPTION(OSG_INSTALL_PDB_FILES "" OFF)
132 ENDIF(WIN32)
134 OSG_OPTION(OSG_INSTALL_EXAMPLES "" OFF)
135 OSG_OPTION(OSG_INSTALL_EXAMPLE_EXE "" OFF)
136 OSG_OPTION(OSG_INSTALL_APPS "" ON)
138 OSG_OPTION(OSGCOMPAT_ENABLE                  "" OFF)
139 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED       "" OFF)
140 OSG_OPTION(OSGCOMPAT_ENABLE_DEPRECATED_PROPS "" OFF)
142 OSG_SET_CACHE(OSG_RENDERPROPERTY_BITS 64 STRING "")
143 OSG_SET_CACHE(OSG_RENDERPROPERTY_UNIQUE_BITS 16 STRING "")
145 OSG_OPTION(OSG_GENERATE_SEPARATE_LIB_DOC "Generate separate doxygen documentation for contrib libraries" OFF)
146 OSG_OPTION(OSG_INSTALL_DOXYDOC "Install Doxygen documentation" OFF)
148 SET(OSG_DOXY_DOC_TYPE "User" CACHE STRING
149     "The type of documentation to generate (User, Developer, Trac)")
150 SET(OSG_DOXY_INPUTS CACHE FILEPATH "include given file instead of autogen")
151 SET(OSG_DOXY_STDOUT_LOG CACHE FILEPATH "log std to file")
153 # Not sure
154 #OPTION(OSG_ENABLE_MTCPTR "" ON)
155 #OPTION(OSG_ENABLE_GIF    "" ON)
157 ## prep options for OSGConfigured.h
159 IF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
160   SET(OSG_DISABLE_DEPRECATED 1)
161 ENDIF(NOT OSGCOMPAT_ENABLE_DEPRECATED)
163 IF(OSG_USE_OSG2_NAMESPACE)
164   ADD_DEFINITIONS(-DOSG_USE_OSG2_NAMESPACE=1)
165 ENDIF()
167 IF(OSG_ENABLE_SSE2)
168   SET(OSG_SIMD_SSE 1)
169 ENDIF(OSG_ENABLE_SSE2)
171 IF(OSG_ENABLE_NEW_OSB_IO)
172   SET(OSG_NEW_OSB_IO 1)
173 ENDIF(OSG_ENABLE_NEW_OSB_IO)
175 IF(OSG_ENABLE_GLDEFINE_MAPPER)
176   SET(OSG_GL_DEFMAPPER 1)
177 ENDIF(OSG_ENABLE_GLDEFINE_MAPPER)
179 IF(OSG_ENABLE_OGL2_SHADERFUNCTIONS)
180   SET(OSG_OGL2_SHADERFUNCS 1)
181 ENDIF(OSG_ENABLE_OGL2_SHADERFUNCTIONS)
183 IF(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS)
184   SET(OSG_OGL_VERTEXATTRIB_FUNCS 1)
185 ENDIF(OSG_ENABLE_OGL_VERTEXATTRIB_FUNCS)
187 IF(OSG_ENABLE_NEW_GEOHANDLER)
188   SET(OSG_NEW_GEOHANDLER 1)
189 ENDIF(OSG_ENABLE_NEW_GEOHANDLER)
191 IF(OSG_ENABLE_OGL_COREONLY)
192   SET(OSG_OGL_COREONLY 1)
193 ENDIF(OSG_ENABLE_OGL_COREONLY)
195 IF(OSG_ENABLE_GL_INCLUDE_GLEW)
196   SET(OSG_GL_INCLUDE_GLEW 1)
197 ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW)
199 IF(OSG_ENABLE_OGL_ES2)
200   SET(OSG_OGL_ES2 1)
201   SET(OSG_OGL_NO_DOUBLE 1)
202 ENDIF(OSG_ENABLE_OGL_ES2)
204 IF(OSG_ENABLE_OGLES_PROTOS)
205   SET(OSG_USE_OGLES_PROTOS 1)
206   SET(GL_GLEXT_PROTOTYPES 1)
207 ENDIF(OSG_ENABLE_OGLES_PROTOS)
209 IF(OSG_ENABLE_OGL3_PROTOS)
210   SET(GL_GLEXT_PROTOTYPES 1)
211   SET(GL3_PROTOTYPES 1)
212   SET(OSG_USE_OGL3_PROTOS 1)
213 ENDIF(OSG_ENABLE_OGL3_PROTOS)
215 IF(OSG_ENABLE_OGL4_PROTOS)
216   SET(GL_GLEXT_PROTOTYPES 1)
217   SET(GL3_PROTOTYPES 1)
218   SET(OSG_USE_OGL3_PROTOS 1)
219   SET(OSG_USE_OGL4_PROTOS 1)
220 ENDIF(OSG_ENABLE_OGL4_PROTOS)
222 IF(OSG_ENABLE_OGL_ES2_SIMGL3)
223   SET(OSG_OGL_ES2_SIMGL3 1)
224 ENDIF(OSG_ENABLE_OGL_ES2_SIMGL3)
226 IF(OSG_ENABLE_NEW_SHADER)
227   SET(OSG_NEW_SHADER 1)
228 ENDIF(OSG_ENABLE_NEW_SHADER)
230 IF(OSGCOMPAT_ENABLE)
231   SET(OSG_1_COMPAT 1)
232 ENDIF(OSGCOMPAT_ENABLE)
234 IF(NOT OSG_ENABLE_SCANPARSE_REGEN)
235   SET(OSG_PREBUILD_SCANPARSE 1)
236 ENDIF(NOT OSG_ENABLE_SCANPARSE_REGEN)
238 IF(OSG_ENABLE_ELF_LOCALSTORAGE)
239   SET(OSG_PTHREAD_ELF_TLS 1)
240 ENDIF(OSG_ENABLE_ELF_LOCALSTORAGE)
242 IF(OSG_ENABLE_WIN_LOCALSTORAGE)
243   SET(OSG_WIN32_ASPECT_USE_LOCALSTORAGE 1)
244 ENDIF(OSG_ENABLE_WIN_LOCALSTORAGE)
246 IF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
247   SET(OSG_DEPRECATED_PROPS 1)
248 ENDIF(OSGCOMPAT_ENABLE_DEPRECATED_PROPS)
250 SET(OSG_SHC_MODE_${OSG_SHADER_CACHE_MODE} 1)
252 IF(NOT IOS)
253   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
254   SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
255   SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
256 ENDIF(NOT IOS)
258 INCLUDE(ConfigurePackages)
260 LIST(APPEND OSG_ADDITIONAL_CONFIGURE_LINES "")
262 IF(OSGEXCLUDE_TESTS_FROM_ALL)
263   SET(OSGEXCLUDE_TESTS EXCLUDE_FROM_ALL)
264 ELSE()
265   SET(OSGEXCLUDE_TESTS "")
266 ENDIF()
268 IF(OSGEXCLUDE_UNITTESTS_FROM_ALL)
269   SET(OSGEXCLUDE_UNITTESTS EXCLUDE_FROM_ALL)
270 ELSE()
271   SET(OSGEXCLUDE_UNITTESTS "")
272 ENDIF()
274 IF(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL)
275   SET(OSGEXCLUDE_EXAMPLES_SIMPLE EXCLUDE_FROM_ALL)
276 ELSE()
277   SET(OSGEXCLUDE_EXAMPLES_SIMPLE "")
278 ENDIF()
280 IF(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL)
281   SET(OSGEXCLUDE_EXAMPLES_ADVANCED EXCLUDE_FROM_ALL)
282 ELSE()
283   SET(OSGEXCLUDE_EXAMPLES_ADVANCED "")
284 ENDIF()
286 #####################
287 # External extensions
288 #####################
290 OSG_SET_CACHE(OSG_EXTRA_EXTERNAL_MODULES "" STRING
291               "Extra modules that OpenSG will try to import.")
293 OSG_SET_CACHE(OSG_IGNORE_INSTALL "" STRING
294               "Extra modules that OpenSG will build but not installed.")
296 OSG_SET_CACHE(OSG_EXTERNAL_MODULES_INCLUDE "" FILEPATH 
297               "Include file of extra modules")
299 IF(EXISTS "${OSG_EXTERNAL_MODULES_INCLUDE}")
300   INCLUDE("${OSG_EXTERNAL_MODULES_INCLUDE}")
301 ENDIF()
303 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_MODULES})
304     OPTION(OSGBUILD_${EXTERNAL}
305            "Build using ${EXTERNAL} module" OFF)
307     IF(OSGBUILD_${EXTERNAL})
308         FIND_PATH(OSG_${EXTERNAL}_SOURCE_DIR
309                   CMakeLists.Lib.${EXTERNAL}.txt
310                   ${CMAKE_CURRENT_SOURCE_DIR}/../${EXTERNAL})
312         OSG_ADD_OPT(OSG_${EXTERNAL}_SOURCE_DIR)
314         IF(NOT EXISTS
315                 ${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.Lib.${EXTERNAL}.txt)
317             MESSAGE(SEND_ERROR "Cannot find ${EXTERNAL} sources directory: "
318                                "${OSG_${EXTERNAL}_SOURCE_DIR}")
319         ELSE()
320             LIST(APPEND OSG_EXTERNAL_CONFIGS "${EXTERNAL}")
321         ENDIF()
322     ENDIF()
323 ENDFOREACH(EXTERNAL)
325 OSG_OPTION(OSG_LINK_EXTERNAL_MODULES_TO_CSM "" FALSE)
328 ##############
329 # Compiler
330 ##############
332 SET(OSG_PLATFORM_64 0)
333 SET(OSG_PLATFORM_32 0)
334 SET(OSG_APPLE64     0)
335 SET(OSG_APPLE32     0)
336 SET(OSG_LIBDIR_SUFFIX "")
338 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
339   SET(OSG_PLATFORM_64 1)
340   SET(OSG_LIBDIR_SUFFIX "64")
342   IF(NOT WIN32)
343     SET(OSG_LIBDIR_BASE_SUFFIX "64")
344   ENDIF(NOT WIN32)
346   IF(APPLE)
347     SET(OSG_APPLE64 1)
348   ENDIF(APPLE)
349 ELSE()
350   SET(OSG_PLATFORM_32 1)
352   IF(APPLE)
353     SET(OSG_APPLE32 1)
354   ENDIF(APPLE)
355 ENDIF()
358 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
359     SET(LINUX 1)
360 ENDIF()
362 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
363   SET(CMAKE_BUILD_TYPE Debug CACHE STRING
364       "Choose the type of build, options are: Debug Release."
365       FORCE)
366 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
368 IF(NOT WIN32) 
369   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"          AND 
370      NOT CMAKE_BUILD_TYPE STREQUAL "DebugGV"        AND
371      NOT CMAKE_BUILD_TYPE STREQUAL "Release"        AND
372      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseGV"      AND
373      NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"   )
375     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
376                         "Please use either Release or Debug")
378   ENDIF()
379 ELSEIF(NOT MSVC_IDE)
381   IF(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
382     SET(CMAKE_BUILD_TYPE DebugOpt CACHE STRING
383         "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}."
384         FORCE)  
385   ENDIF()
387   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"    AND 
388      NOT CMAKE_BUILD_TYPE STREQUAL "DebugOpt" AND
389      NOT CMAKE_BUILD_TYPE STREQUAL "Release"  AND
390      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseNoOpt")
392     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
393                         "Please use on of ${CMAKE_CONFIGURATION_TYPES}")
395   ENDIF()
396 ENDIF()
398 IF(NOT OSG_COMPILER_DEFAULTS)
399    INCLUDE(CMake/SetupCompiler.cmake)
400    SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) #INTERNAL
401 ENDIF(NOT OSG_COMPILER_DEFAULTS)
403 INCLUDE(CMake/UpdateCompiler.cmake)
405 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
406    CMAKE_BUILD_TYPE STREQUAL "DebugGV")
408     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
409     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
411 ENDIF()
413 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
415 OSG_CHECK_INSTALL()
417 ##############################################################################
418 # DEPENDENCIES
419 ##############################################################################
421 # Global include/library dirs, libs and definitions
422 SET(OSG_GLOBAL_DEP_INCDIR "")
423 SET(OSG_GLOBAL_DEP_LIBDIR "")
424 SET(OSG_GLOBAL_DEP_LIBS   "")
425 SET(OSG_GLOBAL_DEP_DEFS   "")
428 #IF(WIN32)
429   OSG_OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
430   OSG_OPTION(OSG_USE_STATIC_SUPPORT_LIBS "" OFF)
432   IF(OSG_USE_OSGSUPPORT_LIBS)
433     OSG_SET_CACHE(OSG_SUPPORT_ROOT "" PATH "")
434   ENDIF(OSG_USE_OSGSUPPORT_LIBS)
436   IF(EXISTS "${OSG_SUPPORT_ROOT}" AND
437      EXISTS "${OSG_SUPPORT_ROOT}/include/OSGSupportConfig.cmake")
439     INCLUDE("${OSG_SUPPORT_ROOT}/include/OSGSupportConfig.cmake")
441     SET(_OSG_FATAL_DMS_COMBO  FALSE)
442     SET(_OSG_FATAL_ITER_COMBO FALSE)
444     IF( NOT OSG_DISABLE_MICROSOFT_SECURE_CXXX AND     OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
445       SET(_OSG_FATAL_DMS_COMBO TRUE)
446     ENDIF()
448     IF(     OSG_DISABLE_MICROSOFT_SECURE_CXXX AND NOT OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
449       SET(_OSG_FATAL_DMS_COMBO TRUE)
450     ENDIF()
452     IF(_OSG_FATAL_DMS_COMBO)
454       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_SECURE settings:\n"
455                           "  Support : ${OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX}\n"
456                           "  OpenSG  : ${OSG_DISABLE_MICROSOFT_SECURE_CXXX}")
458     ENDIF()
461     IF( NOT OSG_DISABLE_MS_ITERATOR_DEBUGGING AND     OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
462       SET(_OSG_FATAL_ITER_COMBO TRUE)
463     ENDIF()
465     IF(     OSG_DISABLE_MS_ITERATOR_DEBUGGING AND NOT OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
466       SET(_OSG_FATAL_ITER_COMBO TRUE)
467     ENDIF()
469     IF(_OSG_FATAL_ITER_COMBO)
471       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_ITER_DEBUG settings:\n"
472                           "  Support : ${OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING}\n"
473                           "  OpenSG  : ${OSG_DISABLE_MS_ITERATOR_DEBUGGING}")
475     ENDIF()
476   ENDIF()
478 IF(WIN32)
479    SET(OSG_INSTALL_SUBDIR "" CACHE STRING "add subdir to installed libs")
480 ENDIF(WIN32)
482 IF(NOT OSG_BUILD_DEPENDEND)
484     ##########
485     #### boost
486     ##########
488     OSG_CONFIGURE_BOOST()
490     #########
491     #### zlib
492     #########
494     OSG_CONFIGURE_ZLIB()
496 #    MESSAGE(STATUS "zlib: ${ZLIB_FOUND}")
498     IF(UNIX AND NOT OSG_APPLE32)
499         #############
500         #### Freetype
501         #############
503         FIND_PACKAGE(Freetype)
505         IF(FREETYPE_FOUND)
506             OSG_SET(OSG_WITH_FT2 1)
508             FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig)
510             IF(FONTCONFIG_LIBRARY MATCHES "fontconfig")
511                 OSG_SET(OSG_WITH_FONTCONFIG 1)
512             ENDIF()
514         ENDIF(FREETYPE_FOUND)
516         OSG_ADD_OPT(FREETYPE_FOUND)
517         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_freetype2)
518         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_ft2build)
519         OSG_ADD_OPT(FONTCONFIG_LIBRARY)
520         OSG_ADD_OPT(FREETYPE_LIBRARIES)
521     ENDIF(UNIX AND NOT OSG_APPLE32)
523     ##############
524     #### ImageLibs
525     ##############
527     OSG_CONFIGURE_TIFF()
528     OSG_CONFIGURE_PNG()
529     OSG_CONFIGURE_JPEG()
530     OSG_CONFIGURE_GDAL()
531     OSG_CONFIGURE_OPENEXR()
533     SET(OSG_EXTERNAL_IMAGELIBS)
534     SET(OSG_EXTERNAL_IMAGEINCS)
536 #    MESSAGE(STATUS "tiff: ${TIFF_FOUND} - png ${PNG_FOUND} - jpg: ${JPEG_FOUND} - exr ${OPENEXR_FOUND}")
538     IF(TIFF_FOUND)
539         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
540         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
541         OSG_SET(OSG_WITH_TIF 1)
542         OSG_ADD_OPT(TIFF_LIBRARIES)
543     ENDIF(TIFF_FOUND)
545     IF(PNG_FOUND)
546         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
547         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
548         OSG_SET(OSG_WITH_PNG 1)
549         OSG_ADD_OPT(PNG_LIBRARIES)
550     ENDIF(PNG_FOUND)
552     IF(JPEG_FOUND)
553         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
554         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
555         OSG_SET(OSG_WITH_JPG 1)
556         OSG_ADD_OPT(JPEG_LIBRARIES)
557     ENDIF(JPEG_FOUND)
559     IF(GDAL_FOUND)
560         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
561         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
562         OSG_SET(OSG_WITH_GDAL 1)
563         OSG_ADD_OPT(GDAL_LIBRARIES)
564     ENDIF(GDAL_FOUND)
566     IF(OPENEXR_FOUND)
567         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
568         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
569         OSG_SET(OSG_WITH_IMF 1)
571         OSG_ADD_OPT(OPENEXR_LIBRARIES)
572         OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
573     ENDIF(OPENEXR_FOUND)
576     OSG_ADD_OPT(OSG_EXTERNAL_IMAGELIBS)
577     OSG_ADD_OPT(OSG_EXTERNAL_IMAGEINCS)
579     #############
580     #### Collada
581     #############
583     #FIND_PACKAGE(Collada)
585     OSG_CONFIGURE_COLLADA()
587     IF(COLLADA_FOUND)
589       OSG_SET(OSG_WITH_COLLADA 1)
591       IF(NOT WIN32)
592         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
593            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
595             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
597         ELSE()
599             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
601         ENDIF()
602       ENDIF(NOT WIN32)
604       OSG_ADD_OPT(COLLADA_DAE_INCLUDE_DIR)
605       OSG_ADD_OPT(COLLADA_DOM_INCLUDE_DIR)
607       IF(WIN32 OR COLLADA_TARGET_FOUND)
608         SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
609       ENDIF(WIN32 OR COLLADA_TARGET_FOUND)
611     ELSE(COLLADA_FOUND)
613       SET(OSG_COLLADA_LIBS "")
615     ENDIF(COLLADA_FOUND)
617     OSG_ADD_OPT(COLLADA_FOUND)
619     #############
620     #### GLUT
621     #############
623     OSG_CONFIGURE_GLUT()
625     IF(GLUT_FOUND)
626       OSG_SET(OSG_WITH_GLUT 1)
627       OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
628       OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
629     ELSE(GLUT_FOUND)
630       OSG_SET(OSG_WITH_GLUT 0)
631       OSG_SET(OSG_GLUT_INC_DIR "")
632       OSG_SET(OSG_GLUT_LIBS "")
633     ENDIF(GLUT_FOUND)
635     #############
636     #### QT
637     #############
639     OSG_CONFIGURE_QT()
641     #############
642     #### OpenGL
643     #############
645     IF(APPLE AND IOS)
646       FIND_PACKAGE(OpenGLES REQUIRED)
648       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
649       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
650     ELSE()
651       FIND_PACKAGE(OpenGL REQUIRED)
653       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
654       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
655     ENDIF()
657     IF(OSG_USE_OGL3_PROTOS OR OSG_USE_OGL4_PROTOS)
658       SET(OSG_OGL_INCDIRS ${CMAKE_SOURCE_DIR}/Source/External/OpenGL)
659       LIST(APPEND OSG_GLOBAL_DEP_INCDIR OSG_OGL_INCDIRS)
661       ADD_DEFINITIONS(-DOSG_USE_GL3_INCLUDES=1)
662     ENDIF()
664     #############
665     #### X11
666     #############
668     FIND_PACKAGE(X11)
670     IF(X11_FOUND)
671         OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
672         OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
673     ENDIF(X11_FOUND)
675     OSG_ADD_OPT(X11_FOUND)
677     #############
678     #### VTK
679     #############
681     IF(OSG_USE_OSG_VTK_SETUP)
682       OSG_CONFIGURE_VTK()
683     ELSE(OSG_USE_OSG_VTK_SETUP)
684       FIND_PACKAGE(VTK)
686       IF(VTK_FOUND)
687           OSG_SET(OSG_WITH_VTK 1)
688           OSG_SET(OSG_VTK_LIBS vtkRendering)
690           OSG_ADD_OPT(OSG_VTK_LIBS)
691           OSG_ADD_OPT(VTK_LIBRARY_DIRS)
692           OSG_ADD_OPT(VTK_INCLUDE_DIRS)
693           OSG_ADD_OPT(VTK_DIR)
694       ENDIF(VTK_FOUND)
695     ENDIF(OSG_USE_OSG_VTK_SETUP)
697     OSG_ADD_OPT(VTK_FOUND)
699     ##############
700     #### GLEW
701     ##############
703     IF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
704       OSG_CONFIGURE_GLEW()
706       IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
707         LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
708       ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
710     ENDIF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
712     ##############
713     #### Mini
714     ##############
716     OSG_CONFIGURE_LIBMINI()
718     OSG_ADD_OPT(OSG_LIBMINI_FOUND)
719     OSG_ADD_OPT(OSG_LIBMINI_INCLUDE_DIR)
720     OSG_ADD_OPT(OSG_LIBMINI_LIBRARIES)
722     ###############
723     #### OpenNurbs
724     ###############
726     OSG_CONFIGURE_OPENNURBS()
728     OSG_ADD_OPT(OPENNURBS_FOUND)
729     OSG_ADD_OPT(OPENNURBS_INCLUDE_DIR)
730     OSG_ADD_OPT(OPENNURBS_LIBRARIES)
732     #############
733     #### Python
734     #############
736     FIND_PACKAGE(PythonInterp)
737     FIND_PACKAGE(PythonLibs)
739     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
740     OSG_ADD_OPT(PYTHON_LIBRARY)
742     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
744       FIND_PACKAGE(Boost COMPONENTS python)
746       IF(Boost_FOUND AND WIN32)
748         SET(OSG_BOOST_PYTHON_TARGETS )
749         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
750         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
751       
752       ELSE(Boost_FOUND AND WIN32)
754         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
755            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
757           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
759         ELSE()
760           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
761         ENDIF()
763       ENDIF(Boost_FOUND AND WIN32)
765       # We ignore if boost python fails, we catch that somewhere else
766       # so if we get here Boost_FOUND was true in the first place
767       SET(Boost_FOUND TRUE)
769       FIND_PACKAGE(GCCXML)
771       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
772       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
773       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
775     ENDIF()
778     ###############
779     #### Flex/Bison
780     ###############
782     FIND_PROGRAM(FLEX_EXE flex)
783     FIND_PROGRAM(BISON_EXE bison)
785     OSG_ADD_OPT(FLEX_EXE)
786     OSG_ADD_OPT(BISON_EXE)
788     ##############
789     #### NVPerfSDK
790     ##############
792     OSG_FIND_PACKAGE(NVidiaPerfSDK)
794     IF(NVIDIAPERFSDK_FOUND)
795         OSG_SET(OSG_WITH_NVPERFSDK 1)
796         OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
797         OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
798     ELSE(NVIDIAPERFSDK_FOUND)
799         OSG_SET(OSG_WITH_NVPERFSDK 0)
800         OSG_SET(OSG_NVPERFSDK_INC_DIR "")
801         OSG_SET(OSG_NVPERFSDK_LIBS "")
802     ENDIF(NVIDIAPERFSDK_FOUND)
805     #############
806     #### Support
807     #############
809     IF(UNIX)
810         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
811         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
813         OSG_ADD_OPT(OSG_THREAD_LIB)
814         OSG_ADD_OPT(OSG_DL_LIB)
815     ENDIF(UNIX)
817     IF(APPLE)
818         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
819         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
820         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
821         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
822     ENDIF(APPLE)
824     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
826 ENDIF(NOT OSG_BUILD_DEPENDEND)
828 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
829   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
830     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
831   ENDIF(EXISTS
832   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
833 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
835 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
836   INCLUDE(${OSG_GLOBAL_PREP})
837 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
839 IF(APPLE AND OSG_COCOA_FRAMEWORK)
840     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
841 ELSEIF(WIN32)
842     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
843 ELSEIF(UNIX AND X11_FOUND)
844     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
845 ELSEIF(APPLE AND IOS)
846     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
847 ELSE()
848     OSG_SET(OSG_NATIVE_WINDOW "")
849 ENDIF()
851 ###############
852 #### Doxygen
853 ###############
855 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
856   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
857                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
858 ENDIF()
860 FIND_PACKAGE(Doxygen)
862 ##############################################################################
863 # Overrides if dependend
864 ##############################################################################
866 IF(NOT WIN32)
867     IF(OSG_BUILD_DEPENDEND)
868         MESSAGE(STATUS "Load reference settings")
869         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
870         # Needed to get the correct vtk/boost settings
871         FIND_PACKAGE(VTK)
872         OSG_BOOST_DEP_SETUP()
873         OSG_CONFIGURE_QT()
874     ELSE(OSG_BUILD_DEPENDEND)
875 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
876     ENDIF(OSG_BUILD_DEPENDEND)
877 ENDIF(NOT WIN32)
879 ##############################################################################
880 # MAIN BUILD STEPS
881 ##############################################################################
883 # when adding passes, make sure to add a corresponding pass directory variable
884 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
885 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
887 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
888 SET(OSG_PASSDIR_OSGSETUP   "Build")
890 ADD_CUSTOM_TARGET(OSGAll)
892 ###############
893 # Clean
894 ###############
896 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
898 IF(OSG_OLD_BUILD_FILES)
899     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
900 ENDIF(OSG_OLD_BUILD_FILES)
902 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
904 IF(OSG_OLD_CONFIG_FILES)
905     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
906 ENDIF(OSG_OLD_CONFIG_FILES)
908 ###############
909 # Tests
910 ###############
912 ADD_CUSTOM_TARGET(OSGAllApps)
913 ADD_DEPENDENCIES(OSGAll OSGAllApps)
915 # optional pass for test programs
916 IF(OSGBUILD_TESTS)
917     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
918     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
920     ADD_CUSTOM_TARGET(OSGAllTests)
921     ADD_DEPENDENCIES(OSGAll OSGAllTests)
922 ENDIF(OSGBUILD_TESTS)
924 ###############
925 # UnitTests
926 ###############
928 IF(OSGBUILD_UNITTESTS)
929     ENABLE_TESTING()
930     INCLUDE(CTest)
932     # optional pass for unittest programs
933     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
934     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
936     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
937                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
939     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
940     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
941     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
943     ADD_CUSTOM_TARGET(OSGAllUnitTests)
944     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
945 ENDIF(OSGBUILD_UNITTESTS)
947 ###############
948 # Python
949 ###############
951 # optional pass for test programs
952 IF(OSGBUILD_PYTHON_BINDINGS)
953     LIST(APPEND OSG_CMAKE_PASSES "OSGPYTHON")
954     SET(OSG_PASSDIR_OSGPYTHON "Python")
956     IF(EXISTS ${PYOSG_PYPLUSPLUS_DIR})
957       SET(OSG_HAS_PYOSG_PYPLUSPLUS_DIR "True")
958     ELSE()
959       SET(OSG_HAS_PYOSG_PYPLUSPLUS_DIR "False")
960     ENDIF()
962     IF(EXISTS ${PYOSG_PYPLUSPLUS_GOODIES_DIR})
963       SET(OSG_HAS_PYOSG_PYPLUSPLUS_GOODIES_DIR "True")
964     ELSE()
965       SET(OSG_HAS_PYOSG_PYPLUSPLUS_GOODIES_DIR "False")
966     ENDIF()
968     SET(OSG_CAN_REGEN_PYTHON_BINDINGS FALSE)
970     IF(GCCXML                       AND
971        PYOSG_DIR                    AND
972        PYOSG_PYPLUSPLUS_DIR         AND 
973        PYOSG_PYPLUSPLUS_GOODIES_DIR)
975      IF(EXISTS ${GCCXML}                       AND
976         EXISTS ${PYOSG_DIR}                    AND
977         EXISTS ${PYOSG_PYPLUSPLUS_DIR}         AND 
978         EXISTS ${PYOSG_PYPLUSPLUS_GOODIES_DIR})
980         SET(OSG_CAN_REGEN_PYTHON_BINDINGS TRUE)
982       ENDIF()
983     ENDIF()
985     EXECUTE_PROCESS(
986       COMMAND "${CMAKE_COMMAND}" -E copy_if_different
987                 "${CMAKE_SOURCE_DIR}/Bindings/Python/genLibOrder.py"
988                 "${CMAKE_BINARY_DIR}/Python/Helper/genLibOrder.py")
990     FILE(WRITE  "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "# Lib order information\n\n\nlibInfo = {}\n\n")
991     FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "fullLibInfo = {}\n\n")
993     IF(EXISTS ${PYOSG_DIR})
994       FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper")
996       #########################
997       # osggen.py
998       #########################
1000       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osggen.py")
1001       SET(_OSG_FILE_OUT_PROC "${CMAKE_BINARY_DIR}/Python/Helper/processed/osggen.py.proc")
1002       SET(_OSG_FILE_OUT      "${CMAKE_BINARY_DIR}/Python/Helper/osggen.py")
1003       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/osggen.py.patch")
1005       EXECUTE_PROCESS(
1006         COMMAND "${CMAKE_COMMAND}" -E copy
1007                   "${_OSG_FILE_IN}"
1008                   "${_OSG_FILE_OUT_PROC}")
1010       EXECUTE_PROCESS(COMMAND "patch" 
1011                       INPUT_FILE "${_OSG_PATCH_FILE}"
1012                       WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper/processed")
1014       EXECUTE_PROCESS(
1015         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1016                   "${_OSG_FILE_OUT_PROC}"
1017                   "${_OSG_FILE_OUT}")
1020       #########################
1021       # splitGenHelper.py
1022       #########################
1024       EXECUTE_PROCESS(
1025         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1026                   "${CMAKE_SOURCE_DIR}/Bindings/Python/splitGenHelper.py"
1027                   "${CMAKE_BINARY_DIR}/Python/Helper/splitGenHelper.py")
1028      
1029       #########################
1030       # settings.py
1031       #########################
1033       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/settings.py")
1034       SET(_OSG_FILE_OUT_PROC "${CMAKE_BINARY_DIR}/Python/Helper/processed/settings.py.proc")
1035       SET(_OSG_FILE_OUT      "${CMAKE_BINARY_DIR}/Python/Helper/settings.py")
1036       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/settings.py.patch")
1038       EXECUTE_PROCESS(
1039         COMMAND "${CMAKE_COMMAND}" -E copy
1040                   "${_OSG_FILE_IN}"
1041                   "${_OSG_FILE_OUT_PROC}")
1043       EXECUTE_PROCESS(COMMAND "patch" 
1044                       INPUT_FILE "${_OSG_PATCH_FILE}"
1045                       WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper/processed")
1047       EXECUTE_PROCESS(
1048         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1049                   "${_OSG_FILE_OUT_PROC}"
1050                   "${_OSG_FILE_OUT}")
1052       #########################
1053       # PreBoostPython.h
1054       #########################
1056       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/PreBoostPython.h")
1057       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/PreBoostPython.h.proc")
1058       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/PreBoostPython.h")
1060       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1062       STRING(REPLACE "<OpenSG/"
1063                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1065       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1067       EXECUTE_PROCESS(
1068         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1069                   "${_OSG_FILE_OUT_PROC}"
1070                   "${_OSG_FILE_OUT}")
1073       #########################
1074       # OsgPtrHelpers.h
1075       #########################
1077       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/OsgPtrHelpers.h")
1078       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/OsgPtrHelpers.h.proc")
1079       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/OsgPtrHelpers.h")
1081       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1083       STRING(REPLACE "<OpenSG/"
1084                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1086       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1088       EXECUTE_PROCESS(
1089         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1090                   "${_OSG_FILE_OUT_PROC}"
1091                   "${_OSG_FILE_OUT}")
1094       #########################
1095       # pypp_OSGBase_aliases.h
1096       #########################
1098       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/aliases.h")
1099       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/pypp_aliases.h.proc")
1100       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/pypp_aliases.h")
1101       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/pypp_aliases.h.patch")
1103       EXECUTE_PROCESS(
1104         COMMAND "${CMAKE_COMMAND}" -E copy
1105                   "${_OSG_FILE_IN}"
1106                   "${_OSG_FILE_OUT_PROC}")
1108       EXECUTE_PROCESS(COMMAND "patch" 
1109                       INPUT_FILE "${_OSG_PATCH_FILE}"
1110                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed")
1112       EXECUTE_PROCESS(
1113         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1114                   "${_OSG_FILE_OUT_PROC}"
1115                   "${_OSG_FILE_OUT}")
1118       #########################
1119       # ColorWrapper.h
1120       #########################
1122       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/ColorWrapper.h")
1123       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/ColorWrapper.h.proc")
1124       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/ColorWrapper.h")
1126       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1128       STRING(REPLACE "<OpenSG/"
1129                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1131       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1133       EXECUTE_PROCESS(
1134         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1135                   "${_OSG_FILE_OUT_PROC}"
1136                   "${_OSG_FILE_OUT}")
1139       #########################
1140       # VecStorageWrappers.h
1141       #########################
1143       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/VecStorageWrappers.h")
1144       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/VecStorageWrappers.h.proc")
1145       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/VecStorageWrappers.h")
1147       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1149       STRING(REPLACE "<OpenSG/"
1150                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1152       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1154       EXECUTE_PROCESS(
1155         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1156                   "${_OSG_FILE_OUT_PROC}"
1157                   "${_OSG_FILE_OUT}")
1160       #########################
1161       # BaseWrappers.h
1162       #########################
1164       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.h")
1165       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/BaseWrappers.h.proc")
1166       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/BaseWrappers.h")
1167       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Patches/wrappers.h.patch")
1169       EXECUTE_PROCESS(
1170         COMMAND "${CMAKE_COMMAND}" -E copy
1171                   "${_OSG_FILE_IN}"
1172                   "${_OSG_FILE_OUT_PROC}")
1174       EXECUTE_PROCESS(COMMAND "patch" 
1175                       INPUT_FILE "${_OSG_PATCH_FILE}"
1176                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed")
1178       EXECUTE_PROCESS(
1179         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1180                   "${_OSG_FILE_OUT_PROC}"
1181                   "${_OSG_FILE_OUT}")
1184       #########################
1185       # BaseWrappers.cpp
1186       #########################
1188       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.cpp")
1189       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/BaseWrappers.cpp.proc")
1190       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/BaseWrappers.cpp")
1191       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Patches/wrappers.cpp.patch")
1193       EXECUTE_PROCESS(
1194         COMMAND "${CMAKE_COMMAND}" -E copy
1195                   "${_OSG_FILE_IN}"
1196                   "${_OSG_FILE_OUT_PROC}")
1198       EXECUTE_PROCESS(COMMAND "patch" 
1199                       INPUT_FILE "${_OSG_PATCH_FILE}"
1200                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed")
1202       EXECUTE_PROCESS(
1203         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1204                   "${_OSG_FILE_OUT_PROC}"
1205                   "${_OSG_FILE_OUT}")
1209       #########################
1210       # SystemWrappers.h
1211       #########################
1213       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.h")
1214       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed/SystemWrappers.h.proc")
1215       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/SystemWrappers.h")
1216       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Patches/wrappers.h.patch")
1218       EXECUTE_PROCESS(
1219         COMMAND "${CMAKE_COMMAND}" -E copy
1220                   "${_OSG_FILE_IN}"
1221                   "${_OSG_FILE_OUT_PROC}")
1223       EXECUTE_PROCESS(COMMAND "patch" 
1224                       INPUT_FILE "${_OSG_PATCH_FILE}"
1225                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed")
1227       EXECUTE_PROCESS(
1228         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1229                   "${_OSG_FILE_OUT_PROC}"
1230                   "${_OSG_FILE_OUT}")
1233       #########################
1234       # SystemWrappers.cpp
1235       #########################
1237       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.cpp")
1238       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed/SystemWrappers.cpp.proc")
1239       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/SystemWrappers.cpp")
1240       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Patches/wrappers.cpp.patch")
1242       EXECUTE_PROCESS(
1243         COMMAND "${CMAKE_COMMAND}" -E copy
1244                   "${_OSG_FILE_IN}"
1245                   "${_OSG_FILE_OUT_PROC}")
1247       EXECUTE_PROCESS(COMMAND "patch" 
1248                       INPUT_FILE "${_OSG_PATCH_FILE}"
1249                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed")
1251       EXECUTE_PROCESS(
1252         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1253                   "${_OSG_FILE_OUT_PROC}"
1254                   "${_OSG_FILE_OUT}")
1257       #########################
1258       # helpers.py
1259       #########################
1261       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/helpers.py")
1262       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/helpers.py.proc")
1263       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py")
1264       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/helpers.py.patch")
1266       EXECUTE_PROCESS(
1267         COMMAND "${CMAKE_COMMAND}" -E copy
1268                   "${_OSG_FILE_IN}"
1269                   "${_OSG_FILE_OUT_PROC}")
1271       EXECUTE_PROCESS(COMMAND "patch" 
1272                       INPUT_FILE "${_OSG_PATCH_FILE}"
1273                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1275       EXECUTE_PROCESS(
1276         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1277                   "${_OSG_FILE_OUT_PROC}"
1278                   "${_OSG_FILE_OUT}")
1281       #########################
1282       # cored_node.py
1283       #########################
1285       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/cored_node.py")
1286       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/cored_node.py.proc")
1287       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py")
1288       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/cored_node.py.patch")
1290       EXECUTE_PROCESS(
1291         COMMAND "${CMAKE_COMMAND}" -E copy
1292                   "${_OSG_FILE_IN}"
1293                   "${_OSG_FILE_OUT_PROC}")
1295       EXECUTE_PROCESS(COMMAND "patch" 
1296                       INPUT_FILE "${_OSG_PATCH_FILE}"
1297                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1299       EXECUTE_PROCESS(
1300         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1301                   "${_OSG_FILE_OUT_PROC}"
1302                   "${_OSG_FILE_OUT}")
1305       #########################
1306       # fcd_reflector.py
1307       #########################
1309       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/fcd_reflector.py")
1310       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/fcd_reflector.py.proc")
1311       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py")
1312       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/fcd_reflector.py.patch")
1314       EXECUTE_PROCESS(
1315         COMMAND "${CMAKE_COMMAND}" -E copy
1316                   "${_OSG_FILE_IN}"
1317                   "${_OSG_FILE_OUT_PROC}")
1319       EXECUTE_PROCESS(COMMAND "patch" 
1320                       INPUT_FILE "${_OSG_PATCH_FILE}"
1321                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1323       EXECUTE_PROCESS(
1324         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1325                   "${_OSG_FILE_OUT_PROC}"
1326                   "${_OSG_FILE_OUT}")
1328     ENDIF(EXISTS ${PYOSG_DIR})
1330     SET(_OSG_SRC_PYPATH_HELPERS ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers)
1331     SET(_OSG_SRC_PYPATH_OSG     ${CMAKE_BINARY_DIR}/Python/lib/osg2/helpers)
1333     SET(_OSG_DST_PYPATH_HELPERS ${CMAKE_BINARY_DIR}/Python/lib/osg2/helpers)
1334     SET(_OSG_DST_PYPATH_OSG     ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg)
1336     FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Python/lib/osg2)
1337     FILE(MAKE_DIRECTORY ${_OSG_DST_PYPATH_HELPERS})
1338     FILE(MAKE_DIRECTORY ${_OSG_DST_PYPATH_OSG})
1340     OSG_SYMLINK_CHECKED(${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1341                         ${CMAKE_BINARY_DIR}/Python/lib/osg2/__init__.py)
1343     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/cored_node.py
1344                         ${_OSG_DST_PYPATH_HELPERS}/cored_node.py)
1345     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/fcd_reflector.py
1346                         ${_OSG_DST_PYPATH_HELPERS}/fcd_reflector.py)
1347     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/helpers.py
1348                         ${_OSG_DST_PYPATH_HELPERS}/helpers.py)
1349     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/__init__.py
1350                         ${_OSG_DST_PYPATH_HELPERS}/__init__.py)
1352     ADD_CUSTOM_TARGET(OSGPy)
1353     IF(OSG_CAN_REGEN_PYTHON_BINDINGS)
1354       ADD_CUSTOM_TARGET(OSGPyGen)
1355     ENDIF()
1356 #    ADD_CUSTOM_TARGET(OSGPyBuild)
1358 ENDIF(OSGBUILD_PYTHON_BINDINGS)
1360 #################
1361 # Documentation I
1362 #################
1363 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1364 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1366 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1367     ADD_CUSTOM_TARGET(Doc)
1368 ENDIF()
1370 IF(DOXYGEN_EXECUTABLE)
1371     SET(DOXYGEN_VERSION)
1372     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1373                     OUTPUT_VARIABLE DOXYGEN_VERSION
1374                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1375     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1376         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1377                         "when building OpenSG documentation. "
1378                         "Please use a different version, sorry for the inconvenience.")
1379     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1380 ENDIF(DOXYGEN_EXECUTABLE)
1382 IF(NOT OSG_DOXY_INPUTS)
1383     # add a pass for doxygen to run
1384     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1385     SET(OSG_PASSDIR_OSGDOXYDOC "Doc")
1386 ENDIF(NOT OSG_DOXY_INPUTS)
1388 # set up variables for the config file
1389 IF(DOXYGEN_DOT_EXECUTABLE)
1390     SET(OSG_DOXY_HAVE_DOT "YES")
1391 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1393 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1394 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1396 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1398 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1399     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1400     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1401     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1402     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1403     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1404     SET(OSG_DOXY_SEARCHENGINE "NO")
1406 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1407     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1408     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1409     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1410     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1411     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1412     SET(OSG_DOXY_SEARCHENGINE "NO")
1414 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1415     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1416     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1417     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1418     SET(OSG_DOXY_HAVE_DOT "NO")
1419     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1420     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1421     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1422     SET(OSG_DOXY_SEARCHENGINE "NO")
1424 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1426 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1427   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1428 ELSE()
1429   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1430 ENDIF()
1432 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1434 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1435 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1437 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1438   SET(OSG_DOC_SECTION "all_in_one")
1439 ELSE()
1440   SET(OSG_DOC_SECTION "separate")
1441 ENDIF()
1443 # write doxygen config file
1444 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1445                "${OSG_DOXY_CONFIGURATION_FILE}")
1447 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1449 # find/process documentation include files
1450 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1452 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1454   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1456   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1457                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1459 ENDFOREACH()
1461 IF(OSG_DOXY_INPUTS)
1462     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1463                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1464 ENDIF(OSG_DOXY_INPUTS)
1467 IF(DOXYGEN_EXECUTABLE)
1468   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1469   ADD_DEPENDENCIES(DocUpload Doc)
1472   ADD_CUSTOM_TARGET(DocSyncGV
1473                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1474                     WORKING_DIRECTORY Doc)
1476   ADD_CUSTOM_TARGET(DocCompleteGV)
1477   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1478 ENDIF(DOXYGEN_EXECUTABLE)
1480 ADD_CUSTOM_TARGET(OSGAllLibs)
1481 ADD_DEPENDENCIES(OSGAll OSGAllLibs)
1483 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1484 ADD_CUSTOM_TARGET(OSGAllContribLibs)
1486 ###############
1487 # Passes
1488 ###############
1490 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1491   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1493   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1494        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1496   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1497     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1498     INCLUDE(${_OSGCORE_EXT_FILE})
1499   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1502 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1504 # Find files describing libraries to build, but make sure base
1505 # and system are processed first
1506 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1507      "Source/CMakeLists.Lib.OSGBase.txt")
1509 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1510      "Source/CMakeLists.Lib.OSGSystem.txt")
1512 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1513      "Source/*CMakeLists.Lib.*.txt")
1515 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1516 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1518 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1519 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1521 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1522   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1524   IF(_OSG_FOUND_CONTRIB_CONFIG)
1525     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1526   ELSE()
1527     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1528   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1529 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1531 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1533 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1535   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1536                          ${_OSG_LIBRARY_CONFIG}
1537                           PATH)
1539   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1540                          ${_OSG_LIBRARY_CONFIG}
1541                           NAME)
1543   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1544                      ${_OSG_LIBCONFIG_BASENAME})
1546   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1547                          ${_OSG_LIBCONFIG_BASENAME_1}
1548                          NAME_WE)
1550   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1551     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1552   ENDIF()
1554 ENDFOREACH()
1556 IF(OSG_ENABLE_CUDA)
1557   IF(CUDA_FOUND)
1558     SET(OSG_WITH_CUDA 1)
1559   ENDIF(CUDA_FOUND)
1560 ELSE(OSG_ENABLE_CUDA)
1561   SET(OSG_WITH_CUDA 0)
1562 ENDIF(OSG_ENABLE_CUDA)
1563 IF(OPENCL_FOUND)
1564   SET(OSG_WITH_OPENCL)
1565 ENDIF(OPENCL_FOUND)
1567 IF(NOT WIN32)
1568   IF(NOT OSG_BUILD_DEPENDEND)
1569     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1570   ENDIF(NOT OSG_BUILD_DEPENDEND)
1571 ENDIF(NOT WIN32)
1573 # run build passes
1574 FOREACH(PASS ${OSG_CMAKE_PASSES})
1575     SET(OSG_CMAKE_PASS ${PASS})
1577     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1579     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1580         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1581         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1582         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1583         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1585         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1587         IF(_OSG_IS_CONTRIBLIB)
1588           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1589         ELSE()
1590           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1591         ENDIF()
1593         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1594     ENDFOREACH(LIBCONFIGFILE)
1596     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1598     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1599         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1600                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1601     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1603 ENDFOREACH()
1606 ###############
1607 # OSGConfigured
1608 ###############
1611 EXECUTE_PROCESS(
1612     COMMAND "${CMAKE_COMMAND}" -E copy
1613                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1614                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1616 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1617   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1618 ENDFOREACH()
1620 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1622 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1623                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1625 EXECUTE_PROCESS(
1626     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1627                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1628                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1630 #################
1631 # Examples/Simple
1632 #################
1634 ADD_CUSTOM_TARGET(OSGAllExamples)
1635 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1637 IF(OSGBUILD_EXAMPLES_SIMPLE)
1638     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1639     ADD_SUBDIRECTORY("Examples/Simple")
1640     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1641 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1643 ###################
1644 # Examples/Advanced
1645 ###################
1647 IF(OSGBUILD_EXAMPLES_ADVANCED)
1648     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1649     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1650     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1651     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1652 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1654 ###################
1655 # Examples/Advanced
1656 ###################
1658 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1659     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1660     ADD_SUBDIRECTORY("Examples/Tutorial")
1661     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1662 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1664 ###################
1665 # External Examples
1666 ###################
1668 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1669   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1671   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1672     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1673     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1674   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1675 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1677 ##################
1678 # Documentation II
1679 ##################
1681 SET(OSG_DOC_PIPES "")
1683 IF(OSG_DOXY_STDOUT_LOG)
1684     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1685 ENDIF(OSG_DOXY_STDOUT_LOG)
1687 IF(DOXYGEN_EXECUTABLE)
1688     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1689         ADD_CUSTOM_TARGET(Doc
1690             VERBATIM
1691             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1692     ENDIF()
1693 ENDIF()
1695 ##################
1696 # osg2-config
1697 ##################
1699 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1700 # is generated during the OSGCOLLECT pass.
1702 # substitute variables in static parts
1703 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1704                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1705 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1706                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1708 # read in all parts
1709 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1710 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1711 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1713 # concatenate final file
1714 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1715 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1716 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1718 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1719 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1720 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1722 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1723         DESTINATION bin
1724         COMPONENT development_tools)
1726 ##################
1727 # cmake modules
1728 ##################
1730 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake"
1731         DESTINATION share/OpenSG/cmake
1732         COMPONENT development_configuration)
1733 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1734         DESTINATION share/OpenSG/cmake
1735         COMPONENT development_configuration)
1736 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1737         DESTINATION share/OpenSG/cmake
1738         COMPONENT development_configuration)
1739 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1740         DESTINATION share/OpenSG/cmake
1741         COMPONENT development_configuration)
1742 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1743         DESTINATION share/OpenSG/cmake
1744         COMPONENT development_configuration)
1745 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1746         DESTINATION share/OpenSG/cmake
1747         COMPONENT development_configuration)
1748 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1749         DESTINATION share/OpenSG/cmake
1750         COMPONENT development_configuration)
1751 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1752         DESTINATION share/OpenSG/cmake
1753         COMPONENT development_configuration)
1754 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/SetupCompiler.cmake"
1755         DESTINATION share/OpenSG/cmake
1756         COMPONENT development_configuration)
1757 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/UpdateCompiler.cmake"
1758         DESTINATION share/OpenSG/cmake
1759         COMPONENT development_configuration)
1760 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/BuildFunctions.cmake"
1761         DESTINATION share/OpenSG/cmake
1762         COMPONENT development_configuration)
1763 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/ConfigurePackages.cmake"
1764         DESTINATION share/OpenSG/cmake
1765         COMPONENT development_configuration)
1766 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/ExternalProjectHelper.cmake"
1767         DESTINATION share/OpenSG/cmake
1768         COMPONENT development_configuration)
1769 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1770         DESTINATION share/OpenSG/cmake
1771         COMPONENT development_configuration)
1772 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1773         DESTINATION share/OpenSG/cmake
1774         COMPONENT development_configuration)
1775 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1776         DESTINATION bin
1777         COMPONENT development_tools
1778         PATTERN "*.pyc" EXCLUDE
1779         PATTERN ".svn"  EXCLUDE)
1781 ##################
1782 # Global Python
1783 ##################
1785 IF(OSGBUILD_PYTHON_BINDINGS)
1786   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1787                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1788                   OUTPUT_VARIABLE _OSG_LIBORDER)
1790   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1792   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1793     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1794     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1795     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1796   ENDFOREACH()
1798   SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1800   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1801   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1803   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1804                  "${_OSG_GEN_INIT_FILE_OUT}")
1806   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1807                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1809   IF(WIN32) 
1811     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1812     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1813     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1814     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1816     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1817             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1818             CONFIGURATIONS Release)
1820     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1821             DESTINATION ${_OSG_TARGET_PYLIBDIR_D}/osg
1822               CONFIGURATIONS Debug)
1824     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1825             DESTINATION ${_OSG_TARGET_PYLIBDIR_DO}/osg
1826             CONFIGURATIONS DebugOpt)
1828     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1829             DESTINATION ${_OSG_TARGET_PYLIBDIR_RN}/osg
1830             CONFIGURATIONS ReleaseNoOpt)
1833     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1834             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1835             CONFIGURATIONS Release)
1837     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1838                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1839                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1840                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1841             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1842             CONFIGURATIONS Release)
1845     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1846             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1847             CONFIGURATIONS Debug)
1849     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1850                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1851                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1852                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1853             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1854             CONFIGURATIONS Debug)
1857     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1858             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1859             CONFIGURATIONS DebugOpt)
1861     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1862                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1863                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1864                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1865             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1866             CONFIGURATIONS DebugOpt)
1869     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1870             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1871             CONFIGURATIONS ReleaseNoOpt)
1873     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1874                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1875                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1876                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1877             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1878             CONFIGURATIONS ReleaseNoOpt)
1880   ELSE(WIN32)   
1882     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1883     SET(_OSG_PY_INST_BASE 
1884         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1886     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1887             DESTINATION ${_OSG_PY_INST_BASE}/osg)
1889     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1890             DESTINATION ${_OSG_PY_INST_BASE})
1892     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1893                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1894                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1895                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1896             DESTINATION ${_OSG_PY_INST_BASE}/helpers)
1898   ENDIF(WIN32)
1900 ENDIF()
1902 ##################
1903 # Documentation
1904 ##################
1905 IF(DOXYGEN_EXECUTABLE)
1906     IF(OSG_INSTALL_DOXYDOC)
1907         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1908                 DESTINATION share/OpenSG/documentation
1909                 COMPONENT documentation)
1910     ENDIF()
1911 ENDIF()
1913 ##################
1914 # Images/Icons
1915 ##################
1917 ##################
1918 # CSM Example
1919 ##################
1921 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
1922         DESTINATION share/OpenSG/Examples/
1923         COMPONENT examples_basic)
1925 ##################
1926 # Packaging
1927 ##################
1929 IF(OSGBUILD_ENABLE_PACKAGING)
1931     SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
1933     SET(CPACK_PACKAGE_NAME                "OpenSG")
1934     SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
1935     SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
1936     SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
1937     SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
1938     SET(CPACK_PACKAGE_VENDOR              "OpenSG")
1939     SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
1940     SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
1941     SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
1942     SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
1944     if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
1945         set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
1946         set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
1947     endif ()
1949     if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
1950         set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
1951     endif()
1953     #Define Components
1954     SET(CPACK_COMPONENTS_ALL development_tools
1955         development_configuration
1956         code_headers
1957         libraries
1958         debug_program_db
1959         release_program_db
1960         debug_libraries
1961         release_libraries
1962         debug_runtimes
1963         release_runtimes
1964         data_images
1965         examples_basic
1966         examples_advanced
1967         Unspecified
1968         )
1971     #Components
1972     #Runtime
1973     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
1975     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
1976     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
1977     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
1978     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1980     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
1981     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
1982     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
1983     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
1985     #Development
1986     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
1988     #Libraries
1989     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
1990     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
1991     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
1992     set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
1994     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
1995     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
1996     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
1997     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
1999     #Program database
2000     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
2001     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
2002     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
2003     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
2005     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
2006     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
2007     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
2008     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
2010     #Tools
2011     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
2012     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
2013     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
2014     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
2016     #Configuration
2017     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
2018     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
2019     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
2020     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
2022     #Headers
2023     SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
2024     SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
2025     SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
2026     SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
2028     #Examples
2029     SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
2031     SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
2032     SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
2033     SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
2034     SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
2036     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
2037     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
2038     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
2039     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
2041     #Shared Data
2042     SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
2044     SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
2045     SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
2046     SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
2047     SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
2049     #Documentation
2050     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
2052     #Dependencies
2053     #Boost
2054     #Base
2056     #NSIS specific configuration
2057     IF(WIN32)
2058         INCLUDE(InstallRequiredSystemLibraries)
2059         IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
2060             IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
2061                          ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
2062                  include(CMakeDetermineVSServicePack)
2063                  DetermineVSServicePack( my_service_pack )
2065                  IF( my_service_pack )
2066                      SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
2067                  ENDIF()
2068             ENDIF()
2070             #Extra install commands
2071             SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
2072             SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
2075             SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
2076             SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
2077             FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
2078             SET(CPACK_NSIS_MODIFY_PATH         ON)
2079             SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
2080             SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
2081             SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
2082             SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
2083             SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
2084             SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
2085             SET(CPACK_NSIS_MENU_LINKS          "")
2086             #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
2087             #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
2088         ENDIF()
2089     ENDIF()
2092     # Date macro by Benoit RAT (www.neub.co.nr)
2093     MACRO (TODAY RESULT)
2094         IF (WIN32)
2095             EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
2096             string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
2097         ELSEIF(UNIX)
2098             EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
2099             string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
2100         ELSE (WIN32)
2101             MESSAGE(SEND_ERROR "date not implemented")
2102             SET(${RESULT} 000000)
2103         ENDIF (WIN32)
2104     ENDMACRO (TODAY)
2106     TODAY(DATE)
2108     # Determine package type
2109     IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
2110         IF(WIN32)
2111             SET(OSGBUILD_PACKAGE_TYPE "ZIP")
2112         ELSE(WIN32)
2113             SET(OSGBUILD_PACKAGE_TYPE "RPM")
2114         ENDIF(WIN32)
2115     ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
2117     STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
2119     IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
2120         SET( PACK_EXT "tar.bz2" )
2121     ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
2122         SET( PACK_EXT "tar.gz" )
2123     ELSE()
2124         STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
2125     ENDIF()
2127     SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
2128     SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
2130     INCLUDE(CPack)
2133     # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
2134     IF(WIN32)
2135         #TODO: Need a way to do this on Windows
2136         #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 )
2137         #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
2138     ELSE(WIN32)
2139         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 )
2140         ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
2141     ENDIF(WIN32)
2144 ENDIF(OSGBUILD_ENABLE_PACKAGING)
2146 IF(WIN32)
2147   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
2148                                 CACHE STRING "OpenSG Build Types" FORCE )
2149 ENDIF(WIN32)
2150 IF(APPLE AND IOS)
2151   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
2152                                 CACHE STRING "OpenSG Build Types" FORCE )
2153 ENDIF()
2155 IF(WIN32)
2156   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2157        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
2159   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2160        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
2162 ENDIF(WIN32)
2164 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2165      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
2167 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2168      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
2170 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2171      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
2173 IF(OSG_WITH_CUDA)
2174   CUDA_BUILD_CLEAN_TARGET()
2175 ENDIF(OSG_WITH_CUDA)