-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
95 lines (75 loc) · 2.72 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
cmake_minimum_required(VERSION 3.0.0)
# Define LINUX
if (UNIX AND NOT APPLE)
set(LINUX 1)
endif()
# Setup modules path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# Project name
project(tddod)
# Some compiler flags
# set(CMAKE_CXX_STANDARD 17) # C++17
# if (MSVC)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "/MP") # Multi core in VS
# endif()
# Define _DEBUG
if (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-D_DEBUG)
endif()
#justwindowsthings
if (WIN32)
add_definitions(-DNOMINMAX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
# Project files
file(GLOB srcfiles ./src/*.*)
file(GLOB componentsfiles ./src/components/*.*)
file(GLOB systemsfiles ./src/systems/*.*)
file(GLOB helpersfiles ./src/helpers/*.*)
list(APPEND includes PUBLIC ./src/)
# list(APPEND includes PUBLIC ./src/components/)
# list(APPEND includes PUBLIC ./src/systems/)
#------------------------------------------------------------------------------
# Third parties
#------------------------------------------------------------------------------
# OpenGL
find_package(OpenGL REQUIRED)
list(APPEND includes PUBLIC ${OPENGL_INCLUDE_DIR})
list(APPEND libs ${OPENGL_LIBRARIES})
# SDL2
set(HAVE_LIBC ON)
add_subdirectory(./thirdparty/SDL-mirror/)
list(APPEND libs SDL2-static)
list(APPEND includes PUBLIC ./thirdparty/SDL-mirror/include/)
# gl3w
list(APPEND includes PUBLIC ./thirdparty/gl3w/include/)
list(APPEND srcthirdparty ./thirdparty/gl3w/src/gl3w.c)
# EnTT
list(APPEND includes PUBLIC ./thirdparty/entt/src/)
# stb
list(APPEND includes PUBLIC ./thirdparty/stb/)
#------------------------------------------------------------------------------
# Assets
#------------------------------------------------------------------------------
file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/assets/*.*")
foreach(file ${files})
message("configuring ${file}")
configure_file(${file} ${CMAKE_CURRENT_BINARY_DIR}/${file} COPYONLY)
endforeach()
#------------------------------------------------------------------------------
# Exe
#------------------------------------------------------------------------------
# tddod.exe, use WinMain on Windows
source_group("thirdparty" FILES ${srcthirdparty})
source_group("game" FILES ${srcfiles})
source_group("components" FILES ${componentsfiles})
source_group("systems" FILES ${systemsfiles})
source_group("helpers" FILES ${helpersfiles})
add_executable(tddod WIN32 ${srcfiles} ${componentsfiles} ${systemsfiles} ${helpersfiles} ${srcthirdparty})
# Work dir
set_property(TARGET tddod PROPERTY
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/")
# Lib/Headers
target_include_directories(tddod ${includes})
target_link_libraries(tddod ${libs})