forked from ducttape/ducttape-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
137 lines (114 loc) · 4.88 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
project(ducttape-engine)
cmake_minimum_required(VERSION 2.8.3)
set(VERSION_MAJOR 0)
set(VERSION_MINOR 2)
set(VERSION_PATCH 0)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(BUILD_STATIC FALSE CACHE BOOL "TRUE to build static libraries (mind LGPL3 implications), FALSE to build shared libraries (preferred)")
set(BUILD_SAMPLES TRUE CACHE BOOL "TRUE to build the samples, FALSE to ignore them")
set(BUILD_TESTS TRUE CACHE BOOL "TRUE to build the tests, FALSE to ignore them")
set(BUILD_DOC TRUE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
if(BUILD_STATIC)
add_definitions(-DDUCTTAPE_STATIC)
endif()
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
else()
set(Boost_USE_STATIC_LIBS OFF)
endif()
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BULLET_ROOT "" CACHE PATH "Path to Bullet dir")
set(BOOST_ROOT "" CACHE PATH "Path to Boost dir")
set(OGRE_HOME "" CACHE PATH "Path to OGRE dir")
set(SFMLDIR "" CACHE PATH "Path to SFML dir")
set(ENV{QTDIR} "" CACHE PATH "Path to Qt4")
set(MYGUI_ROOT "" CACHE PATH "Path to MYGUI dir")
set(OgreProcedural_HOME "" CACHE PATH "Path to Ogre Procedural dir")
set(YAMLCPP_DIR "" CACHE PATH "Path to yaml-cpp dir")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake-extras/")
if(EXISTS "${PROJECT_SOURCE_DIR}/dependencies")
set(BULLET_ROOT "${PROJECT_SOURCE_DIR}/dependencies/bullet")
set(BOOST_ROOT "${PROJECT_SOURCE_DIR}/dependencies/boost")
set(OGRE_HOME "${PROJECT_SOURCE_DIR}/dependencies/ogre")
set(SFMLDIR "${PROJECT_SOURCE_DIR}/dependencies/sfml")
set(ENV{QTDIR} "${PROJECT_SOURCE_DIR}/dependencies/qt4")
file(WRITE "${PROJECT_SOURCE_DIR}/dependencies/qt4/bin/qt.conf" "[Paths]\nPrefix = ${PROJECT_SOURCE_DIR}/dependencies/qt4")
set(MYGUI_ROOT "${PROJECT_SOURCE_DIR}/dependencies/mygui")
set(OgreProcedural_HOME "${PROJECT_SOURCE_DIR}/dependencies/ogre-procedural")
set(YAMLCPP_DIR "${PROJECT_SOURCE_DIR}/dependencies/yaml-cpp")
file(GLOB_RECURSE DLLS_LIST ${PROJECT_SOURCE_DIR}/dependencies/*.dll)
file(MAKE_DIRECTORY "${EXECUTABLE_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}")
file(COPY ${DLLS_LIST} DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug")
file(COPY ${DLLS_LIST} DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release")
endif()
find_package(SFML 2 COMPONENTS audio graphics network system window REQUIRED)
find_package(Bullet REQUIRED)
find_package(Boost COMPONENTS date_time program_options thread REQUIRED)
find_package(OIS REQUIRED)
find_package(OGRE REQUIRED)
find_package(MyGUI REQUIRED)
find_package(MyGUI_PLATFORM REQUIRED)
find_package(YamlCpp REQUIRED)
# Qt4 stuff
set(QT_USE_QTSCRIPT TRUE)
set(QT_DONT_USE_QTGUI TRUE)
set(QT_USE_QTXML TRUE)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITONS})
if(MSVC) # Sort the odd stuff out
set(CMAKE_CXX_FLAGS "/DCOMPILER_MSVC /DOgreProcedural_STATIC /WX /MP /EHsc")
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG") # Odd duplicate symbols with /GL
set(CMAKE_CXX_FLAGS_DEBUG "/Zi")
else() # GCC/Mingw
set(CMAKE_CXX_FLAGS "-DCOMPILER_GCC -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-parameter -pedantic -std=c++0x -fvisibility=hidden -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -flto -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
endif()
include_directories(SYSTEM
${PROJECT_SOURCE_DIR}/engine/src/
${Boost_INCLUDE_DIRS}
${SFML_INCLUDE_DIR}
${OGRE_INCLUDE_DIRS}
${OGRE_Paging_INCLUDE_DIRS}
${OGRE_Terrain_INCLUDE_DIRS}
${MYGUI_INCLUDE_DIR}
${MYGUI_PLATFORM_INCLUDE_DIR}
${BULLET_INCLUDE_DIRS}
${OIS_INCLUDE_DIRS}
${YAMLCPP_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/externals/btogre/include
${PROJECT_SOURCE_DIR}/externals/ogre-procedural/library/include
${PROJECT_SOURCE_DIR}/externals/ogre-paged/library/include
)
add_subdirectory(${PROJECT_SOURCE_DIR}/externals)
add_subdirectory("${PROJECT_SOURCE_DIR}/engine/")
if(BUILD_EDITOR)
add_subdirectory("${PROJECT_SOURCE_DIR}/editor/")
endif()
if(BUILD_SAMPLES)
add_subdirectory("${PROJECT_SOURCE_DIR}/samples/")
endif()
if(BUILD_TESTS)
#include(CTest)
enable_testing()
add_subdirectory("${PROJECT_SOURCE_DIR}/tests/")
endif()
if(BUILD_DOC)
add_subdirectory("${PROJECT_SOURCE_DIR}/docs/")
endif()
# Installation stuff.
install(DIRECTORY "${PROJECT_SOURCE_DIR}/engine/src/"
DESTINATION include/ducttape
FILES_MATCHING PATTERN "*.hpp")
install(FILES "${PROJECT_SOURCE_DIR}/cmake-extras/FindDucttape.cmake"
DESTINATION ${CMAKE_ROOT}/Modules)
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE"
DESTINATION share/ducttape)