forked from alexsylex/AnimationMotionRevolution
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
170 lines (138 loc) · 3.76 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
cmake_minimum_required(VERSION 3.20)
add_compile_definitions(SKSE_SUPPORT_XBYAK)
# ---- Cache build vars ----
set(Boost_USE_STATIC_RUNTIME OFF CACHE BOOL "")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "")
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
# ---- Project ----
project(
AnimationMotionRevolution
VERSION 1.0.0
LANGUAGES CXX
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY
)
# ---- Include guards ----
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif()
# ---- Dependencies ----
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_DEBUG_RUNTIME OFF)
if (MSVC)
add_compile_definitions(
_UNICODE
)
add_compile_options(
/MP # Build with Multiple Processes
/sdl # Enable Additional Security Checks
/utf-8 # Set Source and Executable character sets to UTF-8
/permissive- # Standards conformance
/Zc:alignedNew # C++17 over-aligned allocation
/Zc:auto # Deduce Variable Type
/Zc:char8_t
/Zc:__cplusplus # Enable updated __cplusplus macro
/Zc:externC
/Zc:externConstexpr # Enable extern constexpr variables
/Zc:forScope # Force Conformance in for Loop Scope
/Zc:hiddenFriend
/Zc:implicitNoexcept # Implicit Exception Specifiers
/Zc:lambda
/Zc:noexceptTypes # C++17 noexcept rules
/Zc:preprocessor # Enable preprocessor conformance mode
/Zc:referenceBinding # Enforce reference binding rules
/Zc:rvalueCast # Enforce type conversion rules
/Zc:sizedDealloc # Enable Global Sized Deallocation Functions
#/Zc:strictStrings # Disable string literal type conversion
/Zc:ternary # Enforce conditional operator rules
/Zc:threadSafeInit # Thread-safe Local Static Initialization
/Zc:tlsGuards
/Zc:trigraphs # Trigraphs Substitution
/Zc:wchar_t # wchar_t Is Native Type
/experimental:external
/external:anglebrackets
/external:W0
/W4 # Warning level (all warnings)
/WX # Warning level (warnings are errors)
"$<$<CONFIG:DEBUG>:/Zi>"
"$<$<CONFIG:RELEASE>:/Oi;/Gy;/Zc:inline;/JMC->"
)
endif()
add_subdirectory("../CommonLibSSE" CommonLibSSE)
find_package(spdlog REQUIRED CONFIG)
# ---- Add source files ----
set(headers
include/half.h
include/Hooks.h
include/INISettingCollection.h
include/Logger.h
include/MotionDataContainer.h
include/pch.h
include/Setting.h
)
set(sources
source/main.cpp
source/Hooks.cpp
source/INISettingCollection.cpp
source/pch.cpp
)
source_group(
TREE
${CMAKE_CURRENT_SOURCE_DIR}
FILES
${headers}
${sources}
)
# ---- Create DLL ----
add_library(
${PROJECT_NAME}
SHARED
${headers}
${sources}
${CMAKE_CURRENT_BINARY_DIR}/version.rc
.clang-format
)
target_compile_features(
${PROJECT_NAME}
PRIVATE
cxx_std_20
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(
${PROJECT_NAME}
PRIVATE
CommonLibSSE::CommonLibSSE
spdlog::spdlog
)
if (MSVC)
target_link_options(
${PROJECT_NAME}
PRIVATE
"$<$<CONFIG:DEBUG>:/INCREMENTAL;/OPT:NOREF;/OPT:NOICF>"
"$<$<CONFIG:RELEASE>:/INCREMENTAL:NO;/OPT:REF;/OPT:ICF>"
)
endif()
target_precompile_headers(
${PROJECT_NAME}
PRIVATE
include/PCH.h
)
add_custom_command(TARGET AnimationMotionRevolution POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:AnimationMotionRevolution>
"$ENV{Skyrim64Dir}/Data/SKSE/Plugins/$<TARGET_FILE_NAME:AnimationMotionRevolution>"
COMMENT "Copying to SSE directory"
)