forked from enginmanap/limonEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
172 lines (139 loc) · 6.03 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
cmake_minimum_required(VERSION 3.3)
project(LimonEngine)
set(PROJECT_VERSION 0.6)
add_definitions(-DGLM_ENABLE_EXPERIMENTAL)
add_definitions(-DGLM_FORCE_SILENT_WARNINGS)
add_definitions(-DASSIMP_VALIDATE_WORKAROUND)
add_definitions(-DCEREAL_SUPPORT)
#set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(cotire)
IF (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -mconsole -Wall -Wextra -Wnon-virtual-dtor -pedantic")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wnon-virtual-dtor -pedantic")
ENDIF()
include(libs/CmakeLists.txt)
include_directories(${CMAKE_SOURCE_DIR}/src)
file(GLOB_RECURSE SOURCE_FILES
src/*.cpp)
add_executable(LimonEngine ${SOURCE_FILES})
INCLUDE(FindPkgConfig)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED SDL2_image>=2.0.0)
include_directories(${SDL2_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIR})
if (NOT SDL2_IMAGE_FOUND)
message(ERROR " SDL2_Image not found!")
endif (NOT SDL2_IMAGE_FOUND)
if(WINDOWS)
find_package(FREETYPE REQUIRED)
else()
find_package(Freetype REQUIRED)
endif()
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS})
if (NOT FREETYPE_FOUND)
message(ERROR " FREETYPE not found!")
endif (NOT FREETYPE_FOUND)
find_package(TinyXML2 REQUIRED)
if (NOT TinyXML2_FOUND)
message(ERROR " TinyXML2 not found!")
endif (NOT TinyXML2_FOUND)
INCLUDE_DIRECTORIES(${TinyXML2_INCLUDE_DIRS})
find_package(GLEW REQUIRED)
INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIRS})
find_package(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OpenGL_INCLUDE_DIRS})
if (NOT OPENGL_FOUND)
message(ERROR " OPENGL not found!")
endif (NOT OPENGL_FOUND)
find_package(Bullet REQUIRED)
INCLUDE_DIRECTORIES(SYSTEM ${BULLET_INCLUDE_DIRS})
if (NOT BULLET_FOUND)
message(ERROR " Bullet not found!")
endif (NOT BULLET_FOUND)
find_package(glm REQUIRED)
if (NOT glm_FOUND)
message(ERROR " GLM not found!")
endif (NOT glm_FOUND)
INCLUDE_DIRECTORIES(SYSTEM ${GLM_INCLUDE_DIRS})
find_package(assimp REQUIRED)
if (NOT assimp_FOUND)
message(ERROR " Assimp not found!")
endif (NOT assimp_FOUND)
INCLUDE_DIRECTORIES(${ASSIMP_INCLUDE_DIRS})
add_custom_target(copyData
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Engine ${CMAKE_BINARY_DIR}/Engine)
add_dependencies(LimonEngine copyData)
TARGET_LINK_LIBRARIES(LimonEngine ImGui ImGuizmo OpenAL ${TinyXML2_LIBRARIES} ${BULLET_LIBRARIES} ${SDL2_LIBRARY} ${FREETYPE_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${ASSIMP_LIBRARIES})
IF (WIN32)
#add icon to windows binary
SET( LimonEngine_LINKFLAGS ${CMAKE_CURRENT_SOURCE_DIR}/resources/limonEngine.res )
SET_TARGET_PROPERTIES(LimonEngine PROPERTIES LINK_FLAGS ${LimonEngine_LINKFLAGS} )
ENDIF()
add_library(LimonAPI STATIC
src/API/TriggerInterface.cpp
src/API/PlayerExtensionInterface.cpp
src/API/ActorInterface.cpp
src/API/LimonAPI.cpp
src/API/InputStates.cpp
src/API/LimonConverter.h
)
file(GLOB API_HEADERS
"src/API/*.h"
)
set_property(TARGET LimonAPI PROPERTY POSITION_INDEPENDENT_CODE ON)
IF (WIN32 AND NOT ( MINGW OR MSYS))
add_custom_command(TARGET LimonAPI POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/LimonAPI/
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/LimonAPI/include/limonAPI/
COMMAND ${CMAKE_COMMAND} -E copy ${API_HEADERS} ${CMAKE_BINARY_DIR}/LimonAPI/include/limonAPI/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/API/CMakeLists.txt ${CMAKE_BINARY_DIR}/LimonAPI/
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/LimonAPI/lib
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/libLimonAPI.lib ${CMAKE_BINARY_DIR}/LimonAPI/lib
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/LimonAPI/src
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "LimonAPI.zip" --format=zip -- ${CMAKE_BINARY_DIR}/LimonAPI
COMMAND echo "Building api project done"
)
else()
add_custom_command(TARGET LimonAPI POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/LimonAPI/
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/LimonAPI/include/limonAPI/
COMMAND ${CMAKE_COMMAND} -E copy ${API_HEADERS} ${CMAKE_BINARY_DIR}/LimonAPI/include/limonAPI/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/API/CMakeLists.txt ${CMAKE_BINARY_DIR}/LimonAPI/
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/LimonAPI/lib
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/libLimonAPI.a ${CMAKE_BINARY_DIR}/LimonAPI/lib
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/LimonAPI/src
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "LimonAPI.zip" --format=zip -- ${CMAKE_BINARY_DIR}/LimonAPI
COMMAND echo "Building api project done"
)
ENDIF()
add_library(customTriggers SHARED
samples/CoinPickUpOnTrigger.cpp
samples/MayanCoinPickup.cpp
samples/MayanLever.cpp
samples/DoorAnimationAction.cpp
samples/ShooterPlayerExtension.cpp
samples/HumanEnemy.cpp
samples/CowboyShooterExtension.cpp
samples/CowboyEnemyAI.cpp
samples/WesternMenuPlayerExtension.cpp
samples/WesternMenuPlayerExtension.h
samples/KillCowboyPlayer.cpp
samples/WesternStoryStartupAction.cpp
samples/WesternStoryAtGraveAction.cpp
samples/WesternStoryAtUndertakerAction.cpp
samples/WesternStoryAtSaloonAction.cpp
samples/WesternStoryAtTrainAction.cpp
samples/WesternStoryNewGameAction.cpp
)
IF (WIN32 AND NOT ( MINGW OR MSYS))
TARGET_LINK_LIBRARIES(customTriggers ${CMAKE_BINARY_DIR}/libLimonAPI.lib)
else()
TARGET_LINK_LIBRARIES(customTriggers ${CMAKE_BINARY_DIR}/libLimonAPI.a)
ENDIF()
add_dependencies(customTriggers LimonAPI)
set_target_properties(customTriggers PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(customTriggers PROPERTIES SOVERSION 1)
#cotire(LimonEngine)