forked from reworks-org/EnttPong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
164 lines (130 loc) · 5.04 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
cmake_minimum_required(VERSION 3.9)
set(CMAKE_CXX_STANDARD 14)
include(ExternalProject)
project(EnttPong)
# Install all final products of ExternalProject_ADD() at this location
set(EXTERNAL_INSTALL_PATH "${CMAKE_BINARY_DIR}/external")
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
FIND_LIBRARY(IOKIT_LIBRARY IOKit)
FIND_LIBRARY(CARBON_LIBRARY Carbon)
FIND_LIBRARY(FORCEFEEDBACK_LIBRARY ForceFeedback)
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation)
FIND_LIBRARY(ICONV_LIBRARY iconv)
FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio)
FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY AudioToolbox)
FIND_LIBRARY(COREVIDEO_LIBRARY CoreVideo)
if(APPLE)
# Download & build SDL2 dependency
ExternalProject_Add(
sdl2
URL https://libsdl.org/release/SDL2-2.0.8.zip
#install it in the build directory. no "" chars because they break SDL2's installation :(
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_PATH} -DCMAKE_OSX_ARCHITECHURES=i386;x86_64
)
set(
SDL2_LINK_DEPENDENCIES
PRIVATE dl
PRIVATE pthread
PRIVATE ${COCOA_LIBRARY}
PRIVATE ${IOKIT_LIBRARY}
PRIVATE ${CARBON_LIBRARY}
PRIVATE ${FORCEFEEDBACK_LIBRARY}
PRIVATE ${COREFOUNDATION_LIBRARY}
PRIVATE ${ICONV_LIBRARY}
PRIVATE ${COREAUDIO_LIBRARY}
PRIVATE ${AUDIOTOOLBOX_LIBRARY}
PRIVATE ${COREVIDEO_LIBRARY}
)
elseif(LINUX OR UNIX)
# Download & build SDL2 dependency
ExternalProject_Add(
sdl2
URL https://libsdl.org/release/SDL2-2.0.8.zip
#install it in the build directory. no "" chars because they break SDL2's installation :(
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_PATH}
)
set(
SDL2_LINK_DEPENDENCIES
PRIVATE dl
PRIVATE pthread
)
endif()
# Cross-platform SDL2 static library filenames & paths
set(SDL2_STATIC_FILENAME "${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(SDL2_STATIC_LIBRARY_PATH "${EXTERNAL_INSTALL_PATH}/lib/${SDL2_STATIC_FILENAME}")
# Executable's name & sources
set(ENTTPONG_EXE "enttpong")
set(
ENTTPONG_SOURCES
EnttPong/src/main.cpp
EnttPong/src/core/BasicLog.hpp
EnttPong/src/core/Game.cpp
EnttPong/src/core/Game.hpp
EnttPong/src/tags/PlayerTag.cpp
EnttPong/src/tags/PlayerTag.hpp
EnttPong/src/tags/BallTag.cpp
EnttPong/src/tags/BallTag.hpp
EnttPong/src/tags/AITag.cpp
EnttPong/src/tags/AITag.hpp
EnttPong/src/graphics/Window.cpp
EnttPong/src/graphics/Window.hpp
EnttPong/src/systems/MoveSystem.cpp
EnttPong/src/systems/MoveSystem.hpp
EnttPong/src/systems/RenderSystem.cpp
EnttPong/src/systems/RenderSystem.hpp
EnttPong/src/systems/CollisionSystem.hpp
EnttPong/src/systems/CollisionSystem.cpp
EnttPong/src/systems/AISystem.hpp
EnttPong/src/systems/AISystem.cpp
EnttPong/src/components/PositionComponent.cpp
EnttPong/src/components/PositionComponent.hpp
EnttPong/src/components/SpriteComponent.cpp
EnttPong/src/components/SpriteComponent.hpp
EnttPong/src/utils/RandomVelocity.hpp
# SDL2_gfx dependency (sources directly integrated to the project)
EnttPong/src/libs/SDL2_gfx/SDL2_gfxPrimitives.c
EnttPong/src/libs/SDL2_gfx/SDL2_gfxPrimitives.h
EnttPong/src/libs/SDL2_gfx/SDL2_gfxPrimitives_font.h
EnttPong/src/libs/SDL2_gfx/SDL2_rotozoom.c
EnttPong/src/libs/SDL2_gfx/SDL2_rotozoom.h
#entt dependency
EnttPong/src/libs/entt/core/family.hpp
EnttPong/src/libs/entt/core/hashed_string.hpp
EnttPong/src/libs/entt/core/ident.hpp
EnttPong/src/libs/entt/entity/actor.hpp
EnttPong/src/libs/entt/entity/entt_traits.hpp
EnttPong/src/libs/entt/entity/registry.hpp
EnttPong/src/libs/entt/entity/sparse_set.hpp
EnttPong/src/libs/entt/entity/view.hpp
EnttPong/src/libs/entt/locator/locator.hpp
EnttPong/src/libs/entt/process/process.hpp
EnttPong/src/libs/entt/process/scheduler.hpp
EnttPong/src/libs/entt/resource/cache.hpp
EnttPong/src/libs/entt/resource/handle.hpp
EnttPong/src/libs/entt/resource/loader.hpp
EnttPong/src/libs/entt/signal/bus.hpp
EnttPong/src/libs/entt/signal/delegate.hpp
EnttPong/src/libs/entt/signal/dispatcher.hpp
EnttPong/src/libs/entt/signal/emitter.hpp
EnttPong/src/libs/entt/signal/sigh.hpp
EnttPong/src/libs/entt/signal/signal.hpp
EnttPong/src/libs/entt/entt.hpp
)
add_executable(
"${ENTTPONG_EXE}"
"${ENTTPONG_SOURCES}"
)
# Make sure project's dependencies have been cloned/built before building enttpong
add_dependencies(
"${ENTTPONG_EXE}"
sdl2
)
target_include_directories(
"${ENTTPONG_EXE}"
PRIVATE "${EXTERNAL_INSTALL_PATH}/include"
)
target_link_libraries(
"${ENTTPONG_EXE}"
${SDL2_LINK_DEPENDENCIES}
PRIVATE ${SDL2_STATIC_LIBRARY_PATH}
)