only import codegen when not building it

This commit is contained in:
matcool 2022-05-27 00:03:29 -03:00
parent eb72059c3e
commit 8fe349d259
No known key found for this signature in database
GPG key ID: BF58756086D7AB1C
2 changed files with 8 additions and 2 deletions

View file

@ -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)

View file

@ -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)