changed: prep package builds
[opensg.git] / CMakeLists.txt
blob354fec309c72b4d24cbd735c6b423067627d24f3
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(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
376   SET(CMAKE_BUILD_TYPE Debug CACHE STRING
377       "Choose the type of build, options are: Debug Release."
378       FORCE)
379 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
381 IF(NOT WIN32) 
382   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"          AND 
383      NOT CMAKE_BUILD_TYPE STREQUAL "DebugGV"        AND
384      NOT CMAKE_BUILD_TYPE STREQUAL "Release"        AND
385      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseGV"      AND
386      NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"   )
388     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
389                         "Please use either Release or Debug")
391   ENDIF()
392 ELSEIF(NOT MSVC_IDE)
394   IF(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
395     SET(CMAKE_BUILD_TYPE DebugOpt CACHE STRING
396         "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}."
397         FORCE)  
398   ENDIF()
400   IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug"    AND 
401      NOT CMAKE_BUILD_TYPE STREQUAL "DebugOpt" AND
402      NOT CMAKE_BUILD_TYPE STREQUAL "Release"  AND
403      NOT CMAKE_BUILD_TYPE STREQUAL "ReleaseNoOpt")
405     MESSAGE(FATAL_ERROR "incorrect build type ${CMAKE_BUILD_TYPE}.\n"
406                         "Please use on of ${CMAKE_CONFIGURATION_TYPES}")
408   ENDIF()
409 ENDIF()
411 IF(NOT OSG_COMPILER_DEFAULTS)
412    INCLUDE(CMake/SetupCompiler.cmake)
413    SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) #INTERNAL
414 ENDIF(NOT OSG_COMPILER_DEFAULTS)
416 INCLUDE(CMake/UpdateCompiler.cmake)
418 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
419    CMAKE_BUILD_TYPE STREQUAL "DebugGV")
421     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
422     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
424 ENDIF()
426 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
428 OSG_CHECK_INSTALL()
430 ##############################################################################
431 # DEPENDENCIES
432 ##############################################################################
434 # Global include/library dirs, libs and definitions
435 SET(OSG_GLOBAL_DEP_INCDIR "")
436 SET(OSG_GLOBAL_DEP_LIBDIR "")
437 SET(OSG_GLOBAL_DEP_LIBS   "")
438 SET(OSG_GLOBAL_DEP_DEFS   "")
440 IF(NOT WIN32)
441   SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
442 ENDIF()
444 #IF(WIN32)
445   OSG_OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
446   OSG_OPTION(OSG_USE_STATIC_SUPPORT_LIBS "" OFF)
448   IF(OSG_USE_OSGSUPPORT_LIBS)
449     OSG_SET_CACHE(OSG_SUPPORT_ROOT "" PATH "")
450   ENDIF(OSG_USE_OSGSUPPORT_LIBS)
452   IF(EXISTS "${OSG_SUPPORT_ROOT}" AND
453      EXISTS "${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
455     INCLUDE("${OSG_SUPPORT_ROOT}/include${OSG_SUPPORT_INC_SUBDIR}/OSGSupportConfig.cmake")
457     SET(_OSG_FATAL_DMS_COMBO  FALSE)
458     SET(_OSG_FATAL_ITER_COMBO FALSE)
460     IF( NOT OSG_DISABLE_MICROSOFT_SECURE_CXXX AND     OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
461       SET(_OSG_FATAL_DMS_COMBO TRUE)
462     ENDIF()
464     IF(     OSG_DISABLE_MICROSOFT_SECURE_CXXX AND NOT OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX)
465       SET(_OSG_FATAL_DMS_COMBO TRUE)
466     ENDIF()
468     IF(_OSG_FATAL_DMS_COMBO)
470       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_SECURE settings:\n"
471                           "  Support : ${OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX}\n"
472                           "  OpenSG  : ${OSG_DISABLE_MICROSOFT_SECURE_CXXX}")
474     ENDIF()
477     IF( NOT OSG_DISABLE_MS_ITERATOR_DEBUGGING AND     OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
478       SET(_OSG_FATAL_ITER_COMBO TRUE)
479     ENDIF()
481     IF(     OSG_DISABLE_MS_ITERATOR_DEBUGGING AND NOT OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING)
482       SET(_OSG_FATAL_ITER_COMBO TRUE)
483     ENDIF()
485     IF(_OSG_FATAL_ITER_COMBO)
487       MESSAGE(FATAL_ERROR "Conflicting DISABLE_MS_ITER_DEBUG settings:\n"
488                           "  Support : ${OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING}\n"
489                           "  OpenSG  : ${OSG_DISABLE_MS_ITERATOR_DEBUGGING}")
491     ENDIF()
492   ENDIF()
494 IF(WIN32)
495    SET(OSG_INSTALL_SUBDIR "" CACHE STRING "add subdir to installed libs")
496 ENDIF(WIN32)
498 IF(NOT OSG_BUILD_DEPENDEND)
500     ##########
501     #### boost
502     ##########
504     OSG_CONFIGURE_BOOST()
506     #########
507     #### zlib
508     #########
510     OSG_CONFIGURE_ZLIB()
512 #    MESSAGE(STATUS "zlib: ${ZLIB_FOUND}")
514     IF(UNIX AND NOT OSG_APPLE32)
515         #############
516         #### Freetype
517         #############
519         FIND_PACKAGE(Freetype)
521         IF(FREETYPE_FOUND)
522             OSG_SET(OSG_WITH_FT2 1)
524             FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig)
526             IF(FONTCONFIG_LIBRARY MATCHES "fontconfig")
527                 OSG_SET(OSG_WITH_FONTCONFIG 1)
528             ENDIF()
530         ENDIF(FREETYPE_FOUND)
532         OSG_ADD_OPT(FREETYPE_FOUND)
533         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_freetype2)
534         OSG_ADD_OPT(FREETYPE_INCLUDE_DIR_ft2build)
535         OSG_ADD_OPT(FONTCONFIG_LIBRARY)
536         OSG_ADD_OPT(FREETYPE_LIBRARIES)
537     ENDIF(UNIX AND NOT OSG_APPLE32)
539     ##############
540     #### ImageLibs
541     ##############
543     OSG_CONFIGURE_TIFF()
544     OSG_CONFIGURE_PNG()
545     OSG_CONFIGURE_JPEG()
546     OSG_CONFIGURE_GDAL()
547     OSG_CONFIGURE_OPENEXR()
549     SET(OSG_EXTERNAL_IMAGELIBS)
550     SET(OSG_EXTERNAL_IMAGEINCS)
552 #    MESSAGE(STATUS "tiff: ${TIFF_FOUND} - png ${PNG_FOUND} - jpg: ${JPEG_FOUND} - exr ${OPENEXR_FOUND}")
554     IF(TIFF_FOUND)
555         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
556         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
557         OSG_SET(OSG_WITH_TIF 1)
558         OSG_ADD_OPT(TIFF_LIBRARIES)
559     ENDIF(TIFF_FOUND)
561     IF(PNG_FOUND)
562         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
563         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
564         OSG_SET(OSG_WITH_PNG 1)
565         OSG_ADD_OPT(PNG_INCLUDE_DIR)
566         OSG_ADD_OPT(PNG_LIBRARIES)
567     ENDIF(PNG_FOUND)
569     IF(JPEG_FOUND)
570         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
571         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
572         OSG_SET(OSG_WITH_JPG 1)
573         OSG_ADD_OPT(JPEG_LIBRARIES)
574     ENDIF(JPEG_FOUND)
576     IF(GDAL_FOUND)
577         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
578         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
579         OSG_SET(OSG_WITH_GDAL 1)
580         OSG_ADD_OPT(GDAL_LIBRARIES)
581     ENDIF(GDAL_FOUND)
583     IF(OPENEXR_FOUND)
584         SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
585         SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
586         OSG_SET(OSG_WITH_IMF 1)
588         OSG_ADD_OPT(OPENEXR_LIBRARIES)
589         OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
590     ENDIF(OPENEXR_FOUND)
593     OSG_ADD_OPT(OSG_EXTERNAL_IMAGELIBS)
594     OSG_ADD_OPT(OSG_EXTERNAL_IMAGEINCS)
596     #############
597     #### Collada
598     #############
600     #FIND_PACKAGE(Collada)
602     OSG_CONFIGURE_COLLADA()
604     IF(COLLADA_FOUND)
606       OSG_SET(OSG_WITH_COLLADA 1)
608       IF(NOT WIN32)
609         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
610            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
612             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
614         ELSE()
616             OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
618         ENDIF()
619       ENDIF(NOT WIN32)
621       OSG_ADD_OPT(COLLADA_DAE_INCLUDE_DIR)
622       OSG_ADD_OPT(COLLADA_DOM_INCLUDE_DIR)
624       IF(WIN32 OR COLLADA_TARGET_FOUND)
625         SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
626       ENDIF(WIN32 OR COLLADA_TARGET_FOUND)
628     ELSE(COLLADA_FOUND)
630       SET(OSG_COLLADA_LIBS "")
632     ENDIF(COLLADA_FOUND)
634     OSG_ADD_OPT(COLLADA_FOUND)
636     #############
637     #### GLUT
638     #############
640     OSG_CONFIGURE_GLUT()
642     IF(GLUT_FOUND)
643       OSG_SET(OSG_WITH_GLUT 1)
644       OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
645       OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
646     ELSE(GLUT_FOUND)
647       OSG_SET(OSG_WITH_GLUT 0)
648       OSG_SET(OSG_GLUT_INC_DIR "")
649       OSG_SET(OSG_GLUT_LIBS "")
650     ENDIF(GLUT_FOUND)
652     #############
653     #### QT
654     #############
656     OSG_CONFIGURE_QT()
658     #############
659     #### OpenGL
660     #############
662     IF(APPLE AND IOS)
663       FIND_PACKAGE(OpenGLES REQUIRED)
665       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
666       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
667     ELSE()
668       FIND_PACKAGE(OpenGL REQUIRED)
670       OSG_ADD_OPT(OPENGL_gl_LIBRARY)
671       OSG_ADD_OPT(OPENGL_glu_LIBRARY)
672     ENDIF()
674     IF(OSG_USE_OGL3_PROTOS OR OSG_USE_OGL4_PROTOS)
675       SET(OSG_OGL_INCDIRS ${CMAKE_SOURCE_DIR}/Source/External/OpenGL)
676       LIST(APPEND OSG_GLOBAL_DEP_INCDIR OSG_OGL_INCDIRS)
678       ADD_DEFINITIONS(-DOSG_USE_GL3_INCLUDES=1)
679     ENDIF()
681     #############
682     #### X11
683     #############
685     FIND_PACKAGE(X11)
687     IF(X11_FOUND)
688         OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
689         OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
690     ENDIF(X11_FOUND)
692     OSG_ADD_OPT(X11_FOUND)
694     #############
695     #### VTK
696     #############
698     IF(OSG_USE_OSG_VTK_SETUP)
699       OSG_CONFIGURE_VTK()
700     ELSE(OSG_USE_OSG_VTK_SETUP)
701       FIND_PACKAGE(VTK)
703       IF(VTK_FOUND)
704           OSG_SET(OSG_WITH_VTK 1)
705           OSG_SET(OSG_VTK_LIBS "vtkCommon;vtkFiltering;vtkGraphics;vtkIO;vtkRendering")
707           OSG_ADD_OPT(OSG_VTK_LIBS)
708           OSG_ADD_OPT(VTK_LIBRARY_DIRS)
709           OSG_ADD_OPT(VTK_INCLUDE_DIRS)
710           OSG_ADD_OPT(VTK_DIR)
711       ENDIF(VTK_FOUND)
712     ENDIF(OSG_USE_OSG_VTK_SETUP)
714     OSG_ADD_OPT(VTK_FOUND)
716     ##############
717     #### GLEW
718     ##############
720     IF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
721       OSG_CONFIGURE_GLEW()
723       IF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
724         LIST(APPEND OSG_GLOBAL_DEP_INCDIR GLEW_INCLUDE_DIR)
725       ENDIF(OSG_ENABLE_GL_INCLUDE_GLEW AND GLEW_FOUND)
727     ENDIF(WIN32 OR OSG_ENABLE_GL_INCLUDE_GLEW)
729     ##############
730     #### Mini
731     ##############
733     OSG_CONFIGURE_LIBMINI()
735     OSG_ADD_OPT(OSG_LIBMINI_FOUND)
736     OSG_ADD_OPT(OSG_LIBMINI_INCLUDE_DIR)
737     OSG_ADD_OPT(OSG_LIBMINI_LIBRARIES)
739     ###############
740     #### OpenNurbs
741     ###############
743     OSG_CONFIGURE_OPENNURBS()
745     OSG_ADD_OPT(OPENNURBS_FOUND)
746     OSG_ADD_OPT(OPENNURBS_INCLUDE_DIR)
747     OSG_ADD_OPT(OPENNURBS_LIBRARIES)
749     #############
750     #### Python
751     #############
753     FIND_PACKAGE(PythonInterp)
754     FIND_PACKAGE(PythonLibs)
756     OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
757     OSG_ADD_OPT(PYTHON_LIBRARY)
759     IF(Boost_FOUND AND PYTHONLIBS_FOUND)
761       FIND_PACKAGE(Boost COMPONENTS python)
763       IF(Boost_FOUND AND WIN32)
765         SET(OSG_BOOST_PYTHON_TARGETS )
766         OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
767         SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
768       
769       ELSE(Boost_FOUND AND WIN32)
771         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR 
772            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
774           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
776         ELSE()
777           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
778         ENDIF()
780       ENDIF(Boost_FOUND AND WIN32)
782       # We ignore if boost python fails, we catch that somewhere else
783       # so if we get here Boost_FOUND was true in the first place
784       SET(Boost_FOUND TRUE)
786       FIND_PACKAGE(GCCXML)
788       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_DIR "" PATH "")
789       OSG_SET_CACHE(PYOSG_PYPLUSPLUS_GOODIES_DIR "" PATH "")
790       OSG_SET_CACHE(PYOSG_DIR "" PATH "")
792     ENDIF()
795     ###############
796     #### Flex/Bison
797     ###############
799     FIND_PROGRAM(FLEX_EXE flex)
800     FIND_PROGRAM(BISON_EXE bison)
802     OSG_ADD_OPT(FLEX_EXE)
803     OSG_ADD_OPT(BISON_EXE)
805     ##############
806     #### NVPerfSDK
807     ##############
809     OSG_FIND_PACKAGE(NVidiaPerfSDK)
811     IF(NVIDIAPERFSDK_FOUND)
812         OSG_SET(OSG_WITH_NVPERFSDK 1)
813         OSG_SET(OSG_NVPERFSDK_INC_DIR ${NVIDIAPERFSDK_INCLUDE_DIR})
814         OSG_SET(OSG_NVPERFSDK_LIBS ${NVIDIAPERFSDK_LIBRARIES})
815     ELSE(NVIDIAPERFSDK_FOUND)
816         OSG_SET(OSG_WITH_NVPERFSDK 0)
817         OSG_SET(OSG_NVPERFSDK_INC_DIR "")
818         OSG_SET(OSG_NVPERFSDK_LIBS "")
819     ENDIF(NVIDIAPERFSDK_FOUND)
822     #############
823     #### Support
824     #############
826     IF(UNIX)
827         FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
828         FIND_LIBRARY(OSG_DL_LIB     NAMES dl)
830         OSG_ADD_OPT(OSG_THREAD_LIB)
831         OSG_ADD_OPT(OSG_DL_LIB)
832     ENDIF(UNIX)
834     IF(APPLE)
835         FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
836         FIND_LIBRARY(OSG_CORESERVICES_FRAMEWORK NAMES CoreServices)
837         FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
838         FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
840         OSG_ADD_OPT(OSG_APPLICATIONSERVICES_FRAMEWORK)
841         OSG_ADD_OPT(OSG_CORESERVICES_FRAMEWORK)
842         OSG_ADD_OPT(OSG_CARBON_FRAMEWORK)
843         OSG_ADD_OPT(OSG_COCOA_FRAMEWORK)
844     ENDIF(APPLE)
846     OSG_ADD_OPT(CMAKE_INSTALL_PREFIX)
848 ENDIF(NOT OSG_BUILD_DEPENDEND)
850 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
851   IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
852     INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
853   ENDIF(EXISTS
854   ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
855 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
857 IF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
858   INCLUDE(${OSG_GLOBAL_PREP})
859 ENDIF(OSG_GLOBAL_PREP AND EXISTS ${OSG_GLOBAL_PREP})
861 IF(APPLE AND OSG_COCOA_FRAMEWORK)
862     OSG_SET(OSG_NATIVE_WINDOW OSGWindowCocoa)
863 ELSEIF(WIN32)
864     OSG_SET(OSG_NATIVE_WINDOW OSGWindowWIN32)
865 ELSEIF(UNIX AND X11_FOUND)
866     OSG_SET(OSG_NATIVE_WINDOW OSGWindowX)
867 ELSEIF(APPLE AND IOS)
868     OSG_SET(OSG_NATIVE_WINDOW OSGWindowEAGL)
869 ELSE()
870     OSG_SET(OSG_NATIVE_WINDOW "")
871 ENDIF()
873 ###############
874 #### Doxygen
875 ###############
877 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
878   SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen" 
879                          CACHE FILEPATH "doxygen executable (custom)" FORCE)
880 ENDIF()
882 FIND_PACKAGE(Doxygen)
884 ##############################################################################
885 # Overrides if dependend
886 ##############################################################################
888 IF(NOT WIN32)
889     IF(OSG_BUILD_DEPENDEND)
890         MESSAGE(STATUS "Load reference settings")
891         INCLUDE(${OSG_REFERENCE_DIR}/CMake.settings)
892         # Needed to get the correct vtk/boost settings
893         FIND_PACKAGE(VTK)
894         OSG_BOOST_DEP_SETUP()
895         OSG_CONFIGURE_QT()
896     ELSE(OSG_BUILD_DEPENDEND)
897 #        OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
898     ENDIF(OSG_BUILD_DEPENDEND)
899 ENDIF(NOT WIN32)
901 ##############################################################################
902 # MAIN BUILD STEPS
903 ##############################################################################
905 # when adding passes, make sure to add a corresponding pass directory variable
906 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
907 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
909 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
910 SET(OSG_PASSDIR_OSGSETUP   "Build")
912 ADD_CUSTOM_TARGET(OSGAll)
914 ###############
915 # Clean
916 ###############
918 FILE(GLOB OSG_OLD_BUILD_FILES  "${CMAKE_BINARY_DIR}/*.cmake")
920 IF(OSG_OLD_BUILD_FILES)
921     FILE(REMOVE ${OSG_OLD_BUILD_FILES})
922 ENDIF(OSG_OLD_BUILD_FILES)
924 FILE(GLOB OSG_OLD_CONFIG_FILES "${CMAKE_BINARY_DIR}/bin/osg2-config.part*.tmp")
926 IF(OSG_OLD_CONFIG_FILES)
927     FILE(REMOVE ${OSG_OLD_CONFIG_FILES})
928 ENDIF(OSG_OLD_CONFIG_FILES)
930 ###############
931 # Tests
932 ###############
934 ADD_CUSTOM_TARGET(OSGAllApps)
935 ADD_DEPENDENCIES(OSGAll OSGAllApps)
937 # optional pass for test programs
938 IF(OSGBUILD_TESTS)
939     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
940     SET(OSG_PASSDIR_OSGSETUPTEST "Test")
942     ADD_CUSTOM_TARGET(OSGAllTests)
943     ADD_DEPENDENCIES(OSGAll OSGAllTests)
944 ENDIF(OSGBUILD_TESTS)
946 ###############
947 # UnitTests
948 ###############
950 IF(OSGBUILD_UNITTESTS)
951     ENABLE_TESTING()
952     INCLUDE(CTest)
954     # optional pass for unittest programs
955     LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPUNITTEST")
956     SET(OSG_PASSDIR_OSGSETUPUNITTEST "UnitTest")
958     ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/Tools/unittest-cpp"
959                      "${OSG_PASSDIR_OSGSETUPUNITTEST}")
961     SET(OSG_UNITTEST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTest++/src")
962     SET(OSG_UNITTEST_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/bin")
963     SET(OSG_UNITTEST_LIBRARY      "UnitTest++")
965     ADD_CUSTOM_TARGET(OSGAllUnitTests)
966     ADD_DEPENDENCIES(OSGAll OSGAllUnitTests)
967 ENDIF(OSGBUILD_UNITTESTS)
969 ###############
970 # Python
971 ###############
973 # optional pass for test programs
974 IF(OSGBUILD_PYTHON_BINDINGS)
975     LIST(APPEND OSG_CMAKE_PASSES "OSGPYTHON")
976     SET(OSG_PASSDIR_OSGPYTHON "Python")
978     IF(EXISTS ${PYOSG_PYPLUSPLUS_DIR})
979       SET(OSG_HAS_PYOSG_PYPLUSPLUS_DIR "True")
980     ELSE()
981       SET(OSG_HAS_PYOSG_PYPLUSPLUS_DIR "False")
982     ENDIF()
984     IF(EXISTS ${PYOSG_PYPLUSPLUS_GOODIES_DIR})
985       SET(OSG_HAS_PYOSG_PYPLUSPLUS_GOODIES_DIR "True")
986     ELSE()
987       SET(OSG_HAS_PYOSG_PYPLUSPLUS_GOODIES_DIR "False")
988     ENDIF()
990     SET(OSG_CAN_REGEN_PYTHON_BINDINGS FALSE)
992     IF(GCCXML                       AND
993        PYOSG_DIR                    AND
994        PYOSG_PYPLUSPLUS_DIR         AND 
995        PYOSG_PYPLUSPLUS_GOODIES_DIR)
997      IF(EXISTS ${GCCXML}                       AND
998         EXISTS ${PYOSG_DIR}                    AND
999         EXISTS ${PYOSG_PYPLUSPLUS_DIR}         AND 
1000         EXISTS ${PYOSG_PYPLUSPLUS_GOODIES_DIR})
1002         SET(OSG_CAN_REGEN_PYTHON_BINDINGS TRUE)
1004       ENDIF()
1005     ENDIF()
1007     EXECUTE_PROCESS(
1008       COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1009                 "${CMAKE_SOURCE_DIR}/Bindings/Python/genLibOrder.py"
1010                 "${CMAKE_BINARY_DIR}/Python/Helper/genLibOrder.py")
1012     FILE(WRITE  "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "# Lib order information\n\n\nlibInfo = {}\n\n")
1013     FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "fullLibInfo = {}\n\n")
1015     IF(EXISTS ${PYOSG_DIR})
1016       FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper")
1018       #########################
1019       # osggen.py
1020       #########################
1022       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osggen.py")
1023       SET(_OSG_FILE_OUT_PROC "${CMAKE_BINARY_DIR}/Python/Helper/processed/osggen.py.proc")
1024       SET(_OSG_FILE_OUT      "${CMAKE_BINARY_DIR}/Python/Helper/osggen.py")
1025       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/osggen.py.patch")
1027       EXECUTE_PROCESS(
1028         COMMAND "${CMAKE_COMMAND}" -E copy
1029                   "${_OSG_FILE_IN}"
1030                   "${_OSG_FILE_OUT_PROC}")
1032       EXECUTE_PROCESS(COMMAND "patch" 
1033                       INPUT_FILE "${_OSG_PATCH_FILE}"
1034                       WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper/processed")
1036       EXECUTE_PROCESS(
1037         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1038                   "${_OSG_FILE_OUT_PROC}"
1039                   "${_OSG_FILE_OUT}")
1042       #########################
1043       # splitGenHelper.py
1044       #########################
1046       EXECUTE_PROCESS(
1047         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1048                   "${CMAKE_SOURCE_DIR}/Bindings/Python/splitGenHelper.py"
1049                   "${CMAKE_BINARY_DIR}/Python/Helper/splitGenHelper.py")
1050      
1051       #########################
1052       # settings.py
1053       #########################
1055       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/settings.py")
1056       SET(_OSG_FILE_OUT_PROC "${CMAKE_BINARY_DIR}/Python/Helper/processed/settings.py.proc")
1057       SET(_OSG_FILE_OUT      "${CMAKE_BINARY_DIR}/Python/Helper/settings.py")
1058       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/settings.py.patch")
1060       EXECUTE_PROCESS(
1061         COMMAND "${CMAKE_COMMAND}" -E copy
1062                   "${_OSG_FILE_IN}"
1063                   "${_OSG_FILE_OUT_PROC}")
1065       EXECUTE_PROCESS(COMMAND "patch" 
1066                       INPUT_FILE "${_OSG_PATCH_FILE}"
1067                       WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Python/Helper/processed")
1069       EXECUTE_PROCESS(
1070         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1071                   "${_OSG_FILE_OUT_PROC}"
1072                   "${_OSG_FILE_OUT}")
1074       #########################
1075       # PreBoostPython.h
1076       #########################
1078       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/PreBoostPython.h")
1079       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/PreBoostPython.h.proc")
1080       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/PreBoostPython.h")
1082       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1084       STRING(REPLACE "<OpenSG/"
1085                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1087       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1089       EXECUTE_PROCESS(
1090         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1091                   "${_OSG_FILE_OUT_PROC}"
1092                   "${_OSG_FILE_OUT}")
1095       #########################
1096       # OsgPtrHelpers.h
1097       #########################
1099       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/OsgPtrHelpers.h")
1100       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/OsgPtrHelpers.h.proc")
1101       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/OsgPtrHelpers.h")
1103       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1105       STRING(REPLACE "<OpenSG/"
1106                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1108       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1110       EXECUTE_PROCESS(
1111         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1112                   "${_OSG_FILE_OUT_PROC}"
1113                   "${_OSG_FILE_OUT}")
1116       #########################
1117       # pypp_OSGBase_aliases.h
1118       #########################
1120       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/aliases.h")
1121       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed/pypp_aliases.h.proc")
1122       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/pypp_aliases.h")
1123       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/pypp_aliases.h.patch")
1125       EXECUTE_PROCESS(
1126         COMMAND "${CMAKE_COMMAND}" -E copy
1127                   "${_OSG_FILE_IN}"
1128                   "${_OSG_FILE_OUT_PROC}")
1130       EXECUTE_PROCESS(COMMAND "patch" 
1131                       INPUT_FILE "${_OSG_PATCH_FILE}"
1132                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/processed")
1134       EXECUTE_PROCESS(
1135         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1136                   "${_OSG_FILE_OUT_PROC}"
1137                   "${_OSG_FILE_OUT}")
1140       #########################
1141       # ColorWrapper.h
1142       #########################
1144       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/ColorWrapper.h")
1145       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/ColorWrapper.h.proc")
1146       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/ColorWrapper.h")
1148       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1150       STRING(REPLACE "<OpenSG/"
1151                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1153       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1155       EXECUTE_PROCESS(
1156         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1157                   "${_OSG_FILE_OUT_PROC}"
1158                   "${_OSG_FILE_OUT}")
1161       #########################
1162       # VecStorageWrappers.h
1163       #########################
1165       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/VecStorageWrappers.h")
1166       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/VecStorageWrappers.h.proc")
1167       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/VecStorageWrappers.h")
1169       FILE(READ ${_OSG_FILE_IN} _OSG_FILE_IN_DATA)
1171       STRING(REPLACE "<OpenSG/"
1172                      "<" _OSG_FILE_IN_DATA_P1 "${_OSG_FILE_IN_DATA}")
1174       FILE(WRITE ${_OSG_FILE_OUT_PROC} "${_OSG_FILE_IN_DATA_P1}")
1176       EXECUTE_PROCESS(
1177         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1178                   "${_OSG_FILE_OUT_PROC}"
1179                   "${_OSG_FILE_OUT}")
1182       #########################
1183       # BaseWrappers.h
1184       #########################
1186       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.h")
1187       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/BaseWrappers.h.proc")
1188       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/BaseWrappers.h")
1189       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Patches/wrappers.h.patch")
1191       EXECUTE_PROCESS(
1192         COMMAND "${CMAKE_COMMAND}" -E copy
1193                   "${_OSG_FILE_IN}"
1194                   "${_OSG_FILE_OUT_PROC}")
1196       EXECUTE_PROCESS(COMMAND "patch" 
1197                       INPUT_FILE "${_OSG_PATCH_FILE}"
1198                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed")
1200       EXECUTE_PROCESS(
1201         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1202                   "${_OSG_FILE_OUT_PROC}"
1203                   "${_OSG_FILE_OUT}")
1206       #########################
1207       # BaseWrappers.cpp
1208       #########################
1210       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.cpp")
1211       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed/BaseWrappers.cpp.proc")
1212       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/BaseWrappers.cpp")
1213       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Patches/wrappers.cpp.patch")
1215       EXECUTE_PROCESS(
1216         COMMAND "${CMAKE_COMMAND}" -E copy
1217                   "${_OSG_FILE_IN}"
1218                   "${_OSG_FILE_OUT_PROC}")
1220       EXECUTE_PROCESS(COMMAND "patch" 
1221                       INPUT_FILE "${_OSG_PATCH_FILE}"
1222                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/Base/Bindings/Python/Wrapper/processed")
1224       EXECUTE_PROCESS(
1225         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1226                   "${_OSG_FILE_OUT_PROC}"
1227                   "${_OSG_FILE_OUT}")
1231       #########################
1232       # SystemWrappers.h
1233       #########################
1235       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.h")
1236       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed/SystemWrappers.h.proc")
1237       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/SystemWrappers.h")
1238       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Patches/wrappers.h.patch")
1240       EXECUTE_PROCESS(
1241         COMMAND "${CMAKE_COMMAND}" -E copy
1242                   "${_OSG_FILE_IN}"
1243                   "${_OSG_FILE_OUT_PROC}")
1245       EXECUTE_PROCESS(COMMAND "patch" 
1246                       INPUT_FILE "${_OSG_PATCH_FILE}"
1247                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed")
1249       EXECUTE_PROCESS(
1250         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1251                   "${_OSG_FILE_OUT_PROC}"
1252                   "${_OSG_FILE_OUT}")
1255       #########################
1256       # SystemWrappers.cpp
1257       #########################
1259       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/Wrappers.cpp")
1260       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed/SystemWrappers.cpp.proc")
1261       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/SystemWrappers.cpp")
1262       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Patches/wrappers.cpp.patch")
1264       EXECUTE_PROCESS(
1265         COMMAND "${CMAKE_COMMAND}" -E copy
1266                   "${_OSG_FILE_IN}"
1267                   "${_OSG_FILE_OUT_PROC}")
1269       EXECUTE_PROCESS(COMMAND "patch" 
1270                       INPUT_FILE "${_OSG_PATCH_FILE}"
1271                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Source/System/Bindings/Python/Wrapper/processed")
1273       EXECUTE_PROCESS(
1274         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1275                   "${_OSG_FILE_OUT_PROC}"
1276                   "${_OSG_FILE_OUT}")
1279       #########################
1280       # helpers.py
1281       #########################
1283       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/helpers.py")
1284       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/helpers.py.proc")
1285       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py")
1286       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/helpers.py.patch")
1288       EXECUTE_PROCESS(
1289         COMMAND "${CMAKE_COMMAND}" -E copy
1290                   "${_OSG_FILE_IN}"
1291                   "${_OSG_FILE_OUT_PROC}")
1293       EXECUTE_PROCESS(COMMAND "patch" 
1294                       INPUT_FILE "${_OSG_PATCH_FILE}"
1295                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1297       EXECUTE_PROCESS(
1298         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1299                   "${_OSG_FILE_OUT_PROC}"
1300                   "${_OSG_FILE_OUT}")
1303       #########################
1304       # cored_node.py
1305       #########################
1307       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/cored_node.py")
1308       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/cored_node.py.proc")
1309       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py")
1310       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/cored_node.py.patch")
1312       EXECUTE_PROCESS(
1313         COMMAND "${CMAKE_COMMAND}" -E copy
1314                   "${_OSG_FILE_IN}"
1315                   "${_OSG_FILE_OUT_PROC}")
1317       EXECUTE_PROCESS(COMMAND "patch" 
1318                       INPUT_FILE "${_OSG_PATCH_FILE}"
1319                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1321       EXECUTE_PROCESS(
1322         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1323                   "${_OSG_FILE_OUT_PROC}"
1324                   "${_OSG_FILE_OUT}")
1327       #########################
1328       # fcd_reflector.py
1329       #########################
1331       SET(_OSG_FILE_IN       "${PYOSG_DIR}/src/osg_module/lib/fcd_reflector.py")
1332       SET(_OSG_FILE_OUT_PROC "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed/fcd_reflector.py.proc")
1333       SET(_OSG_FILE_OUT      "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py")
1334       SET(_OSG_PATCH_FILE    "${CMAKE_SOURCE_DIR}/Bindings/Python/Patches/fcd_reflector.py.patch")
1336       EXECUTE_PROCESS(
1337         COMMAND "${CMAKE_COMMAND}" -E copy
1338                   "${_OSG_FILE_IN}"
1339                   "${_OSG_FILE_OUT_PROC}")
1341       EXECUTE_PROCESS(COMMAND "patch" 
1342                       INPUT_FILE "${_OSG_PATCH_FILE}"
1343                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/processed")
1345       EXECUTE_PROCESS(
1346         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1347                   "${_OSG_FILE_OUT_PROC}"
1348                   "${_OSG_FILE_OUT}")
1350     ENDIF(EXISTS ${PYOSG_DIR})
1352     SET(_OSG_SRC_PYPATH_HELPERS ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers)
1353     SET(_OSG_SRC_PYPATH_OSG     ${CMAKE_BINARY_DIR}/Python/lib/osg2/helpers)
1355     SET(_OSG_DST_PYPATH_HELPERS ${CMAKE_BINARY_DIR}/Python/lib/osg2/helpers)
1356     SET(_OSG_DST_PYPATH_OSG     ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg)
1358     FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Python/lib/osg2)
1359     FILE(MAKE_DIRECTORY ${_OSG_DST_PYPATH_HELPERS})
1360     FILE(MAKE_DIRECTORY ${_OSG_DST_PYPATH_OSG})
1362     OSG_SYMLINK_CHECKED(${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1363                         ${CMAKE_BINARY_DIR}/Python/lib/osg2/__init__.py)
1365     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/cored_node.py
1366                         ${_OSG_DST_PYPATH_HELPERS}/cored_node.py)
1367     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/fcd_reflector.py
1368                         ${_OSG_DST_PYPATH_HELPERS}/fcd_reflector.py)
1369     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/helpers.py
1370                         ${_OSG_DST_PYPATH_HELPERS}/helpers.py)
1371     OSG_SYMLINK_CHECKED(${_OSG_SRC_PYPATH_HELPERS}/__init__.py
1372                         ${_OSG_DST_PYPATH_HELPERS}/__init__.py)
1374     SET(OSG_PYTHON_COMMON_INCDIR "${CMAKE_SOURCE_DIR}/Bindings/Python/Common" CACHE PATH "" FORCE)
1376     ADD_CUSTOM_TARGET(OSGPy)
1377     IF(OSG_CAN_REGEN_PYTHON_BINDINGS)
1378       ADD_CUSTOM_TARGET(OSGPyGen)
1379     ENDIF()
1380 #    ADD_CUSTOM_TARGET(OSGPyBuild)
1382 ENDIF(OSGBUILD_PYTHON_BINDINGS)
1384 # Neverthless install bindings common headers
1385 INSTALL(FILES "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/PreBoostPython.h"
1386               "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/OsgPtrHelpers.h"
1387               "${CMAKE_SOURCE_DIR}/Bindings/Python/Common/pypp_aliases.h"
1388         DESTINATION include/OpenSG/Bindings/Python/Common
1389         COMPONENT code_headers)
1393 #################
1394 # Documentation I
1395 #################
1396 SET(OSG_DOXY_HTML_DIR "${CMAKE_BINARY_DIR}/Doc/html")
1397 FILE(MAKE_DIRECTORY ${OSG_DOXY_HTML_DIR})
1399 IF(OSG_GENERATE_SEPARATE_LIB_DOC)
1400     ADD_CUSTOM_TARGET(Doc)
1401 ENDIF()
1403 IF(DOXYGEN_EXECUTABLE)
1404     SET(DOXYGEN_VERSION)
1405     EXECUTE_PROCESS(COMMAND "${DOXYGEN_EXECUTABLE}" "--version"
1406                     OUTPUT_VARIABLE DOXYGEN_VERSION
1407                     OUTPUT_STRIP_TRAILING_WHITESPACE)
1408     IF(DOXYGEN_VERSION STREQUAL "1.7.3")
1409         MESSAGE(WARNING "Detected doxygen version 1.7.3, which is known to crash "
1410                         "when building OpenSG documentation. "
1411                         "Please use a different version, sorry for the inconvenience.")
1412     ENDIF(DOXYGEN_VERSION STREQUAL "1.7.3")
1413 ENDIF(DOXYGEN_EXECUTABLE)
1415 IF(NOT OSG_DOXY_INPUTS)
1416     # add a pass for doxygen to run
1417     LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
1418     SET(OSG_PASSDIR_OSGDOXYDOC "Doc")
1419 ENDIF(NOT OSG_DOXY_INPUTS)
1421 # set up variables for the config file
1422 IF(DOXYGEN_DOT_EXECUTABLE)
1423     SET(OSG_DOXY_HAVE_DOT "YES")
1424 ENDIF(DOXYGEN_DOT_EXECUTABLE)
1426 SET(OSG_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
1427 SET(OSG_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/opensg-doxy")
1428 SET(OSG_GENDOXY_CONFIGURATION_FILE "${CMAKE_BINARY_DIR}/GenDoc/opensg-doxy")
1430 SET(OSG_DOXY_HTML_CSS "${CMAKE_SOURCE_DIR}/Doc/doxygen_osg.css")
1432 IF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1433     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1434     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1435     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1436     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1437     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1438     SET(OSG_DOXY_SEARCHENGINE "NO")
1440 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Developer")
1441     SET(OSG_DOXY_FULL_PATH_NAMES "YES")
1442     SET(OSG_DOXY_STRIP_FROM_PATH "${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}")
1443     SET(OSG_DOXY_INTERNAL_DOCS "YES")
1444     SET(OSG_DOXY_STRIP_CODE_COMMENTS "NO")
1445     SET(OSG_DOXY_GENERATE_TREEVIEW "YES")
1446     SET(OSG_DOXY_SEARCHENGINE "NO")
1448 ELSEIF(OSG_DOXY_DOC_TYPE STREQUAL "Trac")
1449     SET(OSG_DOXY_FULL_PATH_NAMES "NO")
1450     SET(OSG_DOXY_INTERNAL_DOCS "NO")
1451     SET(OSG_DOXY_STRIP_CODE_COMMENTS "YES")
1452     SET(OSG_DOXY_HAVE_DOT "NO")
1453     SET(OSG_DOXY_GENERATE_TREEVIEW "NO")
1454     SET(OSG_DOXY_HTML_HEADER "${CMAKE_SOURCE_DIR}/Doc/TracHeader.html")
1455     SET(OSG_DOXY_HTML_FOOTER "${CMAKE_SOURCE_DIR}/Doc/TracFooter.html")
1456     SET(OSG_DOXY_SEARCHENGINE "NO")
1458 ENDIF(OSG_DOXY_DOC_TYPE STREQUAL "User")
1460 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1461   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Full")
1462 ELSE()
1463   SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/Doc/html/Glue")
1464 ENDIF()
1466 FILE(MAKE_DIRECTORY ${OSG_OpenSG_DOC_DIRECTORY})
1468 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGFullDoc.include")
1469 SET(OSG_DOC_GENERAL_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGGeneralDoc.include")
1471 IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1472   SET(OSG_DOC_SECTION "all_in_one")
1473   SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
1474 ELSE()
1475   SET(OSG_DOC_SECTION "separate")
1476 ENDIF()
1478 # write doxygen config file
1479 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1480                "${OSG_DOXY_CONFIGURATION_FILE}")
1483 # write general doc config file
1485 SET(OSG_OpenSG_DOC_DIRECTORY "${CMAKE_BINARY_DIR}/GenDoc")
1486 SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE "")
1487 #SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS=${CMAKE_BINARY_DIR}/Doc/html/Full/html")
1489 SET(OSG_DOC_SECTION "${OSG_DOC_SECTION} include_general_doc")
1491 CONFIGURE_FILE("${OSG_DOXY_CONFIGURATION_FILE_IN}"
1492                "${OSG_GENDOXY_CONFIGURATION_FILE}")
1494 SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
1496 # find/process documentation include files
1497 FILE(GLOB OSG_DOC_INCLUDES "${CMAKE_SOURCE_DIR}/Doc/Include/*.include")
1499 FOREACH(_OSG_DOC_INCLUDE_FULL ${OSG_DOC_INCLUDES})
1501   GET_FILENAME_COMPONENT(_OSG_DOC_INCLUDE ${_OSG_DOC_INCLUDE_FULL} NAME)
1503   CONFIGURE_FILE("${_OSG_DOC_INCLUDE_FULL}"
1504                  "${CMAKE_BINARY_DIR}/Doc/Include/${_OSG_DOC_INCLUDE}")
1506 ENDFOREACH()
1508 IF(OSG_DOXY_INPUTS)
1509     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
1510                 "@INCLUDE = ${OSG_DOXY_INPUTS}\n")
1511 ENDIF(OSG_DOXY_INPUTS)
1514 IF(DOXYGEN_EXECUTABLE)
1515   ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
1516   ADD_DEPENDENCIES(DocUpload Doc)
1519   ADD_CUSTOM_TARGET(DocSyncGV
1520                     COMMAND rsync html -av --delete html rsync://tombstone.camtech.ntu.edu.sg/opensgdoc
1521                     WORKING_DIRECTORY Doc)
1523   ADD_CUSTOM_TARGET(DocCompleteGV)
1524   ADD_DEPENDENCIES(DocCompleteGV Doc DocSyncGV)
1525 ENDIF(DOXYGEN_EXECUTABLE)
1527 ADD_CUSTOM_TARGET(OSGAllLibs)
1528 ADD_DEPENDENCIES(OSGAll OSGAllLibs)
1530 ADD_CUSTOM_TARGET(OSGAllCoreLibs)
1531 ADD_CUSTOM_TARGET(OSGAllContribLibs)
1533 ###############
1534 # Passes
1535 ###############
1537 FOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1538   MESSAGE(STATUS "processing core ext : ${_OSGCORE_EXT_DIR}")
1540   FILE(GLOB_RECURSE _OSG_LIBRARY_EXT_CONFIG_FILES
1541        "${_OSGCORE_EXT_DIR}/*CMakeLists.Extension.*.txt")
1543   FOREACH(_OSGCORE_EXT_FILE ${_OSG_LIBRARY_EXT_CONFIG_FILES})
1544     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_FILE}")
1545     INCLUDE(${_OSGCORE_EXT_FILE})
1546   ENDFOREACH(_OSGCORE_EXT_FILE ${OSG_LIBRARY_EXT_CONFIG_FILES})
1549 ENDFOREACH(_OSGCORE_EXT_DIR ${OSG_CORE_EXTENSIONS})
1551 # Find files describing libraries to build, but make sure base
1552 # and system are processed first
1553 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_BASE RELATIVE "${CMAKE_SOURCE_DIR}"
1554      "Source/CMakeLists.Lib.OSGBase.txt")
1556 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILE_SYSTEM RELATIVE "${CMAKE_SOURCE_DIR}"
1557      "Source/CMakeLists.Lib.OSGSystem.txt")
1559 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
1560      "Source/*CMakeLists.Lib.*.txt")
1562 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1563 LIST(REMOVE_ITEM _OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1565 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_BASE})
1566 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${OSG_LIBRARY_CONFIG_FILE_SYSTEM})
1568 FOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1569   STRING(REGEX MATCH Source/Contrib _OSG_FOUND_CONTRIB_CONFIG ${_OSG_LIBRARY_CONFIG})
1571   IF(_OSG_FOUND_CONTRIB_CONFIG)
1572     LIST(APPEND _OSG_CONTRIB_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1573   ELSE()
1574     LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG})
1575   ENDIF(_OSG_FOUND_CONTRIB_CONFIG)
1576 ENDFOREACH(_OSG_LIBRARY_CONFIG ${_OSG_LIBRARY_CONFIG_FILES})
1578 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_CONTRIB_LIBRARY_CONFIG_FILES})
1580 FOREACH(_OSG_LIBRARY_CONFIG ${OSG_LIBRARY_CONFIG_FILES})
1582   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_DIR
1583                          ${_OSG_LIBRARY_CONFIG}
1584                           PATH)
1586   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1587                          ${_OSG_LIBRARY_CONFIG}
1588                           NAME)
1590   STRING(REPLACE CMakeLists.Lib. "" _OSG_LIBCONFIG_BASENAME_1
1591                      ${_OSG_LIBCONFIG_BASENAME})
1593   GET_FILENAME_COMPONENT(_OSG_LIBCONFIG_BASENAME
1594                          ${_OSG_LIBCONFIG_BASENAME_1}
1595                          NAME_WE)
1597   IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1598     INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${_OSG_LIBCONFIG_DIR}/${_OSG_LIBCONFIG_BASENAME}.Prepare.cmake")
1599   ENDIF()
1601 ENDFOREACH()
1603 IF(OSG_ENABLE_CUDA)
1604   IF(CUDA_FOUND)
1605     SET(OSG_WITH_CUDA 1)
1606   ENDIF(CUDA_FOUND)
1607 ELSE(OSG_ENABLE_CUDA)
1608   SET(OSG_WITH_CUDA 0)
1609 ENDIF(OSG_ENABLE_CUDA)
1610 IF(OPENCL_FOUND)
1611   SET(OSG_WITH_OPENCL)
1612 ENDIF(OPENCL_FOUND)
1614 # run build passes
1615 FOREACH(PASS ${OSG_CMAKE_PASSES})
1616     SET(OSG_CMAKE_PASS ${PASS})
1618     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
1620     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
1621         GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
1622         GET_FILENAME_COMPONENT(LIBFILENAME  "${LIBCONFIGFILE}" NAME)
1623         STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
1624         STRING(REPLACE ".txt"            "" LIBFILENAME "${LIBFILENAME}")
1626         STRING(REGEX MATCH OSGContrib*|OSGTest* _OSG_IS_CONTRIBLIB ${LIBFILENAME})
1628         IF(_OSG_IS_CONTRIBLIB)
1629           SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1630         ELSE()
1631           SET(OSG_MAIN_LIB_TARGET OSGAllCoreLibs)
1632         ENDIF()
1634         ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
1635     ENDFOREACH(LIBCONFIGFILE)
1637     SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
1639     FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1640         ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
1641                          "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
1642     ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
1644 ENDFOREACH()
1646 IF(NOT WIN32)
1647   IF(NOT OSG_BUILD_DEPENDEND)
1648     OSG_WRITE_SETTINGS(${CMAKE_BINARY_DIR}/CMake.settings)
1649   ENDIF(NOT OSG_BUILD_DEPENDEND)
1650 ENDIF(NOT WIN32)
1652 ###############
1653 # OSGConfigured
1654 ###############
1657 EXECUTE_PROCESS(
1658     COMMAND "${CMAKE_COMMAND}" -E copy
1659                      "${CMAKE_SOURCE_DIR}/OSGConfigured.h.cmake"
1660                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake")
1662 FOREACH(_OSG_ADD_CONFIGURE_LINE ${OSG_ADDITIONAL_CONFIGURE_LINES})
1663   FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
1664 ENDFOREACH()
1666 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake" "\n#endif // _OSGCONFIGURED_H_\n")
1668 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp.cmake"
1669                "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp")
1671 EXECUTE_PROCESS(
1672     COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1673                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h.tmp"
1674                      "${CMAKE_BINARY_DIR}/Source/Base/Base/OSGConfigured.h")
1676 #################
1677 # Examples/Simple
1678 #################
1680 ADD_CUSTOM_TARGET(OSGAllExamples)
1681 ADD_DEPENDENCIES(OSGAll OSGAllExamples)
1683 IF(OSGBUILD_EXAMPLES_SIMPLE)
1684     ADD_CUSTOM_TARGET(OSGAllSimpleExamples)
1685     ADD_SUBDIRECTORY("Examples/Simple")
1686     ADD_DEPENDENCIES(OSGAllExamples OSGAllSimpleExamples)
1687 ENDIF(OSGBUILD_EXAMPLES_SIMPLE)
1689 ###################
1690 # Examples/Advanced
1691 ###################
1693 IF(OSGBUILD_EXAMPLES_ADVANCED)
1694     ADD_CUSTOM_TARGET(OSGAllAdvancedExamples)
1695     ADD_SUBDIRECTORY("Examples/Advanced/DeferredShading")
1696     ADD_SUBDIRECTORY("Examples/Advanced/Character")
1697     ADD_DEPENDENCIES(OSGAllExamples OSGAllAdvancedExamples)
1698 ENDIF(OSGBUILD_EXAMPLES_ADVANCED)
1700 ###################
1701 # Examples/Advanced
1702 ###################
1704 IF(OSGBUILD_EXAMPLES_TUTORIAL)
1705     ADD_CUSTOM_TARGET(OSGAllTutorialExamples)
1706     ADD_SUBDIRECTORY("Examples/Tutorial")
1707     ADD_DEPENDENCIES(OSGAllExamples OSGAllTutorialExamples)
1708 ENDIF(OSGBUILD_EXAMPLES_TUTORIAL)
1710 ###################
1711 # External Examples
1712 ###################
1714 FOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1715   MESSAGE(STATUS "processing example ext : ${_OSGCORE_EXT_EXAMPLE_DIR}")
1717   IF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1718     MESSAGE(STATUS "   Found and process ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt")
1719     INCLUDE(${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1720   ENDIF(EXISTS ${_OSGCORE_EXT_EXAMPLE_DIR}/CMakeLists.Examples.txt)
1721 ENDFOREACH(_OSGCORE_EXT_EXAMPLE_DIR ${OSG_CORE_EXAMPLE_EXTENSIONS})
1723 ##################
1724 # Documentation II
1725 ##################
1727 SET(OSG_DOC_PIPES "")
1729 IF(OSG_DOXY_STDOUT_LOG)
1730     SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG})
1731 ENDIF(OSG_DOXY_STDOUT_LOG)
1733 IF(DOXYGEN_EXECUTABLE)
1734     IF(NOT OSG_GENERATE_SEPARATE_LIB_DOC)
1735         ADD_CUSTOM_TARGET(Doc
1736             VERBATIM
1737             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1738     ENDIF()
1739 ENDIF()
1741 IF(DOXYGEN_EXECUTABLE)
1742   ADD_CUSTOM_TARGET(GenDoc
1743                     VERBATIM
1744                     COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_GENDOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES})
1745 ENDIF()
1747 ##################
1748 # osg2-config
1749 ##################
1751 # osg2-config is created from multiple parts (parts 1 and 3 static, part 2
1752 # is generated during the OSGCOLLECT pass.
1754 # substitute variables in static parts
1755 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part1.in"
1756                "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1757 CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/CMake/osg2-config.part3.in"
1758                "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1760 # read in all parts
1761 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp" OSG2_CONFIG_PART1_CONTENT)
1762 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp" OSG2_CONFIG_PART2_CONTENT)
1763 FILE(READ "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp" OSG2_CONFIG_PART3_CONTENT)
1765 # concatenate final file
1766 FILE(WRITE  "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART1_CONTENT}")
1767 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART2_CONTENT}")
1768 FILE(APPEND "${CMAKE_BINARY_DIR}/bin/osg2-config" "${OSG2_CONFIG_PART3_CONTENT}")
1770 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part1.tmp")
1771 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
1772 FILE(REMOVE  "${CMAKE_BINARY_DIR}/bin/osg2-config.part3.tmp")
1774 INSTALL(PROGRAMS "${CMAKE_BINARY_DIR}/bin/osg2-config"
1775         DESTINATION bin
1776         COMPONENT development_tools)
1778 ##################
1779 # cmake modules
1780 ##################
1782 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenSG.cmake"
1783         DESTINATION share/OpenSG/cmake
1784         COMPONENT development_configuration)
1785 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindCollada.cmake"
1786         DESTINATION share/OpenSG/cmake
1787         COMPONENT development_configuration)
1788 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindOpenEXR.cmake"
1789         DESTINATION share/OpenSG/cmake
1790         COMPONENT development_configuration)
1791 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindGLUT_OpenSG.cmake"
1792         DESTINATION share/OpenSG/cmake
1793         COMPONENT development_configuration)
1794 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindJPEG_OpenSG.cmake"
1795         DESTINATION share/OpenSG/cmake
1796         COMPONENT development_configuration)
1797 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindPNG_OpenSG.cmake"
1798         DESTINATION share/OpenSG/cmake
1799         COMPONENT development_configuration)
1800 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindTIFF_OpenSG.cmake"
1801         DESTINATION share/OpenSG/cmake
1802         COMPONENT development_configuration)
1803 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/FindZLIB_OpenSG.cmake"
1804         DESTINATION share/OpenSG/cmake
1805         COMPONENT development_configuration)
1806 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/SetupCompiler.cmake"
1807         DESTINATION share/OpenSG/cmake
1808         COMPONENT development_configuration)
1809 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/UpdateCompiler.cmake"
1810         DESTINATION share/OpenSG/cmake
1811         COMPONENT development_configuration)
1812 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/BuildFunctions.cmake"
1813         DESTINATION share/OpenSG/cmake
1814         COMPONENT development_configuration)
1815 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/ConfigurePackages.cmake"
1816         DESTINATION share/OpenSG/cmake
1817         COMPONENT development_configuration)
1818 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/ExternalProjectHelper.cmake"
1819         DESTINATION share/OpenSG/cmake
1820         COMPONENT development_configuration)
1821 INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/OpenSGVersion.cmake"
1822         DESTINATION share/OpenSG/cmake
1823         COMPONENT development_configuration)
1824 INSTALL(FILES "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
1825         DESTINATION share/OpenSG/cmake
1826         COMPONENT development_configuration)
1827 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Tools/fcd2code"
1828         DESTINATION bin
1829         COMPONENT development_tools
1830         PATTERN "*.pyc" EXCLUDE
1831         PATTERN ".svn"  EXCLUDE)
1833 ##################
1834 # Global Python
1835 ##################
1837 IF(OSGBUILD_PYTHON_BINDINGS)
1838   EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} Python/Helper/genLibOrder.py
1839                   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1840                   OUTPUT_VARIABLE _OSG_LIBORDER)
1843                  
1844   SET(_OSG_PY_MODNAME_LIST "osg2ModuleNameList = [\n")
1845   SET(_OSG_PY_MOD_LIST "osg2ModuleList = [\n")
1847   FOREACH(_OSG_LIB ${_OSG_LIBORDER})
1848     STRING(REPLACE "\n" "" _OSG_LIB ${_OSG_LIB})
1849     SET(OSG_PYTHON_ALL_IMPORTS "${OSG_PYTHON_ALL_IMPORTS}from ..${_OSG_LIB} import *\n")
1850     SET(_OSG_PY_MOD_LIST "${_OSG_PY_MOD_LIST}  ${_OSG_LIB}Py,\n")
1851     SET(_OSG_PY_MODNAME_LIST "${_OSG_PY_MODNAME_LIST}  \"${_OSG_LIB}\",\n")
1852   ENDFOREACH()
1854   SET(OSG_PYTHON_ALL_IMPORTS "${_OSG_PY_MODNAME_LIST}  ]\n\n${OSG_PYTHON_ALL_IMPORTS}\n\n${_OSG_PY_MOD_LIST}  ]\n\n")
1856   SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_SOURCE_DIR}/Bindings/Python/osg.__init__.py.in")
1857   SET(_OSG_GEN_INIT_FILE_OUT "${CMAKE_SOURCE_DIR}/Bindings/Python/module/__init__.py")
1860   CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1861                  "${_OSG_GEN_INIT_FILE_OUT}")
1863   OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
1864                       ${CMAKE_BINARY_DIR}/Python/lib/osg2/osg/__init__.py)
1866   IF(WIN32) 
1868     SET(_OSG_TARGET_PYLIBDIR    lib/python/${_OSG_ISC}rel/osg2)
1869     SET(_OSG_TARGET_PYLIBDIR_D  lib/python/${_OSG_ISC}debug/osg2)
1870     SET(_OSG_TARGET_PYLIBDIR_RN lib/python/${_OSG_ISC}relnoopt/osg2)
1871     SET(_OSG_TARGET_PYLIBDIR_DO lib/python/${_OSG_ISC}debugopt/osg2)
1873     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1874             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/osg
1875             CONFIGURATIONS Release
1876             COMPONENT      release_runtimes)
1878     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1879             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/osg
1880             CONFIGURATIONS Debug
1881             COMPONENT      debug_runtimes)
1883     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1884             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/osg
1885             CONFIGURATIONS DebugOpt
1886             COMPONENT      debug_opt_runtimes)
1888     INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
1889             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/osg
1890             CONFIGURATIONS ReleaseNoOpt
1891             COMPONENT      release_no_opt_runtimes)
1894     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1895             DESTINATION    ${_OSG_TARGET_PYLIBDIR}
1896             CONFIGURATIONS Release
1897             COMPONENT      release_runtimes)
1899     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1900                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1901                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1902                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1903             DESTINATION    ${_OSG_TARGET_PYLIBDIR}/helpers
1904             CONFIGURATIONS Release
1905             COMPONENT      release_runtimes)
1908     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1909             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}
1910             CONFIGURATIONS Debug
1911             COMPONENT      debug_runtimes)
1913     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1914                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1915                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1916                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1917             DESTINATION    ${_OSG_TARGET_PYLIBDIR_D}/helpers
1918             CONFIGURATIONS Debug
1919             COMPONENT      debug_runtimes)
1922     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1923             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}
1924             CONFIGURATIONS DebugOpt
1925             COMPONENT      debug_opt_runtimes)
1927     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1928                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1929                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1930                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1931             DESTINATION    ${_OSG_TARGET_PYLIBDIR_DO}/helpers
1932             CONFIGURATIONS DebugOpt
1933             COMPONENT      debug_opt_runtimes)
1936     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py
1937             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}
1938             CONFIGURATIONS ReleaseNoOpt
1939             COMPONENT      release_no_opt_runtimes)
1941     INSTALL(FILES          ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py
1942                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1943                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1944                            ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1945             DESTINATION    ${_OSG_TARGET_PYLIBDIR_RN}/helpers
1946             CONFIGURATIONS ReleaseNoOpt
1947             COMPONENT      release_no_opt_runtimes)
1949   ELSE(WIN32)   
1951     GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
1952     SET(_OSG_PY_INST_BASE 
1953         "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2")
1955     INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
1956             DESTINATION ${_OSG_PY_INST_BASE}/osg
1957             COMPONENT   libraries)
1959     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/osg2/__init__.py 
1960             DESTINATION ${_OSG_PY_INST_BASE}
1961             COMPONENT   libraries)
1963     INSTALL(FILES       ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/__init__.py 
1964                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/helpers.py 
1965                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/cored_node.py 
1966                         ${CMAKE_SOURCE_DIR}/Bindings/Python/helpers/fcd_reflector.py 
1967             DESTINATION ${_OSG_PY_INST_BASE}/helpers
1968             COMPONENT   libraries)
1970   ENDIF(WIN32)
1972 ENDIF()
1974 ##################
1975 # Documentation
1976 ##################
1978 IF(DOXYGEN_EXECUTABLE)
1979     IF(OSG_INSTALL_DOXYDOC)
1980         INSTALL(DIRECTORY "${OSG_DOXY_HTML_DIR}"
1981                 DESTINATION share/OpenSG/documentation
1982                 COMPONENT documentation)
1983     ENDIF()
1984 ENDIF()
1986 ##################
1987 # Images/Icons
1988 ##################
1990 ##################
1991 # CSM Example
1992 ##################
1994 INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Examples/CSM"
1995         DESTINATION share/OpenSG/Examples/
1996         COMPONENT examples_basic)
1998 ##################
1999 # Packaging
2000 ##################
2002 IF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
2004     SET(SYSTEM_SPEC  ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
2006     SET(CPACK_PACKAGE_NAME                "OpenSG")
2007     SET(CPACK_PACKAGE_VERSION             ${OSG_VERSION})
2008     SET(CPACK_PACKAGE_VERSION_MAJOR       ${OSG_VERSION_MAJOR})
2009     SET(CPACK_PACKAGE_VERSION_MINOR       ${OSG_VERSION_MINOR})
2010     SET(CPACK_PACKAGE_VERSION_PATCH       ${OSG_VERSION_PATCH})
2011     SET(CPACK_PACKAGE_VENDOR              "OpenSG")
2012     SET(CPACK_PACKAGE_CONTACT             "Dirk Reiners <dirk@www.opensg.org>")
2013     SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSG is a portable scenegraph system to create realtime 3D graphics programs")
2014     SET(CPACK_RESOURCE_FILE_LICENSE       "${CMAKE_SOURCE_DIR}/COPYING")
2015     SET(CPACK_PACKAGE_FILE_NAME           "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${CMAKE_BUILD_TYPE}")
2017     if (EXISTS "${CMAKE_SOURCE_DIR}/README.txt")
2018         set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
2019         set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.txt")
2020     endif ()
2022     if (EXISTS "${CMAKE_SOURCE_DIR}/Welcome.txt")
2023         set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
2024     endif()
2026     #Define Components
2027     SET(CPACK_COMPONENTS_ALL development_tools
2028         development_configuration
2029         code_headers
2030         libraries
2031         debug_program_db
2032         release_program_db
2033         debug_libraries
2034         release_libraries
2035         debug_runtimes
2036         release_runtimes
2037         data_images
2038         examples_basic
2039         examples_advanced
2040         Unspecified
2041         )
2044     #Components
2045     #Runtime
2046     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files needed to execute software with OpenSG.")
2048     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DISPLAY_NAME "Debug Runtime")
2049     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_DESCRIPTION "Debug Runtimes Libraries Description")
2050     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_GROUP "Runtime")
2051     SET(CPACK_COMPONENT_DEBUG_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
2053     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DISPLAY_NAME "Release Runtime")
2054     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_DESCRIPTION "Release Runtime Libraries Description")
2055     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_GROUP "Runtime")
2056     SET(CPACK_COMPONENT_RELEASE_RUNTIMES_INSTALL_TYPES Full Developer Runtime)
2058     #Development
2059     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development files needed to develop software with OpenSG.")
2061     #Libraries
2062     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DISPLAY_NAME "Release Libraries")
2063     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_DESCRIPTION "Release Libraries Description")
2064     SET(CPACK_COMPONENT_RELEASE_LIBRARIES_GROUP "Development")
2065     set(CPACK_COMPONENT_RELEASE_LIBRARIES_INSTALL_TYPES Full Developer)
2067     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DISPLAY_NAME "Debug Libraries")
2068     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_DESCRIPTION "Debug Libraries Description")
2069     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_GROUP "Development")
2070     SET(CPACK_COMPONENT_DEBUG_LIBRARIES_INSTALL_TYPES Full Developer)
2072     #Program database
2073     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DISPLAY_NAME "Release Program Database")
2074     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_DESCRIPTION "Release Program Database Description")
2075     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_GROUP "Development")
2076     SET(CPACK_COMPONENT_RELEASE_PROGRAM_DB_INSTALL_TYPES Full Developer)
2078     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DISPLAY_NAME "Debug Program Database")
2079     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_DESCRIPTION "Debug Program Database Description")
2080     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_GROUP "Development")
2081     SET(CPACK_COMPONENT_DEBUG_PROGRAM_DB_INSTALL_TYPES Full Developer)
2083     #Tools
2084     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DISPLAY_NAME "Tools")
2085     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_DESCRIPTION "Tools Description")
2086     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_GROUP "Development")
2087     SET(CPACK_COMPONENT_DEVELOPMENT_TOOLS_INSTALL_TYPES Full Developer)
2089     #Configuration
2090     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DISPLAY_NAME "Cmake Configuration")
2091     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_DESCRIPTION "Cmake files")
2092     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_GROUP "Development")
2093     SET(CPACK_COMPONENT_DEVELOPMENT_CONFIGURATION_INSTALL_TYPES Full Developer)
2095     #Headers
2096     SET(CPACK_COMPONENT_CODE_HEADERS_DISPLAY_NAME "C++ Headers")
2097     SET(CPACK_COMPONENT_CODE_HEADERS_DESCRIPTION "C++ Header, inline, and insert files.")
2098     SET(CPACK_COMPONENT_CODE_HEADERS_GROUP "Development")
2099     SET(CPACK_COMPONENT_CODE_HEADERS_INSTALL_TYPES Full Developer)
2101     #Examples
2102     SET(CPACK_COMPONENT_GROUP_EXAMPES_DESCRIPTION "OpenSG Examples.")
2104     SET(CPACK_COMPONENT_EXAMPLES_BASIC_DISPLAY_NAME "Simple Examples")
2105     SET(CPACK_COMPONENT_EXAMPLES_BASIC_DESCRIPTION "A Collection of Simple OpenSG Examples")
2106     SET(CPACK_COMPONENT_EXAMPLES_BASIC_GROUP "Examples")
2107     SET(CPACK_COMPONENT_EXAMPLES_BASIC_INSTALL_TYPES Full Developer)
2109     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DISPLAY_NAME "Advanced Examples")
2110     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_DESCRIPTION "A Collection of Advanced OpenSG Examples")
2111     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_GROUP "Examples")
2112     SET(CPACK_COMPONENT_EXAMPLES_ADVANCED_INSTALL_TYPES Full Developer)
2114     #Shared Data
2115     SET(CPACK_COMPONENT_GROUP_DATA_DESCRIPTION "Extra Data files.")
2117     SET(CPACK_COMPONENT_DATA_IMAGES_DISPLAY_NAME "Images")
2118     SET(CPACK_COMPONENT_DATA_IMAGES_DESCRIPTION "OpenSG Images and Icons")
2119     SET(CPACK_COMPONENT_DATA_IMAGES_GROUP "Data")
2120     SET(CPACK_COMPONENT_DATA_IMAGES_INSTALL_TYPES Full Developer Runtime)
2122     #Documentation
2123     SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Documentation.")
2125     #Dependencies
2126     #Boost
2127     #Base
2129     #NSIS specific configuration
2130     IF(WIN32)
2131         INCLUDE(InstallRequiredSystemLibraries)
2132         IF(OSGBUILD_PACKAGE_TYPE STREQUAL "NSIS")
2133             IF(MSVC AND (${CMAKE_VERSION} VERSION_GREATER "2.8.0" OR
2134                          ${CMAKE_VERSION} VERSION_EQUAL   "2.8.0"   ))
2135                  include(CMakeDetermineVSServicePack)
2136                  DetermineVSServicePack( my_service_pack )
2138                  IF( my_service_pack )
2139                      SET(CPACK_PACKAGE_FILE_NAME       "${PROJECT_NAME}-${OSG_VERSION}-${SYSTEM_SPEC}-${my_service_pack}")
2140                  ENDIF()
2141             ENDIF()
2143             #Extra install commands
2144             SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "")
2145             SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
2148             SET(CPACK_NSIS_MUI_ICON            "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
2149             SET(CPACK_NSIS_MUI_UNIICON         "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico")
2150             FILE(TO_NATIVE_PATH                "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp" CPACK_PACKAGE_ICON)
2151             SET(CPACK_NSIS_MODIFY_PATH         ON)
2152             SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CPACK_PACKAGE_NAME}")
2153             SET(CPACK_NSIS_HELP_LINK           "http://www.opensg.org/wiki/Help")
2154             SET(CPACK_NSIS_URL_INFO_ABOUT      "http://www.opensg.org")
2155             SET(CPACK_NSIS_CONTACT             "${CPACK_PACKAGE_CONTACT}")
2156             SET(CPACK_NSIS_CREATE_ICONS_EXTRA  "createShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk' '$INSTDIR'")
2157             SET(CPACK_NSIS_DELETE_ICONS_EXTRA  "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME} Directory.lnk'")
2158             SET(CPACK_NSIS_MENU_LINKS          "")
2159             #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallFinish.bmp" CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP)
2160             #FILE(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/UnInstallFinish.bmp" CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP)
2161         ENDIF()
2162     ENDIF()
2165     # Date macro by Benoit RAT (www.neub.co.nr)
2166     MACRO (TODAY RESULT)
2167         IF (WIN32)
2168             EXECUTE_PROCESS(COMMAND "date /T" OUTPUT_VARIABLE ${RESULT})
2169             string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
2170         ELSEIF(UNIX)
2171             EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
2172             string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" "${RESULT}" "${${RESULT}}")
2173         ELSE (WIN32)
2174             MESSAGE(SEND_ERROR "date not implemented")
2175             SET(${RESULT} 000000)
2176         ENDIF (WIN32)
2177     ENDMACRO (TODAY)
2179     TODAY(DATE)
2181     # Determine package type
2182     IF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
2183         IF(WIN32)
2184             SET(OSGBUILD_PACKAGE_TYPE "ZIP")
2185         ELSE(WIN32)
2186             SET(OSGBUILD_PACKAGE_TYPE "RPM")
2187         ENDIF(WIN32)
2188     ENDIF(OSGBUILD_PACKAGE_TYPE STREQUAL "")
2190     STRING(TOUPPER ${OSGBUILD_PACKAGE_TYPE} CPACK_GENERATOR)
2192     IF(${CPACK_GENERATOR} STREQUAL "TBZ2")
2193         SET( PACK_EXT "tar.bz2" )
2194     ELSEIF(${CPACK_GENERATOR} STREQUAL "TGZ")
2195         SET( PACK_EXT "tar.gz" )
2196     ELSE()
2197         STRING(TOLOWER ${OSGBUILD_PACKAGE_TYPE} PACK_EXT)
2198     ENDIF()
2200     SET(PACKAGE "${CPACK_PACKAGE_FILE_NAME}.${PACK_EXT}")
2201     SET(OUTFILE "${CPACK_PACKAGE_FILE_NAME}-${BUILDNAME}-${DATE}.${PACK_EXT}")
2203     INCLUDE(CPack)
2206     # For some reason using ${CPACK_OUTPUT_FILE_NAME} in here doesn't work, and neither does setting PACKAGE to it. :(
2207     IF(WIN32)
2208         #TODO: Need a way to do this on Windows
2209         #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 )
2210         #ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
2211     ELSE(WIN32)
2212         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 )
2213         ADD_DEPENDENCIES(PackageUpload "${CPACK_OUTPUT_FILE_NAME}")
2214     ENDIF(WIN32)
2217 ENDIF(OSGBUILD_ENABLE_PACKAGING AND FALSE)
2219 IF(NOT WIN32)
2220   CONFIGURE_FILE(CMake/CMakeLists.packaging.unix.txt 
2221                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
2222                  @ONLY                                      )
2223 ELSE()
2224   CONFIGURE_FILE(CMake/CMakeLists.packaging.win.txt 
2225                  ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
2226                  @ONLY                                      )
2227   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/OpenSG2_Icon.ico"
2228           DESTINATION share/OpenSG/Packaging
2229           COMPONENT packaging
2230           PERMISSIONS OWNER_WRITE OWNER_READ
2231                       GROUP_READ
2232                       WORLD_READ            )
2234   INSTALL(FILES "${CMAKE_SOURCE_DIR}/CMake/Packaging/Windows/InstallerHeader.bmp"
2235           DESTINATION share/OpenSG/Packaging
2236           COMPONENT packaging
2237           PERMISSIONS OWNER_WRITE OWNER_READ
2238                       GROUP_READ
2239                       WORLD_READ            )
2240 ENDIF()
2242 INSTALL(FILES ${CMAKE_BINARY_DIR}/CMakeLists.packaging.txt
2243         DESTINATION share/OpenSG/Packaging
2244         COMPONENT packaging
2245         PERMISSIONS OWNER_WRITE OWNER_READ
2246                     GROUP_READ
2247                     WORLD_READ
2248         RENAME CMakeLists.txt)
2250 INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYING
2251         DESTINATION share/doc/OpenSG/
2252         COMPONENT doc
2253         PERMISSIONS OWNER_WRITE OWNER_READ
2254                     GROUP_READ
2255                     WORLD_READ)
2257 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/PLY/README
2258         DESTINATION share/doc/OpenSG/
2259         COMPONENT doc
2260         PERMISSIONS OWNER_WRITE OWNER_READ
2261                     GROUP_READ
2262                     WORLD_READ
2263         RENAME README.ply)
2265 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/TrapezoidalShadowMaps/README
2266         DESTINATION share/doc/OpenSG/
2267         COMPONENT doc
2268         PERMISSIONS OWNER_WRITE OWNER_READ
2269                     GROUP_READ
2270                     WORLD_READ
2271         RENAME README.tsm)
2273 INSTALL(FILES ${CMAKE_SOURCE_DIR}/Source/Contrib/Rhino3DLoader/README
2274         DESTINATION share/doc/OpenSG/
2275         COMPONENT doc
2276         PERMISSIONS OWNER_WRITE OWNER_READ
2277                     GROUP_READ
2278                     WORLD_READ
2279         RENAME README.rhine)
2282 IF(WIN32)
2283   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
2284                                 CACHE STRING "OpenSG Build Types" FORCE )
2285 ENDIF(WIN32)
2286 IF(APPLE AND IOS)
2287   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;Debug-iphonesimulator;Release-iphonesimulator;Debug-iphoneos;Release-iphoneos"
2288                                 CACHE STRING "OpenSG Build Types" FORCE )
2289 ENDIF()
2291 IF(WIN32)
2292   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2293        "SET(OSG_DISABLE_MICROSOFT_SECURE_CXXX ${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\" FORCE)\n\n")
2295   FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2296        "SET(OSG_DISABLE_MS_ITERATOR_DEBUGGING ${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\" FORCE)\n\n")
2298 ENDIF(WIN32)
2300 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2301      "SET(BOOST_ROOT \"${BOOST_ROOT}\" CACHE PATH \"\")\n\n")
2303 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2304      "SET(OSG_SUPPORT_ROOT \"${OSG_SUPPORT_ROOT}\" CACHE PATH \"\")\n\n")
2306 FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
2307      "SET(OSG_USE_OSGSUPPORT_LIBS ${OSG_USE_OSGSUPPORT_LIBS} CACHE BOOL \"\")\n\n")
2309 ###########################
2310 # Component install Setting
2311 ###########################
2313 GET_CMAKE_PROPERTY(OSG_COMPONENT_LIST COMPONENTS)
2315 IF(NOT WIN32)
2316   ADD_CUSTOM_TARGET(OSG_preinstall
2317                     make preinstall
2318                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2319 ELSE()
2320 ENDIF()
2322 FOREACH(_OSG_CMP ${OSG_COMPONENT_LIST})
2324   IF(NOT WIN32)
2325     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2326                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -P cmake_install.cmake
2327                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2328   ELSE()
2330     SET(_OSG_CMP_CONF Release)
2332     IF(${_OSG_CMP} MATCHES ^debug_)
2333       SET(_OSG_CMP_CONF Debug)
2334     ENDIF()
2336     ADD_CUSTOM_TARGET(INSTALL_${_OSG_CMP}
2337                       COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_OSG_CMP} -DCMAKE_INSTALL_CONFIG_NAME=${_OSG_CMP_CONF} -P cmake_install.cmake
2338                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2340     SET_PROPERTY(TARGET INSTALL_${_OSG_CMP} PROPERTY FOLDER "Packaging")
2341   ENDIF()
2343   IF(NOT WIN32)
2344     ADD_DEPENDENCIES(INSTALL_${_OSG_CMP} OSG_preinstall)
2345   ELSE()
2346   ENDIF()
2347 ENDFOREACH()
2350 IF(WIN32)
2352   ADD_CUSTOM_TARGET(INSTALL_runtime)
2354   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_runtimes)
2355   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_release_binaries)
2357   SET_PROPERTY(TARGET INSTALL_runtime PROPERTY FOLDER "Packaging")
2359 ELSE()
2361   ADD_CUSTOM_TARGET(INSTALL_runtime)
2363   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_libraries)
2364   ADD_DEPENDENCIES(INSTALL_runtime INSTALL_binaries)
2365 ENDIF()
2367 #IF(WIN32)
2368 #  SET_PROPERTY(TARGET ALL_BUILD PROPERTY FOLDER "CMakePredefinedTargets")
2369 #ENDIF()
2371 ################
2372 # Build Setting
2373 ################
2375 IF(NOT WIN32)
2376   IF(NOT OSG_BUILD_DEPENDEND)
2377     OSG_WRITE_OSGBUILD(${CMAKE_BINARY_DIR}/CMake.build.settings)
2378   ENDIF(NOT OSG_BUILD_DEPENDEND)
2379 ENDIF(NOT WIN32)
2381 IF(OSG_WITH_CUDA)
2382   CUDA_BUILD_CLEAN_TARGET()
2383 ENDIF(OSG_WITH_CUDA)
2386 GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2388 FOREACH(_variableName ${_variableNames})
2389   IF(_variableName MATCHES "^OSG")
2390 #    MESSAGE("FOO : ${_variableName}")
2391 #    FILE(APPEND ${FILENAME}
2392 #         "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2393   ENDIF()
2394 ENDFOREACH()