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

MSVC: support building as static library #2169

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMake/cmake_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#endif

#ifdef _MSC_VER
# if defined(FLINT_BUILD_DLL)
# if defined(FLINT_STATIC_BUILD)
# define FLINT_DLL
# elif defined(FLINT_BUILD_DLL)
# define FLINT_DLL __declspec(dllexport)
# else
# define FLINT_DLL __declspec(dllimport)
Expand Down
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,15 @@ target_include_directories(flint PUBLIC
${PThreads_INCLUDE_DIRS}
)

if(BUILD_SHARED_LIBS AND MSVC)
# Export all functions automatically (except global data)
set_target_properties(flint PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Export flint's global data that are marked manually
target_compile_definitions(flint PRIVATE "FLINT_BUILD_DLL")
if(MSVC)
if (BUILD_SHARED_LIBS)
# Export all functions automatically (except global data)
set_target_properties(flint PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Export flint's global data that are marked manually
target_compile_definitions(flint PRIVATE "FLINT_BUILD_DLL")
else()
target_compile_definitions(flint PUBLIC "FLINT_STATIC_BUILD")
endif()
endif()

if (HAS_FLAG_MPOPCNT)
Expand Down