1
1
set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
2
2
set_property (GLOBAL PROPERTY USE_FOLDERS ON )
3
3
4
- IF (WIN32 )
5
- CMAKE_MINIMUM_REQUIRED (VERSION 2.4.6 FATAL_ERROR )
6
- ELSE (WIN32 )
7
- IF (APPLE )
8
- CMAKE_MINIMUM_REQUIRED (VERSION 2.6.0 FATAL_ERROR )
9
- ELSE (APPLE )
10
- CMAKE_MINIMUM_REQUIRED (VERSION 2.4.4 FATAL_ERROR )
11
- ENDIF (APPLE )
12
- ENDIF (WIN32 )
13
-
14
- if (COMMAND cmake_policy )
15
- # Works around warnings libraries linked against that don't
16
- # have absolute paths (e.g. -lpthreads)
17
- cmake_policy (SET CMP0003 NEW )
18
-
19
- # Works around warnings about escaped quotes in ADD_DEFINITIONS
20
- # statements.
21
- cmake_policy (SET CMP0005 NEW )
22
-
23
- # tell CMake to prefer CMake's own CMake modules when available
24
- # only available from cmake-2.8.4
25
- if (${CMAKE_MAJOR_VERSION} GREATER 2 OR
26
- (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8 ) OR
27
- (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3 ))
28
- cmake_policy (SET CMP0017 NEW )
29
- endif ()
30
-
31
- # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
32
- # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
33
- if (${CMAKE_MAJOR_VERSION} GREATER 2 OR
34
- (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 6 ) OR
35
- (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6 AND ${CMAKE_PATCH_VERSION} GREATER 0 ))
36
- cmake_policy (SET CMP0008 OLD )
37
- endif ()
38
4
39
- # disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1)
40
- if (${CMAKE_MAJOR_VERSION} GREATER 2 OR
41
- (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8 ) OR
42
- (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 10 ))
43
- cmake_policy (SET CMP0020 OLD )
44
- endif ()
45
- # nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
46
- #if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
47
- # or even easier (available in cmake-2.6)
48
- #if(POLICY CMPxyzw)
49
-
50
- endif ()
5
+ CMAKE_MINIMUM_REQUIRED (VERSION 3.0.0 FATAL_ERROR )
51
6
52
7
IF (APPLE )
53
8
# Get OSX version in MAJOR.MINOR format
@@ -92,6 +47,12 @@ IF(APPLE)
92
47
SET (CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT} " CACHE STRING "System root for iOS" FORCE )
93
48
94
49
ELSE ()
50
+ foreach (APPLE_SDK_VERSION 10 11 12 13 14 15 )
51
+ if (IS_DIRECTORY "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.${APPLE_SDK_VERSION} .sdk" )
52
+ set (CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.${APPLE_SDK_VERSION} .sdk" )
53
+ endif ()
54
+ endforeach (APPLE_SDK_VERSION )
55
+
95
56
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
96
57
IF (OSG_OSX_VERSION VERSION_LESS 10.5 )
97
58
SET (OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11." )
@@ -103,7 +64,11 @@ IF(APPLE)
103
64
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
104
65
# These are set the first time CMake is run, and can be changed by
105
66
# the user at any time.
106
- IF (OSG_OSX_VERSION VERSION_GREATER 10.7 )
67
+ IF (OSG_OSX_VERSION VERSION_GREATER 10.8 )
68
+ # 64 Bit Works, i386,ppc is not supported any more
69
+ SET (CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" )
70
+ SET (CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "Target OSX version" )
71
+ ELSEIF (OSG_OSX_VERSION VERSION_GREATER 10.7 )
107
72
# 64 Bit Works, i386,ppc is not supported any more
108
73
SET (CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" )
109
74
SET (CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "Target OSX version" )
@@ -127,7 +92,7 @@ ENDIF()
127
92
128
93
PROJECT (osgQt )
129
94
130
- FIND_PACKAGE (OpenSceneGraph 3.0 .0 REQUIRED osgDB osgGA osgUtil osgText osgViewer osgWidget )
95
+ FIND_PACKAGE (OpenSceneGraph 3.6 .0 REQUIRED osgDB osgGA osgUtil osgText osgViewer osgWidget )
131
96
SET (OPENSCENEGRAPH_SOVERSION 145 )
132
97
133
98
SET (OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION} )
@@ -150,7 +115,7 @@ SET(OpenSceneGraph_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
150
115
151
116
# We have some custom .cmake scripts not in the official distribution.
152
117
# Maybe this can be used override existing behavior if needed?
153
- SET (CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR } /CMakeModules;${CMAKE_MODULE_PATH} " )
118
+ SET (CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR } /CMakeModules;${CMAKE_MODULE_PATH} " )
154
119
155
120
# Change the default build type to Release
156
121
IF (NOT CMAKE_BUILD_TYPE )
@@ -292,6 +257,7 @@ IF(APPLE)
292
257
ENDIF ()
293
258
294
259
FIND_PACKAGE (OpenGL )
260
+ add_definitions (-DGL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED )
295
261
ENDIF ()
296
262
297
263
OPTION (OSG_COMPILE_FRAMEWORKS "compile frameworks instead of dylibs (experimental)" OFF )
@@ -304,7 +270,8 @@ ENDIF()
304
270
305
271
INCLUDE_DIRECTORIES (
306
272
${OPENSCENEGRAPH_INCLUDE_DIRS}
307
- ${OpenSceneGraph_SOURCE_DIR} /include
273
+ ${CMAKE_CURRENT_LIST_DIR} /include
274
+ ${CMAKE_CURRENT_BINARY_DIR} /src
308
275
${OPENGL_INCLUDE_DIR}
309
276
)
310
277
@@ -440,7 +407,7 @@ ENDIF(WIN32 AND NOT ANDROID)
440
407
441
408
442
409
# OSG Examples
443
- OPTION (BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF )
410
+ OPTION (BUILD_OSG_EXAMPLES "Enable to build OSG Examples" ON )
444
411
445
412
#
446
413
# If you want to prevent CMake from picking up on any of the following optional 3rd Party dependencies in CMake 2.8 onwards
@@ -456,47 +423,7 @@ INCLUDE(OsgMacroUtils)
456
423
# via cmake -DDESIRED_QT_VERSION=5
457
424
# QUIET option disables messages if the package cannot be found.
458
425
459
- IF (DESIRED_QT_VERSION )
460
- IF (DESIRED_QT_VERSION MATCHES 5 )
461
- FIND_PACKAGE (Qt5 COMPONENTS Widgets REQUIRED )
462
- ELSEIF (DESIRED_QT_VERSION MATCHES 4 )
463
- FIND_PACKAGE (Qt4 REQUIRED )
464
- ENDIF ()
465
-
466
- ELSE ()
467
-
468
- FIND_PACKAGE (Qt5 COMPONENTS Widgets REQUIRED )
469
-
470
- IF ( Qt5Widgets_FOUND )
471
- # CMake 2.8.8 or greater required
472
- BUILDER_VERSION_GREATER (2 8 7 )
473
- IF (NOT VALID_BUILDER_VERSION )
474
- MESSAGE (
475
- SEND_ERROR
476
- "Qt5 requires CMake version 2.8.8 or greater!\n "
477
- "Update CMake or set DESIRED_QT_VERSION to less than 5
478
- or disable OSG_USE_QT."
479
- )
480
- ENDIF ( )
481
- ENDIF ( )
482
-
483
- IF ( NOT Qt5Widgets_FOUND )
484
- FIND_PACKAGE (Qt4 REQUIRED )
485
- ENDIF ()
486
- ENDIF ()
487
-
488
- #If we have found Qt5, let's try to top off by getting the webkit as well
489
- IF ( Qt5Widgets_FOUND )
490
- FIND_PACKAGE (Qt5OpenGL REQUIRED )
491
- FIND_PACKAGE (Qt5WebKitWidgets QUIET )
492
-
493
- IF (COMMAND cmake_policy )
494
- IF (${CMAKE_MAJOR_VERSION} GREATER 2 )
495
- # Qt5 qt5_use_modules usage was causing "Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties." warnings
496
- cmake_policy (SET CMP0043 NEW )
497
- ENDIF ()
498
- ENDIF ()
499
- ENDIF ()
426
+ FIND_PACKAGE (Qt5 COMPONENTS Widgets OpenGL REQUIRED )
500
427
501
428
502
429
################################################################################
@@ -927,11 +854,7 @@ IF(CMAKE_CPACK_COMMAND)
927
854
ENDIF ()
928
855
929
856
# Generate pkg-config configuration files
930
- IF ( Qt5Widgets_FOUND )
931
- SET ( PKGCONFIG_MODULE_NAME osgQt5 )
932
- ELSE ()
933
857
SET ( PKGCONFIG_MODULE_NAME osgQt )
934
- ENDIF ()
935
858
936
859
CONFIGURE_FILE (${PROJECT_SOURCE_DIR} /packaging/pkgconfig/openscenegraph-osgQt.pc.in
937
860
${PROJECT_BINARY_DIR} /packaging/pkgconfig/openscenegraph-${PKGCONFIG_MODULE_NAME}.pc
0 commit comments