-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
145 lines (119 loc) · 3.67 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
cmake_minimum_required(VERSION 3.30)
message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
project(
SleepGivesBuff
VERSION 0.0.1
LANGUAGES CXX
)
#Enable for 1130 changes
set(ENABLE_SKYRIMAE1130 OFF)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF)
set(CMAKE_OPTIMIZE_DEPENDENCIES ON)
set(SKSE_SUPPORT_XBYAK ON)
set(ENABLE_SKYRIM_VR OFF)
include(GNUInstallDirs)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Version.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/Version.h
@ONLY
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY
)
set(PUBLIC_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME})
# Add headers
file(
GLOB_RECURSE
headers
${CMAKE_CURRENT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp
${CMAKE_CURRENT_BINARY_DIR}/include/Version.h
)
list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/include/PCH.h)
# Add sources
file(
GLOB_RECURSE
sources
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc
${CMAKE_CURRENT_BINARY_DIR}/version.rc
${CMAKE_CURRENT_BINARY_DIR}/include/Version.h
)
source_group(
TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${headers} ${sources}
)
set(BUILD_TESTS OFF)
add_subdirectory(extern/CommonLibSSE-NG)
include(extern/CommonLibSSE-NG/cmake/CommonLibSSE.cmake)
add_commonlibsse_plugin(
${PROJECT_NAME}
AUTHOR gujarats
SOURCES ${headers} ${sources}
)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
find_path(SIMPLEINI_INCLUDE_DIRS "SimpleIni.h")
set (SOURCES ${headers} ${sources})
target_include_directories(
${PROJECT_NAME}
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:src>
${SIMPLEINI_INCLUDE_DIRS}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_precompile_headers(
${PROJECT_NAME}
PRIVATE
include/PCH.h
${SIMPLEINI_INCLUDE_DIRS}/SimpleIni.h
)
install(
DIRECTORY ${PUBLIC_HEADER_DIR}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(BUILD_NAME Debug)
else()
set(BUILD_NAME Release)
endif()
if(ENABLE_SKYRIMAE1130)
message("\tBuilding 1130")
set(BUILD_NAME ${BUILD_NAME}1130)
endif()
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E make_directory $ENV{SKYRIM_MODS_FOLDER}/${PROJECT_NAME}/SKSE/Plugins
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> $ENV{SKYRIM_MODS_FOLDER}/${PROJECT_NAME}/SKSE/Plugins
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_PDB_FILE:${PROJECT_NAME}> $ENV{SKYRIM_MODS_FOLDER}/${PROJECT_NAME}/SKSE/Plugins
COMMAND
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/build/Plugin${BUILD_NAME}/SKSE/Plugins
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> ${CMAKE_CURRENT_SOURCE_DIR}/build/Plugin${BUILD_NAME}/SKSE/Plugins
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_PDB_FILE:${PROJECT_NAME}> ${CMAKE_CURRENT_SOURCE_DIR}/build/Plugin${BUILD_NAME}/SKSE/Plugins
COMMAND
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/build/Config/${PROJECT_NAME}.ini ${CMAKE_CURRENT_SOURCE_DIR}/build/Plugin${BUILD_NAME}/SKSE/Plugins
)
file(GLOB_RECURSE OUTPUT_DLLS ${CMAKE_CURRENT_SOURCE_DIR}/build/**/*.dll)
file(GLOB_RECURSE OUTPUT_PDBS ${CMAKE_CURRENT_SOURCE_DIR}/build/**/*.pdb)
set_property(
TARGET ${PROJECT_NAME}
APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${OUTPUT_DLLS} ${OUTPUT_PDBS}
)