root/OpenSceneGraph/trunk/CMakeLists.txt @ 10763

Revision 10763, 37.2 kB (checked in by robert, 5 years ago)

Added OSG_CPP_EXCEPTIONS_AVAILABLE cmake option to enable optional build of plugins and examples that required C++ exceptions

  • Property svn:eol-style set to native
RevLine 
[9908]1set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
2
[6487]3IF(WIN32)
4    CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
5ELSE(WIN32)
6    IF(APPLE)
[8497]7        CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
[6487]8    ELSE(APPLE)
[9908]9        CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
[6487]10    ENDIF(APPLE)
11ENDIF(WIN32)
[6324]12
[8358]13if(COMMAND cmake_policy)
[8390]14    # Works around warnings libraries linked against that don't
15    # have absolute paths (e.g. -lpthreads)
[8358]16    cmake_policy(SET CMP0003 NEW)
[8390]17
18    # Works around warnings about escaped quotes in ADD_DEFINITIONS
19    # statements.
[8487]20    cmake_policy(SET CMP0005 NEW)
[8877]21
22    # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
23    # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
[9428]24    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
[8877]25        cmake_policy(SET CMP0008 OLD)
[9908]26    endif()
27endif()
[6487]28
[6324]29PROJECT(OpenSceneGraph)
30
[6988]31SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
[9677]32SET(OPENSCENEGRAPH_MINOR_VERSION 9)
[10450]33SET(OPENSCENEGRAPH_PATCH_VERSION 6)
34SET(OPENSCENEGRAPH_SOVERSION 61)
[6562]35
[8821]36# set to 0 when not a release candidate, non zero means that any generated
37# svn tags will be treated as release candidates of given number
[9757]38SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
[8821]39
[6709]40SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
[6705]41
[6709]42SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})
43
[7537]44SET(OSG_PLUGIN_PREFIX "")
45
46IF (CYGWIN)
47    SET(OSG_PLUGIN_PREFIX "cygwin_")
[9908]48ENDIF()
[7537]49
50IF(MINGW)
51    SET(OSG_PLUGIN_PREFIX "mingw_")
[9908]52ENDIF()
[7537]53
54
[6709]55# We want to build SONAMES shared librariess
56SET(OPENSCENEGRAPH_SONAMES TRUE)
57SET(OPENTHREADS_SONAMES TRUE)
58
[6591]59SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
60
[6324]61# We have some custom .cmake scripts not in the official distribution.
62# Maybe this can be used override existing behavior if needed?
63SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
64
65
[6430]66# Okay, here's the problem: On some platforms, linking against OpenThreads
[8390]67# is not enough and explicit linking to the underlying thread library
[6430]68# is also required (e.g. FreeBSD). But OpenThreads may be built with different
[8390]69# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
70# thread library is because some platforms support multiple backends (e.g.
71# IRIX supports Sproc and Pthreads). Linking all libraries won't work
[6430]72# because the libraries may be incompatible.
[8390]73# So the current solution is to attempt best guess linking and exempt certain
[6430]74# cases. With IRIX, we're going to hope explicit linking to the underlying
75# library is not necessary. We currently don't case for pthreads on Windows
76# which might be an issue on things like Cygwin. This may need to be fixed.
77FIND_PACKAGE(Threads)
78IF(CMAKE_SYSTEM MATCHES IRIX)
[6474]79    # Erase CMAKE_THREAD_LIBS_INIT and hope it works
[8390]80    SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
[9908]81ENDIF()
[6430]82
[8821]83OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
84IF (OSG_MAINTAINER)
85
86    SET(OPENSCENEGRAPH_SVN "trunk")
87    #SET(OPENSCENEGRAPH_SVN "branches")
88    SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
89
90    #
91    # Provide target for tagging a release
92    #
93    SET(SVNCOMMAND svn)
94    SET(SVNTRUNKDIR     http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
95    SET(SVNTAGDIR       http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
[9647]96    SET(SVNBRANCHDIR    http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)
[8821]97
98    IF   (OPENSCENEGRAPH_SVN STREQUAL "trunk")
99        SET(SVNSOURCEDIR ${SVNTRUNKDIR})
[9908]100    ELSE()
[9793]101        SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
[9908]102    ENDIF()
[8821]103
104
105    IF   (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
106        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
[9908]107    ELSE()
[8821]108        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
[9908]109    ENDIF()
[8821]110
111
112    ADD_CUSTOM_TARGET(tag-test
113        COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
114    )
115
116    ADD_CUSTOM_TARGET(tag-run
117        COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
118    )
119
120    ADD_CUSTOM_TARGET(branch-test
121        COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
122    )
123
124    ADD_CUSTOM_TARGET(branch-run
125        COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
126    )
127
128    #
129    # Provide target for generating ChangeLog
130    #
[9343]131    SET(GENERATELOGS svn2cl)
[8821]132
133    ADD_CUSTOM_TARGET(ChangeLog
[8848]134        COMMAND ${SVNCOMMAND} update
[10037]135        COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
[8821]136    )
137   
138ENDIF(OSG_MAINTAINER)
139
140
[6381]141# Find OpenGL
[6324]142FIND_PACKAGE(OpenGL)
143
144IF(APPLE)
[6474]145    FIND_LIBRARY(CARBON_LIBRARY Carbon)
146    FIND_LIBRARY(COCOA_LIBRARY Cocoa)
[9908]147ENDIF()
[6324]148
149IF(UNIX)
[6474]150    # Not sure what this will do on Cygwin and Msys
151    # Also, remember OS X X11 is a user installed option so it may not exist.
152    FIND_PACKAGE(X11)
153    # Some Unicies need explicit linkage to the Math library or the build fails.
154    FIND_LIBRARY(MATH_LIBRARY m)
[9908]155ENDIF()
[8390]156
[6324]157# Make the headers visible to everything
[8473]158IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
159   INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
[9908]160ENDIF()
[8473]161
[6324]162INCLUDE_DIRECTORIES(
[6474]163    ${OpenSceneGraph_SOURCE_DIR}/include
164    ${OPENGL_INCLUDE_DIR}
[6324]165)
[8390]166
[6324]167# Common global definitions
168#ADD_DEFINITIONS(-D)
169# Platform specific definitions
170
[7537]171
[6324]172IF(WIN32)
[8083]173
[8358]174    IF(MSVC)
175        # This option is to enable the /MP switch for Visual Studio 2005 and above compilers
176        OPTION(WIN32_USE_MP "Set to ON to build OpenSceneGraph with the /MP option (Visual Studio 2005 and above)." OFF)
177        MARK_AS_ADVANCED(WIN32_USE_MP)
[8390]178        IF(WIN32_USE_MP)
[8358]179            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
[8390]180        ENDIF(WIN32_USE_MP)
[8083]181
[9167]182        # turn off various warnings
[9472]183        # foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
184        #     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
185        # endforeach(warning)
[9167]186
[9999]187        # This option is to enable the /DYNAMICBASE switch
188        # It is used to workaround a bug in Windows 7 when linking in release, which results in corrupt
189        # binaries. See this page for details: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/01/24/the-case-of-the-corrupt-pe-binaries.aspx
190        OPTION(WIN32_USE_DYNAMICBASE "Set to ON to build OpenSceneGraph with the /DYNAMICBASE option to work around a bug when linking release executables on Windows 7." OFF)
191        MARK_AS_ADVANCED(WIN32_USE_DYNAMICBASE)
192        IF(WIN32_USE_DYNAMICBASE)
193            SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE")
194        ENDIF(WIN32_USE_DYNAMICBASE)
195
[8358]196        # More MSVC specific compilation flags
197        ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
198        ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
[10146]199
200        OPTION(MSVC_DISABLE_CHECKED_ITERATORS "Set to ON to disable Visual C++ checked iterators. If you do this you must ensure that every other project in your solution and all dependencies are compiled with _SECURE_SCL=0." OFF)
201        MARK_AS_ADVANCED(MSVC_DISABLE_CHECKED_ITERATORS)
202        IF(MSVC_DISABLE_CHECKED_ITERATORS)
203            ADD_DEFINITIONS(-D_SECURE_SCL=0)
204        ENDIF(MSVC_DISABLE_CHECKED_ITERATORS)
[9908]205    ENDIF()
[8358]206
[6474]207    #needed for net plugin
[7534]208    SET (OSG_SOCKET_LIBS wsock32)
[6474]209    # Both Cygwin and Msys need -DNOMINMAX ???
210    IF(UNIX)
211        ADD_DEFINITIONS(-DNOMINMAX)
[9908]212    ENDIF()
213
[7322]214########################################################################################################
[9470]215# the following options are MSVC specific,
[8390]216# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
[7322]217# fron bin folder without requiring installation step.
218# it also prepend "osg${OPENSCENEGRAPH_SOVERSION}-" to only .dll files, leaving .lib files untouched in lib
[8390]219# it also use a hack to get rid of Debug and Release folder in MSVC projects
[7322]220# all the .dll and .pdb are in bin and all the .lib and .exp are in lib
[8390]221#
[7322]222# the second option disable incremental linking in debug build , that is enabled by default by CMake
223##########################################################################################################
224
[7380]225    IF(MSVC)
226        IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
227            MESSAGE("Warning:  disabling versioned options 2.4.6 exibits inconsintencies in .pdb naming, at least under MSVC, suggested upgrading at least to 2.4.7")
228            SET(OSG_MSVC_VERSIONED_DLL OFF)
229            SET(OSG_MSVC_DEBUG_INCREMENTAL_LINK ON)
[9908]230        ELSE()
[7380]231            OPTION(OSG_MSVC_VERSIONED_DLL "Set to ON to build OpenSceneGraph with versioned dll names" ON)
232            MARK_AS_ADVANCED(OSG_MSVC_VERSIONED_DLL)
233            OPTION(OSG_MSVC_DEBUG_INCREMENTAL_LINK "Set to OFF to build OpenSceneGraph without incremental linking in debug (release is off by default)" ON)
234            MARK_AS_ADVANCED(OSG_MSVC_DEBUG_INCREMENTAL_LINK)
235            IF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
236                SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
237                SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
238                SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
239            ENDIF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
[9908]240        ENDIF()
[7380]241    ENDIF(MSVC)
[6324]242ENDIF(WIN32)
243
[6330]244########################################################################################################
245##### these were settings located in SetupCommon.cmake used in Luigi builds.... find out what are useful
246########################################################################################################
247#luigi#SET(CMAKE_VERBOSE_MAKEFILE TRUE)
248#luigi#SET(CMAKE_SKIP_RPATH TRUE)
249#luigi#SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
250#luigi#IF(UNIX)
[6474]251#luigi#    LIST_CONTAINS(contains "g++" ${CMAKE_CXX_COMPILER_LIST})
252#luigi#    IF (contains)
253#luigi#        MESSAGE(${MY_MESSAGE_DEFAULT} "${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} setting  CMAKE_CXX_COMPILER to g++")
254#luigi#        SET(CMAKE_CXX_COMPILER "g++")
255#luigi#        SET(CMAKE_CXX_COMPILER_LOADED 2)
256#luigi#        SET(CMAKE_CXX_COMPILER_WORKS 2)
257#luigi#    ENDIF (contains)
258#luigi#    SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
259#luigi#    SET(CMAKE_CXX_FLAGS_DEBUG "-ggdb -gstabs")
[6330]260#luigi#ENDIF(UNIX)
261########################################################################################################
[6324]262
[8038]263OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF)
[6704]264MARK_AS_ADVANCED(OSG_USE_FLOAT_MATRIX)
[6324]265
[8038]266OPTION(OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float Plane instead of double." OFF)
[6704]267MARK_AS_ADVANCED(OSG_USE_FLOAT_PLANE)
[6330]268
[8038]269OPTION(OSG_USE_FLOAT_BOUNDINGSPHERE "Set to ON to build OpenSceneGraph with float BoundingSphere instead of double." ON)
270MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGSPHERE)
[6704]271
[8038]272OPTION(OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON)
273MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX)
274
[9124]275OPTION(OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF)
276MARK_AS_ADVANCED(OSG_USE_UTF8_FILENAME)
277
[9470]278OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
[9235]279MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
280
[8981]281OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
[8482]282
[10611]283OPTION(OSG_GLU_AVAILABLE "Set to OFF to disable use of OpenGL GLU library." ${OPENGL_GLU_FOUND})
[10675]284OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON)
285OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON)
286OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF)
287OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF)
288OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF)
289
[10703]290SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
291
[10686]292# SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE})
293# SET(OSG_GL_MATRICES_AVAILABLE ${OSG_GL1_AVAILABLE})
294# SET(OSG_GL_VERTEX_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
[10691]295# SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
[10686]296# SET(OSG_GL_FIXED_FUNCTION_AVAILABLE ${OSG_GL1_AVAILABLE})
[10675]297
[10686]298OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${OSG_GL1_AVAILABLE})
299OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ${OSG_GL1_AVAILABLE})
300OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
[10691]301OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
[10686]302OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ${OSG_GL1_AVAILABLE})
303
[10763]304OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
305
[6324]306################################################################################
[8482]307# Set Config file
308
309SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
310CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
311               "${OPENSCENEGRAPH_CONFIG_HEADER}")
[8488]312# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
[8482]313
314
315################################################################################
[9671]316# Set Version Info resource file
317
[9672]318IF(MSVC)
[9677]319    SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
320    CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
[9671]321                   "${OPENSCENEGRAPH_VERSIONINFO_RC}")
[9908]322ENDIF()
[9671]323
324################################################################################
[9588]325# Optional build components
326
327# OSG Applications
328OPTION(BUILD_OSG_APPLICATIONS "Enable to build OSG Applications (e.g. osgviewer)" ON)
329
330# OSG Examples
331OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
332
333################################################################################
[6324]334# 3rd Party Dependency Stuff
[6430]335IF(WIN32)
[6474]336    INCLUDE(Find3rdPartyDependencies)
[9908]337ENDIF()
[6324]338
339# Common to all platforms:
340FIND_PACKAGE(FreeType)
[6381]341FIND_PACKAGE(Inventor)
[6604]342FIND_PACKAGE(Jasper)
[9262]343FIND_PACKAGE(OpenEXR)
[6606]344FIND_PACKAGE(COLLADA)
[9741]345FIND_PACKAGE(ZLIB)
[6607]346FIND_PACKAGE(Xine)
[6611]347FIND_PACKAGE(OpenVRML)
[6612]348FIND_PACKAGE(Performer)
[7196]349FIND_PACKAGE(GDAL)
[7981]350FIND_PACKAGE(CURL)
[8782]351FIND_PACKAGE(ITK)
[9082]352FIND_PACKAGE(LibVNCServer)
[8856]353FIND_PACKAGE(OurDCMTK)
[9847]354FIND_PACKAGE(OpenAL)
[9181]355FIND_PACKAGE(XUL)
[9817]356FIND_PACKAGE(FFmpeg)
[10165]357FIND_PACKAGE(SDL)
[6324]358
[8337]359#use pkg-config to find various modues
[8397]360INCLUDE(FindPkgConfig OPTIONAL)
[8337]361
362IF(PKG_CONFIG_FOUND)
363
364    INCLUDE(FindPkgConfig)
365
366    PKG_CHECK_MODULES(GTK gtk+-2.0)
367
368    IF(WIN32)
369        PKG_CHECK_MODULES(GTKGL gtkglext-win32-1.0)
[9908]370    ELSE()
[8337]371        PKG_CHECK_MODULES(GTKGL gtkglext-x11-1.0)
[9908]372    ENDIF()
[8337]373
374    PKG_CHECK_MODULES(RSVG librsvg-2.0)
375    PKG_CHECK_MODULES(CAIRO cairo)
[9159]376    PKG_CHECK_MODULES(POPPLER poppler-glib)
[8337]377
[9908]378ENDIF()
[8337]379
[10165]380
[9588]381#optional example related dependencies
382IF   (BUILD_OSG_EXAMPLES)
[8796]383
[8979]384
[9588]385    FIND_PACKAGE(FLTK)
386    FIND_PACKAGE(GLUT)
387    FIND_PACKAGE(FOX)
[9169]388
[9588]389    SET(wxWidgets_USE_LIBS base core gl net)
390    FIND_PACKAGE(wxWidgets)
391
392    # To select a specific version of QT define DESIRED_QT_VERSION
393    # via cmake -DDESIRED_QT_VERSION=4
394    IF  (DESIRED_QT_VERSION)
395
396        IF  (DESIRED_QT_VERSION MATCHES 4)
397          FIND_PACKAGE(Qt4)
[9908]398        ELSE()
[9588]399          FIND_PACKAGE(Qt3)
[9908]400        ENDIF()
[9588]401
[9908]402    ELSE()
[9588]403
404        FIND_PACKAGE(Qt4)
405
406        IF  (NOT QT4_FOUND)
407            FIND_PACKAGE(Qt3)
[9908]408        ENDIF()
[9588]409
[9908]410    ENDIF()
[9588]411
412ENDIF(BUILD_OSG_EXAMPLES)
413
414
415
416
417
418
[8796]419#
[8283]420# Test to determine if we want the "tripledot" form of the GLU tesselator callback.
421#
422IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
[8352]423    IF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
424
425        # Skip the compile check for platforms that never need the variable
426        # form.
427        SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT false)
428
[9908]429    ELSE()
[8352]430
431        # For other platforms perform the check
432        INCLUDE(CheckCXXSourceCompiles)
433        SET(CMAKE_REQUIRED_DEFINITIONS -DGLU_TESS_CALLBACK_TRIPLEDOT)
434        SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR})
435        SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY})
436        CHECK_CXX_SOURCE_COMPILES(
437            "#include <osg/GL>
438            #include <osg/GLU>
439            static void testcb(GLvoid *, void*) { }
440            int main() {
441               GLUtesselator *t = gluNewTess();
442               gluTessCallback(t, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) testcb);
443               return 0;
444            }"
445            GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No)
446        SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT
447            ${GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No})
448
[9908]449    ENDIF()
450ENDIF()
[7534]451
[8796]452OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build with variable parameter (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT})
[8283]453IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
454    ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT)
455ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
[7534]456
[6324]457# Platform specific:
458# (We can approach this one of two ways. We can try to FIND everything
459# and simply check if we found the packages before actually building
[8390]460# or we can hardcode the cases. The advantage of the former is that
[6324]461# packages that are installed on platforms that don't require them
[8390]462# will still get built (presuming no compatibility issues). But this
463# also means modules that are redundant may get built. For example,
[6324]464# OS X doesn't need GIF, JPEG, PNG, TIFF, etc because it uses QuickTime.
465# Also, it will clutter the CMake menu with "NOT_FOUND".
466# The downside to the latter is that it is harder to build those
467# potentially redundant modules.)
468
469# Image readers/writers depend on 3rd party libraries except for OS X which
470# can use Quicktime.
471IF(NOT APPLE)
[6474]472    FIND_PACKAGE(GIFLIB)
473    FIND_PACKAGE(JPEG)
474    FIND_PACKAGE(PNG)
475    FIND_PACKAGE(TIFF)
[6324]476
[6474]477    # QuickTime is required for OS X, but optional for Windows.
478    IF(WIN32)
479        FIND_PACKAGE(QuickTime)
[9908]480    ENDIF()
[8390]481
[9908]482ELSE()
[6474]483    FIND_PACKAGE(QuickTime)
[9908]484ENDIF()
[6324]485
486################################################################################
[6395]487# Create bin and lib directories if required
488
489IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
[6705]490   FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib/${OSG_PLUGINS})
[9908]491ENDIF()
[6395]492
493
494################################################################################
[6324]495# Installation stuff
496
[8371]497SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
[8914]498ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX})
499
[9400]500IF(UNIX AND NOT WIN32)
[10060]501  SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
502  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
[9908]503ENDIF()
[6324]504
[8875]505IF(CYGWIN)
[10060]506  SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
507  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
[9908]508ENDIF()
[8375]509
[6430]510IF(UNIX AND NOT WIN32 AND NOT APPLE)
511  IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
[6702]512      SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
513      MARK_AS_ADVANCED(LIB_POSTFIX)
[9908]514  ENDIF()
515ENDIF()
[6702]516IF(NOT DEFINED LIB_POSTFIX)
517    SET(LIB_POSTFIX "")
[9908]518ENDIF()
[8358]519
520# Here we apparantly do some funky stuff with making the bin/ and lib/
521# folders which is probably needed to work around a very old CMake bug?
522
[6349]523#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
524SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin)
[6324]525MAKE_DIRECTORY(${OUTPUT_BINDIR})
[7865]526IF(MSVC AND NOT MSVC_IDE)
527    MAKE_DIRECTORY(${OUTPUT_BINDIR}/${OSG_PLUGINS})
528ENDIF(MSVC AND NOT MSVC_IDE)
529
[6349]530#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
531SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
[6324]532MAKE_DIRECTORY(${OUTPUT_LIBDIR})
[7322]533IF(NOT MSVC)
[7865]534    MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
[7322]535ENDIF(NOT MSVC)
[6324]536
[8358]537# On CMake 2.4.x use EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH and later
538# we work around the DLL placement by use of the PREFIX target property hack
539#
540# On CMake 2.6.x use the newly minted CMAKE_LIBRARY_OUTPUT_DIRECTORY,
541# CMAKE_ARCHIVE_OUTPUT_DIRECTORY & CMAKE_RUNTIME_OUTPUT_DIRECTORY
[6324]542
[9908]543IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 5)
544    SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
545    SET(LIBRARY_OUTPUT_PATH    ${OUTPUT_LIBDIR})
546ELSE()
[8358]547    # If CMake >= 2.6.0
548    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
549    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
550    IF(WIN32)
551        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
552    ELSE(WIN32)
553        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
554    ENDIF(WIN32)
[9908]555ENDIF()
[6324]556
557#SET(INSTALL_BINDIR OpenSceneGraph/bin)
558#SET(INSTALL_INCDIR OpenSceneGraph/include)
559#SET(INSTALL_LIBDIR OpenSceneGraph/lib)
560#SET(INSTALL_DOCDIR OpenSceneGraph/doc)
561
562################################################################################
563# User Options
564
[6562]565
566# Expose CMAKE_INCLUDE_PATH and CMAKE_LIBARY_PATH to the GUI so users
567# may set these values without needing to manipulate the environment.
568SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
569SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
570# We are proposing that a new variable called CMAKE_PREFIX_PATH be introduced
571# to CMake to compliment CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH.
572# A formal feature request has been submited to CMake, Bug #4947.
573# It is intended for those users who have common prefixes for their INCLUDE
574# and LIBRARY locations. So if users have headers in /usr/local/include
575# and libraries in /usr/local/lib, the common prefix is /usr/local.
576# It should also cover the case where headers and libraries are
577# in the same directory.
578# Our proposal expects that FIND_* commands will automatically search for
579# CMAKE_PREFIX_PATH right after CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH.
580# Obviously, since CMake does not currently support this, we must write
581# our Find*.cmake modules to explicitly support this. Otherwise, this variable
582# will have no impact.
583# This is unofficial so this may be removed or changed at anytime.
584SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths.")
585
[8390]586# This is for an advanced option to give aggressive warnings
[6475]587# under different compilers. If yours is not implemented, this option
588# will not be made available.
589IF(CMAKE_COMPILER_IS_GNUCXX)
[8390]590    # To be complete, we might also do GNUCC flags,
[6475]591    # but everything here is C++ code.
592    # -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
593    # returns too many hits.
[8390]594    # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
[6475]595    # interesting C-specific flag.
[6547]596    # Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
597    # errors instead of warnings for certain issues, including superfluous
598    # semicolons and commas, and the use of long long. -fpermissive seems
[8390]599    # to be the workaround.
[9696]600    SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)
[9633]601
[9658]602    # Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
[9633]603
604
[9908]605ELSE()
[6475]606    IF(MSVC)
607        # FIXME: What are good aggressive warning flags for Visual Studio?
608        # And do we need to further subcase this for different versions of VS?
609        # CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
[9570]610        SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
[7322]611
[9470]612
[9908]613    ELSE()
[6475]614        # CMake lacks an elseif, so other non-gcc, non-VS compilers need
[8390]615        # to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
[6475]616        # remain unset.
[9908]617    ENDIF()
618ENDIF()
[6324]619
[6475]620# This part is for the CMake menu option to toggle the warnings on/off.
621# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
622IF(OSG_AGGRESSIVE_WARNING_FLAGS)
[9770]623
624    IF (APPLE)
625        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS OFF)
[9908]626    ELSE()
[9770]627        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS ON)
[9908]628    ENDIF()
[9770]629
630    OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" ${DEFAULT_USE_AGGRESSIVE_WARNINGS})
[6475]631    MARK_AS_ADVANCED(OSG_USE_AGGRESSIVE_WARNINGS)
[6324]632
[6475]633    IF(OSG_USE_AGGRESSIVE_WARNINGS)
[9470]634        # Add flags defined by OSG_AGGRESSIVE_WARNING_FLAGS if they aren't already there
635        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
636            IF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
637                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
[9908]638            ENDIF()
639        ENDFOREACH()
640    ELSE()
[9470]641        # Remove all flags considered aggresive
642        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
[9483]643            STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
[9908]644        ENDFOREACH()
645    ENDIF()
646ENDIF()
[6475]647
[9470]648
649# Dynamic vs Static Linking
650OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking.  Use OFF for static." ON)
651IF   (DYNAMIC_OPENSCENEGRAPH)
652    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
[9908]653ELSE ()
[9470]654    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
[9908]655ENDIF()
[9470]656
657INCLUDE(OsgMacroUtils)
658# OSG Core
659ADD_SUBDIRECTORY(src)
660
661IF   (BUILD_OSG_APPLICATIONS)
662    ADD_SUBDIRECTORY(applications)
[9908]663ENDIF()
[9470]664
665IF   (BUILD_OSG_EXAMPLES)
666    ADD_SUBDIRECTORY(examples)
[9908]667ENDIF()
[9470]668
[9588]669
[8390]670# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
[6475]671# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
672IF(APPLE)
673    # These are just defaults/recommendations, but how we want to build
674    # out of the box. But the user needs to be able to change these options.
[8390]675    # So we must only set the values the first time CMake is run, or we
[6475]676    # will overwrite any changes the user sets.
677    # FORCE is used because the options are not reflected in the UI otherwise.
678    # Seems like a good place to add version specific compiler flags too.
[6547]679    IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
[8390]680        # This is really fragile, but CMake doesn't provide the OS system
681        # version information we need. (Darwin versions can be changed
[6475]682        # independently of OS X versions.)
683        # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
[8527]684        IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
[8742]685            # 64-bit compiles are not supported with Carbon. We should enable
686            # 64-bit compilation by default once osgviewer has been
687            # rewritten with Cocoa.
688            #SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
689            SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
[6475]690            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
[9908]691        ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
692            SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
693            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
694        ELSE()
695            # No Universal Binary support
696            # Should break down further to set the -mmacosx-version-min,
697            # but the SDK detection is too unreliable here.
698        ENDIF()
[6547]699    ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
[8390]700
[6837]701    OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
[8390]702
[6475]703ENDIF(APPLE)
704
[8799]705
706#
707# Provide target for generating wrappers
708#
709SET(GENWRAPPER genwrapper)
710
711ADD_CUSTOM_TARGET(wrappers
712    COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -t ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/Doxyfile.template -d ${OpenSceneGraph_SOURCE_DIR} | doxygen -
713    COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -l ${OpenSceneGraph_SOURCE_DIR}
714)
715
[6324]716# For Doxygen
717INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
[9359]718OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
[9403]719MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
[6324]720# To build the documention, you will have to enable it
721# and then do the equivalent of "make DoxygenDoc".
722IF(BUILD_DOCUMENTATION)
[7843]723
[9359]724    OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
[7845]725    IF(BUILD_REF_DOCS_SEARCHENGINE)
[7843]726        SET(SEARCHENGINE YES)
[9908]727    ELSE()
[7843]728        SET(SEARCHENGINE NO)
[9908]729    ENDIF()
[8390]730
[9359]731    OPTION(BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF)
[7843]732    IF(BUILD_REF_DOCS_TAGFILE)
[9359]733        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg.tag")
[9908]734    ELSE()
[7843]735        SET(GENERATE_TAGFILE "")
[9908]736    ENDIF()
[8390]737
[6474]738    IF(DOT)
739        SET(HAVE_DOT YES)
[9908]740    ELSE()
[6474]741        SET(HAVE_DOT NO)
[9908]742    ENDIF()
[9339]743   
[9359]744    # If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
745    SET(GENERATE_HTMLHELP "NO")
746    IF(DOCUMENTATION_HTML_HELP)
[9403]747        # on windows Documentation.cmake finds the html help workshop fi it exists. On u*ix we might have it with wine but no way to point it out
[9359]748        IF(NOT WIN32)
749            SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
750            MARK_AS_ADVANCED(HTML_HELP_COMPILER)
[9908]751        ENDIF()
[9359]752        # this var sets a proper value in .doxygen files when coniguring them below
753        SET(GENERATE_HTMLHELP "YES")
[9908]754    endif()
[9359]755 
756    # This processes our doxyfile.cmake and substitutes paths to generate
[6474]757    # a final Doxyfile
758    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake
[9359]759        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
[6474]760    )
[9359]761    # copy the osg logo to documentations target folder
762    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
763        ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg32-32.png COPYONLY
764    )
765    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
766    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs DESTINATION doc COMPONENT openscenegraph-doc)
767
768    # now set up openthreads documentation generation
769    IF(BUILD_REF_DOCS_TAGFILE)
770        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenThreadsReferenceDocs/ot.tag")
[9908]771    ENDIF()
[9359]772
773    # This processes our openthreads.doxyfile.cmake and generate a final doxyfile
774    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/openthreads.doxyfile.cmake
775        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
776    )
777    # copy the osg logo to documentations target folder
778    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
779        ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs/osg32-32.png COPYONLY
780    )
781    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
782    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs DESTINATION doc COMPONENT openthreads-doc)
783
784    # Process our other doxyfiles but don't create targets for these
785    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/all_Doxyfile
786        ${PROJECT_BINARY_DIR}/doc/all_Doxyfile)
787    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/auto_Doxyfile
788        ${PROJECT_BINARY_DIR}/doc/auto_Doxyfile)
789    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile
790        ${PROJECT_BINARY_DIR}/doc/core_Doxyfile)
791   
[6474]792    # This creates a new target to build documentation.
793    # It runs ${DOXYGEN} which is the full path and executable to
794    # Doxygen on your system, set by the FindDoxygen.cmake module
795    # (called by FindDocumentation.cmake).
796    # It runs the final generated Doxyfile against it.
797    # The DOT_PATH is substituted into the Doxyfile.
[9359]798    ADD_CUSTOM_TARGET(doc_openscenegraph ${DOXYGEN}
799        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
[6474]800    )
[9359]801    ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN}
802        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
803    )
[6324]804ENDIF(BUILD_DOCUMENTATION)
805
[8942]806OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
807IF(BUILD_DASHBOARD_REPORTS)
808# The following are required to uses Dart and the Cdash dashboard
809# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
810    INCLUDE(Dart)
[9908]811ENDIF()
[8942]812
[9528]813# present the packaging option only if we have the cpack command defined (effectively >= 2.6.0)
[9484]814IF(CMAKE_CPACK_COMMAND)
[9528]815    OPTION(BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
[9350]816    IF(BUILD_OSG_PACKAGES)
817      INCLUDE(OsgCPack)
[9908]818    ENDIF()
819ENDIF()
[6475]820
[10262]821# Generate pkg-config configuration files
[9558]822
[10262]823SET(PKGCONFIG_FILES
824  openscenegraph
825  openscenegraph-osg
826  openscenegraph-osgDB
827  openscenegraph-osgFX
828  openscenegraph-osgGA
829  openscenegraph-osgParticle
830  openscenegraph-osgSim
831  openscenegraph-osgText
832  openscenegraph-osgUtil
833  openscenegraph-osgTerrain
834  openscenegraph-osgManipulator
835  openscenegraph-osgViewer
836  openscenegraph-osgWidget
837  openscenegraph-osgShadow
838  openscenegraph-osgAnimation
839  openscenegraph-osgVolume
840  openscenegraph-osgIntrospection
841)
842
843FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
844  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
845    ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc
[9558]846    @ONLY
847    )
[10262]848  INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
849ENDFOREACH(PKGCONFIG_FILE)
[9558]850
851
[9566]852# Run this as late as possible so users can easier spot the message
[9908]853IF (NOT DEFINED REQUIRES_LIBPATH_MESSAGE AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
854    SET(REQUIRES_LIBPATH_MESSAGE ON)
855ENDIF()
[9584]856
[9588]857IF(REQUIRES_LIBPATH_MESSAGE)
858    IF (NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
859        SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
[9566]860
[9588]861        MESSAGE("\nThe build system is configured to instal libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n"
862            "Your applications may not be able to find your installed libraries unless you:\n"
863            "    set your LD_LIBRARY_PATH (user specific) or\n"
864            "    update your ld.so configuration (system wide)")
865        IF(IS_DIRECTORY /etc/ld.so.conf.d)
866            MESSAGE("You have an ld.so.conf.d directory on your system, so if you wish to ensure that\n"
867                "applications find the installed osg libraries, system wide, you could install a\n"
868                "openscenegraph specific ld.so configuration with:\n"
869                "    sudo make install_ld_conf\n")
870            CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in
871                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
872            )
873            ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
874                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
875                /etc/ld.so.conf.d/openscenegraph.conf
876                COMMAND ldconfig
877                COMMENT "Copying openscenegraph.conf to /etc/ld.so.conf.d and running ldconfig"
878            )
[9908]879        ELSE()
[9588]880            IF(EXISTS /etc/ld.so.conf)
881                MESSAGE("You have an ld.so.conf file in /etc, if you wish to ensure \n"
882                "that applications find the installed osg libraries, system wide, you\n"
883                "could add ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} to it.")
[9908]884            ENDIF()
885        ENDIF()
[9566]886
[9588]887        # emit a message during installation.
888        INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}lib${LIB_POSTFIX}.\\nYou may need to update your ld.so configuration. \")")
889
890    ENDIF(NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
891
[9908]892ELSE()
[9588]893    SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 0 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
[9908]894ENDIF()
[9588]895
896
[9566]897# This needs to be run very last so other parts of the scripts can take
898# advantage of this.
899IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
900    SET(OSG_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before")
[9908]901ENDIF()
[9566]902
[6686]903#-----------------------------------------------------------------------------
904### uninstall target
905#-----------------------------------------------------------------------------
906CONFIGURE_FILE(
907  "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
908  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
909  IMMEDIATE @ONLY)
910ADD_CUSTOM_TARGET(uninstall
911  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
Note: See TracBrowser for help on using the browser.