-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (52 loc) · 2.07 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
cmake_minimum_required(VERSION 2.8.11)
# Name of the project
set(PROJECT_NAME QtNGL)
project(${PROJECT_NAME})
#Bring the headers into the project (local ones)
include_directories(include $ENV{HOME}/NGL/include ui)
#the file(GLOB...) allows for wildcard additions of our src dir
set(SOURCES ${PROJECT_SOURCE_DIR}/src/main.cpp
${PROJECT_SOURCE_DIR}/src/MainWindow.cpp
${PROJECT_SOURCE_DIR}/src/NGLScene.cpp
${PROJECT_SOURCE_DIR}/include/NGLScene.h
${PROJECT_SOURCE_DIR}/include/MainWindow.h
)
# use C++ 11
set(CMAKE_CXX_STANDARD 11)
# NGL also needs the OpenGL framework from Qt so add it Also as this demo uses
# a UI these modules need to be imported before we can use the qt5_wrap_ui module.
find_package(Qt5OpenGL)
find_package(Qt5Widgets)
find_package(Qt5Gui)
find_package(Qt5Core)
#This demo uses a UI so we need to add this to run UIC
#set(CMAKE_AUTOUIC ON)
qt5_wrap_ui(UIS_HDRS ${PROJECT_SOURCE_DIR}/ui/MainWindow.ui)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# see what platform we are on and set platform defines
# see what platform we are on and set platform defines
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions(-DDARWIN)
find_library(MACGL OpenGL)
set ( PROJECT_LINK_LIBS -lNGL ${MACGL})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-DLINUX)
set ( PROJECT_LINK_LIBS -lNGL -lGL)
endif()
#As were using Qt we need to run moc
#disable -rdynamic
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
add_definitions(-O2 -D_FILE_OFFSET_BITS=64 -fPIC)
# now add NGL specific values
link_directories( ~/NGL/lib )
include_directories(~/NGL/include/)
# as NGL uses Qt we need to define this flag
add_definitions(-DQT5BUILD)
# add exe and link libs this must be after the other defines
add_executable(${PROJECT_NAME} ${SOURCES} ${UIS_HDRS})
target_link_libraries(${PROJECT_NAME} ${PROJECT_LINK_LIBS} Qt5::OpenGL Qt5::Core Qt5::Gui Qt5::Widgets )