-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
144 lines (119 loc) · 4.44 KB
/
CMakeLists.txt
File metadata and controls
144 lines (119 loc) · 4.44 KB
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
cmake_minimum_required(VERSION 3.24)
project(SmokeAPI VERSION 4.1.3)
include(KoalaBox/cmake/KoalaBox.cmake)
add_subdirectory(KoalaBox)
add_subdirectory(tools)
set(SMOKE_API_STATIC_SOURCES
static/smoke_api/interfaces/steam_apps.hpp
static/smoke_api/interfaces/steam_apps.cpp
static/smoke_api/interfaces/steam_http.hpp
static/smoke_api/interfaces/steam_http.cpp
static/smoke_api/interfaces/steam_inventory.hpp
static/smoke_api/interfaces/steam_inventory.cpp
static/smoke_api/interfaces/steam_user.hpp
static/smoke_api/interfaces/steam_user.cpp
static/smoke_api/api.hpp
static/smoke_api/api.cpp
static/smoke_api/cache.hpp
static/smoke_api/cache.cpp
static/smoke_api/config.hpp
static/smoke_api/config.cpp
static/smoke_api/types.hpp
static/smoke_api/types.cpp
static/smoke_api/steamclient/steamclient.hpp
)
if(IS_LINUX)
set(GENERATED_SOURCES_DIR src/generated/${BITNESS})
file(MAKE_DIRECTORY ${GENERATED_SOURCES_DIR})
set(GENERATED_SOURCES
${GENERATED_SOURCES_DIR}/proxy_exports.hpp
${GENERATED_SOURCES_DIR}/proxy_exports.cpp
)
foreach(SRC IN LISTS GENERATED_SOURCES)
file(TOUCH ${SRC})
endforeach()
endif()
set(SMOKE_API_SOURCES
${SMOKE_API_STATIC_SOURCES}
${GENERATED_SOURCES}
src/smoke_api/smoke_api.cpp
src/smoke_api/smoke_api.hpp
src/steam_api/virtuals/isteamapps.cpp
src/steam_api/virtuals/isteamclient.cpp
src/steam_api/virtuals/isteamgameserver.cpp
src/steam_api/virtuals/isteamhttp.cpp
src/steam_api/virtuals/isteaminventory.cpp
src/steam_api/virtuals/isteamuser.cpp
src/steam_api/virtuals/steam_api_virtuals.hpp
src/steam_api/steam_client.hpp
src/steam_api/steam_client.cpp
src/steam_api/steam_interfaces.cpp
src/steam_api/steam_interfaces.hpp
src/steamclient/steamclient.cpp
)
if(WIN32)
set_32_and_64(STEAM_API_MODULE steam_api)
set_32_and_64(STEAMCLIENT_DLL steamclient)
list(APPEND SMOKE_API_SOURCES src/main_win.cpp)
else()
set(STEAM_API_MODULE libsteam_api)
set(STEAMCLIENT_DLL steamclient)
list(APPEND SMOKE_API_SOURCES src/main_linux.cpp)
endif()
set_32_and_64(SMOKE_API_FILENAME smoke_api32 smoke_api64)
configure_build_config(extra_build_config)
### SmokeAPI interface
add_library(SmokeAPI_common INTERFACE)
add_library(SmokeAPI::common ALIAS SmokeAPI_common)
target_include_directories(SmokeAPI_common INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/static>"
)
target_link_libraries(SmokeAPI_common INTERFACE KoalaBox $<TARGET_OBJECTS:KoalaBox>)
### Static SmokeAPI
add_library(SmokeAPI_static STATIC ${SMOKE_API_STATIC_SOURCES})
add_library(SmokeAPI::static ALIAS SmokeAPI_static)
target_link_libraries(SmokeAPI_static PUBLIC SmokeAPI::common)
### Shared SmokeAPI
add_library(SmokeAPI SHARED ${SMOKE_API_SOURCES})
target_link_libraries(SmokeAPI PUBLIC SmokeAPI::common)
set_target_properties(SmokeAPI PROPERTIES OUTPUT_NAME ${SMOKE_API_FILENAME})
configure_include_directories()
## https://github.com/batterycenter/embed
target_compile_definitions(SmokeAPI PUBLIC B_PRODUCTION_MODE)
CPMAddPackage(
URI "gh:batterycenter/embed@1.2.19"
OPTIONS "B_PRODUCTION_MODE ON"
)
b_embed(SmokeAPI "res/interface_lookup.json")
if(WIN32)
configure_version_resource(
TARGET SmokeAPI
FILE_DESC "Steamworks DLC unlocker"
ORIG_NAME ${SMOKE_API_FILENAME}
)
configure_linker_exports(
TARGET SmokeAPI
HEADER_NAME "linker_exports_for_steam_api.h"
FORWARDED_DLL_NAME "${STEAM_API_MODULE}_o"
LIB_FILES_GLOB "${CMAKE_CURRENT_SOURCE_DIR}/res/steamworks/*/binaries/${STEAM_API_MODULE}.dll"
SOURCES_INPUT_PATH ""
)
set(HEADER_CONTENT "#pragma once\n\n")
foreach(WIN_DLL version winhttp winmm)
set(HEADER_NAME "linker_exports_for_${WIN_DLL}.h")
configure_linker_exports(
TARGET SmokeAPI
HEADER_NAME "${HEADER_NAME}"
FORWARDED_DLL_NAME "C:/Windows/System32/${WIN_DLL}.dll"
LIB_FILES_GLOB "C:/Windows/System32/${WIN_DLL}.dll"
SOURCES_INPUT_PATH ""
)
set(HEADER_CONTENT "${HEADER_CONTENT}#include <${HEADER_NAME}>\n")
endforeach()
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/linker_exports_for_windows_dlls.h"
CONTENT "${HEADER_CONTENT}"
)
# Ignore linker warnings regarding COM-related private exports
set_target_properties(SmokeAPI PROPERTIES LINK_FLAGS "/ignore:4104")
endif()