-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
88 lines (76 loc) · 2.59 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
cmake_minimum_required(VERSION 3.22)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(WARNING [[In-source build detected, please eg. create a new directory and use `cmake ..`]])
endif()
set(BIN_TARGET diablo-mapgen)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/parallel_mapgen.sh ${CMAKE_CURRENT_BINARY_DIR}/parallel_mapgen.sh COPYONLY)
project(DiabloMapGen
VERSION "0.1.0"
LANGUAGES C CXX)
set(PROJECT_VERSION_WITH_SUFFIX "${VERSION_PREFIX}${VERSION_SUFFIX}")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions -funroll-loops -march=native -fsigned-char")
if(CMAKE_BUILD_TYPE MATCHES "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox /GL")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
endif()
set(CMAKE_CXX_STANDARD 20)
add_executable(${BIN_TARGET}
Source/drlg_l1.cpp
Source/drlg_l2.cpp
Source/drlg_l3.cpp
Source/drlg_l4.cpp
Source/engine.cpp
Source/analyzer/gameseed.cpp
Source/analyzer/path.cpp
Source/analyzer/pattern.cpp
Source/analyzer/puzzler.cpp
Source/analyzer/quest.cpp
Source/analyzer/scannerName.cpp
Source/analyzer/stairs.cpp
Source/analyzer/warp.cpp
Source/funkMapGen.cpp
Source/gendung.cpp
Source/itemdat.cpp
Source/items.cpp
Source/level.cpp
Source/lighting.cpp
Source/mapGen/configuration.cpp
Source/monstdat.cpp
Source/monster.cpp
Source/objdat.cpp
Source/objects.cpp
Source/path.cpp
Source/quests.cpp
Source/spelldat.cpp
#Source/stores.cpp
Source/themes.cpp
Source/trigs.cpp
)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND CMAKE_BUILD_TYPE MATCHES "Debug")
target_link_libraries(${BIN_TARGET} PUBLIC "-fsanitize=undefined")
endif()
if(CMAKE_STRIP)
add_custom_command(
TARGET ${BIN_TARGET} POST_BUILD
DEPENDS ${BIN_TARGET}
COMMAND $<$<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>>:${CMAKE_STRIP}>
ARGS $<TARGET_FILE:${BIN_TARGET}>)
endif()
add_executable (seed_table "tools/seed_table.cpp")
target_compile_features(seed_table PUBLIC cxx_std_20)
add_executable (sort_candidates "tools/sort_candidates.cpp")
target_compile_features(sort_candidates PUBLIC cxx_std_20)