2017-11-20 20:49:20 +08:00
#
# OpenSceneGraph CMake build file
#
SET ( OPENSCENEGRAPH_MAJOR_VERSION 3 )
2018-03-20 17:12:58 +08:00
SET ( OPENSCENEGRAPH_MINOR_VERSION 6 )
2019-01-04 17:22:12 +08:00
SET ( OPENSCENEGRAPH_PATCH_VERSION 4 )
2019-01-09 18:19:34 +08:00
SET ( OPENSCENEGRAPH_SOVERSION 159 )
2017-11-20 20:49:20 +08:00
# set to 0 when not a release candidate, non zero means that any generated
# git tags will be treated as release candidates of given number
2019-01-09 18:19:34 +08:00
SET ( OPENSCENEGRAPH_RELEASE_CANDIDATE 2 )
2009-03-11 22:08:43 +08:00
set ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
2011-03-09 21:05:59 +08:00
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
2009-03-11 22:08:43 +08:00
2016-09-23 01:33:35 +08:00
CMAKE_MINIMUM_REQUIRED ( VERSION 2.8.0 FATAL_ERROR )
2007-04-12 18:14:10 +08:00
2008-05-27 06:36:58 +08:00
if ( COMMAND cmake_policy )
2008-05-31 00:53:45 +08:00
# Works around warnings libraries linked against that don't
# have absolute paths (e.g. -lpthreads)
2008-05-27 06:36:58 +08:00
cmake_policy ( SET CMP0003 NEW )
2008-05-31 00:53:45 +08:00
# Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements.
2008-06-23 17:57:45 +08:00
cmake_policy ( SET CMP0005 NEW )
2008-09-18 03:25:40 +08:00
2011-10-20 17:23:26 +08:00
# tell CMake to prefer CMake's own CMake modules when available
2011-10-20 18:52:32 +08:00
# only available from cmake-2.8.4
2018-05-12 14:51:51 +08:00
if ( "${CMAKE_VERSION}" VERSION_GREATER 2.8.3 )
2011-10-20 18:52:32 +08:00
cmake_policy ( SET CMP0017 NEW )
endif ( )
2011-10-20 17:23:26 +08:00
2009-03-11 22:08:43 +08:00
endif ( )
2007-03-09 17:07:05 +08:00
2016-08-10 21:30:28 +08:00
IF ( APPLE )
# Get OSX version in MAJOR.MINOR format
EXECUTE_PROCESS ( COMMAND sw_vers -productVersion
O U T P U T _ V A R I A B L E O S G _ O S X _ V E R S I O N
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
STRING ( REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1"
O S G _ O S X _ V E R S I O N " $ { O S G _ O S X _ V E R S I O N } " )
ENDIF ( )
# Set OSX architecture flags here, since they must be specified before
# creating the actual OSG project.
# Note that the CMAKE_OSX_* variables are not well documented in
# CMake 2.8, but they do officially exist.
# See https://cmake.org/Bug/view.php?id=14695#c34953
# Additionally, OSG_WINDOWING_SYSTEM is set here for OSX since its
# value is needed to find the correct version of OpenGL (X11 or Cocoa).
IF ( APPLE AND NOT ANDROID )
2018-07-10 09:09:28 +08:00
# custom option to flag an iOS build
OPTION ( OSG_BUILD_PLATFORM_IPHONE "Enable IPhoneSDK Device support" OFF )
2016-08-10 21:30:28 +08:00
IF ( OSG_BUILD_PLATFORM_IPHONE )
2018-07-10 09:09:28 +08:00
# set sdk and min versions
SET ( IPHONE_SDKVER "10.2" CACHE STRING "IOS SDK-Version" )
SET ( IPHONE_VERSION_MIN "7.0" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support" )
2016-08-10 21:30:28 +08:00
2018-07-10 09:09:28 +08:00
# get full path to sdk from requested versions
SET ( IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer" )
SET ( IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk" )
2016-08-10 21:30:28 +08:00
2018-07-10 09:09:28 +08:00
# optionally enable bitcode for the build
SET ( IPHONE_ENABLE_BITCODE "NO" CACHE STRING "IOS Enable Bitcode" )
# seamless toggle between device and simulator
SET ( CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator" )
# set deployment target to min version
SET ( CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONE_VERSION_MIN}" CACHE STRING "Deployment target for iOS" FORCE )
# Set standard architectures
SET ( CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" )
2016-08-10 21:30:28 +08:00
ELSE ( )
2018-07-10 09:09:28 +08:00
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
IF ( OSG_OSX_VERSION VERSION_LESS 10.5 )
SET ( OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11." )
ELSE ( )
SET ( OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11." )
ENDIF ( )
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
# These are set the first time CMake is run, and can be changed by
# the user at any time.
IF ( OSG_OSX_VERSION VERSION_GREATER 10.7 )
# 64 Bit Works, i386,ppc is not supported any more
SET ( CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" )
SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "Target OSX version" )
ELSEIF ( OSG_OSX_VERSION VERSION_EQUAL 10.7 )
# 64 Bit Works, PPC is not supported any more
SET ( CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" )
ELSEIF ( OSG_OSX_VERSION VERSION_GREATER 10.4 )
# 64-bit compiles are not supported with Carbon.
SET ( CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" )
SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "Target OSX version" )
ELSEIF ( OSG_OSX_VERSION VERSION_EQUAL 10.4 )
# 64-bit compiles are not supported with Carbon.
SET ( CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" )
ELSE ( )
# No Universal Binary support and SDK detection is too unreliable.
# Warn user and continue at their own peril.
MESSAGE ( WARNING "OSX 10.3 and earlier not supported." )
ENDIF ( )
2016-08-10 21:30:28 +08:00
ENDIF ( )
ENDIF ( )
2018-07-10 09:09:28 +08:00
2007-03-09 17:07:05 +08:00
PROJECT ( OpenSceneGraph )
2007-05-21 01:38:11 +08:00
SET ( OPENSCENEGRAPH_VERSION ${ OPENSCENEGRAPH_MAJOR_VERSION } . ${ OPENSCENEGRAPH_MINOR_VERSION } . ${ OPENSCENEGRAPH_PATCH_VERSION } )
SET ( OSG_PLUGINS osgPlugins- ${ OPENSCENEGRAPH_VERSION } )
2007-10-03 05:26:22 +08:00
SET ( OSG_PLUGIN_PREFIX "" )
IF ( CYGWIN )
SET ( OSG_PLUGIN_PREFIX "cygwin_" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-10-03 05:26:22 +08:00
IF ( MINGW )
SET ( OSG_PLUGIN_PREFIX "mingw_" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-10-03 05:26:22 +08:00
2007-05-21 01:38:11 +08:00
# We want to build SONAMES shared librariess
SET ( OPENSCENEGRAPH_SONAMES TRUE )
SET ( OPENTHREADS_SONAMES TRUE )
2007-05-20 20:29:11 +08:00
2007-05-03 16:50:06 +08:00
SET ( OpenThreads_SOURCE_DIR ${ OpenSceneGraph_SOURCE_DIR } )
2007-03-09 17:07:05 +08:00
# We have some custom .cmake scripts not in the official distribution.
# Maybe this can be used override existing behavior if needed?
SET ( CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}" )
2014-11-20 01:42:11 +08:00
# Change the default build type to Release
IF ( NOT CMAKE_BUILD_TYPE )
SET ( CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE )
ENDIF ( NOT CMAKE_BUILD_TYPE )
2014-11-21 18:37:33 +08:00
IF ( ANDROID )
2011-03-09 00:35:37 +08:00
INCLUDE ( OsgAndroidMacroUtils )
ENDIF ( )
2007-03-29 18:56:07 +08:00
# Okay, here's the problem: On some platforms, linking against OpenThreads
2008-05-31 00:53:45 +08:00
# is not enough and explicit linking to the underlying thread library
2007-03-29 18:56:07 +08:00
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
2008-05-31 00:53:45 +08:00
# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
# thread library is because some platforms support multiple backends (e.g.
# IRIX supports Sproc and Pthreads). Linking all libraries won't work
2007-03-29 18:56:07 +08:00
# because the libraries may be incompatible.
2008-05-31 00:53:45 +08:00
# So the current solution is to attempt best guess linking and exempt certain
2007-03-29 18:56:07 +08:00
# cases. With IRIX, we're going to hope explicit linking to the underlying
# library is not necessary. We currently don't case for pthreads on Windows
# which might be an issue on things like Cygwin. This may need to be fixed.
2011-03-09 00:35:37 +08:00
IF ( NOT ANDROID )
FIND_PACKAGE ( Threads )
ENDIF ( )
2007-03-29 18:56:07 +08:00
IF ( CMAKE_SYSTEM MATCHES IRIX )
2007-04-11 16:33:40 +08:00
# Erase CMAKE_THREAD_LIBS_INIT and hope it works
2008-05-31 00:53:45 +08:00
SET ( CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-03-29 18:56:07 +08:00
2016-03-02 04:35:58 +08:00
OPTION ( OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making git branches, tags, updating ChangeLog." OFF )
2008-09-01 23:27:35 +08:00
IF ( OSG_MAINTAINER )
SET ( OPENSCENEGRAPH_BRANCH OpenSceneGraph- ${ OPENSCENEGRAPH_MAJOR_VERSION } . ${ OPENSCENEGRAPH_MINOR_VERSION } )
#
# Provide target for tagging a release
#
2016-03-02 03:44:32 +08:00
SET ( GITCOMMAND git )
2008-09-01 23:27:35 +08:00
IF ( OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0 )
SET ( RELEASE_NAME OpenSceneGraph- ${ OPENSCENEGRAPH_VERSION } )
2009-03-11 22:08:43 +08:00
ELSE ( )
2008-09-01 23:27:35 +08:00
SET ( RELEASE_NAME OpenSceneGraph- ${ OPENSCENEGRAPH_VERSION } -rc ${ OPENSCENEGRAPH_RELEASE_CANDIDATE } )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-09-01 23:27:35 +08:00
2016-03-02 04:24:19 +08:00
SET ( RELEASE_MESSAGE "Release ${RELEASE_NAME}" )
SET ( BRANCH_MESSAGE "Branch ${OPENSCENEGRAPH_BRANCH}" )
2008-09-01 23:27:35 +08:00
ADD_CUSTOM_TARGET ( tag-test
2016-03-02 04:24:19 +08:00
C O M M A N D e c h o $ { G I T C O M M A N D } t a g - a $ { R E L E A S E _ N A M E } - m $ { R E L E A S E _ M E S S A G E }
2016-03-02 03:44:32 +08:00
C O M M A N D e c h o $ { G I T C O M M A N D } p u s h o r i g i n $ { R E L E A S E _ N A M E }
2008-09-01 23:27:35 +08:00
)
ADD_CUSTOM_TARGET ( tag-run
2016-03-02 04:24:19 +08:00
C O M M A N D $ { G I T C O M M A N D } t a g - a $ { R E L E A S E _ N A M E } - m $ { R E L E A S E _ M E S S A G E }
2016-03-02 03:44:32 +08:00
C O M M A N D $ { G I T C O M M A N D } p u s h o r i g i n $ { R E L E A S E _ N A M E }
2008-09-01 23:27:35 +08:00
)
ADD_CUSTOM_TARGET ( branch-test
2018-03-20 17:20:59 +08:00
C O M M A N D e c h o $ { G I T C O M M A N D } b r a n c h $ { O P E N S C E N E G R A P H _ B R A N C H }
2016-03-02 03:44:32 +08:00
C O M M A N D e c h o $ { G I T C O M M A N D } p u s h o r i g i n $ { O P E N S C E N E G R A P H _ B R A N C H }
2008-09-01 23:27:35 +08:00
)
ADD_CUSTOM_TARGET ( branch-run
2018-03-20 17:20:59 +08:00
C O M M A N D $ { G I T C O M M A N D } b r a n c h $ { O P E N S C E N E G R A P H _ B R A N C H }
2016-03-02 03:44:32 +08:00
C O M M A N D $ { G I T C O M M A N D } p u s h o r i g i n $ { O P E N S C E N E G R A P H _ B R A N C H }
2008-09-01 23:27:35 +08:00
)
#
# Provide target for generating ChangeLog
#
2016-09-06 02:12:54 +08:00
SET ( GITLOGFORMAT "%aD%nAuthor : %an%n%s%b%n" )
2016-03-02 03:44:32 +08:00
SET ( GENERATELOGS git log --pretty=format: ${ GITLOGFORMAT } )
2008-09-01 23:27:35 +08:00
ADD_CUSTOM_TARGET ( ChangeLog
2016-03-02 03:44:32 +08:00
C O M M A N D $ { G E N E R A T E L O G S } > C h a n g e L o g
2008-09-01 23:27:35 +08:00
)
2011-10-20 18:52:32 +08:00
2008-09-01 23:27:35 +08:00
ENDIF ( OSG_MAINTAINER )
2014-11-24 23:19:20 +08:00
IF ( NOT ANDROID )
IF ( APPLE )
2010-11-27 02:19:28 +08:00
2018-07-10 09:09:28 +08:00
IF ( OSG_BUILD_PLATFORM_IPHONE )
2010-11-27 02:19:28 +08:00
2018-07-10 09:09:28 +08:00
# set the sdk path as our sysroot, if we set this before the project is defined cmake fails to build its test program
SET ( CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE )
2010-11-27 02:19:28 +08:00
2018-07-10 09:09:28 +08:00
# Set the path to OpenGL library
SET ( OPENGL_gl_LIBRARY "${IPHONE_SDKROOT}/System/Library/Frameworks/OpenGLES.framework" )
2018-03-09 18:17:59 +08:00
2010-12-02 22:20:52 +08:00
ELSE ( )
FIND_LIBRARY ( CARBON_LIBRARY Carbon )
FIND_LIBRARY ( COCOA_LIBRARY Cocoa )
2016-08-10 21:30:28 +08:00
# Apple OS X: Find OpenGL and AGL based on OSG_WINDOWING_SYSTEM
# This is the accepted way of finding X11/OpenGL on OSX, as
# documented in CMake's FindOpenGL module.
# Note that without this check, libosg would use Cocoa/OpenGL but
# libosgViewer would use X11/OpenGL, which causes compatibility
# issues for applications using OSG.
UNSET ( OPENGL_gl_LIBRARY CACHE )
UNSET ( OPENGL_INCLUDE_DIR CACHE )
IF ( OSG_WINDOWING_SYSTEM STREQUAL "X11" )
FIND_PACKAGE ( X11 )
IF ( NOT X11_FOUND )
MESSAGE ( FATAL_ERROR "OSG_WINDOWING_SYSTEM is X11, but no X11 installation was found. Please make sure X11 is properly installed." )
ENDIF ( )
# Use X11 version of OpenGL as seed for CMake FindOpenGL
GET_FILENAME_COMPONENT ( X11LIBDIR ${ X11_X11_LIB } DIRECTORY )
FIND_LIBRARY ( OPENGL_gl_LIBRARY GL PATHS ${ X11LIBDIR } DOC "OpenGL lib for OSX" NO_DEFAULT_PATH )
SET ( OPENGL_INCLUDE_DIR ${ X11_INCLUDE_DIR } CACHE PATH "Include for OpenGL on OSX" FORCE )
ELSEIF ( OSG_WINDOWING_SYSTEM STREQUAL "Carbon" )
# AGL needed for Carbon windowing systems
FIND_LIBRARY ( AGL_LIBRARY AGL )
ENDIF ( )
2010-12-02 22:20:52 +08:00
FIND_PACKAGE ( OpenGL )
2016-10-14 18:06:31 +08:00
FIND_PACKAGE ( EGL )
2010-12-02 22:20:52 +08:00
ENDIF ( )
2010-11-27 02:19:28 +08:00
2010-04-19 21:44:42 +08:00
OPTION ( OSG_COMPILE_FRAMEWORKS "compile frameworks instead of dylibs (experimental)" OFF )
SET ( OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR "@executable_path/../Frameworks" CACHE STRING "install name dir for compiled frameworks" )
2010-12-02 22:20:52 +08:00
ELSE ( )
2014-11-24 23:19:20 +08:00
# Non-Apple: Find OpenGL
FIND_PACKAGE ( OpenGL )
2016-10-14 18:06:31 +08:00
FIND_PACKAGE ( EGL )
2011-03-09 00:35:37 +08:00
ENDIF ( )
2014-11-24 23:19:20 +08:00
ENDIF ( )
2007-03-09 17:07:05 +08:00
2011-03-09 00:35:37 +08:00
IF ( UNIX AND NOT ANDROID )
2007-04-11 16:33:40 +08:00
# Not sure what this will do on Cygwin and Msys
# Also, remember OS X X11 is a user installed option so it may not exist.
FIND_PACKAGE ( X11 )
# Some Unicies need explicit linkage to the Math library or the build fails.
FIND_LIBRARY ( MATH_LIBRARY m )
2010-03-26 17:01:49 +08:00
From Alberto Luaces, "he new GNU linker, "gold", is going to replace soon the current ld in
almost all Linux distributions. Although it is 100% compatible with ld,
by default it gives an error if a library has unresolved symbols at link
time, that is, it has set -Wl,--no-undefined by default. Debian folks
have found that libosg.so and libosgDB.so use some functions belonging
to libdl.so {dlsym,dlopen,dlclose,dlerror} without linking to it.
My changes link those two libraries to libdl.so explicitly in the same
way it is already done for libm.so and librt.so."
2010-02-11 19:17:55 +08:00
FIND_LIBRARY ( DL_LIBRARY dl )
2010-03-26 17:01:49 +08:00
IF ( NOT DL_LIBRARY )
SET ( DL_LIBRARY "" ) # change from NOTFOUND to empty when passed to linker
ENDIF ( )
2009-11-18 21:00:35 +08:00
IF ( CMAKE_SYSTEM MATCHES "Linux" )
FIND_LIBRARY ( RT_LIBRARY rt )
ENDIF ( CMAKE_SYSTEM MATCHES "Linux" )
2010-03-26 17:01:49 +08:00
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-05-31 00:53:45 +08:00
2010-03-01 19:29:19 +08:00
# Make the headers visible to everything
IF ( NOT ${ PROJECT_BINARY_DIR } EQUAL ${ PROJECT_SOURCE_DIR } )
INCLUDE_DIRECTORIES ( ${ PROJECT_BINARY_DIR } /include )
ENDIF ( )
2018-05-11 01:50:17 +08:00
INCLUDE_DIRECTORIES ( ${ OpenSceneGraph_SOURCE_DIR } /include/ )
2018-03-23 00:51:03 +08:00
INCLUDE_DIRECTORIES ( SYSTEM ${ OPENGL_INCLUDE_DIR } )
2007-03-09 17:07:05 +08:00
# Common global definitions
#ADD_DEFINITIONS(-D)
# Platform specific definitions
2007-10-03 05:26:22 +08:00
2011-03-09 00:35:37 +08:00
IF ( WIN32 AND NOT ANDROID )
2017-12-26 22:35:42 +08:00
OPTION ( OSG_DETERMINE_WIN_VERSION "Wheter to automatically determine current Windows version" ON )
2017-12-31 21:32:44 +08:00
IF ( OSG_DETERMINE_WIN_VERSION )
# Check window version
INCLUDE ( OsgDetermineWinVersion )
get_WIN32_WINNT ( WIN_VERSION )
ADD_DEFINITIONS ( -D_WIN32_WINNT= ${ WIN_VERSION } )
2017-12-26 22:35:42 +08:00
ENDIF ( OSG_DETERMINE_WIN_VERSION )
2008-04-11 21:03:02 +08:00
2008-05-27 06:36:58 +08:00
IF ( MSVC )
# This option is to enable the /MP switch for Visual Studio 2005 and above compilers
OPTION ( WIN32_USE_MP "Set to ON to build OpenSceneGraph with the /MP option (Visual Studio 2005 and above)." OFF )
MARK_AS_ADVANCED ( WIN32_USE_MP )
2008-05-31 00:53:45 +08:00
IF ( WIN32_USE_MP )
2008-05-27 06:36:58 +08:00
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
2008-05-31 00:53:45 +08:00
ENDIF ( WIN32_USE_MP )
2008-05-27 06:36:58 +08:00
2008-11-15 02:22:01 +08:00
# turn off various warnings
2009-01-08 19:35:57 +08:00
# foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
# endforeach(warning)
2008-11-15 02:22:01 +08:00
From Jean-Sebastien Guay, "As I discussed in the thread "Windows 7 beta: "The binary is not a valid Windows image."" on osg-users, I needed to add the /DYNAMICBASE linker option for executables to link properly in release mode on Windows 7 beta.
http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/42400
Since this is a workaround for a bug in a beta OS (which may or may not be fixed, since it's mentioned in their release notes so they may just leave it as it is) I've marked the option as advanced, default to OFF, and clearly documented it as being useful for Windows 7 only. I'd like to be able to test for Windows 7 directly instead of the blanket IF(WIN32), but I can't figure out if this is possible in CMake.
Here's the modified CMakeLists.txt. It's a small change, with low impact, but will be useful to others who test out this OS and when it comes out. Note that I'm not familiar with this option in general, and didn't get any feedback to my questions in the above-mentioned thread, one of which was: Could we just add this option to all builds? What is the impact? That's still unclear to me, but without it OSG executables don't build, and the article I linked didn't seem to present any ill effects to enabling the option."
2009-04-09 17:25:34 +08:00
# This option is to enable the /DYNAMICBASE switch
# It is used to workaround a bug in Windows 7 when linking in release, which results in corrupt
# 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
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 )
MARK_AS_ADVANCED ( WIN32_USE_DYNAMICBASE )
IF ( WIN32_USE_DYNAMICBASE )
SET ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE" )
ENDIF ( WIN32_USE_DYNAMICBASE )
2008-05-27 06:36:58 +08:00
# More MSVC specific compilation flags
ADD_DEFINITIONS ( -D_SCL_SECURE_NO_WARNINGS )
ADD_DEFINITIONS ( -D_CRT_SECURE_NO_DEPRECATE )
2009-05-07 20:55:07 +08:00
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 )
MARK_AS_ADVANCED ( MSVC_DISABLE_CHECKED_ITERATORS )
IF ( MSVC_DISABLE_CHECKED_ITERATORS )
ADD_DEFINITIONS ( -D_SECURE_SCL=0 )
ENDIF ( MSVC_DISABLE_CHECKED_ITERATORS )
2010-03-15 23:01:21 +08:00
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 )
MARK_AS_ADVANCED ( MSVC_USE_DEFAULT_STACK_SIZE )
IF ( MSVC_USE_DEFAULT_STACK_SIZE )
STRING ( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" )
STRING ( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" )
STRING ( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}" )
ENDIF ( MSVC_USE_DEFAULT_STACK_SIZE )
2013-05-31 18:28:39 +08:00
get_filename_component ( CMAKE_MAKE_PROGRAM_NAME ${ CMAKE_MAKE_PROGRAM } NAME )
IF ( CMAKE_MAKE_PROGRAM_NAME STREQUAL "VCExpress.exe" )
OPTION ( MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS - VCExpress detected, not supported in VCExpress )" OFF )
ELSE ( )
OPTION ( MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS" ON )
ENDIF ( )
SET_PROPERTY ( GLOBAL PROPERTY USE_FOLDERS ${ MSVC_BUILD_USE_SOLUTION_FOLDERS } )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-04-11 21:03:02 +08:00
2007-04-11 16:33:40 +08:00
#needed for net plugin
2007-10-03 04:56:56 +08:00
SET ( OSG_SOCKET_LIBS wsock32 )
2007-04-11 16:33:40 +08:00
# Both Cygwin and Msys need -DNOMINMAX ???
IF ( UNIX )
ADD_DEFINITIONS ( -DNOMINMAX )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-08-30 18:41:15 +08:00
########################################################################################################
2009-01-08 19:26:16 +08:00
# the following options are MSVC specific,
2008-05-31 00:53:45 +08:00
# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
2007-08-30 18:41:15 +08:00
# fron bin folder without requiring installation step.
# it also prepend "osg${OPENSCENEGRAPH_SOVERSION}-" to only .dll files, leaving .lib files untouched in lib
2008-05-31 00:53:45 +08:00
# it also use a hack to get rid of Debug and Release folder in MSVC projects
2007-08-30 18:41:15 +08:00
# all the .dll and .pdb are in bin and all the .lib and .exp are in lib
2008-05-31 00:53:45 +08:00
#
2007-08-30 18:41:15 +08:00
# the second option disable incremental linking in debug build , that is enabled by default by CMake
##########################################################################################################
2007-09-11 00:06:23 +08:00
IF ( MSVC )
2016-09-23 01:33:35 +08:00
OPTION ( OSG_MSVC_VERSIONED_DLL "Set to ON to build OpenSceneGraph with versioned dll names" ON )
MARK_AS_ADVANCED ( OSG_MSVC_VERSIONED_DLL )
OPTION ( OSG_MSVC_DEBUG_INCREMENTAL_LINK "Set to OFF to build OpenSceneGraph without incremental linking in debug (release is off by default)" ON )
MARK_AS_ADVANCED ( OSG_MSVC_DEBUG_INCREMENTAL_LINK )
IF ( NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK )
SET ( CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" )
SET ( CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" )
SET ( CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" )
ENDIF ( NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK )
2007-09-11 00:06:23 +08:00
ENDIF ( MSVC )
2011-03-09 00:35:37 +08:00
ENDIF ( WIN32 AND NOT ANDROID )
2007-03-09 17:07:05 +08:00
2007-03-10 00:25:11 +08:00
########################################################################################################
##### these were settings located in SetupCommon.cmake used in Luigi builds.... find out what are useful
########################################################################################################
#luigi#SET(CMAKE_VERBOSE_MAKEFILE TRUE)
#luigi#SET(CMAKE_SKIP_RPATH TRUE)
#luigi#SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
#luigi#IF(UNIX)
2007-04-11 16:33:40 +08:00
#luigi# LIST_CONTAINS(contains "g++" ${CMAKE_CXX_COMPILER_LIST})
#luigi# IF (contains)
#luigi# MESSAGE(${MY_MESSAGE_DEFAULT} "${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} setting CMAKE_CXX_COMPILER to g++")
#luigi# SET(CMAKE_CXX_COMPILER "g++")
#luigi# SET(CMAKE_CXX_COMPILER_LOADED 2)
#luigi# SET(CMAKE_CXX_COMPILER_WORKS 2)
#luigi# ENDIF (contains)
#luigi# SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
#luigi# SET(CMAKE_CXX_FLAGS_DEBUG "-ggdb -gstabs")
2007-03-10 00:25:11 +08:00
#luigi#ENDIF(UNIX)
########################################################################################################
2010-09-15 20:00:12 +08:00
OPTION ( OSG_NOTIFY_DISABLED "Set to ON to build OpenSceneGraph with the notify() disabled." OFF )
2010-02-12 19:45:00 +08:00
2017-05-25 02:40:08 +08:00
OPTION ( OSG_USE_DEPRECATED_API "Set to ON to build OpenSceneGraph with the OSG_USE_DEPREFATED_API #define enabled to allow access to deprecated APIs ." ON )
2008-04-04 02:36:50 +08:00
OPTION ( OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF )
2007-05-20 19:45:09 +08:00
MARK_AS_ADVANCED ( OSG_USE_FLOAT_MATRIX )
2008-04-04 02:36:50 +08:00
OPTION ( OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float Plane instead of double." OFF )
2007-05-20 19:45:09 +08:00
MARK_AS_ADVANCED ( OSG_USE_FLOAT_PLANE )
2007-03-09 17:07:05 +08:00
2008-04-04 02:36:50 +08:00
OPTION ( OSG_USE_FLOAT_BOUNDINGSPHERE "Set to ON to build OpenSceneGraph with float BoundingSphere instead of double." ON )
MARK_AS_ADVANCED ( OSG_USE_FLOAT_BOUNDINGSPHERE )
OPTION ( OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON )
MARK_AS_ADVANCED ( OSG_USE_FLOAT_BOUNDINGBOX )
2007-03-09 17:07:05 +08:00
2011-04-14 23:21:53 +08:00
IF ( WIN32 )
OPTION ( OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF )
MARK_AS_ADVANCED ( OSG_USE_UTF8_FILENAME )
ENDIF ( )
2008-11-07 23:08:08 +08:00
2009-01-08 19:26:16 +08:00
OPTION ( OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON )
2008-11-25 00:32:52 +08:00
MARK_AS_ADVANCED ( OSG_DISABLE_MSVC_WARNINGS )
2015-10-22 21:42:19 +08:00
OPTION ( OSG_PROVIDE_READFILE "Set to ON for include/osgDB/ReadFile to provide the osgDB::read*File(() methods. " ON )
2008-10-03 23:36:34 +08:00
OPTION ( OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON )
2016-06-02 20:03:07 +08:00
OPTION ( OSG_USE_REF_PTR_SAFE_DEREFERENCE "Set to ON to throw an exception whenever ref_ptr<> is dereferenced or called. " OFF )
2013-06-18 19:18:28 +08:00
2018-01-23 23:27:24 +08:00
OPTION ( OSG_ENVVAR_SUPPORTED "Set to ON to build OpenSceneGraph with the #define OSG_ENVVAR_SUPPORTED, found in include/osg/Config, to enable use of getenv() related functions." ON )
2017-11-01 21:32:47 +08:00
2014-04-23 17:08:26 +08:00
# Map the OPENGL_PROFILE to OSG_GL*_AVAILABLE settings
2015-08-12 14:39:57 +08:00
SET ( OPENGL_PROFILE "GL2" CACHE STRING "OpenGL Profile to use, choose from GL1, GL2, GL3, GLES1, GLES2, GLES3" )
2014-04-23 17:08:26 +08:00
IF ( ( OPENGL_PROFILE STREQUAL "GL1" ) OR ( OPENGL_PROFILE STREQUAL "GL2" ) )
OPTION ( OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON )
ELSE ( )
OPTION ( OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." OFF )
ENDIF ( )
IF ( ( OPENGL_PROFILE STREQUAL "GL2" ) )
OPTION ( OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON )
ELSE ( )
OPTION ( OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." OFF )
ENDIF ( )
IF ( ( OPENGL_PROFILE STREQUAL "GL3" ) OR ( OPENGL_PROFILE STREQUAL "GLCORE" ) )
OPTION ( OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." ON )
2016-08-06 05:04:03 +08:00
if ( APPLE )
add_definitions ( -DGL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED )
endif ( )
2014-04-23 17:08:26 +08:00
ELSE ( )
OPTION ( OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF )
ENDIF ( )
IF ( ( OPENGL_PROFILE STREQUAL "GLES1" ) )
OPTION ( OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." ON )
ELSE ( )
OPTION ( OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF )
ENDIF ( )
IF ( ( OPENGL_PROFILE STREQUAL "GLES2" ) )
OPTION ( OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
2015-04-13 18:11:32 +08:00
ELSEIF ( ( OPENGL_PROFILE STREQUAL "GLES3" ) )
2017-03-18 14:53:32 +08:00
OPTION ( OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." ON )
ELSEIF ( ( OPENGL_PROFILE STREQUAL "GLES2+GLES3" ) )
2015-04-13 18:11:32 +08:00
OPTION ( OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
OPTION ( OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." ON )
2014-04-23 17:08:26 +08:00
ELSE ( )
OPTION ( OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF )
2015-04-13 18:11:32 +08:00
OPTION ( OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." OFF )
2014-04-23 17:08:26 +08:00
ENDIF ( )
2010-04-29 05:22:44 +08:00
OPTION ( OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF )
2009-10-22 20:06:00 +08:00
2014-04-23 17:08:26 +08:00
# Map the OSG_GL*_AVAILABLE settings to OSG_GL_* settings
2017-03-18 14:53:32 +08:00
IF ( OSG_GLES2_AVAILABLE OR OSG_GLES3_AVAILABLE OR OSG_GL3_AVAILABLE )
2014-04-23 17:08:26 +08:00
OPTION ( OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF )
OPTION ( OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." OFF )
OPTION ( OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." OFF )
OPTION ( OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." OFF )
OPTION ( OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." OFF )
ELSEIF ( OSG_GLES1_AVAILABLE )
OPTION ( OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF )
OPTION ( OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON )
OPTION ( OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON )
OPTION ( OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON )
OPTION ( OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON )
ELSE ( )
OPTION ( OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ON )
OPTION ( OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON )
OPTION ( OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON )
OPTION ( OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON )
OPTION ( OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON )
ENDIF ( )
2017-03-18 14:53:32 +08:00
IF ( OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE OR OSG_GLES3_AVAILABLE )
2014-04-23 17:08:26 +08:00
OPTION ( OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." OFF )
ELSE ( )
OPTION ( OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON )
ENDIF ( )
# Map the OSG_GL*_AVAILABLE settings to OpenGL header settings
2018-11-11 18:14:50 +08:00
SET ( DEFAULT_GL_CONTEXT_VERSION "1.0" )
2014-04-23 17:08:26 +08:00
IF ( OSG_GL3_AVAILABLE )
2018-04-24 23:22:13 +08:00
2018-11-11 18:14:50 +08:00
SET ( DEFAULT_GL_CONTEXT_VERSION "3.3" )
2018-04-24 23:22:13 +08:00
2014-04-23 17:08:26 +08:00
IF ( APPLE )
2014-05-01 23:50:14 +08:00
SET ( OPENGL_HEADER1 "#include <OpenGL/gl.h>" CACHE STRING "#include<> line for OpenGL Header" )
2014-04-23 17:08:26 +08:00
SET ( OPENGL_HEADER2 "#include <OpenGL/gl3.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ELSE ( )
IF ( OPENGL_PROFILE STREQUAL "GLCORE" )
2014-04-29 20:18:51 +08:00
IF ( WIN32 )
FIND_PACKAGE ( GLCORE REQUIRED )
ENDIF ( )
2014-04-23 17:08:26 +08:00
SET ( OPENGL_HEADER1 "#include <GL/glcorearb.h>" CACHE STRING "#include<> line for OpenGL Header" )
SET ( OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ELSE ( )
2018-06-29 16:52:47 +08:00
SET ( OPENGL_HEADER1 "#include <GL/gl.h>" CACHE STRING "#include<> line for OpenGL Header" )
2014-04-23 17:08:26 +08:00
SET ( OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ENDIF ( )
ENDIF ( )
ELSEIF ( OSG_GLES1_AVAILABLE )
2014-08-08 17:28:26 +08:00
IF ( APPLE AND NOT ANDROID )
2014-04-23 17:08:26 +08:00
SET ( OPENGL_HEADER1 "#include \" TargetConditionals.h\ "" CACHE STRING "#include<> line for OpenGL Header" )
SET ( OPENGL_HEADER2 "#include <OpenGLES/ES1/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ELSE ( )
SET ( OPENGL_HEADER1 "#include <GLES/gl.h>" CACHE STRING "#include<> line for OpenGL Header" )
SET ( OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ENDIF ( )
ELSEIF ( OSG_GLES2_AVAILABLE )
2014-08-08 17:28:26 +08:00
IF ( APPLE AND NOT ANDROID )
2014-05-01 23:50:14 +08:00
SET ( OPENGL_HEADER1 "#include \" TargetConditionals.h\ "" CACHE STRING "#include<> line for OpenGL Header" )
2014-04-23 17:08:26 +08:00
SET ( OPENGL_HEADER2 "#include <OpenGLES/ES2/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ELSE ( )
SET ( OPENGL_HEADER1 "#include <GLES2/gl2.h>" CACHE STRING "#include<> line for OpenGL Header" )
SET ( OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
2017-03-15 09:35:58 +08:00
ENDIF ( )
ELSEIF ( OSG_GLES3_AVAILABLE )
IF ( APPLE AND NOT ANDROID )
SET ( OPENGL_HEADER1 "#include \" TargetConditionals.h\ "" CACHE STRING "#include<> line for OpenGL Header" )
SET ( OPENGL_HEADER2 "#include <OpenGLES/ES3/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ELSE ( )
SET ( OPENGL_HEADER1 "#include <GLES3/gl3.h>" CACHE STRING "#include<> line for OpenGL Header" )
SET ( OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
2014-04-23 17:08:26 +08:00
ENDIF ( )
ELSE ( )
IF ( APPLE )
2014-05-01 23:50:14 +08:00
SET ( OPENGL_HEADER1 "#include <OpenGL/gl.h>" CACHE STRING "#include<> line for OpenGL Header" )
2014-04-23 17:08:26 +08:00
SET ( OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ELSE ( )
SET ( OPENGL_HEADER1 "#include <GL/gl.h>" CACHE STRING "#include<> line for OpenGL Header" )
SET ( OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required" )
ENDIF ( )
ENDIF ( )
2018-11-11 18:14:50 +08:00
SET ( OSG_GL_CONTEXT_VERSION ${ DEFAULT_GL_CONTEXT_VERSION } CACHE STRING "GL Context String to pass when creaing graphics contexts" )
2014-04-23 17:08:26 +08:00
IF ( OSG_GL1_AVAILABLE )
2017-03-29 21:28:09 +08:00
SET ( OSG_GL1_FEATURES 1 )
2014-04-23 17:08:26 +08:00
ELSE ( )
2017-03-29 21:28:09 +08:00
SET ( OSG_GL1_FEATURES 0 )
2014-04-23 17:08:26 +08:00
ENDIF ( )
IF ( OSG_GL2_AVAILABLE )
2017-03-29 21:28:09 +08:00
SET ( OSG_GL2_FEATURES 1 )
2014-04-23 17:08:26 +08:00
ELSE ( )
2017-03-29 21:28:09 +08:00
SET ( OSG_GL2_FEATURES 0 )
2014-04-23 17:08:26 +08:00
ENDIF ( )
IF ( OSG_GL3_AVAILABLE )
2017-03-29 21:28:09 +08:00
SET ( OSG_GL3_FEATURES 1 )
2014-04-23 17:08:26 +08:00
ELSE ( )
2017-03-29 21:28:09 +08:00
SET ( OSG_GL3_FEATURES 0 )
2014-04-23 17:08:26 +08:00
ENDIF ( )
IF ( OSG_GLES1_AVAILABLE )
2017-03-29 21:28:09 +08:00
SET ( OSG_GLES1_FEATURES 1 )
2014-04-23 17:08:26 +08:00
ELSE ( )
2017-03-29 21:28:09 +08:00
SET ( OSG_GLES1_FEATURES 0 )
2014-04-23 17:08:26 +08:00
ENDIF ( )
2014-06-02 16:13:39 +08:00
IF ( OSG_GLES2_AVAILABLE )
2017-03-29 21:28:09 +08:00
SET ( OSG_GLES2_FEATURES 1 )
2014-04-23 17:08:26 +08:00
ELSE ( )
2017-03-29 21:28:09 +08:00
SET ( OSG_GLES2_FEATURES 0 )
2014-04-23 17:08:26 +08:00
ENDIF ( )
2009-10-23 21:19:57 +08:00
2015-04-13 18:11:32 +08:00
IF ( OSG_GLES3_AVAILABLE )
2017-03-29 21:28:09 +08:00
SET ( OSG_GLES3_FEATURES 1 )
2015-04-13 18:11:32 +08:00
ELSE ( )
2017-03-29 21:28:09 +08:00
SET ( OSG_GLES3_FEATURES 0 )
2015-04-13 18:11:32 +08:00
ENDIF ( )
2014-11-21 18:37:33 +08:00
IF ( ANDROID )
IF ( OSG_GLES1_AVAILABLE )
FIND_PATH ( OPENGL_INCLUDE_DIR GLES/gl.h
P A T H S
$ { A N D R O I D _ S Y S R O O T } / u s r / i n c l u d e )
FIND_LIBRARY ( OPENGL_gl_LIBRARY GLESv1_CM
P A T H S
$ { A N D R O I D _ S Y S R O O T } / u s r / l i b )
ELSEIF ( OSG_GLES2_AVAILABLE )
FIND_PATH ( OPENGL_INCLUDE_DIR GLES2/gl2.h
P A T H S
$ { A N D R O I D _ S Y S R O O T } / u s r / i n c l u d e )
FIND_LIBRARY ( OPENGL_gl_LIBRARY GLESv2
P A T H S
$ { A N D R O I D _ S Y S R O O T } / u s r / l i b )
2017-03-18 14:53:32 +08:00
ELSEIF ( OSG_GLES3_AVAILABLE )
FIND_PATH ( OPENGL_INCLUDE_DIR GLES3/gl3.h
P A T H S
$ { A N D R O I D _ S Y S R O O T } / u s r / i n c l u d e )
FIND_LIBRARY ( OPENGL_gl_LIBRARY GLESv3
P A T H S
$ { A N D R O I D _ S Y S R O O T } / u s r / l i b )
2014-11-21 18:37:33 +08:00
ENDIF ( )
ENDIF ( )
2009-11-17 20:55:52 +08:00
2014-04-25 16:56:53 +08:00
2008-06-21 03:52:14 +08:00
################################################################################
2015-07-22 21:49:14 +08:00
# Set Config header file
2008-06-21 03:52:14 +08:00
SET ( OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config" )
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
" $ { O P E N S C E N E G R A P H _ C O N F I G _ H E A D E R } " )
2015-08-11 03:40:36 +08:00
2015-07-22 21:49:14 +08:00
################################################################################
# Set OpenGL header file
2015-08-11 03:40:36 +08:00
2015-07-22 21:49:14 +08:00
INCLUDE ( CheckCXXSourceCompiles )
#SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIR})
check_cxx_source_compiles (
2015-08-11 03:40:36 +08:00
" $ { O P E N G L _ H E A D E R 1 }
$ { O P E N G L _ H E A D E R 2 }
2015-07-22 21:49:14 +08:00
i n t main ( ) { G L i n t 6 4 t e s t ; r e t u r n 0 ; } "
G L _ H E A D E R _ H A S _ G L I N T 6 4
)
2015-08-11 03:40:36 +08:00
2015-07-22 21:49:14 +08:00
check_cxx_source_compiles (
2015-08-11 03:40:36 +08:00
" $ { O P E N G L _ H E A D E R 1 }
$ { O P E N G L _ H E A D E R 2 }
2015-07-22 21:49:14 +08:00
i n t main ( ) { G L u i n t 6 4 t e s t ; r e t u r n 0 ; } "
G L _ H E A D E R _ H A S _ G L U I N T 6 4
)
2009-11-19 00:24:01 +08:00
2014-04-30 21:19:22 +08:00
SET ( OPENSCENEGRAPH_OPENGL_HEADER "${PROJECT_BINARY_DIR}/include/osg/GL" )
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
2014-04-24 15:22:55 +08:00
" $ { O P E N S C E N E G R A P H _ O P E N G L _ H E A D E R } " )
2014-04-23 17:08:26 +08:00
2008-06-23 18:18:04 +08:00
# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
2008-06-21 03:52:14 +08:00
2014-04-25 16:56:53 +08:00
################################################################################
2015-07-22 21:49:14 +08:00
# Set Version header file
2014-04-25 16:56:53 +08:00
2014-11-29 00:10:14 +08:00
SET ( OPENSCENEGRAPH_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/osg/Version" )
2014-04-25 16:56:53 +08:00
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
" $ { O P E N S C E N E G R A P H _ V E R S I O N _ H E A D E R } " )
2009-02-05 22:55:17 +08:00
################################################################################
# Set Version Info resource file
2014-04-25 16:56:53 +08:00
2009-02-05 22:56:39 +08:00
IF ( MSVC )
2009-02-06 16:46:02 +08:00
SET ( OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc" )
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
2009-02-05 22:55:17 +08:00
" $ { O P E N S C E N E G R A P H _ V E R S I O N I N F O _ R C } " )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2009-02-05 22:55:17 +08:00
2009-01-29 21:29:08 +08:00
################################################################################
# Optional build components
# OSG Applications
OPTION ( BUILD_OSG_APPLICATIONS "Enable to build OSG Applications (e.g. osgviewer)" ON )
# OSG Examples
OPTION ( BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF )
2017-02-03 17:01:15 +08:00
# OSG Plugins disable option for apple build on travis ci test - full build job runs over time limit of 50 min.
OPTION ( BUILD_OSG_PLUGINS "Build OSG Plugins - Disable for compile testing examples on a time limit" ON )
mark_as_advanced ( BUILD_OSG_PLUGINS )
2007-03-09 17:07:05 +08:00
################################################################################
# 3rd Party Dependency Stuff
2011-03-09 00:35:37 +08:00
IF ( WIN32 AND NOT ANDROID )
2007-04-11 16:33:40 +08:00
INCLUDE ( Find3rdPartyDependencies )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-03-09 17:07:05 +08:00
2014-02-05 00:49:13 +08:00
OPTION ( OSG_USE_LOCAL_LUA_SOURCE "Enable to use local Lua source when building the lua plugin" ON )
2014-12-22 18:35:33 +08:00
#
# If you want to prevent CMake from picking up on any of the following optional 3rd Party dependencies in CMake 2.8 onwards
# you can use the following style of command line option when invoking Cmake (here illustrating ignoring PythonLibs) :
# cmake -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=1 .
#
2011-03-09 00:35:37 +08:00
IF ( ANDROID )
2011-04-21 20:53:22 +08:00
ANDROID_3RD_PARTY ( )
2011-03-09 00:35:37 +08:00
ELSE ( )
# Common to all platforms except android:
2014-04-14 00:04:27 +08:00
FIND_PACKAGE ( Freetype )
2017-11-14 18:38:18 +08:00
FIND_PACKAGE ( ilmbase )
2011-03-09 00:35:37 +08:00
FIND_PACKAGE ( Inventor )
FIND_PACKAGE ( Jasper )
FIND_PACKAGE ( OpenEXR )
2016-12-01 03:11:15 +08:00
FIND_PACKAGE ( OpenCascade )
2011-03-09 00:35:37 +08:00
FIND_PACKAGE ( COLLADA )
FIND_PACKAGE ( FBX )
FIND_PACKAGE ( ZLIB )
FIND_PACKAGE ( OpenVRML )
FIND_PACKAGE ( GDAL )
2012-02-18 00:45:49 +08:00
FIND_PACKAGE ( GTA )
2011-03-09 00:35:37 +08:00
FIND_PACKAGE ( CURL )
FIND_PACKAGE ( LibVNCServer )
2017-07-26 19:54:37 +08:00
FIND_PACKAGE ( DCMTK )
2011-03-09 00:35:37 +08:00
FIND_PACKAGE ( FFmpeg )
2015-02-26 03:25:34 +08:00
FIND_PACKAGE ( GStreamer COMPONENTS app pbutils )
2014-12-16 19:20:42 +08:00
FIND_PACKAGE ( GLIB COMPONENTS gobject )
2011-03-09 00:35:37 +08:00
FIND_PACKAGE ( DirectShow )
2014-12-18 03:21:32 +08:00
FIND_PACKAGE ( SDL2 )
2011-03-09 00:35:37 +08:00
FIND_PACKAGE ( SDL )
FIND_PACKAGE ( Poppler-glib )
FIND_PACKAGE ( RSVG )
FIND_PACKAGE ( GtkGl )
FIND_PACKAGE ( DirectInput )
FIND_PACKAGE ( NVTT )
2013-07-30 14:12:31 +08:00
IF ( NOT WIN32 )
FIND_PACKAGE ( Asio )
ENDIF ( )
2012-12-06 01:15:53 +08:00
FIND_PACKAGE ( ZeroConf )
2014-02-05 00:49:13 +08:00
2014-12-19 01:47:08 +08:00
FIND_PACKAGE ( LIBLAS )
2014-02-05 00:49:13 +08:00
IF ( NOT(OSG_USE_LOCAL_LUA_SOURCE ) )
FIND_PACKAGE ( Lua52 )
IF ( NOT ( LUA_LIBRARIES AND LUA_INCLUDE_DIR ) )
FIND_PACKAGE ( Lua51 )
ENDIF ( )
2013-10-05 04:42:23 +08:00
ENDIF ( )
2014-02-05 00:49:13 +08:00
2015-02-02 17:53:55 +08:00
# V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this.
# FIND_PACKAGE(V8)
# FIND_PACKAGE(PythonLibs)
2011-03-09 00:35:37 +08:00
ENDIF ( )
2007-03-09 17:07:05 +08:00
2010-11-09 22:39:32 +08:00
# Include macro utilities here
INCLUDE ( OsgMacroUtils )
2011-09-13 17:53:34 +08:00
2009-01-29 21:29:08 +08:00
#optional example related dependencies
2011-03-09 00:35:37 +08:00
IF ( BUILD_OSG_EXAMPLES AND NOT ANDROID )
2009-01-29 21:29:08 +08:00
FIND_PACKAGE ( FLTK )
FIND_PACKAGE ( FOX )
SET ( wxWidgets_USE_LIBS base core gl net )
FIND_PACKAGE ( wxWidgets )
2011-03-09 00:35:37 +08:00
ENDIF ( BUILD_OSG_EXAMPLES AND NOT ANDROID )
2009-01-29 21:29:08 +08:00
2007-03-09 17:07:05 +08:00
# Platform specific:
# (We can approach this one of two ways. We can try to FIND everything
# and simply check if we found the packages before actually building
2008-05-31 00:53:45 +08:00
# or we can hardcode the cases. The advantage of the former is that
2007-03-09 17:07:05 +08:00
# packages that are installed on platforms that don't require them
2008-05-31 00:53:45 +08:00
# will still get built (presuming no compatibility issues). But this
# also means modules that are redundant may get built. For example,
2007-03-09 17:07:05 +08:00
# OS X doesn't need GIF, JPEG, PNG, TIFF, etc because it uses QuickTime.
# Also, it will clutter the CMake menu with "NOT_FOUND".
# The downside to the latter is that it is harder to build those
# potentially redundant modules.)
# Image readers/writers depend on 3rd party libraries except for OS X which
# can use Quicktime.
2011-03-09 00:35:37 +08:00
IF ( NOT ANDROID )
IF ( NOT APPLE )
FIND_PACKAGE ( GIFLIB )
FIND_PACKAGE ( JPEG )
FIND_PACKAGE ( PNG )
FIND_PACKAGE ( TIFF )
# QuickTime is required for OS X, but optional for Windows.
IF ( WIN32 )
FIND_PACKAGE ( QuickTime )
ENDIF ( )
2007-04-11 16:33:40 +08:00
2011-03-09 00:35:37 +08:00
ELSE ( )
2013-01-26 00:54:30 +08:00
FIND_PACKAGE ( TIFF )
2007-04-11 16:33:40 +08:00
FIND_PACKAGE ( QuickTime )
2011-03-09 00:35:37 +08:00
FIND_PACKAGE ( QTKit )
FIND_PACKAGE ( CoreVideo )
2012-10-02 22:07:12 +08:00
FIND_PACKAGE ( CoreMedia )
FIND_PACKAGE ( QuartzCore )
FIND_PACKAGE ( AVFoundation )
2009-03-11 22:08:43 +08:00
ENDIF ( )
ENDIF ( )
2007-03-09 17:07:05 +08:00
2007-03-23 16:53:06 +08:00
################################################################################
# Create bin and lib directories if required
IF ( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
2007-05-20 20:29:11 +08:00
FILE ( MAKE_DIRECTORY ${ CMAKE_BINARY_DIR } /bin ${ CMAKE_BINARY_DIR } /lib ${ CMAKE_BINARY_DIR } /lib/ ${ OSG_PLUGINS } )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-03-23 16:53:06 +08:00
2007-03-09 17:07:05 +08:00
################################################################################
# Installation stuff
2008-05-28 01:42:56 +08:00
SET ( CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows" )
From David Fries,"We are needing to compile Debug, Release, and MinSizeWithDebInfo, but
currently only Debug appends "d" so the Release and MinSizeWithDebInfo
(and MinSizeRel) all produce the same filenames. This set of changes
lets each build type have a cmake defined string appended, defaulting
to Release none, Debug d, RelWithDebInfo rd, MinSizeRel s. But a user
still can have Release, RelWithDebInfo, and MinSizeRel to produce the
same filenames. It does so by setting the preprocessor define
OSG_LIBRARY_POSTFIX in src/osgDB/CMakeLists.txt to one of the
previously defined cmake variables CMAKE_DEBUG_POSTFIX
CMAKE_RELEASE_POSTFIX CMAKE_RELWITHDEBINFO_POSTFIX
CMAKE_MINSIZEREL_POSTFIX. This method cuts down on the #ifdef _DEBUG
#else preprocessor directives in Registry.cpp as the extension is
always passed in OSG_LIBRARY_POSTFIX. That and __MINGW32__ didn't
have the _DEBUG check which looks like a bug."
2010-03-11 01:19:35 +08:00
SET ( CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows" )
SET ( CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows" )
SET ( CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows" )
2008-09-22 22:58:35 +08:00
2017-08-17 00:51:58 +08:00
# Correct any incorrect case usage in CMAKE_BUILD_TYPE
IF ( CMAKE_BUILD_TYPE MATCHES "release" OR CMAKE_BUILD_TYPE MATCHES "RELEASE" )
SET ( CMAKE_BUILD_TYPE "Release" )
ELSEIF ( CMAKE_BUILD_TYPE MATCHES "minsizerel" OR CMAKE_BUILD_TYPE MATCHES "MINSIZEREL" )
SET ( CMAKE_BUILD_TYPE "MinSizeRel" )
ELSEIF ( CMAKE_BUILD_TYPE MATCHES "relwithdebinfo" OR CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO" )
SET ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
ELSEIF ( CMAKE_BUILD_TYPE MATCHES "debug" OR CMAKE_BUILD_TYPE MATCHES "DEBUG" )
SET ( CMAKE_BUILD_TYPE "Debug" )
ENDIF ( )
2011-03-11 18:18:43 +08:00
# Set the build postfix extension according to what configuration is being built.
IF ( CMAKE_BUILD_TYPE MATCHES "Release" )
SET ( CMAKE_BUILD_POSTFIX "${CMAKE_RELEASE_POSTFIX}" )
ELSEIF ( CMAKE_BUILD_TYPE MATCHES "MinSizeRel" )
SET ( CMAKE_BUILD_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" )
ELSEIF ( CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" )
SET ( CMAKE_BUILD_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" )
ELSEIF ( CMAKE_BUILD_TYPE MATCHES "Debug" )
SET ( CMAKE_BUILD_POSTFIX "${CMAKE_DEBUG_POSTFIX}" )
ELSE ( )
2011-03-16 21:41:39 +08:00
SET ( CMAKE_BUILD_POSTFIX "" )
2011-03-11 18:18:43 +08:00
ENDIF ( )
2008-12-19 01:09:12 +08:00
IF ( UNIX AND NOT WIN32 )
2009-04-21 22:27:34 +08:00
SET ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG" )
SET ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-05-28 20:49:47 +08:00
2008-09-18 02:56:59 +08:00
IF ( CYGWIN )
2009-04-21 22:27:34 +08:00
SET ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG" )
SET ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-03-09 17:07:05 +08:00
2007-03-29 18:56:07 +08:00
IF ( UNIX AND NOT WIN32 AND NOT APPLE )
IF ( CMAKE_SIZEOF_VOID_P MATCHES "8" )
2007-05-20 17:55:34 +08:00
SET ( LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement" )
MARK_AS_ADVANCED ( LIB_POSTFIX )
2009-03-11 22:08:43 +08:00
ENDIF ( )
ENDIF ( )
2007-05-20 17:55:34 +08:00
IF ( NOT DEFINED LIB_POSTFIX )
SET ( LIB_POSTFIX "" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-05-27 06:36:58 +08:00
2017-08-16 00:23:49 +08:00
# Here we apparently do some funky stuff with making the bin/ and lib/
2008-05-27 06:36:58 +08:00
# folders which is probably needed to work around a very old CMake bug?
2007-03-13 05:23:09 +08:00
#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
SET ( OUTPUT_BINDIR ${ PROJECT_BINARY_DIR } /bin )
2007-03-09 17:07:05 +08:00
MAKE_DIRECTORY ( ${ OUTPUT_BINDIR } )
2008-02-18 23:26:46 +08:00
IF ( MSVC AND NOT MSVC_IDE )
MAKE_DIRECTORY ( ${ OUTPUT_BINDIR } / ${ OSG_PLUGINS } )
ENDIF ( MSVC AND NOT MSVC_IDE )
2007-03-13 05:23:09 +08:00
#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
SET ( OUTPUT_LIBDIR ${ PROJECT_BINARY_DIR } /lib )
2007-03-09 17:07:05 +08:00
MAKE_DIRECTORY ( ${ OUTPUT_LIBDIR } )
2009-11-18 20:15:29 +08:00
IF ( NOT MSVC OR MSVC_IDE )
2008-02-18 23:26:46 +08:00
MAKE_DIRECTORY ( ${ OUTPUT_LIBDIR } / ${ OSG_PLUGINS } )
2009-11-18 20:15:29 +08:00
ENDIF ( NOT MSVC OR MSVC_IDE )
2007-03-09 17:07:05 +08:00
2010-11-09 22:39:32 +08:00
# CMake >= 2.8.1 changed the output directory algorithm (See doc).
# 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.
# (Doc reads "multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory").
# 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.
2016-09-23 01:33:35 +08:00
SET ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ OUTPUT_LIBDIR } )
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ OUTPUT_BINDIR } )
IF ( WIN32 )
SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ OUTPUT_BINDIR } )
ELSE ( WIN32 )
SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ OUTPUT_LIBDIR } )
ENDIF ( WIN32 )
# Testing CMAKE_VERSION is possible in >= 2.6.4 only
BUILDER_VERSION_GREATER ( 2 8 0 )
IF ( VALID_BUILDER_VERSION ) # If CMake >= 2.8.1
FOREACH ( CONF ${ CMAKE_CONFIGURATION_TYPES } ) # For each configuration (Debug, Release, MinSizeRel... and/or anything the user chooses)
STRING ( TOUPPER "${CONF}" CONF ) # Go uppercase (DEBUG, RELEASE...)
SET ( "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}" )
SET ( "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}" )
IF ( WIN32 )
SET ( "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}" )
ELSE ( )
SET ( "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}" )
ENDIF ( )
ENDFOREACH ( )
ENDIF ( VALID_BUILDER_VERSION )
2007-03-09 17:07:05 +08:00
#SET(INSTALL_BINDIR OpenSceneGraph/bin)
#SET(INSTALL_INCDIR OpenSceneGraph/include)
#SET(INSTALL_LIBDIR OpenSceneGraph/lib)
#SET(INSTALL_DOCDIR OpenSceneGraph/doc)
################################################################################
# User Options
2007-04-27 18:29:48 +08:00
# Expose CMAKE_INCLUDE_PATH and CMAKE_LIBARY_PATH to the GUI so users
# may set these values without needing to manipulate the environment.
SET ( CMAKE_INCLUDE_PATH ${ CMAKE_INCLUDE_PATH } CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths." )
SET ( CMAKE_LIBRARY_PATH ${ CMAKE_LIBRARY_PATH } CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths." )
# We are proposing that a new variable called CMAKE_PREFIX_PATH be introduced
# to CMake to compliment CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH.
# A formal feature request has been submited to CMake, Bug #4947.
# It is intended for those users who have common prefixes for their INCLUDE
# and LIBRARY locations. So if users have headers in /usr/local/include
# and libraries in /usr/local/lib, the common prefix is /usr/local.
# It should also cover the case where headers and libraries are
# in the same directory.
# Our proposal expects that FIND_* commands will automatically search for
# CMAKE_PREFIX_PATH right after CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH.
# Obviously, since CMake does not currently support this, we must write
# our Find*.cmake modules to explicitly support this. Otherwise, this variable
# will have no impact.
# This is unofficial so this may be removed or changed at anytime.
SET ( CMAKE_PREFIX_PATH ${ CMAKE_PREFIX_PATH } CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths." )
2016-06-02 18:06:50 +08:00
2008-05-31 00:53:45 +08:00
# This is for an advanced option to give aggressive warnings
2007-04-11 16:35:39 +08:00
# under different compilers. If yours is not implemented, this option
# will not be made available.
IF ( CMAKE_COMPILER_IS_GNUCXX )
2008-05-31 00:53:45 +08:00
# To be complete, we might also do GNUCC flags,
2007-04-11 16:35:39 +08:00
# but everything here is C++ code.
# -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
# returns too many hits.
2008-05-31 00:53:45 +08:00
# FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
2007-04-11 16:35:39 +08:00
# interesting C-specific flag.
2007-04-25 17:14:01 +08:00
# Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
# errors instead of warnings for certain issues, including superfluous
# semicolons and commas, and the use of long long. -fpermissive seems
2008-05-31 00:53:45 +08:00
# to be the workaround.
2016-06-03 03:00:42 +08:00
SET ( OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused )
2016-09-20 16:23:15 +08:00
MESSAGE ( STATUS "g++ version ${CMAKE_CXX_COMPILER_VERSION} " )
IF ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6 )
SET ( OSG_AGGRESSIVE_WARNING_FLAGS ${ OSG_AGGRESSIVE_WARNING_FLAGS } -Wmaybe-uninitialized -Wextra )
2016-09-22 15:09:46 +08:00
IF ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 )
2016-09-20 16:23:15 +08:00
SET ( OSG_AGGRESSIVE_WARNING_FLAGS ${ OSG_AGGRESSIVE_WARNING_FLAGS } -Wshadow )
IF ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 )
# -Wmisleading-indentation (in -Wall) generates less warnings when interpreting tab as 4 spaces instead of the default of 8
# SET(OSG_AGGRESSIVE_WARNING_FLAGS ${OSG_AGGRESSIVE_WARNING_FLAGS} -ftabstop=4)
SET ( OSG_AGGRESSIVE_WARNING_FLAGS ${ OSG_AGGRESSIVE_WARNING_FLAGS } -Wno-misleading-indentation )
ENDIF ( )
2016-09-16 23:12:41 +08:00
ENDIF ( )
2016-06-03 03:00:42 +08:00
ENDIF ( )
2009-02-03 19:05:35 +08:00
2009-02-05 19:10:32 +08:00
# Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
2009-02-03 19:05:35 +08:00
2013-07-01 17:10:11 +08:00
ELSEIF ( MSVC )
2013-07-02 22:35:29 +08:00
#disable specific warning level 4 warnings:
#C4100 'identifier' : unreferenced formal parameter
#C4127 Error Message conditional expression is constant
#C4706 assignment within conditional expression
2016-09-19 22:40:59 +08:00
#C4589: Constructor of abstract class 'osgGA::CameraManipulator' ignores initializer for virtual base class 'osg::Object'
SET ( OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4589 /wd4706 /wd4127 /wd4100 )
2013-07-01 17:10:11 +08:00
ELSEIF ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
SET ( OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -Wno-overloaded-virtual )
2007-04-11 16:35:39 +08:00
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
2008-05-31 00:53:45 +08:00
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
2007-04-11 16:35:39 +08:00
# remain unset.
From Stephan Huber, "attached you’ll find a bunch of fixes + enhancements for iOS and OS X based on current trunk. I incorporated + tested the submission from Colin Cochran, so his submission is not needed anymore.
* fixed a bug with multi-touch and touch-id-generation on iOS and OS X. (will fix a bug reported by Colin Cochran, without ditching the existing logic)
* removed unnecessary warning-flagss when generating xcode-projects via cmake, will enable the usage of OSG_AGGRESSIVE_WARNING_FLAGS
* added support for 10.9 (OS X)
* new cmake-variable: IPHONE_VERSION_MIN, this will set the deployment-target (previously hard-coded) If you set the IPHONE_VERSION_MIN to something like 7.0 osg gets compiled also for 64bit (amd64)
* cmake defaults now to the clang compiler if IPHONE_VERSION_MIN > 4.2
* cmake now sets some xcode-settings so the compiler uses the c++98-standard (clang defaults to c++11, w/o this I got a lot of linking errors)
* removed include-dir for avfoundation-plugin as not needed on OSX/IOS.
* enhanced the ios-example, will now show multitouch-information on a hud (similar to the osgmultitouch-example), and more importantly, will compile + link out of the box
* small enhancements for the osc-device-plugin (send only one msg for MOVE/DRAG, even if multiple msgs/event is enabled)
* better memory-handling for the zeroconf-plugin
* fixed a possible bug in the rest-http-plugin when receiving mouse-events.
* incorporated a fix from Colin Cochran "forwarded touch events are not transformed into the GL UIView“
"
2013-10-07 18:05:09 +08:00
IF ( APPLE )
2014-05-06 17:43:32 +08:00
SET ( OSG_CXX_LANGUAGE_STANDARD "C++11" CACHE STRING "set the c++ language standard (C++98 / GNU++98 / C++11) for OSG" )
2013-11-01 22:40:50 +08:00
MARK_AS_ADVANCED ( OSG_CXX_LANGUAGE_STANDARD )
# remove existing flags
REMOVE_CXX_FLAG ( -std=c++98 )
2014-05-06 17:43:32 +08:00
REMOVE_CXX_FLAG ( -std=gnu++98 )
2013-11-01 22:40:50 +08:00
REMOVE_CXX_FLAG ( -std=c++11 )
REMOVE_CXX_FLAG ( -stdlib=libstdc++ )
REMOVE_CXX_FLAG ( -stdlib=libc++ )
IF ( ${ OSG_CXX_LANGUAGE_STANDARD } STREQUAL "c++98" OR ${ OSG_CXX_LANGUAGE_STANDARD } STREQUAL "C++98" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -stdlib=libstdc++" )
ELSE ( )
2014-05-06 17:43:32 +08:00
IF ( ${ OSG_CXX_LANGUAGE_STANDARD } STREQUAL "gnu++98" OR ${ OSG_CXX_LANGUAGE_STANDARD } STREQUAL "GNU++98" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++98" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98 -stdlib=libstdc++" )
ELSE ( )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++" )
ENDIF ( )
2013-11-01 22:40:50 +08:00
ENDIF ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual -Wno-conversion" )
From Stephan Huber, "attached you’ll find a bunch of fixes + enhancements for iOS and OS X based on current trunk. I incorporated + tested the submission from Colin Cochran, so his submission is not needed anymore.
* fixed a bug with multi-touch and touch-id-generation on iOS and OS X. (will fix a bug reported by Colin Cochran, without ditching the existing logic)
* removed unnecessary warning-flagss when generating xcode-projects via cmake, will enable the usage of OSG_AGGRESSIVE_WARNING_FLAGS
* added support for 10.9 (OS X)
* new cmake-variable: IPHONE_VERSION_MIN, this will set the deployment-target (previously hard-coded) If you set the IPHONE_VERSION_MIN to something like 7.0 osg gets compiled also for 64bit (amd64)
* cmake defaults now to the clang compiler if IPHONE_VERSION_MIN > 4.2
* cmake now sets some xcode-settings so the compiler uses the c++98-standard (clang defaults to c++11, w/o this I got a lot of linking errors)
* removed include-dir for avfoundation-plugin as not needed on OSX/IOS.
* enhanced the ios-example, will now show multitouch-information on a hud (similar to the osgmultitouch-example), and more importantly, will compile + link out of the box
* small enhancements for the osc-device-plugin (send only one msg for MOVE/DRAG, even if multiple msgs/event is enabled)
* better memory-handling for the zeroconf-plugin
* fixed a possible bug in the rest-http-plugin when receiving mouse-events.
* incorporated a fix from Colin Cochran "forwarded touch events are not transformed into the GL UIView“
"
2013-10-07 18:05:09 +08:00
set ( WARNING_CFLAGS "" )
ENDIF ( )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2007-04-11 16:35:39 +08:00
# This part is for the CMake menu option to toggle the warnings on/off.
# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
IF ( OSG_AGGRESSIVE_WARNING_FLAGS )
2009-02-12 01:21:36 +08:00
2016-06-02 18:06:50 +08:00
SET ( OSG_AGGRESSIVE_WARNING_FLAGS ${ OSG_AGGRESSIVE_WARNING_FLAGS } CACHE STRING "Compiler flags to use when OSG_AGGRESSIVE_WARNINGS is enabled." FORCE )
2009-02-12 01:21:36 +08:00
IF ( APPLE )
SET ( DEFAULT_USE_AGGRESSIVE_WARNINGS OFF )
2009-03-11 22:08:43 +08:00
ELSE ( )
2009-02-12 01:21:36 +08:00
SET ( DEFAULT_USE_AGGRESSIVE_WARNINGS ON )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2009-02-12 01:21:36 +08:00
2016-06-02 19:43:09 +08:00
OPTION ( OSG_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" ${ DEFAULT_USE_AGGRESSIVE_WARNINGS } )
2007-04-11 16:35:39 +08:00
2016-06-02 18:06:50 +08:00
IF ( OSG_AGGRESSIVE_WARNINGS )
2009-01-08 19:26:16 +08:00
# Add flags defined by OSG_AGGRESSIVE_WARNING_FLAGS if they aren't already there
FOREACH ( flag ${ OSG_AGGRESSIVE_WARNING_FLAGS } )
IF ( NOT CMAKE_CXX_FLAGS MATCHES "${flag}" )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
ENDFOREACH ( )
ELSE ( )
2017-08-16 00:23:49 +08:00
# Remove all flags considered aggressive
2009-01-08 19:26:16 +08:00
FOREACH ( flag ${ OSG_AGGRESSIVE_WARNING_FLAGS } )
2009-01-10 03:53:28 +08:00
STRING ( REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
2009-03-11 22:08:43 +08:00
ENDFOREACH ( )
ENDIF ( )
ENDIF ( )
2007-04-11 16:35:39 +08:00
2009-01-08 19:26:16 +08:00
# Dynamic vs Static Linking
OPTION ( DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking. Use OFF for static." ON )
IF ( DYNAMIC_OPENSCENEGRAPH )
SET ( OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED" )
2009-03-11 22:08:43 +08:00
ELSE ( )
2009-01-08 19:26:16 +08:00
SET ( OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2009-01-08 19:26:16 +08:00
2010-11-09 22:39:32 +08:00
2009-01-08 19:26:16 +08:00
# OSG Core
ADD_SUBDIRECTORY ( src )
2011-03-09 00:35:37 +08:00
IF ( BUILD_OSG_APPLICATIONS AND NOT ANDROID )
2009-01-08 19:26:16 +08:00
ADD_SUBDIRECTORY ( applications )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2009-01-08 19:26:16 +08:00
IF ( BUILD_OSG_EXAMPLES )
ADD_SUBDIRECTORY ( examples )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2009-01-08 19:26:16 +08:00
2009-01-29 21:29:08 +08:00
2013-05-21 18:22:54 +08:00
IF ( APPLE AND NOT ANDROID )
2010-11-27 02:19:28 +08:00
2018-07-10 09:09:28 +08:00
IF ( OSG_BUILD_PLATFORM_IPHONE )
2010-11-27 02:19:28 +08:00
2018-07-10 09:09:28 +08:00
# set osg window system to iOS
SET ( OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Windowing system type for graphics window creation, options only IOS." FORCE )
2010-11-27 02:19:28 +08:00
2018-07-10 09:09:28 +08:00
# set osg default image plugin
2010-12-02 22:20:52 +08:00
SET ( OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for iOS" FORCE )
2010-11-27 02:19:28 +08:00
2018-07-10 09:09:28 +08:00
# ensure app bundles for example app
2010-11-27 02:19:28 +08:00
OPTION ( OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" ON )
ELSE ( )
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
# These are just defaults/recommendations, but how we want to build
# out of the box. But the user needs to be able to change these options.
# So we must only set the values the first time CMake is run, or we
# will overwrite any changes the user sets.
# FORCE is used because the options are not reflected in the UI otherwise.
# Seems like a good place to add version specific compiler flags too.
IF ( NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE )
2016-08-10 21:30:28 +08:00
IF ( OSG_OSX_VERSION VERSION_GREATER 10.7 )
SET ( OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE )
ELSEIF ( OSG_OSX_VERSION VERSION_EQUAL 10.7 )
SET ( OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE )
ELSEIF ( OSG_OSX_VERSION VERSION_GREATER 10.4 )
SET ( OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE )
ELSEIF ( OSG_OSX_VERSION VERSION_EQUAL 10.4 )
SET ( OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "Forced imageio default image plugin for OSX" FORCE )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE )
ENDIF ( )
2012-03-23 18:18:27 +08:00
ENDIF ( )
2010-11-27 02:19:28 +08:00
OPTION ( OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF )
ENDIF ( )
2008-05-31 00:53:45 +08:00
2013-05-22 18:28:07 +08:00
ENDIF ( )
2007-03-09 17:07:05 +08:00
2008-08-26 20:05:24 +08:00
2007-03-09 17:07:05 +08:00
# For Doxygen
INCLUDE ( ${ CMAKE_ROOT } /Modules/Documentation.cmake OPTIONAL )
2013-05-23 22:14:51 +08:00
OPTION ( BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make doc_openscenegraph doc_openthreads)" OFF )
2008-12-19 19:04:35 +08:00
MARK_AS_ADVANCED ( CLEAR BUILD_DOCUMENTATION )
2007-03-09 17:07:05 +08:00
# To build the documention, you will have to enable it
2013-05-23 22:14:51 +08:00
# and then do the equivalent of "make doc_openscenegraph doc_openthreads".
2007-03-09 17:07:05 +08:00
IF ( BUILD_DOCUMENTATION )
2008-01-29 02:29:38 +08:00
2008-12-16 19:43:28 +08:00
OPTION ( BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF )
2008-01-29 03:54:27 +08:00
IF ( BUILD_REF_DOCS_SEARCHENGINE )
2008-01-29 02:29:38 +08:00
SET ( SEARCHENGINE YES )
2009-03-11 22:08:43 +08:00
ELSE ( )
2008-01-29 02:29:38 +08:00
SET ( SEARCHENGINE NO )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-05-31 00:53:45 +08:00
2008-12-16 19:43:28 +08:00
OPTION ( BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF )
2008-01-29 02:29:38 +08:00
IF ( BUILD_REF_DOCS_TAGFILE )
2008-12-16 19:43:28 +08:00
SET ( GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg.tag" )
2009-03-11 22:08:43 +08:00
ELSE ( )
2008-01-29 02:29:38 +08:00
SET ( GENERATE_TAGFILE "" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-05-31 00:53:45 +08:00
2007-04-11 16:33:40 +08:00
IF ( DOT )
SET ( HAVE_DOT YES )
2009-03-11 22:08:43 +08:00
ELSE ( )
2007-04-11 16:33:40 +08:00
SET ( HAVE_DOT NO )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2011-10-20 18:52:32 +08:00
2008-12-16 19:43:28 +08:00
# If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
SET ( GENERATE_HTMLHELP "NO" )
IF ( DOCUMENTATION_HTML_HELP )
2012-03-23 18:18:27 +08:00
# on windows Documentation.cmake finds the html help workshop if it exists. On u*ix we might have it with wine but no way to point it out
2008-12-16 19:43:28 +08:00
IF ( NOT WIN32 )
SET ( HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html" )
MARK_AS_ADVANCED ( HTML_HELP_COMPILER )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2012-03-23 18:18:27 +08:00
# this var sets a proper value in .doxygen files when configuring them below
2008-12-16 19:43:28 +08:00
SET ( GENERATE_HTMLHELP "YES" )
2009-03-11 22:08:43 +08:00
endif ( )
2011-10-20 18:52:32 +08:00
2008-12-16 19:43:28 +08:00
# This processes our doxyfile.cmake and substitutes paths to generate
2007-04-11 16:33:40 +08:00
# a final Doxyfile
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /doc/Doxyfiles/doxyfile.cmake
2008-12-16 19:43:28 +08:00
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / o p e n s c e n e g r a p h . d o x y f i l e
)
# copy the osg logo to documentations target folder
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /PlatformSpecifics/Windows/icons/src/osg32-32.png
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / O p e n S c e n e G r a p h R e f e r e n c e D o c s / o s g 3 2 - 3 2 . p n g C O P Y O N L Y
2007-04-11 16:33:40 +08:00
)
2008-12-16 19:43:28 +08:00
#INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
INSTALL ( DIRECTORY ${ PROJECT_BINARY_DIR } /doc/OpenSceneGraphReferenceDocs DESTINATION doc COMPONENT openscenegraph-doc )
# now set up openthreads documentation generation
IF ( BUILD_REF_DOCS_TAGFILE )
SET ( GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenThreadsReferenceDocs/ot.tag" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-12-16 19:43:28 +08:00
# This processes our openthreads.doxyfile.cmake and generate a final doxyfile
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /doc/Doxyfiles/openthreads.doxyfile.cmake
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / o p e n t h r e a d s . d o x y f i l e
)
# copy the osg logo to documentations target folder
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /PlatformSpecifics/Windows/icons/src/osg32-32.png
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / O p e n T h r e a d s R e f e r e n c e D o c s / o s g 3 2 - 3 2 . p n g C O P Y O N L Y
)
#INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
INSTALL ( DIRECTORY ${ PROJECT_BINARY_DIR } /doc/OpenThreadsReferenceDocs DESTINATION doc COMPONENT openthreads-doc )
# Process our other doxyfiles but don't create targets for these
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /doc/Doxyfiles/all_Doxyfile
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / a l l _ D o x y f i l e )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /doc/Doxyfiles/auto_Doxyfile
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / a u t o _ D o x y f i l e )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /doc/Doxyfiles/core_Doxyfile
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / c o r e _ D o x y f i l e )
2011-10-20 18:52:32 +08:00
2007-04-11 16:33:40 +08:00
# This creates a new target to build documentation.
# It runs ${DOXYGEN} which is the full path and executable to
# Doxygen on your system, set by the FindDoxygen.cmake module
# (called by FindDocumentation.cmake).
# It runs the final generated Doxyfile against it.
# The DOT_PATH is substituted into the Doxyfile.
2008-12-16 19:43:28 +08:00
ADD_CUSTOM_TARGET ( doc_openscenegraph ${ DOXYGEN }
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / o p e n s c e n e g r a p h . d o x y f i l e
)
2011-05-27 17:08:48 +08:00
SET_TARGET_PROPERTIES ( doc_openscenegraph PROPERTIES FOLDER "Documentation" )
2011-10-20 18:52:32 +08:00
2008-12-16 19:43:28 +08:00
ADD_CUSTOM_TARGET ( doc_openthreads ${ DOXYGEN }
$ { P R O J E C T _ B I N A R Y _ D I R } / d o c / o p e n t h r e a d s . d o x y f i l e
2007-04-11 16:33:40 +08:00
)
2011-05-27 17:08:48 +08:00
SET_TARGET_PROPERTIES ( doc_openthreads PROPERTIES FOLDER "Documentation" )
2007-03-09 17:07:05 +08:00
ENDIF ( BUILD_DOCUMENTATION )
2013-02-04 21:28:45 +08:00
OPTION ( BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph" OFF )
2008-09-25 23:20:20 +08:00
IF ( BUILD_DASHBOARD_REPORTS )
# The following are required to uses Dart and the Cdash dashboard
2013-06-22 03:35:26 +08:00
# viewable here : http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph
2008-09-25 23:20:20 +08:00
INCLUDE ( Dart )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2008-09-25 23:20:20 +08:00
2009-01-22 02:34:10 +08:00
# present the packaging option only if we have the cpack command defined (effectively >= 2.6.0)
From Mattias Helsing, "'ve finally finished the rework of the packaging support. It is
streamlined for tgz and has most of the features that Robert, J-S and
Sukender requested in december. I have an idea of how to discover the
vc80 sp1 or not but haven't had time to implement. The script is
completely reworked and now doesn't include cmakes' bundled
CPack.cmake script at all. In summary:
* filenames are
<package>-<osgversion>-<platform>-<arch>[-compiler]-<configuration>.tar.gz,
ex. libopenscenegraph-2.7.9-Linux-i386-Release.tar.gz,
libopenthreads-dev-2.7.9-win32-x86-vc80sp1-Debug.tar.gz
* targets (projects in msvs) are generated for each specified
component, a target that packages everything that is installed
(openscenegraph-all) and there's a target for running all other
packaging targets (Package ALL on msvs, package_ALL in unix
makefiles).
* It is possible to set the compiler in ccmake (cmake-gui, whatever you use)
* the top folder in packages is the same for all packages (OpenSceneGraph-x.y)
* the packaging support is limited with cmake-2.6.0 and not as
dynamic. With cmake-2.6.1 and later building the gdal plugin (for
example) will create a package_libopenscenegraph-gdal target. With
cmake-2.6.0 only the ones that are always built (libopenscenegraph,
libopenscenegraph-dev, openscenegraph, libopenthreads,
libopenthreads-dev
* i found a better way to decide whether cpack is available to guard
the BUiLD_OSG_PACKAGES option"
2009-01-12 19:34:03 +08:00
IF ( CMAKE_CPACK_COMMAND )
2009-01-22 02:34:10 +08:00
OPTION ( BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF )
2008-12-15 22:07:29 +08:00
IF ( BUILD_OSG_PACKAGES )
INCLUDE ( OsgCPack )
2009-03-11 22:08:43 +08:00
ENDIF ( )
ENDIF ( )
2007-04-11 16:35:39 +08:00
2009-05-22 16:31:58 +08:00
# Generate pkg-config configuration files
SET ( PKGCONFIG_FILES
o p e n s c e n e g r a p h
o p e n s c e n e g r a p h - o s g
o p e n s c e n e g r a p h - o s g D B
o p e n s c e n e g r a p h - o s g F X
o p e n s c e n e g r a p h - o s g G A
o p e n s c e n e g r a p h - o s g P a r t i c l e
o p e n s c e n e g r a p h - o s g S i m
o p e n s c e n e g r a p h - o s g T e x t
o p e n s c e n e g r a p h - o s g U t i l
o p e n s c e n e g r a p h - o s g T e r r a i n
o p e n s c e n e g r a p h - o s g M a n i p u l a t o r
o p e n s c e n e g r a p h - o s g V i e w e r
o p e n s c e n e g r a p h - o s g W i d g e t
o p e n s c e n e g r a p h - o s g S h a d o w
o p e n s c e n e g r a p h - o s g A n i m a t i o n
o p e n s c e n e g r a p h - o s g V o l u m e
)
2009-01-27 23:34:57 +08:00
2009-05-22 16:31:58 +08:00
FOREACH ( PKGCONFIG_FILE ${ PKGCONFIG_FILES } )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /packaging/pkgconfig/ ${ PKGCONFIG_FILE } .pc.in
$ { P R O J E C T _ B I N A R Y _ D I R } / p a c k a g i n g / p k g c o n f i g / $ { P K G C O N F I G _ F I L E } . p c
2009-01-27 23:34:57 +08:00
@ O N L Y
)
2009-05-22 16:31:58 +08:00
INSTALL ( FILES ${ PROJECT_BINARY_DIR } /packaging/pkgconfig/ ${ PKGCONFIG_FILE } .pc DESTINATION lib ${ LIB_POSTFIX } /pkgconfig COMPONENT libopenscenegraph-dev )
ENDFOREACH ( PKGCONFIG_FILE )
2009-01-27 23:34:57 +08:00
2009-01-28 17:42:21 +08:00
# Run this as late as possible so users can easier spot the message
2009-03-11 22:08:43 +08:00
IF ( NOT DEFINED REQUIRES_LIBPATH_MESSAGE AND ${ CMAKE_INSTALL_PREFIX } STREQUAL "/usr/local" )
SET ( REQUIRES_LIBPATH_MESSAGE ON )
ENDIF ( )
2009-01-29 18:43:11 +08:00
2009-01-29 21:29:08 +08:00
IF ( REQUIRES_LIBPATH_MESSAGE )
IF ( NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE )
SET ( OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before" )
2010-03-17 22:36:16 +08:00
MESSAGE ( "\nThe build system is configured to install libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n"
2009-01-29 21:29:08 +08:00
" Y o u r a p p l i c a t i o n s m a y n o t b e a b l e t o f i n d y o u r i n s t a l l e d l i b r a r i e s u n l e s s y o u : \ n "
" s e t y o u r LD_LIBRARY_PATH ( user specific ) o r \ n "
" u p d a t e y o u r l d . s o configuration ( system wide ) " )
IF ( IS_DIRECTORY /etc/ld.so.conf.d )
MESSAGE ( "You have an ld.so.conf.d directory on your system, so if you wish to ensure that\n"
2010-03-17 22:36:16 +08:00
" a p p l i c a t i o n s f i n d t h e i n s t a l l e d o s g l i b r a r i e s , s y s t e m w i d e , y o u c o u l d i n s t a l l a n \ n "
" O p e n S c e n e G r a p h s p e c i f i c l d . s o c o n f i g u r a t i o n w i t h : \ n "
2009-01-29 21:29:08 +08:00
" s u d o m a k e i n s t a l l _ l d _ c o n f \ n " )
CONFIGURE_FILE ( ${ PROJECT_SOURCE_DIR } /packaging/ld.so.conf.d/openscenegraph.conf.in
$ { P R O J E C T _ B I N A R Y _ D I R } / p a c k a g i n g / l d . s o . c o n f . d / o p e n s c e n e g r a p h . c o n f
)
2011-10-20 18:52:32 +08:00
ADD_CUSTOM_TARGET ( install_ld_conf ${ CMAKE_COMMAND } -E copy_if_different
2009-01-29 21:29:08 +08:00
$ { P R O J E C T _ B I N A R Y _ D I R } / p a c k a g i n g / l d . s o . c o n f . d / o p e n s c e n e g r a p h . c o n f
/ e t c / l d . s o . c o n f . d / o p e n s c e n e g r a p h . c o n f
C O M M A N D l d c o n f i g
C O M M E N T " C o p y i n g o p e n s c e n e g r a p h . c o n f t o / e t c / l d . s o . c o n f . d a n d r u n n i n g l d c o n f i g "
)
2009-03-11 22:08:43 +08:00
ELSE ( )
2009-01-29 21:29:08 +08:00
IF ( EXISTS /etc/ld.so.conf )
MESSAGE ( "You have an ld.so.conf file in /etc, if you wish to ensure \n"
" t h a t a p p l i c a t i o n s f i n d t h e i n s t a l l e d o s g l i b r a r i e s , s y s t e m w i d e , y o u \ n "
" c o u l d a d d $ { C M A K E _ I N S T A L L _ P R E F I X } / l i b $ { L I B _ P O S T F I X } t o i t . " )
2009-03-11 22:08:43 +08:00
ENDIF ( )
ENDIF ( )
2009-01-29 21:29:08 +08:00
# emit a message during installation.
INSTALL ( CODE "MESSAGE(\" Libraries were installed to ${ CMAKE_INSTALL_PREFIX } lib ${ LIB_POSTFIX } .\\nYou may need to update your ld.so configuration. \")")
ENDIF ( NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE )
2009-03-11 22:08:43 +08:00
ELSE ( )
2009-01-29 21:29:08 +08:00
SET ( OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 0 CACHE INTERNAL "Flag to track whether the libpath message has been reported before" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2009-01-28 17:42:21 +08:00
# This needs to be run very last so other parts of the scripts can take
# advantage of this.
IF ( NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE )
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" )
2009-03-11 22:08:43 +08:00
ENDIF ( )
2009-01-27 23:34:57 +08:00
2018-11-09 19:28:57 +08:00
#-----------------------------------------------------------------------------
# add clobber build target to clear all the non git registered files/directories
#-----------------------------------------------------------------------------
add_custom_target ( clobber
C O M M A N D g i t c l e a n - d - f - x
)
2007-05-17 19:48:30 +08:00
#-----------------------------------------------------------------------------
### uninstall target
#-----------------------------------------------------------------------------
CONFIGURE_FILE (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C M a k e M o d u l e s / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
ADD_CUSTOM_TARGET ( uninstall
" $ { C M A K E _ C O M M A N D } " - P " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e " )
2011-03-09 00:35:37 +08:00
#