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