10 INCLUDE(OSGCommonConfig)
12 SET(OSG2_PROJECT TRUE CACHE INTERNAL "" FORCE)
13 SET(OSG_EXTERNAL_PROJECT TRUE CACHE INTERNAL "" FORCE)
17 INCLUDE(OSGCommonOptions)
19 MESSAGE(STATUS "ARGS: ${ARGC} | ${ARGV} ")
20 MESSAGE(STATUS "OPT : ${OSG_OPTIONAL_COMPONENTS}")
22 SET(_OSG_COMPONENTS ${ARGV})
25 OSG_COMMON_OPTIONS_CONFIGURED()
27 SET(OSG_PLATFORM_64 0)
28 SET(OSG_PLATFORM_32 0)
29 SET(OSG_LIBDIR_SUFFIX "")
31 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
32 SET(OSG_PLATFORM_64 1)
33 SET(OSG_LIBDIR_SUFFIX "64")
35 SET(OSG_LIBDIR_BASE_SUFFIX "64")
38 SET(OSG_PLATFORM_32 1)
41 IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
46 SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
47 CACHE STRING "OpenSG Build Types" FORCE )
49 SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
50 CACHE STRING "OpenSG Build Types" FORCE )
53 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
54 CMAKE_BUILD_TYPE STREQUAL "DebugGV")
55 SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
56 SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
59 IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
60 OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
61 ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
62 OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
63 ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
66 IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
67 SET(CMAKE_BUILD_TYPE Debug CACHE STRING
68 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
70 ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
72 # Disable boost cmake config, as it screws up OpenSG's boost config
74 SET(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "" FORCE)
75 SET(Boost_ADDITIONAL_VERSIONS "1.54.0"
92 SET(OSG_BUILD_ACTIVE TRUE)
93 ADD_DEFINITIONS(-D OSG_BUILD_ACTIVE)
96 SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
101 INCLUDE(OpenSGExtDep)
108 LIST(FIND _OSG_COMPONENTS OSG2Base _OSG_USE_OSG2_NAME)
110 IF(NOT _OSG_USE_OSG2_NAME EQUAL -1)
111 SET(_OSG_PREF "OSG2")
114 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}FileIO _OSG_USE_FILEIO)
115 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}ImageFileIO _OSG_USE_IMAGEFILEIO)
116 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}ContribComputeBase _OSG_USE_CONTRIBCOMPUTE)
117 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}ContribCSM _OSG_USE_CONTRIBCSM)
118 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}Cluster _OSG_USE_CLUSTER)
119 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}WindowQT4 _OSG_USE_QT)
120 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}System _OSG_USE_SYSTEM)
121 LIST(FIND _OSG_COMPONENTS ${_OSG_PREF}ContribWebInterface _OSG_USE_WEBINTERFACE)
123 IF(_OSG_USE_CONTRIBCOMPUTE EQUAL -1 AND NOT _OSG_USE_SYSTEM EQUAL -1)
124 LIST(FIND ${_OSG_PREF}System_DEP_LIB CUDA_CUDART_LIBRARY _OSG_USE_CONTRIBCOMPUTE)
127 IF(NOT _OSG_USE_CONTRIBCSM EQUAL -1)
128 IF(_OSG_USE_FILEIO EQUAL -1)
129 LIST(APPEND _OSG_COMPONENTS ${_OSG_PREF}FileIO)
130 SET(_OSG_USE_FILEIO 1)
131 ENDIF(_OSG_USE_FILEIO EQUAL -1)
133 IF(_OSG_USE_CLUSTER EQUAL -1)
134 LIST(APPEND _OSG_COMPONENTS ${_OSG_PREF}Cluster)
135 SET(_OSG_USE_CLUSTER 1)
136 ENDIF(_OSG_USE_CLUSTER EQUAL -1)
138 IF(_OSG_USE_WEBINTERFACE EQUAL -1)
139 LIST(FIND OSGContribCSM_DEP_OSG_LIB ${_OSG_PREF}ContribWebInterface
140 _OSG_USE_WEBINTERFACE)
142 IF(NOT _OSG_USE_WEBINTERFACE EQUAL -1)
143 LIST(APPEND _OSG_COMPONENTS ${_OSG_PREF}ContribWebInterface)
147 ENDIF(NOT _OSG_USE_CONTRIBCSM EQUAL -1)
149 IF(NOT OSG_EXTPROJ_NO_OSGINCLUDE)
150 FIND_PACKAGE(OpenSG REQUIRED COMPONENTS ${_OSG_COMPONENTS})
152 FIND_PACKAGE(OpenSG REQUIRED)
156 IF(NOT OSG_COMPILER_DEFAULTS)
157 INCLUDE(OSGSetupCompiler)
158 SET(OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE ) #INTERNAL
159 ENDIF(NOT OSG_COMPILER_DEFAULTS)
161 INCLUDE(OSGUpdateCompiler)
163 INCLUDE(OSGBuildFunctions)
164 INCLUDE(OSGConfigurePackages)
166 IF(NOT OSG_EXTPROJ_NO_OSGINCLUDE)
167 INCLUDE_DIRECTORIES(${OpenSG_INCLUDE_DIRS})
169 LIST(APPEND OSG_GLOBAL_DEP_DEFS "OSGEXT_NO_OSG_INCLUDES")
172 OSG_CONFIGURE_SUPPORT()
181 FIND_LIBRARY(OSG_THREAD_LIB NAMES pthread)
182 FIND_LIBRARY(OSG_DL_LIB NAMES dl)
183 FIND_LIBRARY(OSG_RT_LIB NAMES rt)
185 OSG_ADD_OPT(OSG_THREAD_LIB)
186 OSG_ADD_OPT(OSG_DL_LIB)
187 OSG_ADD_OPT(OSG_RT_LIB)
191 FIND_LIBRARY(OSG_APPLICATIONSERVICES_FRAMEWORK NAMES ApplicationServices)
192 FIND_LIBRARY(OSG_CARBON_FRAMEWORK NAMES Carbon)
193 FIND_LIBRARY(OSG_COCOA_FRAMEWORK NAMES Cocoa)
200 IF(OSG_EXT_OPENGL_OPTIONAL)
203 FIND_PACKAGE(OpenGL REQUIRED)
207 OSG_ADD_OPT(OPENGL_gl_LIBRARY)
208 OSG_ADD_OPT(OPENGL_glu_LIBRARY)
218 OSG_SET(OSG_X_LIBS ${X11_X11_LIB})
219 OSG_SET(OSG_X_INC_DIR ${X11_X11_INCLUDE_PATH})
222 OSG_ADD_OPT(X11_FOUND)
231 OSG_SET(OSG_WITH_GLUT 1)
232 OSG_SET(OSG_GLUT_INC_DIR ${GLUT_INCLUDE_DIR})
233 OSG_SET(OSG_GLUT_LIBS ${GLUT_LIBRARIES})
235 OSG_SET(OSG_WITH_GLUT 0)
236 OSG_SET(OSG_GLUT_INC_DIR "")
237 OSG_SET(OSG_GLUT_LIBS "")
244 FIND_PACKAGE(PythonInterp)
250 OSG_CONFIGURE_BOOST()
253 MESSAGE(STATUS "Need fileio deps : ${_OSG_USE_FILEIO}")
254 MESSAGE(STATUS "Need imgfileio deps : ${_OSG_USE_IMAGEFILEIO}")
255 MESSAGE(STATUS "Need cuda deps : ${_OSG_USE_CONTRIBCOMPUTE}")
256 MESSAGE(STATUS "Need cluster : ${_OSG_USE_CLUSTER}")
257 MESSAGE(STATUS "Need csm : ${_OSG_USE_CONTRIBCSM}")
258 MESSAGE(STATUS "Need qt : ${_OSG_USE_QT}")
260 IF(NOT _OSG_USE_IMAGEFILEIO EQUAL -1)
262 MESSAGE(STATUS "Configure image file io")
267 OSG_CONFIGURE_OPENEXR()
270 SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} TIFF_LIBRARIES)
271 SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} TIFF_INCLUDE_DIR)
272 OSG_SET(OSG_WITH_TIF 1)
273 OSG_ADD_OPT(TIFF_LIBRARIES)
277 SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} PNG_LIBRARIES)
278 SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} PNG_INCLUDE_DIR)
279 OSG_SET(OSG_WITH_PNG 1)
280 OSG_ADD_OPT(PNG_INCLUDE_DIR)
281 OSG_ADD_OPT(PNG_LIBRARIES)
285 SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} JPEG_LIBRARIES)
286 SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} JPEG_INCLUDE_DIR)
287 OSG_SET(OSG_WITH_JPG 1)
288 OSG_ADD_OPT(JPEG_LIBRARIES)
292 SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} GDAL_LIBRARIES)
293 SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} GDAL_INCLUDE_DIR)
294 OSG_SET(OSG_WITH_GDAL 1)
295 OSG_ADD_OPT(GDAL_LIBRARIES)
299 SET(OSG_EXTERNAL_IMAGELIBS ${OSG_EXTERNAL_IMAGELIBS} OPENEXR_LIBRARIES)
300 SET(OSG_EXTERNAL_IMAGEINCS ${OSG_EXTERNAL_IMAGEINCS} OPENEXR_INCLUDE_DIR)
301 OSG_SET(OSG_WITH_IMF 1)
303 OSG_ADD_OPT(OPENEXR_LIBRARIES)
304 OSG_ADD_OPT(OPENEXR_INCLUDE_DIR)
307 ENDIF(NOT _OSG_USE_IMAGEFILEIO EQUAL -1)
309 IF(NOT _OSG_USE_FILEIO EQUAL -1)
311 MESSAGE(STATUS "Configure file io")
313 OSG_CONFIGURE_COLLADA()
317 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
318 CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
320 OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_DEBUG})
324 OSG_SET(OSG_COLLADA_LIBS ${COLLADA_LIBRARY_RELEASE})
329 SET(OSG_COLLADA_LIBS ${OSG_COLLADA_TARGETS})
334 SET(OSG_COLLADA_LIBS "")
337 ENDIF(NOT _OSG_USE_FILEIO EQUAL -1)
339 IF(NOT _OSG_USE_CONTRIBCOMPUTE EQUAL -1) # AND OSG_ENABLE_CUDA)
341 MESSAGE(STATUS "Configure cuda deps")
343 FIND_PACKAGE(CUDA QUIET REQUIRED)
347 OSG_SETUP_CUDA_FLAGS()
349 INCLUDE(ConfigurePackages.OSGContribComputeBase)
351 IF(NOT OSG_BUILD_DEPENDEND)
352 OSG_CONFIGURE_NVSDKCOMMON()
353 OSG_CONFIGURE_NVOCLUTILS()
354 OSG_CONFIGURE_CUDACOMMON()
355 OSG_CONFIGURE_CUDAUTIL()
356 # OSG_CONFIGURE_CUDPP()
357 OSG_CONFIGURE_CUDAPARTSDK(${OSG_SUPPORT_ROOT})
359 IF(NOT OSG_WITH_CUDAPARTSDK AND OSG_EXT_SUPPORT_ROOT)
360 OSG_CONFIGURE_CUDAPARTSDK(${OSG_EXT_SUPPORT_ROOT})
362 ENDIF(NOT OSG_BUILD_DEPENDEND)
364 MESSAGE(STATUS "NV Status: NV:${OSG_NVSDKCOMMON_FOUND}")
365 MESSAGE(STATUS "Cuda Status: CC:${OSG_CUDACOMMON_FOUND} CU:${OSG_CUDAUTIL_FOUND}")
366 MESSAGE(STATUS "OCL Status : NV:${OSG_NVOCLUTILS_FOUND}")
370 ENDIF(NOT _OSG_USE_CONTRIBCOMPUTE EQUAL -1) # AND OSG_ENABLE_CUDA)
372 IF(NOT _OSG_USE_QT EQUAL -1)
379 IF(EXISTS ${OSG_SUPPORT_ROOT}/qt5)
380 SET(QT5_CMAKE_DIR "${OSG_SUPPORT_ROOT}/qt5/lib/cmake" CACHE PATH "" FORCE)
381 ELSEIF(EXISTS ${OSG_SUPPORT_ROOT}/qt4)
382 SET(QT_QMAKE_EXECUTABLE "${OSG_SUPPORT_ROOT}/qt4/bin/qmake.exe" CACHE FILEPATH "" FORCE)
393 FIND_PACKAGE(PythonLibs)
395 OSG_ADD_OPT(PYTHON_INCLUDE_PATH)
396 OSG_ADD_OPT(PYTHON_LIBRARY)
398 IF(Boost_FOUND AND PYTHONLIBS_FOUND)
400 FIND_PACKAGE(Boost COMPONENTS python)
402 IF(Boost_FOUND AND WIN32)
404 SET(OSG_BOOST_PYTHON_TARGETS )
405 OSG_ADD_IMPORT_LIB(OSG_BOOST_PYTHON_TARGETS Boost_PYTHON_LIBRARY)
406 SET(OSG_BOOST_PYTHON_LIBS ${OSG_BOOST_PYTHON_TARGETS})
408 ELSE(Boost_FOUND AND WIN32)
410 IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
411 CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
413 SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
416 SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
419 ENDIF(Boost_FOUND AND WIN32)
421 # We ignore if boost python fails, we catch that somewhere else
422 # so if we get here Boost_FOUND was true in the first place
423 SET(Boost_FOUND TRUE)
425 ENDIF(Boost_FOUND AND PYTHONLIBS_FOUND)
430 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
431 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
432 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
436 OSG_OPTION(OSG_USE_SEPARATE_LIBDIRS "" ON)
439 IF(OSGEXCLUDE_TESTS_FROM_ALL)
440 SET(OSGEXCLUDE_TESTS EXCLUDE_FROM_ALL)
442 SET(OSGEXCLUDE_TESTS "")
445 IF(OSGEXCLUDE_UNITTESTS_FROM_ALL)
446 SET(OSGEXCLUDE_UNITTESTS EXCLUDE_FROM_ALL)
448 SET(OSGEXCLUDE_UNITTESTS "")
451 IF(OSGEXCLUDE_EXAMPLES_SIMPLE_FROM_ALL)
452 SET(OSGEXCLUDE_EXAMPLES_SIMPLE EXCLUDE_FROM_ALL)
454 SET(OSGEXCLUDE_EXAMPLES_SIMPLE "")
457 IF(OSGEXCLUDE_EXAMPLES_ADVANCED_FROM_ALL)
458 SET(OSGEXCLUDE_EXAMPLES_ADVANCED EXCLUDE_FROM_ALL)
460 SET(OSGEXCLUDE_EXAMPLES_ADVANCED "")
463 INCLUDE(OSGSetupPython)
465 MESSAGE("FOOOO ${CMAKE_PROJECT_NAME} ${CMAKE_BINARY_DIR}")
467 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cmake)
469 STRING(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_UP)
471 STRING(REPLACE "OpenSG" "OSG" CMAKE_PROJECT_NAME_SHORT ${CMAKE_PROJECT_NAME})
472 STRING(TOUPPER ${CMAKE_PROJECT_NAME_SHORT} CMAKE_PROJECT_NAME_SHORT_UP)
474 CONFIGURE_FILE(${OpenSG_DIR}/share/OpenSG/cmake/FindOpenSG.cmake.in
475 ${CMAKE_BINARY_DIR}/cmake/Find${CMAKE_PROJECT_NAME}.cmake
478 INSTALL(FILES "${CMAKE_BINARY_DIR}/cmake/Find${CMAKE_PROJECT_NAME}.cmake"
479 DESTINATION share/OpenSG/cmake)
480 # COMPONENT development_configuration)
482 OSG_SET_CACHE(OSG_EXTRA_EXTERNAL_MODULES "" STRING
483 "Extra modules that OpenSG will try to import.")
485 OSG_SET_CACHE(OSG_EXTERNAL_MODULES_INCLUDE "" FILEPATH
486 "Include file of extra modules")
488 IF(EXISTS "${OSG_EXTERNAL_MODULES_INCLUDE}")
489 INCLUDE("${OSG_EXTERNAL_MODULES_INCLUDE}")
492 FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_MODULES})
493 OPTION(OSGBUILD_${EXTERNAL}
494 "Build using ${EXTERNAL} module" OFF)
496 IF(OSGBUILD_${EXTERNAL})
497 FIND_PATH(OSG_${EXTERNAL}_SOURCE_DIR
498 CMakeLists.Lib.${EXTERNAL}.txt
499 ${CMAKE_CURRENT_SOURCE_DIR}/../${EXTERNAL})
501 OSG_ADD_OPT(OSG_${EXTERNAL}_SOURCE_DIR)
504 ${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.Lib.${EXTERNAL}.txt)
506 MESSAGE(SEND_ERROR "Cannot find ${EXTERNAL} sources directory: "
507 "${OSG_${EXTERNAL}_SOURCE_DIR}")
509 LIST(APPEND OSG_EXTERNAL_CONFIGS "${EXTERNAL}")
511 GET_FILENAME_COMPONENT(_EXT_SRC_DIR
512 "${OSG_${EXTERNAL}_SOURCE_DIR}/.."
515 IF(EXISTS "${OSG_${EXTERNAL}_SOURCE_DIR}/CMakeLists.PackagePrepare.cmake")
516 LIST(APPEND OSG_EXTERNAL_PREPARE "${OSG_${EXTERNAL}_SOURCE_DIR}")
519 IF(EXISTS "${_EXT_SRC_DIR}/CMakeLists.PackagePrepare.cmake")
520 LIST(APPEND OSG_EXTERNAL_PREPARE "${_EXT_SRC_DIR}")
526 IF(OSG_EXTERNAL_PREPARE)
527 LIST(REMOVE_DUPLICATES OSG_EXTERNAL_PREPARE)
532 MACRO(_OSG_SETUP_BUILD)
534 # when adding passes, make sure to add a corresponding pass directory variable
535 # OSG_PASSDIR_${PASSNAME} - this variable may not be empty!
536 SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
538 SET(OSG_PASSDIR_OSGCOLLECT "Collect")
539 SET(OSG_PASSDIR_OSGSETUP "Build")
545 FILE(GLOB OSG_OLD_BUILD_FILES "${CMAKE_BINARY_DIR}/*.cmake")
547 IF(OSG_OLD_BUILD_FILES)
548 FILE(REMOVE ${OSG_OLD_BUILD_FILES})
549 ENDIF(OSG_OLD_BUILD_FILES)
551 # FOREACH(_OSG_COMPONENT ${STORED_PROJECTS})
552 FOREACH(_OSG_COMPONENT ${_OSG_COMPONENTS})
553 MESSAGE(STATUS "FAKE : ${CMAKE_BINARY_DIR}/${_OSG_COMPONENT}.cmake")
554 FILE(WRITE ${CMAKE_BINARY_DIR}/${_OSG_COMPONENT}.cmake "#dummy")
556 SET(_OSG_COMPONENT_LI )
558 FOREACH(_OSG_COMPONENT_DEP ${${_OSG_COMPONENT}_DEP_OSG_LIB})
559 LIST(APPEND _OSG_COMPONENT_LI ${_OSG_COMPONENT_DEP})
560 ENDFOREACH(_OSG_COMPONENT_DEP ${${_OSG_COMPONENT}_DEP_OSG_LIB})
562 FOREACH(_OSG_COMPONENT_DEP ${${_OSG_COMPONENT}_DEP_LIB})
563 IF(TARGET ${_OSG_COMPONENT_DEP})
564 LIST(APPEND _OSG_COMPONENT_LI ${_OSG_COMPONENT_DEP})
565 ELSE(TARGET ${_OSG_COMPONENT_DEP})
566 LIST(APPEND _OSG_COMPONENT_LI ${${_OSG_COMPONENT_DEP}})
567 ENDIF(TARGET ${_OSG_COMPONENT_DEP})
568 ENDFOREACH(_OSG_COMPONENT_DEP ${${_OSG_COMPONENT}_DEP_LIB})
570 IF(_OSG_COMPONENT_LI AND TARGET ${_OSG_COMPONENT})
572 SET_TARGET_PROPERTIES(${_OSG_COMPONENT} PROPERTIES
573 IMPORTED_LINK_INTERFACE_LIBRARIES "${_OSG_COMPONENT_LI}")
574 ENDIF(_OSG_COMPONENT_LI AND TARGET ${_OSG_COMPONENT})
576 IF(EXISTS "${OSG_PYTHON_MODULE_BASE_DIR}/${_OSG_COMPONENT}/module")
577 SET(OSG_PYTHON_${_OSG_COMPONENT}_MODULE_DIR "${OSG_PYTHON_MODULE_BASE_DIR}/${_OSG_COMPONENT}/module" CACHE INTERNAL "" FORCE)
580 ENDFOREACH(_OSG_COMPONENT ${STORE_PROJECTS})
586 # optional pass for test programs
588 LIST(APPEND OSG_CMAKE_PASSES "OSGSETUPTEST")
589 SET(OSG_PASSDIR_OSGSETUPTEST "Test")
592 OSG_OPTION(OSG_ENABLE_FCD2CODE "" ON)
593 OSG_OPTION(OSG_FCD2CODE_WRITE_CLASS "" OFF)
594 OSG_OPTION(OSGBUILD_PYTHON_BINDINGS "Build python bindings" ON)
596 SET(OSG_MAIN_LIB_TARGET OSGAllContribLibs)
609 IF(EXISTS "${OSG_SUPPORT_ROOT}/bin/doxygen" AND NOT DOXYGEN_EXECUTABLE)
610 SET(DOXYGEN_EXECUTABLE "${OSG_SUPPORT_ROOT}/bin/doxygen"
611 CACHE FILEPATH "doxygen executable (custom)" FORCE)
614 FIND_PACKAGE(Doxygen)
616 # IF(NOT OSG_DOXY_INPUTS)
617 # add a pass for doxygen to run
618 LIST(APPEND OSG_CMAKE_PASSES "OSGDOXYDOC")
619 SET(OSG_PASSDIR_OSGDOXYDOC "Doc/build")
620 # ENDIF(NOT OSG_DOXY_INPUTS)
622 # set up variables for the config file
623 IF(DOXYGEN_DOT_EXECUTABLE)
624 SET(OSG_DOXY_HAVE_DOT "YES")
625 ENDIF(DOXYGEN_DOT_EXECUTABLE)
627 ENDMACRO(_OSG_SETUP_BUILD)
629 MACRO(_OSG_RUN_PASSES)
631 FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
632 GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
633 GET_FILENAME_COMPONENT(LIBFILENAME "${LIBCONFIGFILE}" NAME)
634 STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
635 STRING(REPLACE ".txt" "" LIBFILENAME "${LIBFILENAME}")
637 IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBCONFIGDIR}/${LIBFILENAME}.Prepare.cmake)
638 INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/${LIBCONFIGDIR}/${LIBFILENAME}.Prepare.cmake)
640 IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBCONFIGDIR}/${LIBFILENAME}.PrePasses.cmake)
641 INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/${LIBCONFIGDIR}/${LIBFILENAME}.PrePasses.cmake)
643 ENDFOREACH(LIBCONFIGFILE)
645 FOREACH(EXTERNAL_PREPARE ${OSG_EXTERNAL_PREPARE})
646 INCLUDE("${EXTERNAL_PREPARE}/CMakeLists.PackagePrepare.cmake")
649 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
650 IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
651 INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
653 ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Prepare.cmake)
654 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
656 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
657 IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
658 INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
659 ENDIF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.PrePasses.cmake)
660 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
663 FOREACH(PASS ${OSG_CMAKE_PASSES})
664 SET(OSG_CMAKE_PASS ${PASS})
666 MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in ${OSG_PASSDIR_${PASS}}\n")
668 FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
669 GET_FILENAME_COMPONENT(LIBCONFIGDIR "${LIBCONFIGFILE}" PATH)
670 GET_FILENAME_COMPONENT(LIBFILENAME "${LIBCONFIGFILE}" NAME)
671 STRING(REPLACE "CMakeLists.Lib." "" LIBFILENAME "${LIBFILENAME}")
672 STRING(REPLACE ".txt" "" LIBFILENAME "${LIBFILENAME}")
674 ADD_SUBDIRECTORY("${LIBCONFIGDIR}" "${OSG_PASSDIR_${PASS}}/${LIBFILENAME}")
676 ENDFOREACH(LIBCONFIGFILE)
678 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
679 ADD_SUBDIRECTORY("${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}"
680 "External/${EXTERNAL_CONFIG}/${OSG_PASSDIR_${PASS}}")
681 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
686 SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugOpt;ReleaseNoOpt"
687 CACHE STRING "OpenSG Build Types" FORCE )
689 SET(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugGV"
690 CACHE STRING "OpenSG Build Types" FORCE )
694 COMMAND "${CMAKE_COMMAND}" -E copy
695 "${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME_SHORT}Configured.h.cmake"
696 "${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h.tmp.cmake")
698 FOREACH(_OSG_ADD_CONFIGURE_LINE ${${CMAKE_PROJECT_NAME_UP}_ADDITIONAL_CONFIGURE_LINES})
699 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h.tmp.cmake" "\n${_OSG_ADD_CONFIGURE_LINE}\n")
702 FILE(APPEND "${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h.tmp.cmake" "\n#endif // _${CMAKE_PROJECT_NAME_SHORT_UP}CONFIGURED_H_\n")
704 CONFIGURE_FILE("${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h.tmp.cmake"
705 "${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h.tmp")
708 COMMAND "${CMAKE_COMMAND}" -E copy_if_different
709 "${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h.tmp"
710 "${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h")
712 INSTALL(FILES ${CMAKE_BINARY_DIR}/Source/Base/Base/${CMAKE_PROJECT_NAME_SHORT}Configured.h
713 DESTINATION include/OpenSG
714 PERMISSIONS OWNER_WRITE OWNER_READ
718 FOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
719 IF(EXISTS ${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
720 INCLUDE(${OSG_${EXTERNAL_CONFIG}_SOURCE_DIR}/${EXTERNAL_CONFIG}.Finalize.cmake)
722 ENDFOREACH(EXTERNAL_CONFIG ${OSG_EXTERNAL_CONFIGS})
724 ENDMACRO(_OSG_RUN_PASSES)
726 MACRO(OSG_COLLECT_LIBS CURRENT_DIR_ONLY)
734 SET(_OSG_CURRDIR_ONLY ${CURRENT_DIR_ONLY})
736 # Find files describing libraries to build, but make sure base
737 # and system are processed first
739 IF(_OSG_CURRDIR_ONLY)
740 FILE(GLOB OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
741 "./*CMakeLists.Lib.*.txt")
743 FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
744 "./*CMakeLists.Lib.*.txt")
747 MESSAGE("FOOO ${OSG_LIBRARY_CONFIG_FILES}")
749 IF(OSG_EXCLUDE_FROM_BUILD)
750 LIST(REMOVE_ITEM OSG_LIBRARY_CONFIG_FILES ${OSG_EXCLUDE_FROM_BUILD})
755 ENDMACRO(OSG_COLLECT_LIBS CURRENT_DIR_ONLY)
757 MACRO(OSG_DOCOLLECT_LIBS)
765 SET(_OSG_CURRDIR_ONLY ${CURRENT_DIR_ONLY})
767 SET(_OSG_TMPLIST ${ARGV})
768 MATH(EXPR _OSG_LISTCOUNT ${ARGC}-1)
770 # Find files describing libraries to build, but make sure base
771 # and system are processed first
773 SET(_OSG_TMPLIST ${ARGV})
774 MATH(EXPR _OSG_LISTCOUNT ${ARGC}-1)
776 FOREACH(_LOOPC RANGE 0 ${_OSG_LISTCOUNT} 2)
778 MATH(EXPR _LOOPN ${_LOOPC}+1)
780 LIST(GET _OSG_TMPLIST ${_LOOPC} OSGLIB_SOURCE_DIR)
781 LIST(GET _OSG_TMPLIST ${_LOOPN} _OSG_CURRDIR_ONLY)
783 IF(_OSG_CURRDIR_ONLY)
784 FILE(GLOB _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
785 "${${OSGLIB_SOURCE_DIR}}/*CMakeLists.Lib.*.txt")
787 FILE(GLOB_RECURSE _OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
788 "${${OSGLIB_SOURCE_DIR}}/*CMakeLists.Lib.*.txt")
791 LIST(APPEND OSG_LIBRARY_CONFIG_FILES ${_OSG_LIBRARY_CONFIG_FILES})
793 IF(EXISTS ${${OSGLIB_SOURCE_DIR}}/CMakeLists.PackagePrepare.cmake)
794 INCLUDE(${${OSGLIB_SOURCE_DIR}}/CMakeLists.PackagePrepare.cmake)
799 IF(OSG_EXCLUDE_FROM_BUILD)
800 LIST(REMOVE_ITEM OSG_LIBRARY_CONFIG_FILES ${OSG_EXCLUDE_FROM_BUILD})
805 ENDMACRO(OSG_DOCOLLECT_LIBS)