Generate proxy exports on demand

This commit is contained in:
acidicoala
2025-10-07 00:41:49 +05:00
parent 7e9c4c42b9
commit d5db62c2f2
9 changed files with 29336 additions and 10 deletions

View File

@@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="linux_exports_generator [32]" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--input_libs_glob $ProjectFileDir$/res/steamworks/*/binaries/linux32/libsteam_api.so --output_path $ProjectFileDir$/src/generated/32/proxy_exports" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="SmokeAPI" TARGET_NAME="linux_exports_generator" CONFIG_NAME="Debug [32]" RUN_TARGET_PROJECT_NAME="SmokeAPI" RUN_TARGET_NAME="linux_exports_generator">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="linux_exports_generator [64]" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--input_libs_glob $ProjectFileDir$/res/steamworks/*/binaries/linux64/libsteam_api.so --output_path $CMakeCurrentGenerationDir$/generated/proxy_exports" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="SmokeAPI" TARGET_NAME="linux_exports_generator" CONFIG_NAME="Debug [32]" RUN_TARGET_PROJECT_NAME="SmokeAPI" RUN_TARGET_NAME="linux_exports_generator">
<configuration default="false" name="linux_exports_generator [64]" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--input_libs_glob $ProjectFileDir$/res/steamworks/*/binaries/linux64/libsteam_api.so --output_path $ProjectFileDir$/src/generated/64/proxy_exports" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="SmokeAPI" TARGET_NAME="linux_exports_generator" CONFIG_NAME="Debug [32]" RUN_TARGET_PROJECT_NAME="SmokeAPI" RUN_TARGET_NAME="linux_exports_generator">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>

View File

@@ -26,8 +26,20 @@ set(SMOKE_API_STATIC_SOURCES
static/smoke_api/steamclient/steamclient.hpp
)
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()
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
@@ -127,11 +139,4 @@ if(WIN32)
# Ignore linker warnings regarding COM-related private exports
set_target_properties(SmokeAPI PROPERTIES LINK_FLAGS "/ignore:4104")
else()
set_32_and_64(LINUX_DIR linux32 linux64)
configure_proxy_exports(
TARGET SmokeAPI
INPUT_LIBS_GLOB "${CMAKE_SOURCE_DIR}/res/steamworks/*/binaries/${LINUX_DIR}/libsteam_api.so"
OUTPUT_NAME "proxy_exports"
)
endif()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
// Auto-generated header file
#pragma once
namespace proxy_exports {
void init(void* self_lib_handle, void* original_lib_handle);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
// Auto-generated header file
#pragma once
namespace proxy_exports {
void init(void* self_lib_handle, void* original_lib_handle);
}

View File

@@ -28,7 +28,11 @@
#if defined(KB_WIN)
#include "koalabox/win.hpp"
#elif defined(KB_LINUX)
#include "proxy_exports.hpp"
#if defined(KB_32)
#include "generated/32/proxy_exports.hpp"
#else
#include "generated/64/proxy_exports.hpp"
#endif
#endif
// Hooking steam_api has shown itself to be less desirable than steamclient