From 8fe349d259ba2989337fb700fad49076f21bd593 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Fri, 27 May 2022 00:03:29 -0300 Subject: [PATCH] only import codegen when not building it --- Geode.cmake | 2 ++ include/platform/platform.hpp | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Geode.cmake b/Geode.cmake index 27188023..15e091c7 100644 --- a/Geode.cmake +++ b/Geode.cmake @@ -66,6 +66,8 @@ function(setup_geode_mod) add_subdirectory(${GEODE_SDK_PATH}/codegen ${GEODE_CODEGEN_DIR}) add_dependencies(${PROJECT_NAME} CodegenRun) endif() + + target_compile_definitions(${PROJECT_NAME} PUBLIC -DGEODE_BUILDING_CODEGEN) endif() target_compile_definitions(${PROJECT_NAME} PUBLIC -DPROJECT_NAME=${PROJECT_NAME} -DEXPORT_${PROJECT_NAME}=1) diff --git a/include/platform/platform.hpp b/include/platform/platform.hpp index 0e9baa28..dda753c4 100644 --- a/include/platform/platform.hpp +++ b/include/platform/platform.hpp @@ -79,9 +79,13 @@ namespace std { #endif #ifdef GEODE_EXPORTING_CODEGEN - #define GEODE_CODEGEN_DLL __declspec(dllexport) + #define GEODE_CODEGEN_DLL __declspec(dllexport) #else - #define GEODE_CODEGEN_DLL __declspec(dllimport) + #ifndef GEODE_BUILDING_CODEGEN + #define GEODE_CODEGEN_DLL __declspec(dllimport) + #else + #define GEODE_CODEGEN_DLL + #endif #endif #define GEODE_API extern "C" __declspec(dllexport)