This repository has been archived by the owner on Mar 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
134 lines (106 loc) · 4.81 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
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
project(swrstoys C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/install")
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing -Wno-microsoft-cast")
endif ()
add_library(swrstoys MODULE
swrstoys/d3d9.def
swrstoys/d3d9_dummy.cpp
swrstoys/dummy.cpp
swrstoys/SWRSToys.cpp)
target_compile_definitions(swrstoys PRIVATE _CRT_SECURE_NO_WARNINGS)
target_include_directories(swrstoys PRIVATE include)
target_link_libraries(swrstoys shlwapi user32 advapi32)
set_target_properties(swrstoys PROPERTIES
OUTPUT_NAME d3d9)
install(TARGETS swrstoys LIBRARY DESTINATION ".")
# detours
add_library(detours
detours/src/creatwth.cpp
detours/src/detours.cpp
detours/src/disasm.cpp
detours/src/disolarm.cpp
detours/src/disolarm64.cpp
detours/src/disolia64.cpp
detours/src/disolx86.cpp
detours/src/disolx64.cpp
detours/src/image.cpp
detours/src/modules.cpp)
target_include_directories(detours PUBLIC detours/src)
# MemoryModule
add_library(MemoryModule
MemoryModule/MemoryModule.c)
target_include_directories(MemoryModule PUBLIC MemoryModule)
# modules
function(module name)
add_library("${name}" MODULE)
target_compile_definitions("${name}" PRIVATE DIRECTINPUT_VERSION=0x0800 _CRT_SECURE_NO_WARNINGS)
target_include_directories("${name}" PRIVATE include include/directx "modules/${name}/")
target_link_directories("${name}" PRIVATE lib)
target_link_libraries("${name}" shlwapi user32 advapi32)
install(TARGETS "${name}" LIBRARY DESTINATION "modules/${name}/")
set(MODULE_PATHS "${MODULE_PATHS}; ${name}=modules/${name}/${name}.dll\n" PARENT_SCOPE)
endfunction()
module(BGMChanger)
target_sources(BGMChanger PRIVATE modules/BGMChanger/BGMChanger.cpp)
module(CharactersInForeground)
target_sources(CharactersInForeground PRIVATE modules/CharactersInForeground/CharactersInForeground.cpp)
module(DPadFix)
target_sources(DPadFix PRIVATE modules/DPadFix/DPadFix.cpp)
target_link_libraries(DPadFix dinput8 detours)
module(MemoryPatch)
target_sources(MemoryPatch PRIVATE modules/MemoryPatch/MemoryPatch.cpp)
module(NetBattleCounter)
target_sources(NetBattleCounter PRIVATE modules/NetBattleCounter/NetBattleCounter.cpp)
target_link_libraries(NetBattleCounter winmm)
module(NetBellChanger)
target_sources(NetBellChanger PRIVATE modules/NetBellChanger/NetBellChanger.cpp)
target_link_libraries(NetBellChanger winmm)
module(NetProfileView)
target_sources(NetProfileView PRIVATE modules/NetProfileView/NetProfileView.cpp)
module(ReplayDnD)
target_sources(ReplayDnD PRIVATE modules/ReplayDnD/ReplayDnD.cpp)
module(ReplayInputView)
target_sources(ReplayInputView PRIVATE
modules/ReplayInputView/ReplayInputView.cpp
modules/ReplayInputView/ReplayInputView.rc)
module(ReplayInputView+)
target_sources(ReplayInputView+ PRIVATE
modules/ReplayInputView+/ReplayInputView.cpp
modules/ReplayInputView+/Text.cpp
modules/ReplayInputView+/ReplayInputView.rc)
module(SkipIntro)
target_sources(SkipIntro PRIVATE
modules/SkipIntro/Soku-SkipIntro/dllmain.cpp)
module(SWRSokuRoll)
target_sources(SWRSokuRoll PRIVATE modules/SWRSokuRoll/SWRSokuRoll.cpp)
file(READ "${CMAKE_SOURCE_DIR}/bin/SokuRoll.dll" SokuRollData HEX)
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," SokuRollData ${SokuRollData})
file(WRITE "${CMAKE_BINARY_DIR}/SokuRoll.inl" "const unsigned char sokuroll_data[] = {${SokuRollData}};\nconst unsigned sokuroll_size = sizeof(sokuroll_data);\n")
target_include_directories(SWRSokuRoll PRIVATE "${CMAKE_BINARY_DIR}")
target_link_libraries(SWRSokuRoll MemoryModule)
module(UPnPNat)
target_sources(UPnPNat PRIVATE modules/UPnPNat/UPnPNat.cpp)
target_link_libraries(UPnPNat iphlpapi ole32 oleaut32)
module(WindowedFullscreen)
target_sources(WindowedFullscreen PRIVATE
modules/WindowedFullscreen/WindowedFullscreen.cpp)
# passing "d3d9" conflicts with the generated d3d9 module somehow, pass an absolute path to the one in lib/
target_link_libraries(WindowedFullscreen detours "${CMAKE_SOURCE_DIR}/lib/d3d9.lib")
module(WindowResizer)
target_sources(WindowResizer PRIVATE
modules/WindowResizer/WindowResizer.cpp)
target_link_libraries(WindowResizer detours)
configure_file("swrstoys/SWRSToys.ini.in" "SWRSToys.ini" @ONLY NEWLINE_STYLE CRLF)
install(DIRECTORY modules/ DESTINATION "modules"
FILES_MATCHING
PATTERN "*/Soku-SkipIntro*" EXCLUDE
PATTERN "*.ini")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SWRSToys.ini" DESTINATION ".")
install(FILES README.md DESTINATION "."
RENAME "SWRSToys.txt")