root/OpenSceneGraph/trunk/CMakeLists.txt @ 10703

Revision 10703, 37.1 kB (checked in by robert, 4 years ago)

Added EGL support into build system for GLES1 + GLES2.

Added EGL support into GraphicsWindowX11.

  • 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
[6324]304################################################################################
[8482]305# Set Config file
306
307SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
308CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
309               "${OPENSCENEGRAPH_CONFIG_HEADER}")
[8488]310# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
[8482]311
312
313################################################################################
[9671]314# Set Version Info resource file
315
[9672]316IF(MSVC)
[9677]317    SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
318    CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
[9671]319                   "${OPENSCENEGRAPH_VERSIONINFO_RC}")
[9908]320ENDIF()
[9671]321
322################################################################################
[9588]323# Optional build components
324
325# OSG Applications
326OPTION(BUILD_OSG_APPLICATIONS "Enable to build OSG Applications (e.g. osgviewer)" ON)
327
328# OSG Examples
329OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
330
331################################################################################
[6324]332# 3rd Party Dependency Stuff
[6430]333IF(WIN32)
[6474]334    INCLUDE(Find3rdPartyDependencies)
[9908]335ENDIF()
[6324]336
337# Common to all platforms:
338FIND_PACKAGE(FreeType)
[6381]339FIND_PACKAGE(Inventor)
[6604]340FIND_PACKAGE(Jasper)
[9262]341FIND_PACKAGE(OpenEXR)
[6606]342FIND_PACKAGE(COLLADA)
[9741]343FIND_PACKAGE(ZLIB)
[6607]344FIND_PACKAGE(Xine)
[6611]345FIND_PACKAGE(OpenVRML)
[6612]346FIND_PACKAGE(Performer)
[7196]347FIND_PACKAGE(GDAL)
[7981]348FIND_PACKAGE(CURL)
[8782]349FIND_PACKAGE(ITK)
[9082]350FIND_PACKAGE(LibVNCServer)
[8856]351FIND_PACKAGE(OurDCMTK)
[9847]352FIND_PACKAGE(OpenAL)
[9181]353FIND_PACKAGE(XUL)
[9817]354FIND_PACKAGE(FFmpeg)
[10165]355FIND_PACKAGE(SDL)
[6324]356
[8337]357#use pkg-config to find various modues
[8397]358INCLUDE(FindPkgConfig OPTIONAL)
[8337]359
360IF(PKG_CONFIG_FOUND)
361
362    INCLUDE(FindPkgConfig)
363
364    PKG_CHECK_MODULES(GTK gtk+-2.0)
365
366    IF(WIN32)
367        PKG_CHECK_MODULES(GTKGL gtkglext-win32-1.0)
[9908]368    ELSE()
[8337]369        PKG_CHECK_MODULES(GTKGL gtkglext-x11-1.0)
[9908]370    ENDIF()
[8337]371
372    PKG_CHECK_MODULES(RSVG librsvg-2.0)
373    PKG_CHECK_MODULES(CAIRO cairo)
[9159]374    PKG_CHECK_MODULES(POPPLER poppler-glib)
[8337]375
[9908]376ENDIF()
[8337]377
[10165]378
[9588]379#optional example related dependencies
380IF   (BUILD_OSG_EXAMPLES)
[8796]381
[8979]382
[9588]383    FIND_PACKAGE(FLTK)
384    FIND_PACKAGE(GLUT)
385    FIND_PACKAGE(FOX)
[9169]386
[9588]387    SET(wxWidgets_USE_LIBS base core gl net)
388    FIND_PACKAGE(wxWidgets)
389
390    # To select a specific version of QT define DESIRED_QT_VERSION
391    # via cmake -DDESIRED_QT_VERSION=4
392    IF  (DESIRED_QT_VERSION)
393
394        IF  (DESIRED_QT_VERSION MATCHES 4)
395          FIND_PACKAGE(Qt4)
[9908]396        ELSE()
[9588]397          FIND_PACKAGE(Qt3)
[9908]398        ENDIF()
[9588]399
[9908]400    ELSE()
[9588]401
402        FIND_PACKAGE(Qt4)
403
404        IF  (NOT QT4_FOUND)
405            FIND_PACKAGE(Qt3)
[9908]406        ENDIF()
[9588]407
[9908]408    ENDIF()
[9588]409
410ENDIF(BUILD_OSG_EXAMPLES)
411
412
413
414
415
416
[8796]417#
[8283]418# Test to determine if we want the "tripledot" form of the GLU tesselator callback.
419#
420IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
[8352]421    IF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
422
423        # Skip the compile check for platforms that never need the variable
424        # form.
425        SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT false)
426
[9908]427    ELSE()
[8352]428
429        # For other platforms perform the check
430        INCLUDE(CheckCXXSourceCompiles)
431        SET(CMAKE_REQUIRED_DEFINITIONS -DGLU_TESS_CALLBACK_TRIPLEDOT)
432        SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR})
433        SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY})
434        CHECK_CXX_SOURCE_COMPILES(
435            "#include <osg/GL>
436            #include <osg/GLU>
437            static void testcb(GLvoid *, void*) { }
438            int main() {
439               GLUtesselator *t = gluNewTess();
440               gluTessCallback(t, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) testcb);
441               return 0;
442            }"
443            GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No)
444        SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT
445            ${GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No})
446
[9908]447    ENDIF()
448ENDIF()
[7534]449
[8796]450OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build with variable parameter (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT})
[8283]451IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
452    ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT)
453ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
[7534]454
[6324]455# Platform specific:
456# (We can approach this one of two ways. We can try to FIND everything
457# and simply check if we found the packages before actually building
[8390]458# or we can hardcode the cases. The advantage of the former is that
[6324]459# packages that are installed on platforms that don't require them
[8390]460# will still get built (presuming no compatibility issues). But this
461# also means modules that are redundant may get built. For example,
[6324]462# OS X doesn't need GIF, JPEG, PNG, TIFF, etc because it uses QuickTime.
463# Also, it will clutter the CMake menu with "NOT_FOUND".
464# The downside to the latter is that it is harder to build those
465# potentially redundant modules.)
466
467# Image readers/writers depend on 3rd party libraries except for OS X which
468# can use Quicktime.
469IF(NOT APPLE)
[6474]470    FIND_PACKAGE(GIFLIB)
471    FIND_PACKAGE(JPEG)
472    FIND_PACKAGE(PNG)
473    FIND_PACKAGE(TIFF)
[6324]474
[6474]475    # QuickTime is required for OS X, but optional for Windows.
476    IF(WIN32)
477        FIND_PACKAGE(QuickTime)
[9908]478    ENDIF()
[8390]479
[9908]480ELSE()
[6474]481    FIND_PACKAGE(QuickTime)
[9908]482ENDIF()
[6324]483
484################################################################################
[6395]485# Create bin and lib directories if required
486
487IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
[6705]488   FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib/${OSG_PLUGINS})
[9908]489ENDIF()
[6395]490
491
492################################################################################
[6324]493# Installation stuff
494
[8371]495SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
[8914]496ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX})
497
[9400]498IF(UNIX AND NOT WIN32)
[10060]499  SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
500  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
[9908]501ENDIF()
[6324]502
[8875]503IF(CYGWIN)
[10060]504  SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
505  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
[9908]506ENDIF()
[8375]507
[6430]508IF(UNIX AND NOT WIN32 AND NOT APPLE)
509  IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
[6702]510      SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
511      MARK_AS_ADVANCED(LIB_POSTFIX)
[9908]512  ENDIF()
513ENDIF()
[6702]514IF(NOT DEFINED LIB_POSTFIX)
515    SET(LIB_POSTFIX "")
[9908]516ENDIF()
[8358]517
518# Here we apparantly do some funky stuff with making the bin/ and lib/
519# folders which is probably needed to work around a very old CMake bug?
520
[6349]521#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
522SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin)
[6324]523MAKE_DIRECTORY(${OUTPUT_BINDIR})
[7865]524IF(MSVC AND NOT MSVC_IDE)
525    MAKE_DIRECTORY(${OUTPUT_BINDIR}/${OSG_PLUGINS})
526ENDIF(MSVC AND NOT MSVC_IDE)
527
[6349]528#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
529SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
[6324]530MAKE_DIRECTORY(${OUTPUT_LIBDIR})
[7322]531IF(NOT MSVC)
[7865]532    MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
[7322]533ENDIF(NOT MSVC)
[6324]534
[8358]535# On CMake 2.4.x use EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH and later
536# we work around the DLL placement by use of the PREFIX target property hack
537#
538# On CMake 2.6.x use the newly minted CMAKE_LIBRARY_OUTPUT_DIRECTORY,
539# CMAKE_ARCHIVE_OUTPUT_DIRECTORY & CMAKE_RUNTIME_OUTPUT_DIRECTORY
[6324]540
[9908]541IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 5)
542    SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
543    SET(LIBRARY_OUTPUT_PATH    ${OUTPUT_LIBDIR})
544ELSE()
[8358]545    # If CMake >= 2.6.0
546    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
547    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
548    IF(WIN32)
549        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
550    ELSE(WIN32)
551        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
552    ENDIF(WIN32)
[9908]553ENDIF()
[6324]554
555#SET(INSTALL_BINDIR OpenSceneGraph/bin)
556#SET(INSTALL_INCDIR OpenSceneGraph/include)
557#SET(INSTALL_LIBDIR OpenSceneGraph/lib)
558#SET(INSTALL_DOCDIR OpenSceneGraph/doc)
559
560################################################################################
561# User Options
562
[6562]563
564# Expose CMAKE_INCLUDE_PATH and CMAKE_LIBARY_PATH to the GUI so users
565# may set these values without needing to manipulate the environment.
566SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
567SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
568# We are proposing that a new variable called CMAKE_PREFIX_PATH be introduced
569# to CMake to compliment CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH.
570# A formal feature request has been submited to CMake, Bug #4947.
571# It is intended for those users who have common prefixes for their INCLUDE
572# and LIBRARY locations. So if users have headers in /usr/local/include
573# and libraries in /usr/local/lib, the common prefix is /usr/local.
574# It should also cover the case where headers and libraries are
575# in the same directory.
576# Our proposal expects that FIND_* commands will automatically search for
577# CMAKE_PREFIX_PATH right after CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH.
578# Obviously, since CMake does not currently support this, we must write
579# our Find*.cmake modules to explicitly support this. Otherwise, this variable
580# will have no impact.
581# This is unofficial so this may be removed or changed at anytime.
582SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths.")
583
[8390]584# This is for an advanced option to give aggressive warnings
[6475]585# under different compilers. If yours is not implemented, this option
586# will not be made available.
587IF(CMAKE_COMPILER_IS_GNUCXX)
[8390]588    # To be complete, we might also do GNUCC flags,
[6475]589    # but everything here is C++ code.
590    # -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
591    # returns too many hits.
[8390]592    # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
[6475]593    # interesting C-specific flag.
[6547]594    # Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
595    # errors instead of warnings for certain issues, including superfluous
596    # semicolons and commas, and the use of long long. -fpermissive seems
[8390]597    # to be the workaround.
[9696]598    SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)
[9633]599
[9658]600    # Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
[9633]601
602
[9908]603ELSE()
[6475]604    IF(MSVC)
605        # FIXME: What are good aggressive warning flags for Visual Studio?
606        # And do we need to further subcase this for different versions of VS?
607        # CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
[9570]608        SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
[7322]609
[9470]610
[9908]611    ELSE()
[6475]612        # CMake lacks an elseif, so other non-gcc, non-VS compilers need
[8390]613        # to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
[6475]614        # remain unset.
[9908]615    ENDIF()
616ENDIF()
[6324]617
[6475]618# This part is for the CMake menu option to toggle the warnings on/off.
619# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
620IF(OSG_AGGRESSIVE_WARNING_FLAGS)
[9770]621
622    IF (APPLE)
623        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS OFF)
[9908]624    ELSE()
[9770]625        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS ON)
[9908]626    ENDIF()
[9770]627
628    OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" ${DEFAULT_USE_AGGRESSIVE_WARNINGS})
[6475]629    MARK_AS_ADVANCED(OSG_USE_AGGRESSIVE_WARNINGS)
[6324]630
[6475]631    IF(OSG_USE_AGGRESSIVE_WARNINGS)
[9470]632        # Add flags defined by OSG_AGGRESSIVE_WARNING_FLAGS if they aren't already there
633        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
634            IF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
635                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
[9908]636            ENDIF()
637        ENDFOREACH()
638    ELSE()
[9470]639        # Remove all flags considered aggresive
640        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
[9483]641            STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
[9908]642        ENDFOREACH()
643    ENDIF()
644ENDIF()
[6475]645
[9470]646
647# Dynamic vs Static Linking
648OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking.  Use OFF for static." ON)
649IF   (DYNAMIC_OPENSCENEGRAPH)
650    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
[9908]651ELSE ()
[9470]652    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
[9908]653ENDIF()
[9470]654
655INCLUDE(OsgMacroUtils)
656# OSG Core
657ADD_SUBDIRECTORY(src)
658
659IF   (BUILD_OSG_APPLICATIONS)
660    ADD_SUBDIRECTORY(applications)
[9908]661ENDIF()
[9470]662
663IF   (BUILD_OSG_EXAMPLES)
664    ADD_SUBDIRECTORY(examples)
[9908]665ENDIF()
[9470]666
[9588]667
[8390]668# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
[6475]669# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
670IF(APPLE)
671    # These are just defaults/recommendations, but how we want to build
672    # out of the box. But the user needs to be able to change these options.
[8390]673    # So we must only set the values the first time CMake is run, or we
[6475]674    # will overwrite any changes the user sets.
675    # FORCE is used because the options are not reflected in the UI otherwise.
676    # Seems like a good place to add version specific compiler flags too.
[6547]677    IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
[8390]678        # This is really fragile, but CMake doesn't provide the OS system
679        # version information we need. (Darwin versions can be changed
[6475]680        # independently of OS X versions.)
681        # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
[8527]682        IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
[8742]683            # 64-bit compiles are not supported with Carbon. We should enable
684            # 64-bit compilation by default once osgviewer has been
685            # rewritten with Cocoa.
686            #SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
687            SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
[6475]688            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]689        ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
690            SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
691            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)
692        ELSE()
693            # No Universal Binary support
694            # Should break down further to set the -mmacosx-version-min,
695            # but the SDK detection is too unreliable here.
696        ENDIF()
[6547]697    ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
[8390]698
[6837]699    OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
[8390]700
[6475]701ENDIF(APPLE)
702
[8799]703
704#
705# Provide target for generating wrappers
706#
707SET(GENWRAPPER genwrapper)
708
709ADD_CUSTOM_TARGET(wrappers
710    COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -t ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/Doxyfile.template -d ${OpenSceneGraph_SOURCE_DIR} | doxygen -
711    COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -l ${OpenSceneGraph_SOURCE_DIR}
712)
713
[6324]714# For Doxygen
715INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
[9359]716OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
[9403]717MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
[6324]718# To build the documention, you will have to enable it
719# and then do the equivalent of "make DoxygenDoc".
720IF(BUILD_DOCUMENTATION)
[7843]721
[9359]722    OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
[7845]723    IF(BUILD_REF_DOCS_SEARCHENGINE)
[7843]724        SET(SEARCHENGINE YES)
[9908]725    ELSE()
[7843]726        SET(SEARCHENGINE NO)
[9908]727    ENDIF()
[8390]728
[9359]729    OPTION(BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF)
[7843]730    IF(BUILD_REF_DOCS_TAGFILE)
[9359]731        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg.tag")
[9908]732    ELSE()
[7843]733        SET(GENERATE_TAGFILE "")
[9908]734    ENDIF()
[8390]735
[6474]736    IF(DOT)
737        SET(HAVE_DOT YES)
[9908]738    ELSE()
[6474]739        SET(HAVE_DOT NO)
[9908]740    ENDIF()
[9339]741   
[9359]742    # If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
743    SET(GENERATE_HTMLHELP "NO")
744    IF(DOCUMENTATION_HTML_HELP)
[9403]745        # 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]746        IF(NOT WIN32)
747            SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
748            MARK_AS_ADVANCED(HTML_HELP_COMPILER)
[9908]749        ENDIF()
[9359]750        # this var sets a proper value in .doxygen files when coniguring them below
751        SET(GENERATE_HTMLHELP "YES")
[9908]752    endif()
[9359]753 
754    # This processes our doxyfile.cmake and substitutes paths to generate
[6474]755    # a final Doxyfile
756    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake
[9359]757        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
[6474]758    )
[9359]759    # copy the osg logo to documentations target folder
760    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
761        ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg32-32.png COPYONLY
762    )
763    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
764    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs DESTINATION doc COMPONENT openscenegraph-doc)
765
766    # now set up openthreads documentation generation
767    IF(BUILD_REF_DOCS_TAGFILE)
768        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenThreadsReferenceDocs/ot.tag")
[9908]769    ENDIF()
[9359]770
771    # This processes our openthreads.doxyfile.cmake and generate a final doxyfile
772    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/openthreads.doxyfile.cmake
773        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
774    )
775    # copy the osg logo to documentations target folder
776    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
777        ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs/osg32-32.png COPYONLY
778    )
779    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
780    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs DESTINATION doc COMPONENT openthreads-doc)
781
782    # Process our other doxyfiles but don't create targets for these
783    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/all_Doxyfile
784        ${PROJECT_BINARY_DIR}/doc/all_Doxyfile)
785    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/auto_Doxyfile
786        ${PROJECT_BINARY_DIR}/doc/auto_Doxyfile)
787    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile
788        ${PROJECT_BINARY_DIR}/doc/core_Doxyfile)
789   
[6474]790    # This creates a new target to build documentation.
791    # It runs ${DOXYGEN} which is the full path and executable to
792    # Doxygen on your system, set by the FindDoxygen.cmake module
793    # (called by FindDocumentation.cmake).
794    # It runs the final generated Doxyfile against it.
795    # The DOT_PATH is substituted into the Doxyfile.
[9359]796    ADD_CUSTOM_TARGET(doc_openscenegraph ${DOXYGEN}
797        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
[6474]798    )
[9359]799    ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN}
800        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
801    )
[6324]802ENDIF(BUILD_DOCUMENTATION)
803
[8942]804OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
805IF(BUILD_DASHBOARD_REPORTS)
806# The following are required to uses Dart and the Cdash dashboard
807# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
808    INCLUDE(Dart)
[9908]809ENDIF()
[8942]810
[9528]811# present the packaging option only if we have the cpack command defined (effectively >= 2.6.0)
[9484]812IF(CMAKE_CPACK_COMMAND)
[9528]813    OPTION(BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
[9350]814    IF(BUILD_OSG_PACKAGES)
815      INCLUDE(OsgCPack)
[9908]816    ENDIF()
817ENDIF()
[6475]818
[10262]819# Generate pkg-config configuration files
[9558]820
[10262]821SET(PKGCONFIG_FILES
822  openscenegraph
823  openscenegraph-osg
824  openscenegraph-osgDB
825  openscenegraph-osgFX
826  openscenegraph-osgGA
827  openscenegraph-osgParticle
828  openscenegraph-osgSim
829  openscenegraph-osgText
830  openscenegraph-osgUtil
831  openscenegraph-osgTerrain
832  openscenegraph-osgManipulator
833  openscenegraph-osgViewer
834  openscenegraph-osgWidget
835  openscenegraph-osgShadow
836  openscenegraph-osgAnimation
837  openscenegraph-osgVolume
838  openscenegraph-osgIntrospection
839)
840
841FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
842  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
843    ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc
[9558]844    @ONLY
845    )
[10262]846  INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
847ENDFOREACH(PKGCONFIG_FILE)
[9558]848
849
[9566]850# Run this as late as possible so users can easier spot the message
[9908]851IF (NOT DEFINED REQUIRES_LIBPATH_MESSAGE AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
852    SET(REQUIRES_LIBPATH_MESSAGE ON)
853ENDIF()
[9584]854
[9588]855IF(REQUIRES_LIBPATH_MESSAGE)
856    IF (NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
857        SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
[9566]858
[9588]859        MESSAGE("\nThe build system is configured to instal libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n"
860            "Your applications may not be able to find your installed libraries unless you:\n"
861            "    set your LD_LIBRARY_PATH (user specific) or\n"
862            "    update your ld.so configuration (system wide)")
863        IF(IS_DIRECTORY /etc/ld.so.conf.d)
864            MESSAGE("You have an ld.so.conf.d directory on your system, so if you wish to ensure that\n"
865                "applications find the installed osg libraries, system wide, you could install a\n"
866                "openscenegraph specific ld.so configuration with:\n"
867                "    sudo make install_ld_conf\n")
868            CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in
869                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
870            )
871            ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
872                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
873                /etc/ld.so.conf.d/openscenegraph.conf
874                COMMAND ldconfig
875                COMMENT "Copying openscenegraph.conf to /etc/ld.so.conf.d and running ldconfig"
876            )
[9908]877        ELSE()
[9588]878            IF(EXISTS /etc/ld.so.conf)
879                MESSAGE("You have an ld.so.conf file in /etc, if you wish to ensure \n"
880                "that applications find the installed osg libraries, system wide, you\n"
881                "could add ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} to it.")
[9908]882            ENDIF()
883        ENDIF()
[9566]884
[9588]885        # emit a message during installation.
886        INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}lib${LIB_POSTFIX}.\\nYou may need to update your ld.so configuration. \")")
887
888    ENDIF(NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
889
[9908]890ELSE()
[9588]891    SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 0 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
[9908]892ENDIF()
[9588]893
894
[9566]895# This needs to be run very last so other parts of the scripts can take
896# advantage of this.
897IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
898    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]899ENDIF()
[9566]900
[6686]901#-----------------------------------------------------------------------------
902### uninstall target
903#-----------------------------------------------------------------------------
904CONFIGURE_FILE(
905  "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
906  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
907  IMMEDIATE @ONLY)
908ADD_CUSTOM_TARGET(uninstall
909  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
Note: See TracBrowser for help on using the browser.