From 245cb9038930e3297f5088457b46fdcef1290256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20Mar=C3=A9chal?= <45510813+JasonMarechal25@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:59:02 +0100 Subject: [PATCH] Use vcpkg for dependency management on all platforms (#770) - Change centos7 image management. Image is now antaresrte/xpansion-centos7 and tags follow semver schema - Migrate depedency management to vcpkg - Use action to setup cmake as much as possible - jsoncpp staticly linked to ease deploiment Comments and explanations: - _git fetch --unshallow_ is necessary because action checkout is shallow but vcpkg requires a "full" clone. - tbb is still manage manualy - jsoncpp is still link dynamicaly for MSVC due to difficulty to manage static/synamique with MSVC --- .github/workflows/build_centos7.yml | 84 +++++++++++++------ .github/workflows/build_oracle8.yml | 67 +++++++-------- .github/workflows/build_ubuntu.yml | 32 ++++--- .github/workflows/build_windows.yml | 8 +- .github/workflows/centos-release.yml | 73 ++++++++++------ .../workflows/centos7-system-deps-build.yml | 73 +++++++++------- .github/workflows/ol8-release.yml | 51 ++++++----- .github/workflows/publish_centos_docker.yml | 4 +- .github/workflows/ubuntu-release.yml | 36 +++++--- .../workflows/ubuntu-system-deps-build.yml | 43 +++++----- .../workflows/windows-vcpkg-deps-build.yml | 5 +- .github/workflows/windows-vcpkg.yml | 5 +- CMakeLists.txt | 37 ++++---- docker/centos7-system-deps | 5 +- .../benders/benders_by_batch/CMakeLists.txt | 4 - src/cpp/benders/benders_core/CMakeLists.txt | 7 +- src/cpp/benders/benders_mpi/BendersMPI.cpp | 2 +- .../benders/benders_sequential/CMakeLists.txt | 4 - src/cpp/benders/factories/BendersFactory.cpp | 5 +- src/cpp/benders/output/CMakeLists.txt | 5 +- src/cpp/helpers/CMakeLists.txt | 10 +-- src/cpp/sensitivity/CMakeLists.txt | 3 - tests/cpp/helpers/CMakeLists.txt | 2 + vcpkg.json | 7 +- 24 files changed, 335 insertions(+), 237 deletions(-) diff --git a/.github/workflows/build_centos7.yml b/.github/workflows/build_centos7.yml index da87fd5bd..c89f5014f 100644 --- a/.github/workflows/build_centos7.yml +++ b/.github/workflows/build_centos7.yml @@ -32,13 +32,13 @@ jobs: if: steps.changed-files.outputs.any_changed == 'true' uses: elgohr/Publish-Docker-Github-Action@main with: - name: antaresrte/rte-antares + name: antaresrte/xpansion-centos7 username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} workdir: docker dockerfile: centos7-system-deps cache: false - tags: centos7-system-deps + tags: latest,1.0.0 versions: runs-on: ubuntu-latest @@ -72,13 +72,13 @@ jobs: build: runs-on: ubuntu-latest needs: [ docker_publish, versions ] - container: 'antaresrte/rte-antares:centos7-system-deps' + container: 'antaresrte/xpansion-centos7' strategy: matrix: xprs: [ # { value: XPRESS-ON, ref: 8.13a }, - { value: XPRESS-ON, ref: 9.2.5 }, - # { value: XPRESS-OFF } + { value: XPRESS-ON, ref: 9.2.5 }, + #{ value: XPRESS-OFF } ] env: XPRESSDIR: ${{ github.workspace }}/xpress @@ -87,8 +87,12 @@ jobs: XPRESSDIR_CONTAINER: ${GITHUB_WORKSPACE}/xpress XPRESS_CONTAINER: ${GITHUB_WORKSPACE}/xpress/bin XPRS_LIB_Path_CONTAINER: ${GITHUB_WORKSPACE}/xpress/lib + VCPKG_ROOT: ${{ github.workspace }}/vcpkg steps: + - run: | + source /opt/rh/devtoolset-10/enable + echo $PATH >> $GITHUB_PATH - name: Get release if: github.event_name == 'release' && github.event.action == 'created' id: get_release @@ -98,7 +102,22 @@ jobs: with: submodules: true - - uses: ./.github/workflows/compile-gtest + - run: | + yum install -y nodejs + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: '3.28.x' + + #Lukka's action doesn't work on runner. + #jwlawson's action doesn't work in ACT + #I left this here to quicly switch between one or the other + # - uses: lukka/get-cmake@latest + # with: + # useLocalCache: false + # useCloudCache: true + - name: Checkout xpressmp linux uses: actions/checkout@v3 #keep v3 with: @@ -109,6 +128,23 @@ jobs: ref: ${{matrix.xprs.ref}} if: matrix.xprs.value == 'XPRESS-ON' + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v3 + with: + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} + + - name: Download pre-compiled librairies uses: ./.github/workflows/download-extract-precompiled-libraries-tgz with: @@ -116,17 +152,9 @@ jobs: antares-version: ${{needs.versions.outputs.antares-version}} os: centos7 os-full-name: CentOS-7.9.2009 - #variant: -ortools-xpress - - - name: Compile Boost - uses: ./.github/workflows/compile-boost - with: - prefix: "../rte-antares-deps-Release/" - name: Compile tbb uses: ./.github/workflows/compile-tbb - with: - cmake: 'cmake3' - name: Install dependencies run: | @@ -134,13 +162,20 @@ jobs: pip3 install wheel #Does not work in requirements pip3 install -r requirements-tests.txt pip3 install -r requirements-ui.txt + + - name: vcpkg install + run: | + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install + - name: Configure run: | [[ ${{ matrix.xprs.value }} == "XPRESS-ON" ]] && XPRESS_VALUE="ON" || XPRESS_VALUE="OFF" source /opt/rh/devtoolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 -B _build -S . \ + cmake -B _build -S . \ -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ -DBUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=Release \ @@ -148,20 +183,19 @@ jobs: -DBUILD_UI=ON \ -DXPRESS=${{ env.XPRESS_VALUE }} \ -DXPRESS_ROOT=${{ env.XPRESSDIR }} \ - -DALLOW_RUN_AS_ROOT=ON + -DALLOW_RUN_AS_ROOT=ON \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake + - name: Build run: | - source /opt/rh/devtoolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 --build _build --config Release -j8 --target install + cmake --build _build --config Release -j$(nproc) + - name: Running unit tests timeout-minutes: 120 shell: bash run: | - source /etc/profile.d/modules.sh - module load mpi + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH export LD_LIBRARY_PATH=LD_LIBRARY_PATH:${{ env.XPRS_LIB_Path_CONTAINER }} export XPRESS=${{ env.XPRESS_CONTAINER }} cd _build - ctest3 -C Release --output-on-failure -L "unit|benders|lpnamer|medium" + ctest -C Release --output-on-failure -L "unit|benders|lpnamer|medium" diff --git a/.github/workflows/build_oracle8.yml b/.github/workflows/build_oracle8.yml index 132444be4..3cd3339b0 100644 --- a/.github/workflows/build_oracle8.yml +++ b/.github/workflows/build_oracle8.yml @@ -49,9 +49,10 @@ jobs: container: 'oraclelinux:8' strategy: matrix: - xprs: [ #{ value: XPRESS-ON, ref: 8.13a }, - { value: XPRESS-ON, ref: 9.2.5 }, - # { value: XPRESS-OFF } + xprs: [ + # { value: XPRESS-ON, ref: 8.13a }, + { value: XPRESS-ON, ref: 9.2.5 }, + # { value: XPRESS-OFF } ] needs: [ versions ] env: @@ -63,18 +64,26 @@ jobs: XPRS_LIB_Path_CONTAINER: ${GITHUB_WORKSPACE}/xpress/lib steps: - - name: Install System run: | - dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core openmpi-devel - dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-10-toolchain zlib-devel python3-devel + dnf install -y epel-release git wget rpm-build redhat-lsb-core openmpi-devel + dnf install -y unzip libuuid-devel gcc-toolset-10-toolchain python3-devel zlib-devel + #make gcc &co available system wide and "action wide" + source /opt/rh/gcc-toolset-10/enable + echo $PATH >> $GITHUB_PATH + + - run: | + dnf module install -y nodejs:20/common + + - uses: lukka/get-cmake@latest + with: + useLocalCache: false + useCloudCache: true - uses: actions/checkout@v4 with: submodules: true - - uses: ./.github/workflows/compile-gtest - - name: Checkout xpressmp linux uses: actions/checkout@v4 with: @@ -89,9 +98,8 @@ jobs: run: | dnf update -y dnf install -y python3 python3-pip - - - run: - echo ${{needs.versions.outputs.antares-deps-version}} + pip3 install wheel #Too late to install in requirements.txt + pip3 install -r requirements-tests.txt - name: Download pre-compiled librairies uses: ./.github/workflows/download-extract-precompiled-libraries-tgz @@ -101,27 +109,24 @@ jobs: os: Oracle8 os-full-name: OracleServer-8.9 - - name: Compile Boost - uses: ./.github/workflows/compile-boost - with: - prefix: "../rte-antares-deps-Release/" - name: Compile TBB uses: ./.github/workflows/compile-tbb - - name: Install dependencies + - run: | + mkdir -p ${{ github.workspace }}/vcpkg_cache + + - name: vcpkg install run: | - source /opt/rh/gcc-toolset-10/enable - pip3 install wheel #Too late to install in requirements.txt - pip3 install -r requirements-tests.txt + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install - name: Configure run: | [[ ${{ matrix.xprs.value }} == "XPRESS-ON" ]] && XPRESS_VALUE="ON" || XPRESS_VALUE="OFF" - source /opt/rh/gcc-toolset-10/enable - dnf install jsoncpp-devel - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 -B _build -S . \ + cmake -B _build -S . \ -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ -DBUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=Release \ @@ -129,23 +134,19 @@ jobs: -DBUILD_UI=OFF \ -DXPRESS=${{ env.XPRESS_VALUE }} \ -DXPRESS_ROOT=${{ env.XPRESSDIR }} \ - -DALLOW_RUN_AS_ROOT=ON - + -DALLOW_RUN_AS_ROOT=ON \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build run: | - source /opt/rh/gcc-toolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake --build _build --config Release -j2 + cmake --build _build --config Release -j$(nproc) - name: Running unit tests timeout-minutes: 120 shell: bash run: | - source /etc/profile.d/modules.sh - module load mpi + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH export LD_LIBRARY_PATH=LD_LIBRARY_PATH:${{ env.XPRS_LIB_Path_CONTAINER }} export XPRESS=${{ env.XPRESS_CONTAINER }} cd _build - ctest3 -C Release --output-on-failure -L "unit|benders|lpnamer|medium" + ctest -C Release --output-on-failure -L "unit|benders|lpnamer|medium" diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/build_ubuntu.yml index 902bbbf97..918319f75 100644 --- a/.github/workflows/build_ubuntu.yml +++ b/.github/workflows/build_ubuntu.yml @@ -23,8 +23,8 @@ jobs: os: [ ubuntu-20.04 ] xprs: [ #{ value: XPRESS-ON, ref: 8.13a }, - { value: XPRESS-ON, ref: 9.2.5 }, - # { value: XPRESS-OFF } + { value: XPRESS-ON, ref: 9.2.5 }, + # { value: XPRESS-OFF } ] env: XPRESSDIR: ${{ github.workspace }}/xpress @@ -65,7 +65,7 @@ jobs: - name: Install mandatory system libraries run: | sudo apt-get update --fix-missing - sudo apt-get install -y ccache cmake libgtest-dev libjsoncpp-dev libtbb-dev libopenmpi-dev + sudo apt-get install -y ccache libtbb-dev sudo apt-get install -y g++-10 gcc-10 - name: Update alternatives @@ -78,6 +78,11 @@ jobs: sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 sudo update-alternatives --set c++ /usr/bin/g++ + - uses: lukka/get-cmake@latest + with: + useLocalCache: false + useCloudCache: true + - name: Read antares-solver version id: antares-version uses: ./.github/actions/read-json-value @@ -107,11 +112,16 @@ jobs: os: ${{matrix.os}} os-full-name: Ubuntu-20.04 - - name: Compile Boost - uses: ./.github/workflows/compile-boost - with: - prefix: "../rte-antares-deps-Release/" - load-toolset: 'false' + - run: | + mkdir -p ${{ github.workspace }}/vcpkg_cache + + - name: vcpkg install + run: | + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install - name: Configure shell: bash @@ -129,13 +139,15 @@ jobs: -DCMAKE_INSTALL_PREFIX=_install \ -DBUILD_UI=ON \ -DXPRESS=${{ env.XPRESS_VALUE }} \ - -DXPRESS_ROOT=${{ env.XPRESSDIR }} + -DXPRESS_ROOT=${{ env.XPRESSDIR }} \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build run: | - cmake --build _build --config Release -j8 + cmake --build _build --config Release -j$(nproc) - name: Test run: | + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH cd _build ctest -C Release --output-on-failure -L "medium|unit|benders|lpnamer" diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index be2f6cfd8..b8277b5ff 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -23,7 +23,7 @@ jobs: os: [ windows-latest ] triplet: [ x64-windows ] xprs: [ #{ value: XPRESS-ON, ref: 8.13a }, - { value: XPRESS-ON, ref: 9.2.5 }, + { value: XPRESS-ON, ref: 9.2.5 }, #{ value: XPRESS-OFF } ] env: @@ -106,6 +106,7 @@ jobs: - name: Install deps with VCPKG run: | cd vcpkg + git fetch --unshallow ./bootstrap-vcpkg.sh vcpkg install --triplet ${{matrix.triplet}} rm -rf buildtrees @@ -135,10 +136,11 @@ jobs: - name: Configure run: | $pwd=Get-Location - cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DCMAKE_PREFIX_PATH="$pwd\rte-antares-${{steps.antares-version.outputs.result}}-installer-64bits" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON -DXPRESS=${{ env.XPRESS_VALUE }} -DXPRESS_ROOT="${{ env.XPRESSDIR }}" + cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DCMAKE_PREFIX_PATH="$pwd\rte-antares-${{steps.antares-version.outputs.result}}-installer-64bits" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON -DXPRESS=${{ env.XPRESS_VALUE }} -DXPRESS_ROOT="${{ env.XPRESSDIR }}" - name: Build run: | - cmake --build _build --config Release -j2 --target install + cmake --build _build --config Release -j4 + - name: Running unit tests timeout-minutes: 120 shell: cmd diff --git a/.github/workflows/centos-release.yml b/.github/workflows/centos-release.yml index 509140cc5..8a6cfbef5 100644 --- a/.github/workflows/centos-release.yml +++ b/.github/workflows/centos-release.yml @@ -40,13 +40,13 @@ jobs: if: steps.changed-files.outputs.any_changed == 'true' uses: elgohr/Publish-Docker-Github-Action@main with: - name: antaresrte/rte-antares + name: antaresrte/xpansion-centos7 username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} workdir: docker dockerfile: centos7-system-deps cache: false - tags: centos7-system-deps + tags: latest,1.0.0 userguide: runs-on: ubuntu-latest @@ -108,7 +108,7 @@ jobs: build: runs-on: ubuntu-latest needs: [ docker_publish, userguide, versions ] - container: 'antaresrte/rte-antares:centos7-system-deps' + container: 'antaresrte/xpansion-centos7' strategy: matrix: xprs: [ @@ -134,6 +134,18 @@ jobs: with: submodules: true + - run: | + source /opt/rh/devtoolset-10/enable + echo $PATH >> $GITHUB_PATH + + - run: | + yum install -y nodejs + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: '3.28.x' + - name: Download pre-compiled librairies uses: ./.github/workflows/download-extract-precompiled-libraries-tgz with: @@ -141,18 +153,9 @@ jobs: antares-version: ${{needs.versions.outputs.antares-version}} os: centos7 os-full-name: CentOS-7.9.2009 - #variant: -ortools-xpress - - - uses: ./.github/workflows/compile-gtest - - name: Compile Boost - uses: ./.github/workflows/compile-boost - with: - prefix: "../rte-antares-deps-Release/" - name: Compile tbb uses: ./.github/workflows/compile-tbb - with: - cmake: 'cmake3' - name: Install dependencies run: | @@ -177,6 +180,31 @@ jobs: ref: 8.13a if: matrix.xprs == 'XPRESS-ON' + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v3 + with: + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} + + + - name: vcpkg install + run: | + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install + - name: Configure shell: bash run: | @@ -186,9 +214,7 @@ jobs: export XPRESS_VALUE="OFF" fi source /opt/rh/devtoolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 -B _build -S . \ + cmake -B _build -S . \ -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ -DBUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=Release \ @@ -197,26 +223,25 @@ jobs: -DUSER_GUIDE_PATH="docs/${{ needs.userguide.outputs.pdf-name }}" \ -DXPRESS=${XPRESS_VALUE} \ -DXPRESS_ROOT=${XPRESSDIR} \ - -DALLOW_RUN_AS_ROOT=ON + -DALLOW_RUN_AS_ROOT=ON \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build shell: bash run: | - source /opt/rh/devtoolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 --build _build --config Release -j2 --target install + cmake --build _build --config Release -j$(nproc) + cd _build + cmake --install . - name: Running unit tests timeout-minutes: 120 shell: bash run: | - source /etc/profile.d/modules.sh - module load mpi + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH export LD_LIBRARY_PATH=LD_LIBRARY_PATH:${{ env.XPRS_LIB_Path_CONTAINER }} export XPRESS=${{ env.XPRESS_CONTAINER }} cd _build - ctest3 -C Release --output-on-failure -L "unit|benders|lpnamer|medium" + ctest -C Release --output-on-failure -L "unit|benders|lpnamer|medium" - name: set name variables id: single_file_name @@ -234,7 +259,7 @@ jobs: run: | cd _build export FILE_NAME="antaresXpansion-${{env.VERSION_WITH_XPRESS}}-CentOS-7.9.2009" - cpack3 -G TGZ -D CPACK_PACKAGE_FILE_NAME=$FILE_NAME + cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=$FILE_NAME echo "TGZ_NAME=$FILE_NAME.tar.gz" >> $GITHUB_ENV - name: Upload .tar.gz diff --git a/.github/workflows/centos7-system-deps-build.yml b/.github/workflows/centos7-system-deps-build.yml index 7be482647..27ff365ed 100644 --- a/.github/workflows/centos7-system-deps-build.yml +++ b/.github/workflows/centos7-system-deps-build.yml @@ -27,13 +27,13 @@ jobs: if: steps.changed-files.outputs.any_changed == 'true' uses: elgohr/Publish-Docker-Github-Action@main with: - name: antaresrte/rte-antares + name: antaresrte/xpansion-centos7 username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} workdir: docker dockerfile: centos7-system-deps cache: false - tags: centos7-system-deps + tags: latest,1.0.0 versions: runs-on: ubuntu-latest @@ -68,7 +68,7 @@ jobs: runs-on: ubuntu-latest needs: [ docker_publish, versions ] - container: 'antaresrte/rte-antares:centos7-system-deps' + container: 'antaresrte/xpansion-centos7' steps: - id: branch-name @@ -78,59 +78,72 @@ jobs: with: submodules: true + - run: | + source /opt/rh/devtoolset-10/enable + echo $PATH >> $GITHUB_PATH + - name: Install dependencies run: | pip3 install wheel #Does not work in requirements pip3 install -r requirements-tests.txt - - uses: ./.github/workflows/compile-gtest - - name: Compile Boost - uses: ./.github/workflows/compile-boost + - run: | + yum install -y nodejs + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 with: - prefix: "../rte-antares-deps-Release/" + cmake-version: '3.28.x' - name: Compile tbb - uses: ./.github/workflows/compile-tbb - with: - cmake: 'cmake3' + uses: ./.github/workflows/compile-tbb - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v3 with: - cmake-version: '3.22.x' + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} + + - name: vcpkg install + run: | + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install - name: Configure run: | - source /opt/rh/devtoolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH cmake -B _build -S . \ -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ - -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON -DALLOW_RUN_AS_ROOT=ON + -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON -DALLOW_RUN_AS_ROOT=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build run: | - source /opt/rh/devtoolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake --build _build --config Release -j2 --target install + cmake --build _build --config Release -j$(nproc) + cd _build + cmake --install . - name: Running unit tests run: | - source /etc/profile.d/modules.sh - module load mpi + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH cd _build - ctest3 -C Release --output-on-failure -L "unit|benders|lpnamer|medium" + ctest -C Release --output-on-failure -L "unit|benders|lpnamer|medium" - name: .tar.gz creation run: | cd _build - cpack3 -G TGZ - - - name: Installer .rpm creation - run: | - cd _build - cpack3 -G RPM + cpack -G TGZ - id: create-single-file name: Single file .tar.gz creation diff --git a/.github/workflows/ol8-release.yml b/.github/workflows/ol8-release.yml index 12883b9f9..270c39129 100644 --- a/.github/workflows/ol8-release.yml +++ b/.github/workflows/ol8-release.yml @@ -102,16 +102,35 @@ jobs: - name: Install System run: | - dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core openmpi-devel - dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-10-toolchain zlib-devel python3-devel + dnf install -y epel-release git wget rpm-build redhat-lsb-core + dnf install -y unzip libuuid-devel gcc-toolset-10-toolchain zlib-devel python3-devel source /opt/rh/gcc-toolset-10/enable - dnf install -y jsoncpp-devel + echo $PATH >> $GITHUB_PATH - name: Checkout uses: actions/checkout@v4 with: submodules: true + - run: | + dnf module install -y nodejs:20/common + + - uses: lukka/get-cmake@latest + with: + useLocalCache: false + useCloudCache: true + + - run: | + mkdir -p ${{ github.workspace }}/vcpkg_cache + + - name: vcpkg install + run: | + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install + - name: Download pre-compiled librairies uses: ./.github/workflows/download-extract-precompiled-libraries-tgz with: @@ -121,16 +140,9 @@ jobs: os-full-name: OracleServer-8.9 #variant: -ortools-xpress - - name: Compile Boost - uses: ./.github/workflows/compile-boost - with: - prefix: "../rte-antares-deps-Release/" - - name: Compile tbb uses: ./.github/workflows/compile-tbb - - uses: ./.github/workflows/compile-gtest - - name: Install dependencies run: | pip3 install --upgrade pip @@ -165,7 +177,7 @@ jobs: source /opt/rh/gcc-toolset-10/enable export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 -B _build -S . \ + cmake -B _build -S . \ -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ -DBUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=Release \ @@ -174,26 +186,25 @@ jobs: -DUSER_GUIDE_PATH="docs/${{ needs.userguide.outputs.pdf-name }}" \ -DXPRESS=${XPRESS_VALUE} \ -DXPRESS_ROOT=${XPRESSDIR} \ - -DALLOW_RUN_AS_ROOT=ON + -DALLOW_RUN_AS_ROOT=ON \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build shell: bash run: | - source /opt/rh/gcc-toolset-10/enable - export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH - export PATH=/usr/lib64/openmpi/bin:$PATH - cmake3 --build _build --config Release -j2 --target install + cmake --build _build --config Release -j$(nproc) + cd _build + cmake --install . - name: Running unit tests timeout-minutes: 120 shell: bash run: | - source /etc/profile.d/modules.sh - module load mpi + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH export LD_LIBRARY_PATH=LD_LIBRARY_PATH:${{ env.XPRS_LIB_Path_CONTAINER }} export XPRESS=${{ env.XPRESS_CONTAINER }} cd _build - ctest3 -C Release --output-on-failure -L "unit|benders|lpnamer|medium" + ctest -C Release --output-on-failure -L "unit|benders|lpnamer|medium" - name: set name variables id: single_file_name @@ -211,7 +222,7 @@ jobs: run: | cd _build export FILE_NAME="antaresXpansion-${{env.VERSION_WITH_XPRESS}}-OracleServer-8.9" - cpack3 -G TGZ -D CPACK_PACKAGE_FILE_NAME=$FILE_NAME + cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=$FILE_NAME echo "TGZ_NAME=$FILE_NAME.tar.gz" >> $GITHUB_ENV - name: Upload .tar.gz diff --git a/.github/workflows/publish_centos_docker.yml b/.github/workflows/publish_centos_docker.yml index 12d7aa448..53284c09d 100644 --- a/.github/workflows/publish_centos_docker.yml +++ b/.github/workflows/publish_centos_docker.yml @@ -18,10 +18,10 @@ jobs: id: docker_push uses: elgohr/Publish-Docker-Github-Action@main with: - name: antaresrte/rte-antares + name: antaresrte/xpansion-centos7 username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} workdir: docker dockerfile: centos7-system-deps cache: false - tags: centos7-system-deps \ No newline at end of file + tags: latest,1.0.0 \ No newline at end of file diff --git a/.github/workflows/ubuntu-release.yml b/.github/workflows/ubuntu-release.yml index 102369ea3..1d7c317f5 100644 --- a/.github/workflows/ubuntu-release.yml +++ b/.github/workflows/ubuntu-release.yml @@ -98,11 +98,12 @@ jobs: - name: Install mandatory system libraries run: | sudo apt-get update --fix-missing - sudo apt-get install libjsoncpp-dev libgtest-dev libboost-mpi-dev libboost-program-options-dev libtbb-dev - cd /usr/src/googletest/ - sudo cmake . - sudo cmake --build . --target install - sudo apt-get install -y g++-10 gcc-10 + sudo apt-get install libtbb-dev + + - uses: lukka/get-cmake@latest + with: + useLocalCache: false + useCloudCache: true - name: Update alternatives #mpicxx uses "g++" so we need g++ to be symbolic link to g++-10 @@ -143,18 +144,23 @@ jobs: os: ${{matrix.os}} os-full-name: Ubuntu-20.04 - - name: Compile Boost - uses: ./.github/workflows/compile-boost - with: - prefix: "../rte-antares-deps-Release/" - load-toolset: 'false' - - name: Download userguide uses: actions/download-artifact@v3 with: name: user-guide path: docs/ + - run: | + mkdir -p ${{ github.workspace }}/vcpkg_cache + + - name: vcpkg install + run: | + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install + - name: Configure shell: bash run: | @@ -173,11 +179,14 @@ jobs: -DBUILD_UI=ON \ -DUSER_GUIDE_PATH="docs/${{ needs.userguide.outputs.pdf-name }}" \ -DXPRESS=${{ env.XPRESS_VALUE }} \ - -DXPRESS_ROOT=${{ env.XPRESSDIR }} + -DXPRESS_ROOT=${{ env.XPRESSDIR }} \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build run: | - cmake --build _build --config Release -j8 --target install + cmake --build _build --config Release -j$(nproc) + cd _build + cmake --install . - name: set name variables id: single_file_name @@ -208,6 +217,7 @@ jobs: - name: Running unit tests run: | + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH cd _build ctest -C Release --output-on-failure -L "medium|unit|benders|lpnamer" diff --git a/.github/workflows/ubuntu-system-deps-build.yml b/.github/workflows/ubuntu-system-deps-build.yml index 1670a9c88..7e94a897b 100644 --- a/.github/workflows/ubuntu-system-deps-build.yml +++ b/.github/workflows/ubuntu-system-deps-build.yml @@ -40,11 +40,12 @@ jobs: - name: Install mandatory system libraries run: | sudo apt-get update --fix-missing - sudo apt-get install libjsoncpp-dev libgtest-dev libboost-mpi-dev libboost-program-options-dev libtbb-dev - cd /usr/src/googletest/ - sudo cmake . - sudo cmake --build . --target install - sudo apt-get install -y g++-10 gcc-10 + sudo apt-get install libtbb-dev + + - uses: lukka/get-cmake@latest + with: + useLocalCache: false + useCloudCache: true - name: Update alternatives #mpicxx uses "g++" so we need g++ to be symbolic link to g++-10 @@ -56,13 +57,6 @@ jobs: sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 sudo update-alternatives --set c++ /usr/bin/g++ - - name: Compile Boost - uses: ./.github/workflows/compile-boost - with: - prefix: "../rte-antares-deps-Release/" - load-toolset: 'false' - - - name: Read antares-xpansion version id: antares-xpansion-version uses: ./.github/actions/read-json-value @@ -70,6 +64,17 @@ jobs: path: 'antares-version.json' key: 'antares_xpansion_version' + - run: | + mkdir -p ${{ github.workspace }}/vcpkg_cache + + - name: vcpkg install + run: | + pushd vcpkg + git fetch --unshallow + ./bootstrap-vcpkg.sh + popd + vcpkg/vcpkg install + - name: Configure run: | cmake -B _build -S . \ @@ -77,14 +82,18 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=_install \ - -DBUILD_UI=ON + -DBUILD_UI=ON \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build run: | - cmake --build _build --config Release -j2 --target install + cmake --build _build --config Release -j$(nproc) + cd _build + cmake --install . - name: Running unit tests run: | + export PATH=${GITHUB_WORKSPACE}/vcpkg_installed/x64-linux/tools/openmpi/bin/:$PATH cd _build ctest -C Release --output-on-failure -L "medium|unit|benders|lpnamer" @@ -98,9 +107,3 @@ jobs: run: | cd _build cpack -G TGZ - - - name: Installer .deb creation - run: | - cd _build - cpack -G DEB - diff --git a/.github/workflows/windows-vcpkg-deps-build.yml b/.github/workflows/windows-vcpkg-deps-build.yml index 594c9a94f..a15055b59 100644 --- a/.github/workflows/windows-vcpkg-deps-build.yml +++ b/.github/workflows/windows-vcpkg-deps-build.yml @@ -76,6 +76,7 @@ jobs: - name: Install deps with VCPKG run: | cd vcpkg + git fetch --unshallow ./bootstrap-vcpkg.sh vcpkg install --triplet ${{matrix.triplet}} rm -rf buildtrees @@ -95,7 +96,9 @@ jobs: - name: Build run: | - cmake --build _build --config Release -j2 --target install + cmake --build _build --config Release -j4 + cd _build + cmake --install . - name: Running unit tests shell: cmd diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index aa8418099..8fc06fe7c 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -150,6 +150,7 @@ jobs: - name: Install deps with VCPKG run: | cd vcpkg + git fetch --unshallow ./bootstrap-vcpkg.sh vcpkg install --triplet ${{matrix.triplet}} rm -rf buildtrees @@ -190,7 +191,9 @@ jobs: - name: Build run: | - cmake --build _build --config Release -j2 --target install + cmake --build _build --config Release -j4 + cd _build + cmake --install . - name: Running unit tests shell: cmd diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fb9091e3..bde157b08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,16 +74,15 @@ if (MSVC) message ("WINDOWS") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") - set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") set (RUNTIME_IGNORE_LIST_RELEASE "/NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:msvcprtd.lib /NODEFAULTLIB:libcmtd.lib") set (CMAKE_EXE_LINKER_FLAGS_RELEASE " ${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${RUNTIME_IGNORE_LIST_RELEASE}") set (CMAKE_SHARED_LINKER_FLAGS_RELEASE " ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${RUNTIME_IGNORE_LIST_RELEASE}") set (CMAKE_STATIC_LINKER_FLAGS_RELEASE " ${CMAKE_STATIC_LINKER_FLAGS_RELEASE} ${RUNTIME_IGNORE_LIST_RELEASE}") - - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") + + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /EHsc") - - + else () set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") @@ -235,8 +234,18 @@ if (SOLVER) endif() find_package(jsoncpp CONFIG REQUIRED) - - +macro(jsoncpplib_name libname) + if (MSVC) + set(${libname} jsoncpp_lib) + else () + set(${libname} jsoncpp_static) + endif () +endmacro() +jsoncpplib_name(jsonlib) +install(FILES + $ + DESTINATION bin +) ## Coin-OR (Clp and CBC solvers) if(COIN_OR) @@ -324,20 +333,6 @@ install(DIRECTORY ${ANTARES_SOLVER_DIR}/../lib/ install(PROGRAMS ${ANTARES_SOLVER_PATH} TYPE BIN) -find_package(antares-study-updater) -if (antares-study-updater_FOUND) - - if (${CMAKE_BUILD_TYPE} STREQUAL "Release") - get_target_property(ANTARES_STUDY_UPDATER_PATH antares-${ANTARES_VERSION}-study-updater IMPORTED_LOCATION_RELEASE) - else () - get_target_property(ANTARES_STUDY_UPDATER_PATH antares-${ANTARES_VERSION}-study-updater IMPORTED_LOCATION_DEBUG) - endif () - - install(PROGRAMS ${ANTARES_STUDY_UPDATER_PATH} - TYPE BIN) - -endif () - include (InstallRequiredSystemLibraries) if(CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/docker/centos7-system-deps b/docker/centos7-system-deps index b534fed80..cf2e7b824 100644 --- a/docker/centos7-system-deps +++ b/docker/centos7-system-deps @@ -8,9 +8,8 @@ RUN yum install -y epel-release RUN \ yum install -y wget git epel-release redhat-lsb-core gcc gcc-c++ make centos-release-scl scl-utils &&\ - yum install -y cmake3 devtoolset-10-gcc* environment-modules rpm-build zlib-devel &&\ - yum install -y jsoncpp-devel openmpi-devel doxygen graphviz &&\ - yum install -y gtest-devel &&\ + yum install -y devtoolset-10-gcc* environment-modules rpm-build zlib-devel &&\ + yum install -y doxygen graphviz &&\ yum install -y install python3-devel && \ yum install -y libuuid-devel diff --git a/src/cpp/benders/benders_by_batch/CMakeLists.txt b/src/cpp/benders/benders_by_batch/CMakeLists.txt index 56128aebc..096caf8f2 100644 --- a/src/cpp/benders/benders_by_batch/CMakeLists.txt +++ b/src/cpp/benders/benders_by_batch/CMakeLists.txt @@ -21,15 +21,11 @@ add_library (benders_by_batch_core STATIC ${CMAKE_CURRENT_SOURCE_DIR}/RandomBatchShuffler.cpp ) -get_target_property(JSON_INC_PATH jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES) - - target_include_directories (benders_by_batch_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ${JSON_INC_PATH}/jsoncpp ) target_link_libraries (benders_by_batch_core diff --git a/src/cpp/benders/benders_core/CMakeLists.txt b/src/cpp/benders/benders_core/CMakeLists.txt index e3f38ffac..d2434990c 100644 --- a/src/cpp/benders/benders_core/CMakeLists.txt +++ b/src/cpp/benders/benders_core/CMakeLists.txt @@ -29,16 +29,13 @@ add_library (benders_core STATIC ${CMAKE_CURRENT_SOURCE_DIR}/BendersMathLogger.cpp ) -get_target_property(JSON_INC_PATH jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES) - - target_include_directories (benders_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include - ${JSON_INC_PATH}/jsoncpp ) +jsoncpplib_name(jsonlib) target_link_libraries (benders_core PUBLIC helpers @@ -46,7 +43,7 @@ target_link_libraries (benders_core solvers glog::glog TBB::tbb - jsoncpp_lib + ${jsonlib} ) add_library (${PROJECT_NAME}::benders_core ALIAS benders_core) \ No newline at end of file diff --git a/src/cpp/benders/benders_mpi/BendersMPI.cpp b/src/cpp/benders/benders_mpi/BendersMPI.cpp index bf2859bc7..a4088a98a 100644 --- a/src/cpp/benders/benders_mpi/BendersMPI.cpp +++ b/src/cpp/benders/benders_mpi/BendersMPI.cpp @@ -322,4 +322,4 @@ void BendersMpi::launch() { free(); } _world.barrier(); -} +} \ No newline at end of file diff --git a/src/cpp/benders/benders_sequential/CMakeLists.txt b/src/cpp/benders/benders_sequential/CMakeLists.txt index 73ded7159..68741f1a1 100644 --- a/src/cpp/benders/benders_sequential/CMakeLists.txt +++ b/src/cpp/benders/benders_sequential/CMakeLists.txt @@ -10,15 +10,11 @@ add_library (benders_sequential_core STATIC ${CMAKE_CURRENT_SOURCE_DIR}/BendersSequential.cpp ) -get_target_property(JSON_INC_PATH jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES) - - target_include_directories (benders_sequential_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ${JSON_INC_PATH}/jsoncpp ) target_link_libraries (benders_sequential_core diff --git a/src/cpp/benders/factories/BendersFactory.cpp b/src/cpp/benders/factories/BendersFactory.cpp index 6231a1f7b..45f808ee6 100644 --- a/src/cpp/benders/factories/BendersFactory.cpp +++ b/src/cpp/benders/factories/BendersFactory.cpp @@ -197,7 +197,6 @@ int RunExternalLoop_(char** argv, const std::filesystem::path& options_file, } BendersMainFactory::BendersMainFactory(int argc, char** argv, - mpi::environment& env, mpi::communicator& world) : argv_(argv), penv_(&env), pworld_(&world) { @@ -212,7 +211,9 @@ BendersMainFactory::BendersMainFactory(int argc, char** argv, BendersMainFactory::BendersMainFactory( int argc, char** argv, const std::filesystem::path& options_file, mpi::environment& env, mpi::communicator& world) - : argv_(argv), options_file_(options_file), penv_(&env), pworld_(&world) { + : argv_(argv), options_file_(options_file), + penv_(&env), + pworld_(&world) { // First check usage (options are given) if (world.rank() == 0) { usage(argc); diff --git a/src/cpp/benders/output/CMakeLists.txt b/src/cpp/benders/output/CMakeLists.txt index 3882a62f5..039a9879f 100644 --- a/src/cpp/benders/output/CMakeLists.txt +++ b/src/cpp/benders/output/CMakeLists.txt @@ -11,7 +11,6 @@ add_library (output_core STATIC ${CMAKE_CURRENT_SOURCE_DIR}/JsonWriter.cpp ) -get_target_property(JSON_INC_PATH jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES) get_target_property(xpansion_interfaces_path xpansion_interfaces INTERFACE_INCLUDE_DIRECTORIES) target_include_directories (output_core @@ -19,13 +18,13 @@ target_include_directories (output_core ${CMAKE_CURRENT_SOURCE_DIR}/include PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ${JSON_INC_PATH}/jsoncpp ${xpansion_interfaces_path} ) +jsoncpplib_name(jsonlib) target_link_libraries (output_core PUBLIC - jsoncpp_lib + ${jsonlib} helpers ) diff --git a/src/cpp/helpers/CMakeLists.txt b/src/cpp/helpers/CMakeLists.txt index f3e94f5e9..08812bd5a 100644 --- a/src/cpp/helpers/CMakeLists.txt +++ b/src/cpp/helpers/CMakeLists.txt @@ -38,27 +38,21 @@ add_library (helpers STATIC ${CMAKE_CURRENT_SOURCE_DIR}/LoggerUtils.h ) -get_target_property(JSON_INC_PATH jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES) get_target_property(xpansion_interfaces_path xpansion_interfaces INTERFACE_INCLUDE_DIRECTORIES) target_include_directories (helpers PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ${JSON_INC_PATH}/jsoncpp ${xpansion_interfaces_path} ) +jsoncpplib_name(jsonlib) target_link_libraries (helpers PUBLIC - jsoncpp_lib + ${jsonlib} solvers glog::glog gflags::gflags Boost::boost Boost::program_options MINIZIP::minizip-ng ) - -install(FILES - $ - DESTINATION bin -) diff --git a/src/cpp/sensitivity/CMakeLists.txt b/src/cpp/sensitivity/CMakeLists.txt index ee1ecdc6d..fcfd0d0b0 100644 --- a/src/cpp/sensitivity/CMakeLists.txt +++ b/src/cpp/sensitivity/CMakeLists.txt @@ -19,13 +19,10 @@ add_library (sensitivity_core Analysis.h Analysis.cpp) -get_target_property(JSON_INC_PATH jsoncpp_lib -INTERFACE_INCLUDE_DIRECTORIES) target_include_directories (sensitivity_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include - ${JSON_INC_PATH}/jsoncpp ) target_link_libraries (sensitivity_core diff --git a/tests/cpp/helpers/CMakeLists.txt b/tests/cpp/helpers/CMakeLists.txt index 4479f1c32..cff4acc9c 100644 --- a/tests/cpp/helpers/CMakeLists.txt +++ b/tests/cpp/helpers/CMakeLists.txt @@ -11,6 +11,7 @@ target_include_directories (helpers_test ${CMAKE_CURRENT_SOURCE_DIR} ) +jsoncpplib_name(jsonlib) target_link_libraries (helpers_test PRIVATE GTest::Main helpers @@ -18,6 +19,7 @@ target_link_libraries (helpers_test PRIVATE lp_namer_model lp_namer_input_reader lp_namer_problem_modifier + ${jsonlib} ${PROJECT_NAME}::benders_sequential_core ) diff --git a/vcpkg.json b/vcpkg.json index e8d86672d..35e3b00cf 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,11 +1,16 @@ { "name": "antares-xpansion", - "version-string": "0.4.0", + "version-string": "1.2.2", + "builtin-baseline": "9484a57dd560b89f0a583be08af6753611c57fd5", "dependencies": [ "jsoncpp", "gtest", "boost-mpi", "boost-program-options", "zlib" + ], + "overrides": [ + { "name": "boost-mpi", "version": "1.81.0" }, + { "name": "boost-program-options", "version": "1.81.0" } ] }