-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
CMakeLists.txt
173 lines (141 loc) · 4.27 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
171
172
# This file is automatically generated from cmake.toml - DO NOT EDIT
# See https://github.com/build-cpp/cmkr for more information
cmake_minimum_required(VERSION 3.15)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
endif()
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)
# Bootstrap cmkr and automatically regenerate CMakeLists.txt
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()
# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Create a configure-time dependency on cmake.toml to improve IDE support
configure_file(cmake.toml cmake.toml COPYONLY)
endif()
project(dlsstweaks-proj)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(ASMJIT_STATIC ON CACHE BOOL "" FORCE)
option(ZYDIS_BUILD_TOOLS "" OFF)
option(ZYDIS_BUILD_EXAMPLES "" OFF)
if ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
# Statically compile runtime
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
message(NOTICE "Building in Release mode")
endif()
include(FetchContent)
message(STATUS "Fetching zydis (v4.0.0)...")
FetchContent_Declare(zydis
GIT_REPOSITORY
"https://github.com/zyantific/zydis"
GIT_TAG
v4.0.0
)
FetchContent_MakeAvailable(zydis)
message(STATUS "Fetching safetyhook (2c134ea8f642d184f422ad5069145147ac085113)...")
FetchContent_Declare(safetyhook
GIT_REPOSITORY
"https://github.com/cursey/safetyhook"
GIT_TAG
2c134ea8f642d184f422ad5069145147ac085113
)
FetchContent_MakeAvailable(safetyhook)
# Target: spdlog
set(spdlog_SOURCES
"external/spdlog/src/async.cpp"
"external/spdlog/src/bundled_fmtlib_format.cpp"
"external/spdlog/src/cfg.cpp"
"external/spdlog/src/color_sinks.cpp"
"external/spdlog/src/file_sinks.cpp"
"external/spdlog/src/spdlog.cpp"
"external/spdlog/src/stdout_sinks.cpp"
cmake.toml
)
add_library(spdlog STATIC)
target_sources(spdlog PRIVATE ${spdlog_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${spdlog_SOURCES})
target_compile_definitions(spdlog PUBLIC
SPDLOG_COMPILED_LIB
)
target_include_directories(spdlog PUBLIC
"external/spdlog/include"
)
# Target: dlsstweaks
set(dlsstweaks_SOURCES
"src/DllMain.cpp"
"src/Proxy.cpp"
"src/ProxyNvngx.cpp"
"src/UserSettings.cpp"
"src/Utility.cpp"
"src/module_hooks/nvngx.cpp"
"src/module_hooks/nvngx_dlss.cpp"
"src/module_hooks/nvngx_dlssg.cpp"
"src/Proxy.def"
"src/Resource.rc"
"external/ModUtils/Patterns.cpp"
"src/DLSSTweaks.hpp"
"src/Proxy.hpp"
"src/Utility.hpp"
"src/resource.h"
"external/ModUtils/Patterns.h"
cmake.toml
)
add_library(dlsstweaks SHARED)
target_sources(dlsstweaks PRIVATE ${dlsstweaks_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${dlsstweaks_SOURCES})
target_compile_definitions(dlsstweaks PUBLIC
)
target_compile_features(dlsstweaks PUBLIC
cxx_std_20
)
target_compile_options(dlsstweaks PUBLIC
"/GS-"
"/bigobj"
"/EHa"
"/MP"
)
target_include_directories(dlsstweaks PUBLIC
"shared/"
"src/"
"include/"
"external/ModUtils/"
"external/ini-cpp/ini/"
"external/DLSS/include/"
)
target_link_libraries(dlsstweaks PUBLIC
spdlog
safetyhook
version.lib
)
target_link_options(dlsstweaks PUBLIC
"/DEBUG"
"/OPT:REF"
"/OPT:ICF"
)
set_target_properties(dlsstweaks PROPERTIES
OUTPUT_NAME
nvngx
RUNTIME_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/bin/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO
"${CMAKE_BINARY_DIR}/lib/${CMKR_TARGET}"
)