Skip to content

Commit cfe946f

Browse files
authored
Merge pull request #1382 from philippremy/develop
2 parents 61fa6bb + b1523d9 commit cfe946f

2 files changed

Lines changed: 69 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ jobs:
603603
cmake --build .
604604
ctest --output-on-failure --no-tests=error
605605
606-
posix-cmake-install-legacy:
606+
posix-cmake-install-legacy-static:
607607
strategy:
608608
fail-fast: false
609609
matrix:
@@ -655,6 +655,58 @@ jobs:
655655
cmake --build .
656656
ctest --output-on-failure --no-tests=error
657657
658+
posix-cmake-install-legacy-shared:
659+
strategy:
660+
fail-fast: false
661+
matrix:
662+
include:
663+
- os: macos-15
664+
665+
runs-on: ${{matrix.os}}
666+
667+
steps:
668+
- uses: actions/checkout@v4
669+
670+
- name: Setup Boost
671+
run: |
672+
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
673+
LIBRARY=${GITHUB_REPOSITORY#*/}
674+
echo LIBRARY: $LIBRARY
675+
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
676+
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
677+
echo GITHUB_REF: $GITHUB_REF
678+
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
679+
REF=${REF#refs/heads/}
680+
echo REF: $REF
681+
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
682+
echo BOOST_BRANCH: $BOOST_BRANCH
683+
cd ..
684+
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
685+
cd boost-root
686+
mkdir -p libs/$LIBRARY
687+
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
688+
git submodule update --init tools/boostdep
689+
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
690+
691+
- name: Configure
692+
run: |
693+
cd ../boost-root
694+
mkdir __build__ && cd __build__
695+
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBOOST_MATH_BUILD_WITH_LEGACY_FUNCTIONS=ON -DCMAKE_INSTALL_PREFIX=~/.local -DBUILD_SHARED_LIBS=ON ..
696+
697+
- name: Install
698+
run: |
699+
cd ../boost-root/__build__
700+
cmake --build . --target install
701+
702+
- name: Use the installed library (legacy compiled)
703+
run: |
704+
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test_legacy
705+
mkdir __build__ && cd __build__
706+
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
707+
cmake --build .
708+
ctest --output-on-failure --no-tests=error
709+
658710
sycl-cmake-test:
659711
strategy:
660712
fail-fast: false

CMakeLists.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ option(BOOST_MATH_BUILD_WITH_LEGACY_FUNCTIONS "Build the C99 and TR1 compiled li
5252
if(BOOST_MATH_BUILD_WITH_LEGACY_FUNCTIONS)
5353

5454
include(CheckCXXSourceCompiles)
55-
get_target_property(_config_type Boost::config TYPE)
56-
if(_config_type STREQUAL "INTERFACE_LIBRARY")
57-
get_target_property(_config_inc Boost::config INTERFACE_INCLUDE_DIRECTORIES)
58-
else()
59-
set(_config_inc "")
55+
set(_config_inc "")
56+
if(NOT BOOST_MATH_STANDALONE)
57+
get_target_property(_config_type Boost::config TYPE)
58+
if(_config_type STREQUAL "INTERFACE_LIBRARY")
59+
get_target_property(_config_inc Boost::config INTERFACE_INCLUDE_DIRECTORIES)
60+
endif()
6061
endif()
6162
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include" ${_config_inc})
6263
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_long_double_support.cpp> \n int main() { return 0;}" BOOST_MATH_HAS_LONG_DOUBLE)
@@ -130,22 +131,29 @@ list(TRANSFORM TR1_SOURCES APPEND ".cpp")
130131
foreach(type IN LISTS types)
131132
add_library(boost_math_tr1${type} ${TR1_SOURCES${type}})
132133
add_library(Boost::math_tr1${type} ALIAS boost_math_tr1${type})
133-
target_link_libraries(boost_math_tr1${type} PUBLIC Boost::config)
134+
if(NOT BOOST_MATH_STANDALONE)
135+
target_link_libraries(boost_math_tr1${type} PUBLIC Boost::config)
136+
endif()
134137
target_include_directories(boost_math_tr1${type} PRIVATE src/tr1)
135138
target_include_directories(boost_math_tr1${type} PRIVATE include)
136139

137140
add_library(boost_math_c99${type} ${C99_SOURCES${type}})
138141
add_library(Boost::math_c99${type} ALIAS boost_math_c99${type})
139-
target_link_libraries(boost_math_c99${type} PUBLIC Boost::config)
142+
if(NOT BOOST_MATH_STANDALONE)
143+
target_link_libraries(boost_math_c99${type} PUBLIC Boost::config)
144+
endif()
140145
target_include_directories(boost_math_c99${type} PRIVATE src/tr1)
141146
target_include_directories(boost_math_c99${type} PRIVATE include)
142147

143148
if(BUILD_SHARED_LIBS)
144149
target_compile_definitions(boost_math_tr1${type} PUBLIC BOOST_MATH_TR1_DYN_LINK=1)
145150
target_compile_definitions(boost_math_c99${type} PUBLIC BOOST_MATH_TR1_DYN_LINK=1)
146-
if(MSVC)
151+
if(WIN32)
147152
target_compile_definitions(boost_math_tr1${type} PRIVATE "BOOST_SYMBOL_EXPORT=__declspec(dllexport)" BOOST_ALL_NO_LIB)
148153
target_compile_definitions(boost_math_c99${type} PRIVATE "BOOST_SYMBOL_EXPORT=__declspec(dllexport)" BOOST_ALL_NO_LIB)
154+
else()
155+
target_compile_definitions(boost_math_tr1${type} PRIVATE "BOOST_SYMBOL_EXPORT=__attribute__((visibility(\"default\")))" BOOST_ALL_NO_LIB)
156+
target_compile_definitions(boost_math_c99${type} PRIVATE "BOOST_SYMBOL_EXPORT=__attribute__((visibility(\"default\")))" BOOST_ALL_NO_LIB)
149157
endif()
150158
endif()
151159

0 commit comments

Comments
 (0)