diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml index 0ba6d24941..8e36ab7e9d 100644 --- a/.github/workflows/build_windows.yaml +++ b/.github/workflows/build_windows.yaml @@ -66,11 +66,41 @@ jobs: cd build SET ZLIB_ROOT=C:\local\zlib-1.3.1 call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Vc\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} -vcvars_ver=14.3 || exit 1 - cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DQL_BUILD_EXAMPLES=false -DQL_BUILD_TEST_SUITE=false -DQL_BUILD_BENCHMARK=false -DQL_ENABLE_SESSIONS=true -DORE_USE_ZLIB=ON -DORE_BUILD_DOC=false -DBOOST_INCLUDEDIR=C:\local\boost -DZLIB_LIBRARY=C:\local\zlib-1.3.1\build\Release\zlib.lib -DBOOST_LIBRARYDIR=C:\local\boost\lib64-msvc-14.3 -L - cmake --build . -j 2 --verbose + cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DQL_BUILD_EXAMPLES=false -DQL_BUILD_TEST_SUITE=false -DQL_BUILD_BENCHMARK=false -DQL_ENABLE_SESSIONS=true -DORE_USE_ZLIB=ON -DORE_BUILD_DOC=false -DORE_BUILD_EXAMPLES=false -DORE_BUILD_APP=true -DORE_BUILD_TESTS=true -DBOOST_INCLUDEDIR=C:\local\boost -DZLIB_LIBRARY=C:\local\zlib-1.3.1\build\Release\zlib.lib -DBOOST_LIBRARYDIR=C:\local\boost\lib64-msvc-14.3 -L + cmake --build . -j 4 --verbose + - name: Save tests artifacts + uses: actions/upload-artifact@v4 + if: ${{ matrix.arch == 'AMD64' }} + with: + name: test-suites + path: | + ${{ github.workspace }}\build\OREData\test\ored-test-suite.exe + ${{ github.workspace }}\build\OREAnalytics\test\orea-test-suite.exe + ${{ github.workspace }}\build\QuantExt\test\quantext-test-suite.exe - name: Save executables as artifacts if: startsWith(github.ref, 'refs/tags/v') uses: actions/upload-artifact@v3 with: name: ore-windows-${{ matrix.arch }} - path: D:\a\Engine\Engine\build\App\ore.exe \ No newline at end of file + path: ${{ github.workspace }}\build\App\ore.exe + + tests: + name: testing + runs-on: windows-2022 + needs: build + steps: + - uses: actions/checkout@v4 + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: test-suites + path: ${{ github.workspace }}\test-suites + - name: run QuantExt tests + run: | + .\test-suites\QuantExt\test\quantext-test-suite.exe + - name: run OREData tests + run: | + .\test-suites\OREData\test\ored-test-suite.exe -- --base_data_path=.\OREData\test + - name: run OREAnalytics tests + run: | + .\test-suites\OREAnalytics\test\orea-test-suite.exe diff --git a/.github/workflows/linux_build.yaml b/.github/workflows/linux_build.yaml index f1ef7c00a6..ecb8d2d7c1 100644 --- a/.github/workflows/linux_build.yaml +++ b/.github/workflows/linux_build.yaml @@ -37,12 +37,60 @@ jobs: sudo apt update sudo apt install -y libboost-all-dev libboost-test-dev ninja-build - name: cmake configure - run : mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=false -DQL_BUILD_EXAMPLES=false -DQL_BUILD_TEST_SUITE=false -DQL_BUILD_BENCHMARK=false -DQL_ENABLE_SESSIONS=true -DORE_BUILD_DOC=false -G "Ninja" .. + run : | + mkdir build + cd build + cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=false \ + -DQL_BUILD_EXAMPLES=false \ + -DQL_BUILD_TEST_SUITE=false \ + -DQL_BUILD_BENCHMARK=false \ + -DQL_ENABLE_SESSIONS=true \ + -DORE_BUILD_DOC=false \ + -DORE_BUILD_EXAMPLES=false \ + -DORE_BUILD_APP=true \ + -DORE_BUILD_TESTS=true \ + -L - name: cmake build - run: cd build/; pwd; cmake --build . -j $(nproc) + run: | + cd build + cmake --build . -j $(nproc) + - name: Save tests artifacts + uses: actions/upload-artifact@v4 + with: + name: test-suites + path: | + ${{ github.workspace }}/build/OREData/test/ored-test-suite + ${{ github.workspace }}/build/OREAnalytics/test/orea-test-suite + ${{ github.workspace }}/build/QuantExt/test/quantext-test-suite - name: Save executables as artifacts if: startsWith(github.ref, 'refs/tags/v') uses: actions/upload-artifact@v3 with: name: ore-exe-linux - path: /home/runner/work/Engine/Engine/build/App/ore + path: ${{ github.workspace }}/build/App/ore + +# Run tests + tests: + name: testing + runs-on: ubuntu-22.04 + needs: build + steps: + - uses: actions/checkout@v4 + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: test-suites + path: ${{ github.workspace }}/test-suites + - name: run QuantExt tests + run: | + chmod +x ./test-suites/QuantExt/test/quantext-test-suite + ./test-suites/QuantExt/test/quantext-test-suite + - name: run OREData tests + run: | + chmod +x ./test-suites/OREData/test/ored-test-suite + ./test-suites/OREData/test/ored-test-suite -- --base_data_path=./OREData/test + - name: run OREAnalytics tests + run: | + chmod +x ./test-suites/OREAnalytics/test/orea-test-suite + ./test-suites/OREAnalytics/test/orea-test-suite diff --git a/cmake/commonSettings.cmake b/cmake/commonSettings.cmake index be4a4a2b05..1b5dac8f73 100644 --- a/cmake/commonSettings.cmake +++ b/cmake/commonSettings.cmake @@ -69,30 +69,6 @@ if(MSVC) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>") - # link against static boost libraries - if(NOT DEFINED Boost_USE_STATIC_LIBS) - if(BUILD_SHARED_LIBS) - set(Boost_USE_STATIC_LIBS 0) - else() - set(Boost_USE_STATIC_LIBS 1) - endif() - endif() - - # Boost static runtime ON for MSVC - if(NOT DEFINED Boost_USE_STATIC_RUNTIME) - if(BUILD_SHARED_LIBS OR(MSVC AND MSVC_LINK_DYNAMIC_RUNTIME)) - set(Boost_USE_STATIC_RUNTIME 0) - else() - set(Boost_USE_STATIC_RUNTIME 1) - endif() - endif() - - - - IF(NOT Boost_USE_STATIC_LIBS) - add_definitions(-DBOOST_ALL_DYN_LINK) - add_definitions(-DBOOST_TEST_DYN_LINK) - endif() add_compile_options(/external:env:BOOST) add_compile_options(/external:W0) add_compile_definitions(_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) @@ -137,9 +113,8 @@ else() set(BUILD_SHARED_LIBS ON) endif() - # link against dynamic boost libraries - add_definitions(-DBOOST_ALL_DYN_LINK) - add_definitions(-DBOOST_TEST_DYN_LINK) + # Issue with Boost CMake finder introduced in version 1.70 + set(Boost_NO_BOOST_CMAKE ON) # avoid a crash in valgrind that sometimes occurs if this flag is not defined add_definitions(-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) @@ -196,9 +171,44 @@ else() # if QuantLib is build separately include_directories("${CMAKE_CURRENT_LIST_DIR}/../QuantLib/build") - endif() +# Boost # +# link against static boost libraries +if(NOT DEFINED Boost_USE_STATIC_LIBS) + if(BUILD_SHARED_LIBS) + set(Boost_USE_STATIC_LIBS OFF) + else() + set(Boost_USE_STATIC_LIBS ON) + endif() +endif() + +# Boost static runtime. ON for MSVC +if(NOT DEFINED Boost_USE_STATIC_RUNTIME) + if(BUILD_SHARED_LIBS OR(MSVC AND MSVC_LINK_DYNAMIC_RUNTIME)) + set(Boost_USE_STATIC_RUNTIME OFF) + else() + set(Boost_USE_STATIC_RUNTIME ON) + endif() +endif() + +if(NOT Boost_USE_STATIC_LIBS) + # link against dynamic boost libraries + add_definitions(-DBOOST_ALL_DYN_LINK) + add_definitions(-DBOOST_TEST_DYN_LINK) +endif() + +# Use Boost Release/Debug +if(CMAKE_BUILD_TYPE MATCHES Release) + set(Boost_USE_DEBUG_LIBS OFF) + set(Boost_USE_RELEASE_LIBS ON) +elseif(CMAKE_BUILD_TYPE MATCHES Debug) + set(Boost_USE_DEBUG_LIBS ON) + set(Boost_USE_RELEASE_LIBS OFF) +endif() + +# Boost end # + # workaround when building with boost 1.81, see https://github.com/boostorg/phoenix/issues/111 add_definitions(-DBOOST_PHOENIX_STL_TUPLE_H_)