1
+ cmake_minimum_required (VERSION 3.8)
2
+
3
+ project (NH3API VERSION 1.0.0)
4
+
5
+ option (NH3API_TARGET_WINDOWS_XP "Target Windows XP. This flag lowers down the Win32 SDK level." ON )
6
+ option (NH3API_NO_CPP_EXCEPTIONS "Disable C++ exceptions globally." OFF )
7
+ option (NH3API_LIB_NO_CPP_EXCEPTIONS "Disable C++ exceptions for NH3API" OFF )
8
+ option (NH3API_INSTALLTARGET "Generate install target" ON )
9
+ include (CMakeDependentOption)
10
+ cmake_dependent_option(NH3API_CMAKE_NOTHROW_NEW "NH3APIs operators new will not throw" ON "NH3API_CMAKE_NO_CPP_EXCEPTIONS" OFF )
11
+ option (NH3API_CMAKE_INLINE_HEADERS "Inline mode. See nh3api_std.hpp for details. Requires C++17" OFF )
12
+
13
+ function (nh3api_add_files)
14
+ set (base_path BASE_PATH OUT)
15
+ set (files FILES )
16
+ cmake_parse_arguments (PARSE_ARGV 0 arg "" "${base_path} " "${files} " )
17
+
18
+ if (NOT arg_BASE_PATH)
19
+ message (FATAL_ERROR "You must provide a BASE_PATH parameter" )
20
+ endif ()
21
+
22
+ if (NOT arg_OUT)
23
+ message (FATAL_ERROR "You must provide a OUT parameter" )
24
+ endif ()
25
+
26
+ if (NOT arg_FILES)
27
+ message (FATAL_ERROR "You must provide a FILES parameter" )
28
+ endif ()
29
+
30
+ set (local_FILES ${${arg_OUT} })
31
+ foreach (header ${arg_FILES} )
32
+ list (APPEND local_FILES "${arg_BASE_PATH} /${header} " )
33
+ endforeach ()
34
+
35
+ set (${arg_OUT} ${local_FILES} PARENT_SCOPE)
36
+ endfunction ()
37
+
38
+ function (add_core_headers VAR)
39
+
40
+ endfunction ()
41
+
42
+ add_library (nh3api STATIC )
43
+ add_library (nh3api::nh3api ALIAS nh3api)
44
+ add_library (nh3api-header-only INTERFACE )
45
+ add_library (nh3api::nh3api-header-only ALIAS nh3api-header-only)
46
+
47
+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
48
+ endif ()
49
+
50
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
51
+ endif ()
52
+
53
+ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
54
+ if (MSVC_TOOLSET_VERSION GREATER 140)
55
+ target_compile_options (nh3api PUBLIC /Zc:threadSafeInit-)
56
+ endif ()
57
+ if (MSVC_TOOLSET_VERSION GREATER 141)
58
+ target_compile_options (nh3api PUBLIC /Zc:__cplusplus)
59
+ endif ()
60
+ target_compile_definitions (nh3api PUBLIC _X86_)
61
+ endif ()
62
+
63
+
64
+ nh3api_add_files(
65
+ BASE_PATH
66
+ nh3api/core
67
+ OUT
68
+ NH3API_SOURCES
69
+ FILES
70
+ adventure.cpp
71
+ artifact.cpp
72
+ base_manager.cpp
73
+ combat.cpp
74
+ events.cpp
75
+ global .cpp
76
+ hero.cpp
77
+ map.cpp
78
+ pathfinding.cpp
79
+ player.cpp
80
+ skills.cpp
81
+ terrain.cpp
82
+ town.cpp
83
+ )
84
+
85
+ nh3api_add_files(
86
+ BASE_PATH
87
+ nh3api
88
+ OUT
89
+ NH3API_SOURCES
90
+ FILES
91
+ turn.cpp
92
+ )
93
+
94
+ nh3api_add_files(
95
+ BASE_PATH
96
+ nh3api/core
97
+ OUT
98
+ NH3API_HEADERS
99
+ FILES
100
+ adventure.hpp
101
+ adventure_AI.hpp
102
+ army.hpp
103
+ artifact.hpp
104
+ base_manager.hpp
105
+ campaign.hpp
106
+ CAutoArray.hpp
107
+ combat.hpp
108
+ creatures.hpp
109
+ events.hpp
110
+ game_setup.hpp
111
+ global .hpp
112
+ hero.hpp
113
+ hero_enums.hpp
114
+ hexcell.hpp
115
+ input_manager.hpp
116
+ lossvictory.hpp
117
+ map.hpp
118
+ map_header.hpp
119
+ multiplayer.hpp
120
+ objects.hpp
121
+ pathfinding.hpp
122
+ player.hpp
123
+ player_enums.hpp
124
+ quests.hpp
125
+ random.hpp
126
+ saved_game.hpp
127
+ skills.hpp
128
+ spells.hpp
129
+ terrain.hpp
130
+ town.hpp
131
+ utils.hpp
132
+ vftables.hpp
133
+ )
134
+
135
+ nh3api_add_files(
136
+ BASE_PATH
137
+ nh3api
138
+ OUT
139
+ NH3API_HEADERS
140
+ FILES
141
+ cdplay.hpp
142
+ cheats.hpp
143
+ core.hpp
144
+ hd_mod.hpp
145
+ legacy.hpp
146
+ turn.hpp
147
+ )
148
+
149
+ target_sources (nh3api PRIVATE ${NH3API_SOURCES} )
0 commit comments