Skip to content

Commit 97cfb9c

Browse files
committed
Added msvc build test.
1 parent ff691d7 commit 97cfb9c

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

.github/workflows/build_and_test.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,32 @@ jobs:
5555

5656
- name: Test
5757
working-directory: ${{github.workspace}}/build
58-
run: ./tests/tree-tests
58+
run: ./tests/tree-tests
59+
60+
msvc:
61+
runs-on: windows-latest
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v2
65+
66+
- name: Setup MSVC
67+
uses: microsoft/setup-msbuild@v1.0.2
68+
69+
- name: Install vcpkg and gtest
70+
run: |
71+
git clone https://github.com/microsoft/vcpkg.git
72+
.\vcpkg\bootstrap-vcpkg.bat
73+
.\vcpkg\vcpkg.exe install gtest
74+
shell: pwsh
75+
env:
76+
VCPKG_DEFAULT_TRIPLET: x64-windows
77+
78+
- name: CMake Configure
79+
run: cmake -B ${{github.workspace}}/build -G"Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake -DINT_TREE_BUILD_EXAMPLES=on -DINT_TREE_ENABLE_TESTS=on -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
80+
81+
- name: Build
82+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
83+
84+
- name: Test
85+
working-directory: ${{github.workspace}}/build
86+
run: .\tests\tree-tests.exe

tests/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ file(GLOB sources "*.cpp")
1919
# Add Executable
2020
add_executable(tree-tests ${sources})
2121

22-
target_link_libraries(tree-tests PRIVATE gtest gmock interval-tree)
22+
find_package(GTest REQUIRED)
23+
24+
target_link_libraries(tree-tests PRIVATE interval-tree GTest::gtest GTest::gmock GTest::gmock_main)
2325

2426
# Compiler Options
2527
set(DEBUG_OPTIONS -fexceptions -g -Wall -pedantic-errors -pedantic)
@@ -29,7 +31,7 @@ set(RELEASE_OPTIONS -fexceptions -O3 -Wall -pedantic)
2931
target_compile_options(tree-tests PUBLIC "$<$<CONFIG:RELEASE>:${RELEASE_OPTIONS}>")
3032

3133
if (INT_TREE_DRAW_EXAMPLES)
32-
target_link_libraries(tree-tests PRIVATE cairo cairo-wrap)
34+
target_link_libraries(tree-tests PRIVATE cairo-wrap cairo)
3335
endif()
3436

3537
# If msys2, copy dynamic libraries to executable directory, visual studio does this automatically.

0 commit comments

Comments
 (0)