mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-22 02:45:49 -04:00
Don't link the entirety of geode-sdk for membertest
This commit is contained in:
parent
b87883903c
commit
45032a4511
6 changed files with 40 additions and 44 deletions
|
@ -45,19 +45,21 @@ include(cmake/CPM.cmake)
|
|||
|
||||
target_sources(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/entry.cpp)
|
||||
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
set(GEODE_CODEGEN_BINARY_OUT ${CMAKE_CURRENT_BINARY_DIR}/codegen)
|
||||
ExternalProject_Add(CodegenProject
|
||||
BUILD_ALWAYS ON
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/codegen
|
||||
CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${GEODE_CODEGEN_BINARY_OUT}"
|
||||
)
|
||||
|
||||
|
||||
file(GLOB CODEGEN_DEPENDS CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bindings/*.bro
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings/GeometryDash.bro
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bindings/Cocos2d.bro
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bindings/Entry.bro
|
||||
DEPENDS ${CODEGEN_DEPENDS}
|
||||
DEPENDS CodegenProject
|
||||
COMMAND ${GEODE_CODEGEN_BINARY_OUT}/Codegen ${GEODE_TARGET_PLATFORM} bindings ${GEODE_CODEGEN_PATH}
|
||||
COMMAND echo codegen > ${GEODE_CODEGEN_PATH}/.stamp
|
||||
|
|
|
@ -23,8 +23,6 @@ if (GEODE_TARGET_PLATFORM STREQUAL "iOS")
|
|||
OSX_ARCHITECTURES arm64
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} -DCC_TARGET_OS_IPHONE)
|
||||
|
||||
set(GEODE_PLATFORM_BINARY "GeodeIOS.dylib")
|
||||
elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
|
@ -33,15 +31,8 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS")
|
|||
APPLE_SILICON_PROCESSOR x86_64
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/platform/mac
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/platform/third_party/mac
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/platform/third_party/mac/OGLES
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE curl "-framework Cocoa")
|
||||
target_compile_options(${PROJECT_NAME} INTERFACE -fms-extensions -Wno-deprecated -Wno-ignored-attributes -Os #[[-flto]] -fvisibility=internal)
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE -DCC_TARGET_OS_MAC)
|
||||
|
||||
set(GEODE_PLATFORM_BINARY "Geode.dylib")
|
||||
|
||||
|
@ -51,14 +42,7 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Win32")
|
|||
GENERATOR_PLATFORM x86
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/platform/win32
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/platform/third_party/win32
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/platform/third_party/win32/zlib
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/platform/third_party/win32/OGLES
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE -DCC_TARGET_OS_WIN32 NOMINMAX)
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE NOMINMAX)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE
|
||||
${GEODE_LOADER_PATH}/include/link/libcocos2d.lib
|
||||
|
|
|
@ -6,7 +6,8 @@ namespace { namespace format_strings {
|
|||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/utils/addresser.hpp>
|
||||
#include <Geode/utils/casts.hpp>
|
||||
#include <Geode/modify/Addresses.hpp>
|
||||
#include <Geode/meta/meta.hpp>
|
||||
#include <Geode/modify/Addresses.hpp>
|
||||
#include <Geode/modify/Types.hpp>
|
||||
using namespace geode;
|
||||
using namespace geode::cast;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#define GEODE_CALL __stdcall
|
||||
#define GEODE_PLATFORM_EXTENSION ".dll"
|
||||
#define GEODE_PLATFORM_SHORT_IDENTIFIER "win"
|
||||
#define CC_TARGET_OS_WIN32
|
||||
#else
|
||||
#define GEODE_WINDOWS(...)
|
||||
#endif
|
||||
|
@ -31,6 +32,7 @@
|
|||
#define GEODE_PLATFORM_NAME "iOS"
|
||||
#define GEODE_PLATFORM_EXTENSION ".ios.dylib"
|
||||
#define GEODE_PLATFORM_SHORT_IDENTIFIER "ios"
|
||||
#define CC_TARGET_OS_IPHONE
|
||||
#else
|
||||
#define GEODE_IOS(...)
|
||||
#define GEODE_MACOS(...) __VA_ARGS__
|
||||
|
@ -39,6 +41,7 @@
|
|||
#define GEODE_PLATFORM_NAME "MacOS"
|
||||
#define GEODE_PLATFORM_EXTENSION ".dylib"
|
||||
#define GEODE_PLATFORM_SHORT_IDENTIFIER "mac"
|
||||
#define CC_TARGET_OS_MAC
|
||||
#endif
|
||||
#define GEODE_CALL
|
||||
#else
|
||||
|
@ -55,6 +58,7 @@
|
|||
#define GEODE_CALL
|
||||
#define GEODE_PLATFORM_EXTENSION ".so"
|
||||
#define GEODE_PLATFORM_SHORT_IDENTIFIER "android"
|
||||
#define CC_TARGET_OS_ANDROID
|
||||
#else
|
||||
#define GEODE_ANDROID(...)
|
||||
#endif
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
* Adapted from https://gist.github.com/altalk23/29b97969e9f0624f783b673f6c1cd279
|
||||
*/
|
||||
|
||||
#include "../loader/Log.hpp"
|
||||
#include "../loader/Mod.hpp"
|
||||
#include "casts.hpp"
|
||||
#include "general.hpp"
|
||||
|
||||
#include <Geode/DefaultInclude.hpp>
|
||||
#include <cstdlib>
|
||||
|
@ -89,10 +86,10 @@ namespace geode::addresser {
|
|||
|
||||
// log::debug("[[" + utils::intToHex((void*)ins) + " + " + utils::intToHex(thunk) + "] +
|
||||
// " + utils::intToHex(index) + "]");
|
||||
log::debug(
|
||||
"[[{} + {}] + {}]", utils::intToHex((void*)ins), utils::intToHex(thunk),
|
||||
utils::intToHex(index)
|
||||
);
|
||||
// log::debug(
|
||||
// "[[{} + {}] + {}]", utils::intToHex((void*)ins), utils::intToHex(thunk),
|
||||
// utils::intToHex(index)
|
||||
// );
|
||||
|
||||
// [[this + thunk] + offset] is the f we want
|
||||
auto address =
|
||||
|
@ -179,23 +176,23 @@ namespace geode::addresser {
|
|||
#else
|
||||
template <typename T>
|
||||
inline intptr_t getVirtual(T func) {
|
||||
log::debug(
|
||||
"Get virtual function address from {}",
|
||||
utils::intToHex(geode::cast::reference_cast<intptr_t>(func))
|
||||
);
|
||||
// log::debug(
|
||||
// "Get virtual function address from {}",
|
||||
// utils::intToHex(geode::cast::reference_cast<intptr_t>(func))
|
||||
// );
|
||||
auto addr = Addresser::addressOfVirtual(func);
|
||||
log::debug("The address is: {}", utils::intToHex(addr));
|
||||
// log::debug("The address is: {}", utils::intToHex(addr));
|
||||
return addr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline intptr_t getNonVirtual(T func) {
|
||||
log::debug(
|
||||
"Get non-virtual function address from {}",
|
||||
utils::intToHex(geode::cast::reference_cast<intptr_t>(func))
|
||||
);
|
||||
// log::debug(
|
||||
// "Get non-virtual function address from {}",
|
||||
// utils::intToHex(geode::cast::reference_cast<intptr_t>(func))
|
||||
// );
|
||||
auto addr = Addresser::addressOfNonVirtual(func);
|
||||
log::debug("The address is: {}", utils::intToHex(addr));
|
||||
// log::debug("The address is: {}", utils::intToHex(addr));
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,15 @@ project(${PROJECT_NAME} VERSION 1.0.0)
|
|||
add_library(${PROJECT_NAME} SHARED MacOS.cpp Windows.cpp)
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
geode-sdk
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
${GEODE_CODEGEN_PATH}
|
||||
${GEODE_LOADER_PATH}/include
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/include
|
||||
${GEODE_LOADER_PATH}/include/Geode/cocos/extensions
|
||||
${GEODE_LOADER_PATH}/include/Geode/fmod
|
||||
)
|
||||
|
||||
# For non existing pads
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ghc_filesystem)
|
||||
|
||||
add_dependencies(${PROJECT_NAME} CodegenRun)
|
Loading…
Reference in a new issue