From b1a86e7b146b0ffcc958f7f138f7fda2139c1ebe Mon Sep 17 00:00:00 2001 From: praydog Date: Wed, 30 Aug 2023 03:46:19 -0700 Subject: [PATCH] Add standalone SDK test project --- CMakeLists.txt | 41 ++++++++++++++++++++++++++++ cmake.toml | 11 ++++++++ side-projects/sdk-test/Main.cpp | 47 +++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 side-projects/sdk-test/Main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a014cf7..4c1f8419 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -639,6 +639,47 @@ target_link_libraries(example_plugin PUBLIC unset(CMKR_TARGET) unset(CMKR_SOURCES) +unset(CMKR_TARGET) +unset(CMKR_SOURCES) + +# Target sdk-test +set(CMKR_TARGET sdk-test) +set(sdk-test_SOURCES "") + +list(APPEND sdk-test_SOURCES + "side-projects/sdk-test/Main.cpp" +) + +list(APPEND sdk-test_SOURCES + cmake.toml +) + +set(CMKR_SOURCES ${sdk-test_SOURCES}) +add_library(sdk-test SHARED) + +if(sdk-test_SOURCES) + target_sources(sdk-test PRIVATE ${sdk-test_SOURCES}) +endif() + +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${sdk-test_SOURCES}) + +target_compile_features(sdk-test PUBLIC + cxx_std_23 +) + +target_include_directories(sdk-test PUBLIC + "shared/" + "include/" +) + +target_link_libraries(sdk-test PUBLIC + kananlib + sdk +) + +unset(CMKR_TARGET) +unset(CMKR_SOURCES) + # Target vr-plugin-nullifier set(CMKR_TARGET vr-plugin-nullifier) set(vr-plugin-nullifier_SOURCES "") diff --git a/cmake.toml b/cmake.toml index 840dd1f7..a12392d0 100644 --- a/cmake.toml +++ b/cmake.toml @@ -169,6 +169,17 @@ type = "plugin" sources = ["examples/example_plugin/**.cpp", "examples/example_plugin/**.c"] headers = ["examples/example_plugin/**.hpp", "examples/example_plugin/**.h"] +[target.sdk-test] +type = "shared" +sources = ["side-projects/sdk-test/**.cpp", "side-projects/sdk-test/**.c"] +headers = ["side-projects/sdk-test/**.hpp", "side-projects/sdk-test/**.h"] +include-directories = ["shared/", "include/"] +compile-features = ["cxx_std_23"] +link-libraries = [ + "kananlib", + "sdk" +] + [target.vr-plugin-nullifier] type = "shared" sources = ["vr-plugin-nullifier/**.cpp", "vr-plugin-nullifier/**.c"] diff --git a/side-projects/sdk-test/Main.cpp b/side-projects/sdk-test/Main.cpp new file mode 100644 index 00000000..d11f607b --- /dev/null +++ b/side-projects/sdk-test/Main.cpp @@ -0,0 +1,47 @@ +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#define SPAWN_CONSOLE + +void startup_thread() { + // Spawn a debug console +#ifdef SPAWN_CONSOLE + AllocConsole(); + freopen("CONOUT$", "w", stdout); +#endif + + // Set up spdlog to sink to the console + spdlog::set_pattern("[%H:%M:%S] [%^%l%$] [iostore-standalone] %v"); + spdlog::set_level(spdlog::level::info); + spdlog::flush_on(spdlog::level::info); + spdlog::set_default_logger(spdlog::stdout_logger_mt("console")); + + SPDLOG_INFO("Test!"); + + sdk::FName::get_constructor(); + sdk::FName::get_to_string(); + sdk::FUObjectArray::get(); + + SPDLOG_INFO("Test finished!"); +} + +BOOL APIENTRY DllMain(HMODULE module, DWORD reason_for_call, LPVOID reserved) { + switch (reason_for_call) + { + case DLL_PROCESS_ATTACH: + //CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)startup_thread, nullptr, 0, nullptr); + startup_thread(); + break; + } + + return TRUE; +} \ No newline at end of file