forked from Tecprog-voID/voID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (32 loc) · 1.39 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
cmake_minimum_required(VERSION 3.0.2)
project(ZebraEngine LANGUAGES CXX)
# Set directory folders
set (PROJECT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
set (PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/src")
set (PROJECT_ASSETS_DIR "${PROJECT_SOURCE_DIR}/assets")
# Gets the list of files inside the src directory
file(GLOB_RECURSE SOURCES "${PROJECT_SRC_DIR}/*.cpp"
"${PROJECT_SRC_DIR}/*.c")
# Include Headers
include_directories("${PROJECT_INCLUDE_DIR}")
#### Compilation ####
# Compilation Flags
set(COMPILE_FLAGS "")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -std=c++11 -W -Wall -pedantic -std=c++11 -Wshadow -O2 -g")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -std=c++11 -W -Wall -pedantic -std=c++11 -Wshadow -O2 -g")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
set(COMPILE_FLAGS "${COMPILE_FLAGS} /Wall")
endif()
# Cmake compilation flags redefinition
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")
#### Executable ####
add_executable(ZebraEngine ${SOURCES})
target_link_libraries(ZebraEngine
SDL2 SDL2_image SDL2_ttf SDL2_mixer)
#### Custom Commands ####
# Copy assets folder to build
add_custom_command(TARGET ZebraEngine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_ASSETS_DIR} ${CMAKE_BINARY_DIR}/assets)