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

Disambiguate shared and static libs .lib files on Windows using MSVC #455

Merged
merged 5 commits into from
May 16, 2024
Merged
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Changes to SUNDIALS in release X.Y.Z

Fixed conflicting `.lib` files between shared and static libs when using `MSVC` on Windows

Fixed invalid `SUNDIALS_EXPORT` generated macro when building both shared and static libs

Created shared user interface for ARKODE user-callable routines, to allow more
uniform control over time-stepping algorithms, improved extensibility, and
simplified code maintenance. Marked the corresponding stepper-specific
Expand Down
19 changes: 13 additions & 6 deletions cmake/macros/SundialsAddLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ macro(sundials_add_library target)

# add compile definitions to object library for SUNDIALS_EXPORT
if(${_libtype} MATCHES "STATIC")
target_compile_definitions(${obj_target} PRIVATE SUNDIALS_STATIC_DEFINE)
target_compile_definitions(${obj_target} PUBLIC SUNDIALS_STATIC_DEFINE)
else()
target_compile_definitions(${obj_target} PRIVATE sundials_core_EXPORTS)
endif()
Expand Down Expand Up @@ -296,7 +296,7 @@ macro(sundials_add_library target)

# add compile definitions for SUNDIALS_EXPORT
if(${_libtype} MATCHES "STATIC")
target_compile_definitions(${_actual_target_name} PRIVATE SUNDIALS_STATIC_DEFINE)
target_compile_definitions(${_actual_target_name} PUBLIC SUNDIALS_STATIC_DEFINE)
else()
target_compile_definitions(${obj_target} PRIVATE sundials_core_EXPORTS)
endif()
Expand Down Expand Up @@ -325,10 +325,17 @@ macro(sundials_add_library target)

# set the correct output name
if(sundials_add_library_OUTPUT_NAME)
set_target_properties(${_actual_target_name} PROPERTIES
OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME}
CLEAN_DIRECT_OUTPUT 1
)
if((MSVC OR ("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")) AND ${_libtype} MATCHES "STATIC")
set_target_properties(${_actual_target_name} PROPERTIES
OUTPUT_NAME "${sundials_add_library_OUTPUT_NAME}_static"
CLEAN_DIRECT_OUTPUT 1
)
else()
set_target_properties(${_actual_target_name} PROPERTIES
OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME}
CLEAN_DIRECT_OUTPUT 1
)
endif()
else()
set_target_properties(${_actual_target_name} PROPERTIES
OUTPUT_NAME ${target}
Expand Down
4 changes: 4 additions & 0 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Added the following MRI coupling tables

**Bug Fixes**

Fixed conflicting ``.lib`` files between shared and static libs when using ``MSVC`` on Windows

Fixed invalid ``SUNDIALS_EXPORT`` generated macro when building both shared and static libs

Updated the CMake variable ``HIP_PLATFORM`` default to ``amd`` as the previous
default, ``hcc``, is no longer recognized in ROCm 5.7.0 or newer. The new
default is also valid in older version of ROCm (at least back to version 4.3.1).
Expand Down
Loading