Skip to content

Fix MSVC CI #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,59 @@ jobs:
# macos-latest, # cppfront is currently broken on AppleClang
ubuntu-latest,
]
include:
- os: windows-latest
gen: Visual Studio 17 2022
- os: ubuntu-latest
gen: Ninja
env:
CMAKE_GENERATOR: ${{ matrix.gen }}
CMAKE_BUILD_TYPE: Release
CMAKE_CONFIG_TYPE: Release
CMAKE_PREFIX_PATH: ${{github.workspace}}/_local
runs-on: ${{ matrix.os }}
steps:
# System set-up
- uses: actions/checkout@v3
with:
submodules: true
- uses: ilammy/msvc-dev-cmd@v1

- uses: lukka/get-cmake@latest

- name: Install GCC 11
if: startsWith(matrix.os, 'ubuntu')
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gcc-11 g++-11
echo "CC=gcc-11" >> $GITHUB_ENV
echo "CXX=g++-11" >> $GITHUB_ENV

# Print tool versions
- name: Print tool versions
run: |
cmake --version

# Main cppfront library
- name: Configure cppfront
run: cmake -G Ninja -S . -B build/cppfront -DCMAKE_BUILD_TYPE=Release
run: cmake -S . -B build/cppfront
- name: Build cppfront
run: cmake --build build/cppfront --config Release
run: cmake --build build/cppfront
- name: Install cppfront locally
run: cmake --install build/cppfront --config Release --prefix _local
run: cmake --install build/cppfront --prefix _local

# Regression tests
- name: Configure regression tests
run: >
cmake -G Ninja -S regression-tests -B build/regression-tests -DCMAKE_BUILD_TYPE=Release
"-DCMAKE_PREFIX_PATH=${{github.workspace}}/_local"
run: cmake -S regression-tests -B build/regression-tests
- name: Build regression tests
run: cmake --build build/regression-tests --config Release
run: cmake --build build/regression-tests
- name: Run regression tests
run: ctest --output-on-failure -C Release -j 2
run: ctest --output-on-failure -j 2
working-directory: build/regression-tests

# Example
- name: Configure example
run: >
cmake -G Ninja -S example -B build/example -DCMAKE_BUILD_TYPE=Release
"-DCMAKE_PREFIX_PATH=${{github.workspace}}/_local"
run: cmake -S example -B build/example
- name: Build example
run: cmake --build build/example --config Release
run: cmake --build build/example
- name: Run example
run: ./build/example/main && cmake -E cat xyzzy
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "cppfront"]
path = cppfront
url = git@github.com:hsutter/cppfront.git
url = https://github.com/hsutter/cppfront.git
5 changes: 5 additions & 0 deletions regression-tests/cmake/CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ target_compile_options(
PRIVATE
"$<$<CXX_COMPILER_ID:MSVC>:/experimental:module>"
)
if (MSVC AND (MSVC_TOOLSET_VERSION LESS 143))
# need -std:c++latest on VS 2019 and below
# TODO: consider making this a more precise usage requirement on cppfront_cpp2util
target_compile_features(test-case PRIVATE cxx_std_23)
endif ()
4 changes: 3 additions & 1 deletion test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

set -e

export CMAKE_CXX_COMPILER_LAUNCHER=ccache
if which ccache; then
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
fi

rm -rf build _local

Expand Down