Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLM shared doesnt export DLL symbols #1279

Open
orion160 opened this issue Mar 15, 2024 · 3 comments
Open

GLM shared doesnt export DLL symbols #1279

orion160 opened this issue Mar 15, 2024 · 3 comments

Comments

@orion160
Copy link

On windows it doesnt create glm.lib.

@seanharmer
Copy link

Just ran into this too.

@seanharmer
Copy link

seanharmer commented Mar 20, 2024

Not sure if this worked prior to #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...

@seanharmer
Copy link

I've made an attempt at a fix in #1280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants