-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
83 lines (69 loc) · 2.13 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
# Specify the minimum CMAKE version required
cmake_minimum_required(VERSION 2.8)
# Your project's name
project(Zombie-Shooter)
# Add all files from the source/ folder to CMake
file(GLOB_RECURSE SRC
"src/*.cpp"
"src/*.h"
"src/*.hpp"
)
file(GLOB_RECURSE SRC_GAMEOBJECT
"src/gameobject/*.cpp"
"src/gameobject/*.h"
"src/gameobject/*.hpp"
)
file(GLOB_RECURSE SRC_RESOURCE
"src/resource/*.cpp"
"src/resource/*.h"
"src/resouce/*.hpp"
)
file(GLOB_RECURSE SRC_STATE
"src/state/*.cpp"
"src/state/*.h"
"src/state/*.hpp"
)
file(GLOB_RECURSE SRC_SYSTEMS
"src/systems/*.cpp"
"src/systems/*.h"
"src/systems/*.hpp"
)
file(GLOB_RECURSE SRC_UTIL
"src/util/*.cpp"
"src/util/*.h"
"src/util/*.hpp"
)
# Define the executable
add_executable(${PROJECT_NAME} ${SRC} ${SRC_GAMEOBJECT} ${SRC_RESOURCE} ${SRC_STATE} ${SRC_SYSTEMS} ${SRC_UTIL})
#Define the filters
source_group("gameobject" FILES ${SRC_GAMEOBJECT})
source_group("resources" FILES ${SRC_RESOURCE})
source_group("state" FILES ${SRC_STATE})
source_group("system" FILES ${SRC_SYSTEMS})
source_group("util" FILES ${SRC_UTIL})
# Copy res folder to executable on build
add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/res $<TARGET_FILE_DIR:${PROJECT_NAME}>/res)
# JSON library
include_directories(deps/json)
# SFML
add_definitions(-DSFML_STATIC)
set(SFML_BUILD_DOC OFF CACHE BOOL "" FORCE)
set(SFML_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(CMAKE_BUILD_TYPE Debug)
add_subdirectory(deps/SFML)
include_directories(deps/SFML/include)
target_link_libraries(${PROJECT_NAME} sfml-network sfml-graphics sfml-window sfml-system sfml-audio)
# GCC Arguments
if(CMAKE_COMPILER_IS_GNUXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-pmf-conversions")
elseif(CMAKE_COMPILER_IS_MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-pmf-conversions")
endif(CMAKE_COMPILER_IS_GNUXX)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)