Skip to content

Commit 8c6db61

Browse files
authored
Merge pull request #22 from openscenegraph/feature/osgQOpenGL
Feature/osgQOpenGL
2 parents 6d324db + 4080078 commit 8c6db61

34 files changed

+25943
-2868
lines changed

CMakeLists.txt

Lines changed: 19 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,8 @@
11
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
22
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
33

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()
384

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)
516

527
IF(APPLE)
538
# Get OSX version in MAJOR.MINOR format
@@ -92,6 +47,12 @@ IF(APPLE)
9247
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
9348

9449
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+
9556
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
9657
IF(OSG_OSX_VERSION VERSION_LESS 10.5)
9758
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)
10364
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
10465
# These are set the first time CMake is run, and can be changed by
10566
# 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)
10772
# 64 Bit Works, i386,ppc is not supported any more
10873
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
10974
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "Target OSX version")
@@ -127,7 +92,7 @@ ENDIF()
12792

12893
PROJECT(osgQt)
12994

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)
13196
SET(OPENSCENEGRAPH_SOVERSION 145)
13297

13398
SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})
@@ -150,7 +115,7 @@ SET(OpenSceneGraph_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
150115

151116
# We have some custom .cmake scripts not in the official distribution.
152117
# 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}")
154119

155120
# Change the default build type to Release
156121
IF(NOT CMAKE_BUILD_TYPE)
@@ -292,6 +257,7 @@ IF(APPLE)
292257
ENDIF()
293258

294259
FIND_PACKAGE(OpenGL)
260+
add_definitions(-DGL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED)
295261
ENDIF ()
296262

297263
OPTION(OSG_COMPILE_FRAMEWORKS "compile frameworks instead of dylibs (experimental)" OFF)
@@ -304,7 +270,8 @@ ENDIF()
304270

305271
INCLUDE_DIRECTORIES(
306272
${OPENSCENEGRAPH_INCLUDE_DIRS}
307-
${OpenSceneGraph_SOURCE_DIR}/include
273+
${CMAKE_CURRENT_LIST_DIR}/include
274+
${CMAKE_CURRENT_BINARY_DIR}/src
308275
${OPENGL_INCLUDE_DIR}
309276
)
310277

@@ -440,7 +407,7 @@ ENDIF(WIN32 AND NOT ANDROID)
440407

441408

442409
# OSG Examples
443-
OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
410+
OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" ON)
444411

445412
#
446413
# 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)
456423
# via cmake -DDESIRED_QT_VERSION=5
457424
# QUIET option disables messages if the package cannot be found.
458425

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)
500427

501428

502429
################################################################################
@@ -927,11 +854,7 @@ IF(CMAKE_CPACK_COMMAND)
927854
ENDIF()
928855

929856
# Generate pkg-config configuration files
930-
IF ( Qt5Widgets_FOUND )
931-
SET ( PKGCONFIG_MODULE_NAME osgQt5 )
932-
ELSE()
933857
SET ( PKGCONFIG_MODULE_NAME osgQt )
934-
ENDIF()
935858

936859
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/openscenegraph-osgQt.pc.in
937860
${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph-${PKGCONFIG_MODULE_NAME}.pc

0 commit comments

Comments
 (0)