diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0750f95e63..578fb5e527 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -603,7 +603,7 @@ jobs: cmake --build . ctest --output-on-failure --no-tests=error - posix-cmake-install-legacy: + posix-cmake-install-legacy-static: strategy: fail-fast: false matrix: @@ -655,6 +655,58 @@ jobs: cmake --build . ctest --output-on-failure --no-tests=error + posix-cmake-install-legacy-shared: + strategy: + fail-fast: false + matrix: + include: + - os: macos-15 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v4 + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + - name: Configure + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBOOST_MATH_BUILD_WITH_LEGACY_FUNCTIONS=ON -DCMAKE_INSTALL_PREFIX=~/.local -DBUILD_SHARED_LIBS=ON .. + + - name: Install + run: | + cd ../boost-root/__build__ + cmake --build . --target install + + - name: Use the installed library (legacy compiled) + run: | + cd ../boost-root/libs/$LIBRARY/test/cmake_install_test_legacy + mkdir __build__ && cd __build__ + cmake -DCMAKE_INSTALL_PREFIX=~/.local .. + cmake --build . + ctest --output-on-failure --no-tests=error + sycl-cmake-test: strategy: fail-fast: false diff --git a/CMakeLists.txt b/CMakeLists.txt index e2d6c055d3..7d5f6d270b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,11 +52,12 @@ option(BOOST_MATH_BUILD_WITH_LEGACY_FUNCTIONS "Build the C99 and TR1 compiled li if(BOOST_MATH_BUILD_WITH_LEGACY_FUNCTIONS) include(CheckCXXSourceCompiles) -get_target_property(_config_type Boost::config TYPE) -if(_config_type STREQUAL "INTERFACE_LIBRARY") - get_target_property(_config_inc Boost::config INTERFACE_INCLUDE_DIRECTORIES) -else() - set(_config_inc "") +set(_config_inc "") +if(NOT BOOST_MATH_STANDALONE) + get_target_property(_config_type Boost::config TYPE) + if(_config_type STREQUAL "INTERFACE_LIBRARY") + get_target_property(_config_inc Boost::config INTERFACE_INCLUDE_DIRECTORIES) + endif() endif() set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include" ${_config_inc}) 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") foreach(type IN LISTS types) add_library(boost_math_tr1${type} ${TR1_SOURCES${type}}) add_library(Boost::math_tr1${type} ALIAS boost_math_tr1${type}) - target_link_libraries(boost_math_tr1${type} PUBLIC Boost::config) + if(NOT BOOST_MATH_STANDALONE) + target_link_libraries(boost_math_tr1${type} PUBLIC Boost::config) + endif() target_include_directories(boost_math_tr1${type} PRIVATE src/tr1) target_include_directories(boost_math_tr1${type} PRIVATE include) add_library(boost_math_c99${type} ${C99_SOURCES${type}}) add_library(Boost::math_c99${type} ALIAS boost_math_c99${type}) - target_link_libraries(boost_math_c99${type} PUBLIC Boost::config) + if(NOT BOOST_MATH_STANDALONE) + target_link_libraries(boost_math_c99${type} PUBLIC Boost::config) + endif() target_include_directories(boost_math_c99${type} PRIVATE src/tr1) target_include_directories(boost_math_c99${type} PRIVATE include) if(BUILD_SHARED_LIBS) target_compile_definitions(boost_math_tr1${type} PUBLIC BOOST_MATH_TR1_DYN_LINK=1) target_compile_definitions(boost_math_c99${type} PUBLIC BOOST_MATH_TR1_DYN_LINK=1) - if(MSVC) + if(WIN32) target_compile_definitions(boost_math_tr1${type} PRIVATE "BOOST_SYMBOL_EXPORT=__declspec(dllexport)" BOOST_ALL_NO_LIB) target_compile_definitions(boost_math_c99${type} PRIVATE "BOOST_SYMBOL_EXPORT=__declspec(dllexport)" BOOST_ALL_NO_LIB) + else() + target_compile_definitions(boost_math_tr1${type} PRIVATE "BOOST_SYMBOL_EXPORT=__attribute__((visibility(\"default\")))" BOOST_ALL_NO_LIB) + target_compile_definitions(boost_math_c99${type} PRIVATE "BOOST_SYMBOL_EXPORT=__attribute__((visibility(\"default\")))" BOOST_ALL_NO_LIB) endif() endif()