File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,20 +14,19 @@ jobs:
1414 strategy :
1515 matrix :
1616 cxx : [g++, clang++]
17- stdcxx : ['c++ 14', 'c++ 17', 'c++ 20']
17+ cxx_standard : ['14', '17', '20']
1818 steps :
1919 - name : Checkout
2020 uses : actions/checkout@v4
21- - name : Install dependencies
22- run : sudo apt-get update && sudo apt-get install g++ clang make libgtest-dev -y
23- - name : Build
21+ - name : Install toolchain
22+ run : sudo apt-get update && sudo apt-get install -y g++ clang cmake ninja-build
23+ - name : Configure (CMake + gtest 1.16.0)
2424 run : |
25- cd library
26- make
27- env :
28- CXX : ${{ matrix.cxx }}
29- STDCXX : ${{ matrix.stdcxx }}
25+ cmake -S library -B library/build \
26+ -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
27+ -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} \
28+ -DCMAKE_CXX_STANDARD_REQUIRED=ON
29+ - name : Build
30+ run : cmake --build library/build
3031 - name : Test
31- run : |
32- cd library
33- ./test.exe --gtest_repeat=20
32+ run : ctest --test-dir library/build --output-on-failure --repeat until-fail:20
Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ library/test.d
88.yarn /
99* .gch
1010tmp /
11+ build /
Original file line number Diff line number Diff line change 7777 "variant" : " cpp" ,
7878 "text_encoding" : " cpp"
7979 },
80- "clangd.fallbackFlags" : [" -std=c++14" , " -I${workspaceFolder}/library" ]
80+ "clangd.arguments" : [
81+ " --compile-commands-dir=${workspaceFolder}/library/build"
82+ ],
83+ "cmake.sourceDirectory" : " /home/mrpython/Desktop/mp-oi-library/library"
8184}
Original file line number Diff line number Diff line change @@ -15,3 +15,5 @@ library/
1515.github /
1616** /* .gch
1717tmp /
18+ build /
19+
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.16 )
2+
3+ project (mp_oi_library LANGUAGES CXX )
4+
5+ set (CMAKE_CXX_STANDARD 14)
6+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
7+ set (CMAKE_CXX_EXTENSIONS OFF )
8+
9+ include (FetchContent )
10+ FetchContent_Declare (
11+ googletest
12+ URL https://github.com/google/googletest/releases/download/v1.16.0/googletest-1.16.0.tar.gz
13+ DOWNLOAD_EXTRACT_TIMESTAMP TRUE
14+ )
15+ FetchContent_MakeAvailable (googletest)
16+
17+ enable_testing ()
18+
19+ file (GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS test /main.cpp )
20+
21+ add_executable (mp_oi_library_tests ${TEST_SOURCES} )
22+
23+ target_include_directories (mp_oi_library_tests PRIVATE
24+ ${CMAKE_SOURCE_DIR }
25+ )
26+
27+ target_compile_options (mp_oi_library_tests PRIVATE
28+ -Wall
29+ -Wextra
30+ -Wshadow
31+ -Wpedantic
32+ -Wno-unused-parameter
33+ -O2
34+ )
35+
36+ target_link_libraries (mp_oi_library_tests PRIVATE
37+ GTest::gtest_main
38+ )
39+
40+ include (GoogleTest )
41+ gtest_discover_tests (mp_oi_library_tests )
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments