Skip to content

Commit b93b641

Browse files
authored
Merge pull request #11 from contour-terminal/revive-msvc-support
[Github CI] Reenable MSVC compiler testing
2 parents 4ded85e + 3e7a41c commit b93b641

File tree

5 files changed

+69
-45
lines changed

5 files changed

+69
-45
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,27 @@ on:
1212
jobs:
1313

1414
# FIXME: We're having a linker error wrt. Catch2 on Windows with MSVC
15-
# windows-msvc:
16-
# name: "Windows - MSVC"
17-
# runs-on: windows-latest
18-
# steps:
19-
# - uses: actions/checkout@v4
20-
# - name: Install dependencies
21-
# run: choco install ninja
22-
# - name: configure
23-
# run: cmake --preset windows-cl-release
24-
# - name: build
25-
# run: cmake --build --preset windows-cl-release
26-
# - name: test
27-
# run: ctest --preset windows-cl-release -VV
15+
windows-msvc:
16+
name: "Windows - MSVC"
17+
runs-on: windows-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Install dependencies
21+
run: choco install ninja
22+
- name: "vcpkg: Install dependencies"
23+
uses: lukka/[email protected]
24+
id: runvcpkg
25+
with:
26+
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
27+
vcpkgGitCommitId: 80403036a665cb8fcc1a1b3e17593d20b03b2489
28+
- name: configure
29+
run: cmake --preset windows-cl-release -D REFLECTION_TESTING=ON
30+
env:
31+
VCPKG_ROOT: "${{ runner.workspace }}/vcpkg"
32+
- name: build
33+
run: cmake --build --preset windows-cl-release
34+
- name: test
35+
run: ctest --preset windows-cl-release -VV
2836

2937
ubuntu24-clang:
3038
name: "Ubuntu Linux - Clang ${{ matrix.clang_version }}"
@@ -43,7 +51,7 @@ jobs:
4351
- name: Install ninja and catch2
4452
run: sudo apt-get install ninja-build catch2
4553
- name: configure
46-
run: cmake --preset linux-clang-release -D REFLECTION_TESTING=ON
54+
run: cmake --preset linux-clang-release -D REFLECTION_TESTING=ON
4755
- name: build
4856
run: cmake --build --preset linux-clang-release
4957
- name: test

CMakePresets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"inherits": ["windows-common"],
3232
"generator": "Visual Studio 17 2022",
3333
"cacheVariables": {
34+
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
3435
"CMAKE_CXX_COMPILER": "cl"
3536
}
3637
},

cmake/ThirdParties.cmake

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,43 @@ message(STATUS "base dir: ${FETCHCONTENT_BASE_DIR}")
1919
message(STATUS "dnld dir: ${3rdparty_DOWNLOAD_DIR}")
2020

