Open orion160 opened 5 months ago
Just ran into this too.
Not sure if this worked prior to https://github.com/g-truc/glm/pull/1186 or not but it seems relevant.
In spdlog, the exports are marked by SPDLOG_API which is setup in common.h by:
#ifdef SPDLOG_COMPILED_LIB
#undef SPDLOG_HEADER_ONLY
#if defined(SPDLOG_SHARED_LIB)
#if defined(_WIN32)
#ifdef spdlog_EXPORTS
#define SPDLOG_API __declspec(dllexport)
#else // !spdlog_EXPORTS
#define SPDLOG_API __declspec(dllimport)
#endif
#else // !defined(_WIN32)
#define SPDLOG_API __attribute__((visibility("default")))
#endif
#else // !defined(SPDLOG_SHARED_LIB)
#define SPDLOG_API
#endif
#define SPDLOG_INLINE
#else // !defined(SPDLOG_COMPILED_LIB)
#define SPDLOG_API
#define SPDLOG_HEADER_ONLY
#define SPDLOG_INLINE inline
#endif // #ifdef SPDLOG_COMPILED_LIB
CMake has a handy function for generating a suitable header. We use a snippet like this in our project to generate and install such a header:
include(GenerateExportHeader)
generate_export_header(KDGpuExample BASE_NAME kdgpuexample)
configure_file(
${CMAKE_CURRENT_BINARY_DIR}/kdgpuexample_export.h ${CMAKE_BINARY_DIR}/include/KDGpuExample/kdgpuexample_export.h
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/kdgpuexample_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/KDGpuExample
)
Then the export/import macro needs adding to the relevant symbols...
I've made an attempt at a fix in https://github.com/g-truc/glm/pull/1280
On windows it doesnt create glm.lib.