From c61dedc3eab719b4e0af398dc9ab48e9c77a00aa Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Thu, 23 Jan 2025 15:59:17 +0100 Subject: [PATCH 1/6] veg: Fix build with Cl and C++20 --- include/proxsuite/linalg/veg/internal/macros.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/proxsuite/linalg/veg/internal/macros.hpp b/include/proxsuite/linalg/veg/internal/macros.hpp index 5f277f443..bcca7d903 100644 --- a/include/proxsuite/linalg/veg/internal/macros.hpp +++ b/include/proxsuite/linalg/veg/internal/macros.hpp @@ -477,7 +477,7 @@ #define __VEG_IMPL_PREFIX_explicit #define __VEG_IMPL_PARAM_EXPAND(I, _, Param) \ - __VEG_PP_TAIL Param __VEG_PP_HEAD Param + __VEG_PP_ID(__VEG_PP_TAIL Param) __VEG_PP_ID(__VEG_PP_HEAD Param) #if VEG_HAS_CONCEPTS #define __VEG_IMPL_TEMPLATE(Attr_Name, TParams, Constraint, ...) \ template<__VEG_PP_REMOVE_PAREN(TParams)> \ From 3141a95be6709bb68d112609e41aebb02db09bf3 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Thu, 23 Jan 2025 16:06:08 +0100 Subject: [PATCH 2/6] changelog: Add entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4f120080..ef3c9e776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed +* Fix Windows build with MSVC compiler and C++20 standard ([#368](https://github.com/Simple-Robotics/proxsuite/pull/368)) + ## [0.7.0] - 2025-01-21 ### Fixed From 164422706b6e93992d17cba1366020f7c7a62cd1 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 24 Jan 2025 11:35:20 +0100 Subject: [PATCH 3/6] ci: Remove steps with same arguments and try to use cl compiler on windows-latest --- .github/workflows/ci-linux-osx-win-conda.yml | 51 ++++---------------- 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci-linux-osx-win-conda.yml b/.github/workflows/ci-linux-osx-win-conda.yml index eac917f76..884749c91 100644 --- a/.github/workflows/ci-linux-osx-win-conda.yml +++ b/.github/workflows/ci-linux-osx-win-conda.yml @@ -26,11 +26,14 @@ jobs: os: macos-latest - name: macos-14 os: macos-14 + # proxsuite doesn't build with vs2019, so we use clang-cl instead - name: windows-2019-clang-cl os: windows-2019 compiler: clang-cl + # proxsuite should work with vs2022 - name: windows-latest os: windows-latest + compiler: cl - name: macos-latest os: macos-latest build_type: Debug @@ -95,7 +98,7 @@ jobs: env - name: Configure [Conda/Linux&macOS] - if: contains(matrix.os, 'macos-latest') || contains(matrix.os, 'ubuntu') + if: contains(matrix.os, 'macos-') || contains(matrix.os, 'ubuntu') shell: bash -l {0} run: | echo $(whereis ccache) @@ -105,18 +108,6 @@ jobs: cd build cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON -DTEST_JULIA_INTERFACE:BOOL=OFF -DOpenMP_ROOT=$CONDA_PREFIX - - name: Configure [Conda/macOS14] - if: contains(matrix.os, 'macos-14') - shell: bash -l {0} - run: | - echo $(whereis ccache) - echo $(which ccache) - git submodule update --init - mkdir build - cd build - cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON -DTEST_JULIA_INTERFACE:BOOL=OFF -DOpenMP_ROOT=$CONDA_PREFIX - - - name: Configure [Conda/macOS-debug/CheckMalloc] if: contains(matrix.os, 'macos-latest') && contains(matrix.build_type, 'Debug') shell: bash -l {0} @@ -126,41 +117,17 @@ jobs: cd build cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCHECK_RUNTIME_MALLOC:BOOL=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON -DTEST_JULIA_INTERFACE:BOOL=OFF -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DOpenMP_ROOT=$CONDA_PREFIX - - name: Configure [Conda/Windows-2019] - if: contains(matrix.os, 'windows-2019') - shell: bash -l {0} - run: | - echo $(where ccache) - git submodule update --init - mkdir build - cd build - export CXX=clang-cl - export CC=clang-cl - cmake .. -G"Ninja" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON - - - name: Configure [Conda/Windows-latest] - if: contains(matrix.os, 'windows-latest') && contains(matrix.cxx_std, '20') - shell: bash -l {0} - run: | - echo $(where ccache) - git submodule update --init - mkdir build - cd build - export CXX=clang-cl - export CC=clang-cl - cmake .. -G"Ninja" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON - - - name: Configure [Conda/Windows-latest] - if: contains(matrix.os, 'windows-latest') && contains(matrix.cxx_std, '17') + - name: Configure [Conda/Windows] + if: contains(matrix.os, 'windows-') shell: bash -l {0} run: | echo $(where ccache) git submodule update --init mkdir build cd build - export CXX=clang-cl - export CC=clang-cl - cmake .. -G"Ninja" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON + export CC=${{ matrix.compiler }} + export CXX=${{ matrix.compiler }} + cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON - name: Build [Conda] shell: bash -l {0} From 4faceb6930c24546ae3f57f73fb520fe64a56150 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 24 Jan 2025 14:00:31 +0100 Subject: [PATCH 4/6] ci: Run Windows build with CMD --- .github/workflows/ci-linux-osx-win-conda.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-linux-osx-win-conda.yml b/.github/workflows/ci-linux-osx-win-conda.yml index 884749c91..8fa9929bc 100644 --- a/.github/workflows/ci-linux-osx-win-conda.yml +++ b/.github/workflows/ci-linux-osx-win-conda.yml @@ -119,15 +119,15 @@ jobs: - name: Configure [Conda/Windows] if: contains(matrix.os, 'windows-') - shell: bash -l {0} + # It's better to use CMD to have all MSVC variables setup + shell: cmd /C CALL {0} run: | - echo $(where ccache) git submodule update --init mkdir build cd build - export CC=${{ matrix.compiler }} - export CXX=${{ matrix.compiler }} - cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=${CONDA_PREFIX}/Lib/site-packages -DPYTHON_EXECUTABLE=${CONDA_PREFIX}/python.exe -DOpenMP_ROOT=$CONDA_PREFIX -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON + set CC=${{ matrix.compiler }} + set CXX=${{ matrix.compiler }} + cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=%CONDA_PREFIX%/Lib/site-packages -DPYTHON_EXECUTABLE=%CONDA_PREFIX%/python.exe -DOpenMP_ROOT=%CONDA_PREFIX% -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON - name: Build [Conda] shell: bash -l {0} From 563b56a3f109fb6c894e9cd99278369712efd866 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 24 Jan 2025 14:37:01 +0100 Subject: [PATCH 5/6] ci: Split the build step --- .github/workflows/ci-linux-osx-win-conda.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-linux-osx-win-conda.yml b/.github/workflows/ci-linux-osx-win-conda.yml index 8fa9929bc..c0255e742 100644 --- a/.github/workflows/ci-linux-osx-win-conda.yml +++ b/.github/workflows/ci-linux-osx-win-conda.yml @@ -129,12 +129,21 @@ jobs: set CXX=${{ matrix.compiler }} cmake .. -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} -DBUILD_PYTHON_INTERFACE:BOOL=ON -DPYTHON_SITELIB=%CONDA_PREFIX%/Lib/site-packages -DPYTHON_EXECUTABLE=%CONDA_PREFIX%/python.exe -DOpenMP_ROOT=%CONDA_PREFIX% -DBUILD_WITH_OPENMP_SUPPORT:BOOL=ON -DLINK_PYTHON_INTERFACE_TO_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DINSTALL_DOCUMENTATION:BOOL=ON - - name: Build [Conda] + - name: Build [Conda/Linux&macOS] + if: contains(matrix.os, 'macos-') || contains(matrix.os, 'ubuntu') shell: bash -l {0} run: | cd build cmake --build . --config ${{ matrix.build_type }} -v -j 1 + - name: Build [Conda/Windows] + if: contains(matrix.os, 'windows-') + # It's better to use CMD to have all MSVC variables setup + shell: cmd /C CALL {0} + run: | + cd build + cmake --build . --config ${{ matrix.build_type }} -v -j 1 + - name: Build documentation [Conda] shell: bash -l {0} run: | From a383d125a43f6cfbc694623aa7a02d4e89a4633f Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 24 Jan 2025 15:06:17 +0100 Subject: [PATCH 6/6] ci: Use VS2022 on Windows-latest --- .github/workflows/ci-linux-osx-win-conda.yml | 22 ++++++++------------ .github/workflows/conda/environment.yml | 20 ++++++++++++++++++ 2 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/conda/environment.yml diff --git a/.github/workflows/ci-linux-osx-win-conda.yml b/.github/workflows/ci-linux-osx-win-conda.yml index c0255e742..582818810 100644 --- a/.github/workflows/ci-linux-osx-win-conda.yml +++ b/.github/workflows/ci-linux-osx-win-conda.yml @@ -62,21 +62,17 @@ jobs: - uses: conda-incubator/setup-miniconda@v3 with: - miniforge-version: latest activate-environment: proxsuite - channels: conda-forge - conda-remove-defaults: "true" + environment-file: .github/workflows/conda/environment.yml + auto-activate-base: false + auto-update-conda: true - - - name: Install dependencies [Conda] + - name: Install dependencies [Conda/Windows-latest] + if: contains(matrix.os, 'windows-latest') shell: bash -l {0} run: | - # Compilation related dependencies - conda install cmake compilers make pkg-config doxygen ninja graphviz typing_extensions llvm-openmp clang - # Main dependencies - conda install eigen simde - # Test dependencies - conda install libmatio numpy scipy + # Use VS2022 on Windows-latest + conda install vs2022_win-64 - name: Install julia [Linux] if: contains(matrix.os, 'ubuntu') @@ -119,7 +115,7 @@ jobs: - name: Configure [Conda/Windows] if: contains(matrix.os, 'windows-') - # It's better to use CMD to have all MSVC variables setup + # It's better to use CMD to have all VS variables setup shell: cmd /C CALL {0} run: | git submodule update --init @@ -138,7 +134,7 @@ jobs: - name: Build [Conda/Windows] if: contains(matrix.os, 'windows-') - # It's better to use CMD to have all MSVC variables setup + # It's better to use CMD to have all VS variables setup shell: cmd /C CALL {0} run: | cd build diff --git a/.github/workflows/conda/environment.yml b/.github/workflows/conda/environment.yml new file mode 100644 index 000000000..8f791028c --- /dev/null +++ b/.github/workflows/conda/environment.yml @@ -0,0 +1,20 @@ +name: proxsuite +channels: + - conda-forge + - nodefaults +dependencies: + - cmake + - compilers + - make + - pkg-config + - doxygen + - ninja + - graphviz + - typing_extensions + - llvm-openmp + - clang + - eigen + - simde + - libmatio + - numpy + - scipy