This repository has been archived by the owner on Aug 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
142 lines (126 loc) · 4.04 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
cmake_minimum_required(VERSION 3.17)
project(SoupedModLoader VERSION 1.0 LANGUAGES C CXX)
# Use C++ 20
set(CMAKE_CXX_STANDARD 20)
# Include CMake's FetchContent module
include(FetchContent)
# Set runtime libs
if(MSVC)
add_compile_options(
$<$<CONFIG:>:/MD> #---------|
$<$<CONFIG:Debug>:/MDd> #---|-- Dynamically link the runtime libraries
$<$<CONFIG:Release>:/MD> #--|
)
endif()
#Add fmt
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG master
)
FetchContent_GetProperties(fmt)
if(NOT fmt_POPULATED)
FetchContent_Populate(fmt)
add_subdirectory(${fmt_SOURCE_DIR} ${fmt_BINARY_DIR})
endif()
#Fetch & Install PolyHook2
FetchContent_Declare(
plh
GIT_REPOSITORY https://github.com/stevemk14ebr/PolyHook_2_0.git
GIT_TAG master
)
FetchContent_GetProperties(plh)
if(NOT plh_POPULATED)
FetchContent_Populate(plh)
set(POLYHOOK_BUILD_DLL ON)
add_subdirectory(${plh_SOURCE_DIR} ${plh_BINARY_DIR})
endif()
#Add glfw
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.3-stable
)
FetchContent_GetProperties(glfw)
if(NOT glfw_POPULATED)
FetchContent_Populate(glfw)
add_subdirectory(${glfw_SOURCE_DIR} ${glfw_BINARY_DIR})
endif()
#Fetch & Install ChakraCore
FetchContent_Declare(
ch
GIT_REPOSITORY https://github.com/chakra-core/ChakraCore.git
GIT_TAG master
)
FetchContent_GetProperties(ch)
if(NOT ch_POPULATED)
FetchContent_Populate(ch)
execute_process(COMMAND msbuild /m /p:Platform=x64 /p:Configuration=${CMAKE_BUILD_TYPE} ${ch_SOURCE_DIR}/Build/Chakra.Core.sln)
add_library(ChakraCore SHARED IMPORTED)
set_target_properties(ChakraCore PROPERTIES
IMPORTED_LOCATION "${ch_SOURCE_DIR}/Build/VcBuild/bin/x64_${CMAKE_BUILD_TYPE}/ChakraCore.dll"
IMPORTED_IMPLIB "${ch_SOURCE_DIR}/Build/VcBuild/bin/x64_${CMAKE_BUILD_TYPE}/ChakraCore.lib"
)
endif()
#Add zlib
FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG master
)
FetchContent_GetProperties(zlib)
if(NOT zlib_POPULATED)
FetchContent_Populate(zlib)
add_subdirectory(${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
endif()
#Add libarchive
FetchContent_Declare(
libarchive
GIT_REPOSITORY https://github.com/libarchive/libarchive.git
GIT_TAG master
)
FetchContent_GetProperties(libarchive)
if(NOT libarchive_POPULATED)
FetchContent_Populate(libarchive)
add_subdirectory(${libarchive_SOURCE_DIR} ${libarchive_BINARY_DIR})
endif()
#Add ghstl
FetchContent_Declare(
ghstl
GIT_REPOSITORY https://github.com/DisabledMallis/ghstl
GIT_TAG main
)
FetchContent_GetProperties(ghstl)
if(NOT ghstl_POPULATED)
FetchContent_Populate(ghstl)
add_subdirectory(${ghstl_SOURCE_DIR} ${ghstl_BINARY_DIR})
endif()
# Include library include dir
include_directories("${glfw_SOURCE_DIR}/include/")
include_directories("${libarchive_SOURCE_DIR}/libarchive")
include_directories("${ch_SOURCE_DIR}/lib/jsrt/")
include_directories("${ghstl_SOURCE_DIR}/include/")
# Final output dir for compile files
set(FINAL_DIR "${CMAKE_CURRENT_LIST_DIR}/build/${CMAKE_BUILD_TYPE}")
# Include SMF headers globally
include_directories("${CMAKE_CURRENT_LIST_DIR}/common/include/")
include_directories("${CMAKE_CURRENT_LIST_DIR}/common/glad/include/")
include_directories("${CMAKE_CURRENT_LIST_DIR}/common/imgui/")
include_directories("${CMAKE_CURRENT_LIST_DIR}/loader/include/")
include_directories("${CMAKE_CURRENT_LIST_DIR}/modfs/include/")
include_directories("${CMAKE_CURRENT_LIST_DIR}/soupsdk/include/")
# Export all symbols (ensures .lib files are created)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Add SMF sources
add_subdirectory(common)
add_subdirectory(launcher)
add_subdirectory(loader)
add_subdirectory(modexplore)
add_subdirectory(modfs)
add_subdirectory(proxy)
add_subdirectory(soupsdk)
# Create release ready folders
execute_process(COMMAND mkdir "${CMAKE_CURRENT_LIST_DIR}/build")
execute_process(COMMAND mkdir ${FINAL_DIR})
execute_process(COMMAND mkdir ${FINAL_DIR}/loaders)
execute_process(COMMAND mkdir ${FINAL_DIR}/proxies)