Skip to content

Commit

Permalink
LAGraph: Fix linking with MSVC
Browse files Browse the repository at this point in the history
Don't use dllexport when building static library.
Use separate variables for dllexport for each library.
  • Loading branch information
mmuetzel committed Oct 23, 2023
1 parent f6b92bd commit f043811
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 64 deletions.
2 changes: 1 addition & 1 deletion LAGraph/config/LAGraph.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#error "The GraphBLAS library must support the v2.0 C API Specification"
#endif

#if ( _MSC_VER && !__INTEL_COMPILER )
#if ( _MSC_VER && !__INTEL_COMPILER && LG_DLL )
#ifdef LG_LIBRARY
// compiling LAGraph itself, exporting symbols to user apps
#define LAGRAPH_PUBLIC __declspec ( dllexport )
Expand Down
2 changes: 2 additions & 0 deletions LAGraph/experimental/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ SET_TARGET_PROPERTIES ( lagraphx PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dlls )
target_link_libraries ( lagraphx PRIVATE lagraph ${GRAPHBLAS_LIBRARIES} )
target_link_directories ( lagraphx BEFORE PUBLIC ${CMAKE_SOURCE_DIR}/build )
target_compile_definitions ( lagraphx PRIVATE LGX_LIBRARY )
target_compile_definitions ( lagraphx PUBLIC LGX_DLL )

#-------------------------------------------------------------------------------
# static lagraphx library properties
Expand Down
2 changes: 2 additions & 0 deletions LAGraph/experimental/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ SET_TARGET_PROPERTIES ( lagraphxtest PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dlls )
target_link_libraries ( lagraphxtest PRIVATE lagraph lagraphtest ${GRAPHBLAS_LIBRARIES} )
target_link_directories ( lagraphxtest BEFORE PUBLIC ${CMAKE_SOURCE_DIR}/build )
target_compile_definitions ( lagraphxtest PRIVATE LGX_TEST_LIBRARY )
target_compile_definitions ( lagraphxtest PUBLIC LGX_TEST_DLL )

#-------------------------------------------------------------------------------
# static lagraphxtest library properties
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/include/LAGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#error "The GraphBLAS library must support the v2.0 C API Specification"
#endif

#if ( _MSC_VER && !__INTEL_COMPILER )
#if ( _MSC_VER && !__INTEL_COMPILER && LG_DLL )
#ifdef LG_LIBRARY
// compiling LAGraph itself, exporting symbols to user apps
#define LAGRAPH_PUBLIC __declspec ( dllexport )
Expand Down
Loading

0 comments on commit f043811

Please sign in to comment.