From aa0a195e9845b7930766abae1e825a4a4da58402 Mon Sep 17 00:00:00 2001 From: Randy Date: Mon, 3 Aug 2020 19:34:45 +0200 Subject: [PATCH 1/5] win32: fix symbol exports --- include/cglm/common.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/cglm/common.h b/include/cglm/common.h index 749fb5d..68530d8 100644 --- a/include/cglm/common.h +++ b/include/cglm/common.h @@ -23,10 +23,12 @@ #include #if defined(_MSC_VER) -# ifdef CGLM_DLL +# if defined(CGLM_DLL) && defined(CGLM_EXPORTS) # define CGLM_EXPORT __declspec(dllexport) -# else +# elif defined(CGLM_DLL) # define CGLM_EXPORT __declspec(dllimport) +# else +# define CGLM_EXPORT # endif # define CGLM_INLINE __forceinline #else From 2ff4ae0b4c5353b2c6caec596fdf3973134c94a6 Mon Sep 17 00:00:00 2001 From: Randy Date: Mon, 3 Aug 2020 20:47:00 +0200 Subject: [PATCH 2/5] simplify exports check --- include/cglm/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cglm/common.h b/include/cglm/common.h index 68530d8..8d68628 100644 --- a/include/cglm/common.h +++ b/include/cglm/common.h @@ -23,7 +23,7 @@ #include #if defined(_MSC_VER) -# if defined(CGLM_DLL) && defined(CGLM_EXPORTS) +# ifdef CGLM_EXPORTS # define CGLM_EXPORT __declspec(dllexport) # elif defined(CGLM_DLL) # define CGLM_EXPORT __declspec(dllimport) From 09fd9f86b913ae9d33eee9e559f05f4dbde42379 Mon Sep 17 00:00:00 2001 From: Randy Date: Mon, 3 Aug 2020 20:47:12 +0200 Subject: [PATCH 3/5] update CMakefile --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f136fda..afc31d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ if(CGLM_USE_C99) endif() if(MSVC) - add_definitions(-DNDEBUG -D_WINDOWS -D_USRDLL -DCGLM_EXPORTS -DCGLM_DLL) + add_definitions(-DNDEBUG -D_WINDOWS -D_USRDLL) add_compile_options(/W3 /Ox /Gy /Oi /TC) # Ref: https://skia.googlesource.com/third_party/sdl/+/refs/heads/master/CMakeLists.txt#225 @@ -75,6 +75,11 @@ add_library(${PROJECT_NAME} src/affine2d.c ) +if(CGLM_SHARED) + add_definitions(-DCGLM_EXPORTS) + target_compile_definitions(${PROJECT_NAME} PUBLIC -DCGLM_DLL) +endif() + set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) From 009fb966a6fc7dfdc60905ec6cecc5135b9fe41a Mon Sep 17 00:00:00 2001 From: Randy Date: Mon, 3 Aug 2020 22:45:50 +0200 Subject: [PATCH 4/5] drop CGLM_DLL, add CGLM_STATIC --- CMakeLists.txt | 3 ++- include/cglm/common.h | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afc31d1..d31fe5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,8 @@ add_library(${PROJECT_NAME} if(CGLM_SHARED) add_definitions(-DCGLM_EXPORTS) - target_compile_definitions(${PROJECT_NAME} PUBLIC -DCGLM_DLL) +else() + target_compile_definitions(${PROJECT_NAME} PUBLIC -DCGLM_STATIC) endif() set_target_properties(${PROJECT_NAME} PROPERTIES diff --git a/include/cglm/common.h b/include/cglm/common.h index 8d68628..810d7ef 100644 --- a/include/cglm/common.h +++ b/include/cglm/common.h @@ -23,12 +23,12 @@ #include #if defined(_MSC_VER) -# ifdef CGLM_EXPORTS -# define CGLM_EXPORT __declspec(dllexport) -# elif defined(CGLM_DLL) -# define CGLM_EXPORT __declspec(dllimport) -# else +# ifdef CGLM_STATIC # define CGLM_EXPORT +# elif defined(CGLM_EXPORTS) +# define CGLM_EXPORT __declspec(dllexport) +# else +# define CGLM_EXPORT __declspec(dllimport) # endif # define CGLM_INLINE __forceinline #else From 77585de397cbcb8e50e81589f05dd02194dc1a22 Mon Sep 17 00:00:00 2001 From: Randy Date: Tue, 4 Aug 2020 19:16:05 +0200 Subject: [PATCH 5/5] remove CGLM_DLL from vs solution --- win/cglm.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win/cglm.vcxproj b/win/cglm.vcxproj index 86b1fc6..8e6e1e7 100644 --- a/win/cglm.vcxproj +++ b/win/cglm.vcxproj @@ -209,7 +209,7 @@ NotUsing Level3 MaxSpeed - WIN32;_DEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL + WIN32;_DEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;%(PreprocessorDefinitions) None Default @@ -225,7 +225,7 @@ Level3 MaxSpeed - _DEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL + _DEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;%(PreprocessorDefinitions) AnySuitable true true @@ -246,7 +246,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL + WIN32;NDEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;%(PreprocessorDefinitions) None CompileAsC @@ -266,7 +266,7 @@ MaxSpeed true true - NDEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL + NDEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;%(PreprocessorDefinitions) None CompileAsC