-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
89 lines (72 loc) · 2.53 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
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(esbox2d CXX)
get_filename_component(PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CONFIGURATION "Debug")
else()
# Support alternative release configurations, e.g. RelWithDebInfo
set(CONFIGURATION "Release")
endif()
include_directories(
${CMAKE_SOURCE_DIR}/external/magnum/x64-windows-vs2015-static/${CONFIGURATION}/include
${CMAKE_SOURCE_DIR}/external/magnum/x64-windows-vs2015-static/${CONFIGURATION}/include/MagnumExternal/OpenGL
${CMAKE_SOURCE_DIR}/external/eigen
${CMAKE_SOURCE_DIR}/external/box2d/include
)
link_directories(
${CMAKE_SOURCE_DIR}/external/magnum/x64-windows-vs2015-static/${CONFIGURATION}/lib
${CMAKE_SOURCE_DIR}/external/box2d/x64-windows-vs2015/${CONFIGURATION}
)
set(SRC_FILES
src/main.cpp
)
set(HEADERS_FILES
)
source_group("Sources" FILES ${SRC_FILES})
source_group("Headers" FILES ${HEADERS_FILES})
message("${PROJECT_NAME}: Main project name: ${CMAKE_PROJECT_NAME}")
message("${PROJECT_NAME}: Current source dir: ${CMAKE_CURRENT_SOURCE_DIR}")
message("${PROJECT_NAME}: Current binary dir: ${CMAKE_CURRENT_BINARY_DIR}")
message("${PROJECT_NAME}: Source dir: ${CMAKE_SOURCE_DIR}")
message("${PROJECT_NAME}: Build type: ${CMAKE_BUILD_TYPE}")
message("${PROJECT_NAME}: Configuration: ${CONFIGURATION}")
# Magnum's got a lot of these
add_compile_options(
"/wd4251"
"/wd4267"
)
add_executable(${PROJECT_NAME}
${SRC_FILES} ${HEADERS_FILES}
)
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "esbox2d"
VERSION "0.1"
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${PROJECT_NAME} PRIVATE)
target_compile_options(${PROJECT_NAME} PRIVATE /std:c++17 /W1 /MDd /ZI /EHsc)
else()
target_compile_definitions(${PROJECT_NAME} PRIVATE -DNDEBUG)
target_compile_options(${PROJECT_NAME} PRIVATE /std:c++17 /W1 /EHsc /Od /MD)
endif()
# Magnum suffixes libraries for debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(MAGNUM_LIB_SUFFIX "-d")
else()
set(MAGNUM_LIB_SUFFIX "")
endif()
target_link_libraries(${PROJECT_NAME}
CorradePluginManager${MAGNUM_LIB_SUFFIX}
CorradeUtility${MAGNUM_LIB_SUFFIX}
glfw3
box2d
opengl32
Magnum${MAGNUM_LIB_SUFFIX}
MagnumGL${MAGNUM_LIB_SUFFIX}
MagnumMeshTools${MAGNUM_LIB_SUFFIX}
MagnumPrimitives${MAGNUM_LIB_SUFFIX}
MagnumGlfwApplication${MAGNUM_LIB_SUFFIX}
MagnumShaders${MAGNUM_LIB_SUFFIX}
MagnumSceneGraph${MAGNUM_LIB_SUFFIX}
MagnumTrade${MAGNUM_LIB_SUFFIX}
)