2121
macro(ThirdPartiesAdd_Catch2)
22-
set(3rdparty_Catch2_VERSION "3.4.0" CACHE STRING "Embedded catch2 version")
23-
set(3rdparty_Catch2_CHECKSUM "SHA256=122928b814b75717316c71af69bd2b43387643ba076a6ec16e7882bfb2dfacbb" CACHE STRING "Embedded catch2 checksum")
24-
set(3rdparty_Catch2_URL "https://github.com/catchorg/Catch2/archive/refs/tags/v${3rdparty_Catch2_VERSION}.tar.gz")
25-
set(CATCH_BUILD_EXAMPLES OFF CACHE INTERNAL "")
26-
set(CATCH_BUILD_EXTRA_TESTS OFF CACHE INTERNAL "")
27-
set(CATCH_BUILD_TESTING OFF CACHE INTERNAL "")
28-
set(CATCH_ENABLE_WERROR OFF CACHE INTERNAL "")
29-
set(CATCH_INSTALL_DOCS OFF CACHE INTERNAL "")
30-
set(CATCH_INSTALL_HELPERS OFF CACHE INTERNAL "")
31-
if(THIRDPARTIES_HAS_FETCHCONTENT)
32-
FetchContent_Declare(
33-
Catch2
34-
URL "${3rdparty_Catch2_URL}"
35-
URL_HASH "${3rdparty_Catch2_CHECKSUM}"
36-
DOWNLOAD_DIR "${3rdparty_DOWNLOAD_DIR}"
37-
DOWNLOAD_NAME "catch2-${3rdparty_Catch2_VERSION}.tar.gz"
38-
EXCLUDE_FROM_ALL
39-
DOWNLOAD_EXTRACT_TIMESTAMP 1
40-
)
41-
FetchContent_MakeAvailable(Catch2)
22+
#find_package(Catch2 QUIET)
23+
find_package(Catch2)
24+
if (Catch2_FOUND)
25+
message(STATUS "Catch2 found: ${Catch2_DIR}")
4226
else()
43-
download_project(
44-
PROJ Catch2
45-
URL "${3rdparty_Catch2_URL}"
46-
URL_HASH "${3rdparty_Catch2_CHECKSUM}"
47-
PREFIX "${FETCHCONTENT_BASE_DIR}/Catch2-${3rdparty_Catch2_VERSION}"
48-
DOWNLOAD_DIR "${3rdparty_DOWNLOAD_DIR}"
49-
DOWNLOAD_NAME "catch2-${3rdparty_Catch2_VERSION}.tar.gz"
50-
EXCLUDE_FROM_ALL
51-
DOWNLOAD_EXTRACT_TIMESTAMP 1
52-
)
27+
message(STATUS "Catch2 not found as system package, adding it as a thirdparty")
28+
set(3rdparty_Catch2_VERSION "3.4.0" CACHE STRING "Embedded catch2 version")
29+
set(3rdparty_Catch2_CHECKSUM "SHA256=122928b814b75717316c71af69bd2b43387643ba076a6ec16e7882bfb2dfacbb" CACHE STRING "Embedded catch2 checksum")
30+
set(3rdparty_Catch2_URL "https://github.com/catchorg/Catch2/archive/refs/tags/v${3rdparty_Catch2_VERSION}.tar.gz")
31+
set(CATCH_BUILD_EXAMPLES OFF CACHE INTERNAL "")
32+
set(CATCH_BUILD_EXTRA_TESTS OFF CACHE INTERNAL "")
33+
set(CATCH_BUILD_TESTING OFF CACHE INTERNAL "")
34+
set(CATCH_ENABLE_WERROR OFF CACHE INTERNAL "")
35+
set(CATCH_INSTALL_DOCS OFF CACHE INTERNAL "")
36+
set(CATCH_INSTALL_HELPERS OFF CACHE INTERNAL "")
37+
if(THIRDPARTIES_HAS_FETCHCONTENT)
38+
FetchContent_Declare(
39+
Catch2
40+
URL "${3rdparty_Catch2_URL}"
41+
URL_HASH "${3rdparty_Catch2_CHECKSUM}"
42+
DOWNLOAD_DIR "${3rdparty_DOWNLOAD_DIR}"
43+
DOWNLOAD_NAME "catch2-${3rdparty_Catch2_VERSION}.tar.gz"
44+
EXCLUDE_FROM_ALL
45+
DOWNLOAD_EXTRACT_TIMESTAMP 1
46+
)
47+
FetchContent_MakeAvailable(Catch2)
48+
else()
49+
download_project(
50+
PROJ Catch2
51+
URL "${3rdparty_Catch2_URL}"
52+
URL_HASH "${3rdparty_Catch2_CHECKSUM}"
53+
PREFIX "${FETCHCONTENT_BASE_DIR}/Catch2-${3rdparty_Catch2_VERSION}"
54+
DOWNLOAD_DIR "${3rdparty_DOWNLOAD_DIR}"
55+
DOWNLOAD_NAME "catch2-${3rdparty_Catch2_VERSION}.tar.gz"
56+
EXCLUDE_FROM_ALL
57+
DOWNLOAD_EXTRACT_TIMESTAMP 1
58+
)
59+
endif()
5360
endif()
5461
endmacro()

include/reflection-cpp/reflection.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,8 @@ consteval auto GetName()
672672
#if defined(_MSC_VER) && !defined(__clang__)
673673
std::string_view str = REFLECTION_PRETTY_FUNCTION;
674674
str = str.substr(str.rfind("::") + 2);
675-
return str.substr(0, str.find('>'));
675+
str = str.substr(0, str.find('>'));
676+
return str.substr(str.find('<')+1);
676677
#else
677678
constexpr auto MarkerStart = std::string_view { "E = " };
678679
std::string_view str = REFLECTION_PRETTY_FUNCTION;

vcpkg.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
3+
"builtin-baseline": "80403036a665cb8fcc1a1b3e17593d20b03b2489",
4+
"dependencies": [
5+
{ "name": "catch2", "version>=": "3.4.0" }
6+
]
7+
}

0 commit comments

Comments
 (0)