-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
81 lines (67 loc) · 3.41 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
cmake_minimum_required(VERSION 3.2)
project(ROCKET_BATTLE
VERSION 1.0
DESCRIPTION "Arcade Rocket game mimic"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
message(STATUS "CMake Build Configuration for ${PROJECT_NAME} @v${PROJECT_VERSION}")
#executable
add_executable(${PROJECT_NAME} src/main.cpp
src/GameManager/GameManager.cpp
src/GameManager/GGraphics.cpp
src/GameManager/TextureManager.cpp
src/GameManager/SoundManager.cpp
src/GameManager/FileManager.cpp
src/GameManager/LevelManager.cpp
src/Entities/GameEntity.cpp
src/Entities/Rocket.cpp
src/Entities/Enemy.cpp
src/Entities/Bullet.cpp
src/Entities/EnemyManager.cpp
src/Entities/BulletManager.cpp
src/Entities/PowerUp.cpp
src/Entities/PowerUpManager.cpp
src/Entities/StatDrawer.cpp
src/Controllers/KeyBoardHandler.cpp
src/Screens/Screen.cpp
src/Screens/HomeScreen.cpp
src/Screens/MinScreen.cpp
src/Screens/PauseScreen.cpp
src/Utils/TimeSetting.cpp
src/VectorMath/Vector2d.cpp)
#add include directories
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/include)
#add linked libraries depending on os
if(WIN32)
message("Windows")
target_link_libraries(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/windows/x64/SDL2_ttf.lib
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/windows/x64/SDL2_mixer.lib
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/windows/x64/SDL2_image.lib
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/windows/x64/SDL2.lib)
file(GLOB_RECURSE DLLS ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/windows/x64/dlls/*.dll)
foreach(Dllfile ${DLLS})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
${Dllfile} ${CMAKE_CURRENT_SOURCE_DIR}/build
COMMENT "Copying ${Dllfile}")
endforeach()
endif()
if(UNIX)
message("Linux")
target_link_libraries(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/linux/libSDL2_ttf.a
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/linux/libz.a
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/linux/libSDL2_image.a
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/linux/libSDL2.a)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SDL2/lib/linux/shared/libpng16.so.16.39.0
${CMAKE_CURRENT_SOURCE_DIR}/build)
endif()
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/textures/ ${CMAKE_CURRENT_SOURCE_DIR}/build/textures
COMMENT "Copying textures")
#also move relevant dlls(based on os) to build folder for dynamic linking