-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
199 lines (148 loc) · 6.71 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
##---------------------------------------------------------------------------
## CMakeLists.txt - OpenSceneGraphWrappers
##
##---------------------------------------------------------------------------
##
## Based upon OpenSceneGraph CMakeLists
##
## People :
## Eric Griffith
## Gerwin de Haan
## Rene Molenaar
## Hartmut Seichter
##
##---------------------------------------------------------------------------
IF(WIN32)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
ENDIF(WIN32)
# Our project is called 'osgswig' this is how it will be called in
# visual studio, and in our makefiles.
PROJECT(osgswig)
# Using full paths for link libraries (CMake 2.6)
IF(COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND cmake_policy)
# We want to build SONAMES shared librariess
SET(OSGSWIG_SONAMES TRUE)
# 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
${CMAKE_SOURCE_DIR}/CMakeModules
${CMAKE_MODULE_PATH}
)
# some simple parser for OSG version numbers
INCLUDE(parse_OSG_version)
# Find OpenGL
FIND_PACKAGE(OpenGL)
IF(UNIX)
# 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)
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
ENDIF(UNIX)
########################################################################################################
##### use the module to include the OpenSceneGraph files
########################################################################################################
FIND_PACKAGE(OSG) #OpenSceneGraph
check_osg_version(${OSG_INCLUDE_DIR}/osg/Version)
#
# Now we tie ourself to the OSG version numbering
#
SET(OSGSWIG_MAJOR_VERSION ${OSG_VERSION_MAJOR})
SET(OSGSWIG_MINOR_VERSION ${OSG_VERSION_MINOR})
SET(OSGSWIG_PATCH_VERSION ${OSG_VERSION_PATCH})
SET(OSGSWIG_SOVERSION ${OSG_VERSION_SO})
MESSAGE("OSG VERSION " ${OSG_VERSION_MAJOR}.${OSG_VERSION_MINOR}.${OSG_VERSION_PATCH})
SET(OSGSWIG_VERSION ${OSGSWIG_MAJOR_VERSION}.${OSGSWIG_MINOR_VERSION}.${OSGSWIG_PATCH_VERSION})
# Optional / HITLabNZ
FIND_PACKAGE(OSGART) #osgART
FIND_PACKAGE(OSGODE) #osgODE
FIND_PACKAGE(OSGVERSE) #osgODE
# Optional / Mike Weiblen
#FIND_PACKAGE(OSGVRPN) #osgVRPN
OPTION(BUILD_WITH_OSGART "Create wrappers for osgART (Augmented Reality Toolkit for OpenSceneGraph)" OFF)
OPTION(BUILD_WITH_OSGPPU "Create wrappers for osgPPU ( OpenSceneGraph Post Processing Units)" OFF)
OPTION(BUILD_WITH_OSGODE "Create wrappers for osgODE (ODE - Open Dynamics Environment for OpenSceneGraph)" OFF)
OPTION(BUILD_WITH_OSGVRPN "Create wrappers for osgVRPN (VRPN - Virtual Reality Peripherals Network)" OFF)
OPTION(BUILD_WITH_OSGVERSE "Create wrappers for osgVerse (lightweight, low latency, general-purpose network protocol for 3D data)" OFF)
IF (BUILD_WITH_OSGPPU)
FIND_PACKAGE(OSGPPU) #osgPPU
ENDIF (BUILD_WITH_OSGPPU)
OPTION(BUILD_WITH_OSGINTROSPECTION "Create wrappers for osgIntrospection (OSG's own introspection library needs to be available)" OFF)
OPTION(BUILD_WITH_OSGANIMATION "Create wrappers for osgAnimation (available from osg 2.8)" ON)
# bug on CMake 2.6 and 2.7 on Mac
IF (APPLE)
SET(OSG_INCLUDE_DIR "/${OSG_INCLUDE_DIR}")
ENDIF(APPLE)
# Make the headers visible to everything
INCLUDE_DIRECTORIES(
${OSG_INCLUDE_DIR}
${osgswig_SOURCE_DIR}/include
${OSG_GEN_INCLUDE_DIR}
)
################################################################################
# 3rd Party Dependency Stuff
################################################################################
# Create bin and lib directories if required
IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
################################################################################
# Installation stuff
SET(CMAKE_DEBUG_POSTFIX "d")
SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd")
IF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
MARK_AS_ADVANCED(LIB_POSTFIX)
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
ENDIF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(NOT DEFINED LIB_POSTFIX)
SET(LIB_POSTFIX "")
ENDIF(NOT DEFINED LIB_POSTFIX)
SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
MAKE_DIRECTORY(${OUTPUT_LIBDIR})
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
################################################################################
# User Options
# 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.")
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths.")
# Dynamic vs Static Linking
#OPTION(DYNAMIC_OSGSWIG "Set to ON to build OSGSWIG for dynamic linking. Use OFF for static." ON)
#IF (DYNAMIC_OSGSWIG)
# SET(OSGSWIG_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
#ELSE (DYNAMIC_OSGSWIG)
# SET(OSGSWIG_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
#ENDIF(DYNAMIC_OSGSWIG)
OPTION(VERBOSE_OSGSWIG "Set to ON to build OSGSWIG with verbose generating output. Use OFF for simple output." ON)
IF (VERBOSE_OSGSWIG)
SET (CMAKE_VERBOSE_MAKEFILE "ON")
ELSE (VERBOSE_OSGSWIG)
SET (CMAKE_VERBOSE_MAKEFILE "OFF")
ENDIF(VERBOSE_OSGSWIG)
INCLUDE(OsgMacroUtils)
# osg swig Core
ADD_SUBDIRECTORY(src)
# For Doxygen
#FIXME: I haven't figured out what to do with VRM's multiple doxyfiles
# and footer.
#INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# This needs to be run very last so other parts of the scripts can take
# advantage of this.
IF(NOT VRM_CONFIG_HAS_BEEN_RUN_BEFORE)
SET(VRM_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")
ENDIF(NOT VRM_CONFIG_HAS_BEEN_RUN_BEFORE)
#-----------------------------------------------------------------------------
### uninstall target
#-----------------------------------------------------------------------------
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")