File tree 4 files changed +66
-2
lines changed 4 files changed +66
-2
lines changed Original file line number Diff line number Diff line change 51
51
run : |
52
52
sudo dpkg --add-architecture i386
53
53
sudo apt-get update -y
54
- sudo apt-get install ${{ matrix.pkgs }} cmake ninja-build -y
54
+ sudo apt-get install ${{ matrix.pkgs }} cmake ninja-build libcriterion-dev -y
55
+
56
+ - name : Install Deps (Windows)
57
+ if : ${{ matrix.os == 'windows-2022' }}
58
+ run : |
59
+ choco install cmake meson ninja
60
+ git clone https://github.com/Snaipe/Criterion.git --recursive
61
+ cd Criterion
62
+ meson install -C build
63
+
64
+ - name : Install Deps (MacOS)
65
+ if : ${{ matrix.os == 'macos-12' }}
66
+ run : brew install criterion
55
67
56
68
- name : Generate Build Files & Build (Linux)
57
69
if : ${{ matrix.os == 'ubuntu-22.04' }}
73
85
run : |
74
86
make all GENERATOR="${{ matrix.gen }}" BUILD_TYPE=Release NUM_JOBS=4 CMAKE_GEN_FLAGS='-DBUILD_APPLE_BUNDLE=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}'
75
87
88
+ - name : Run Test (Windows)
89
+ if : ${{ matrix.os == 'windows-2022' }}
90
+ run : ./build/Release/FileSystem_Test.exe
91
+
92
+ - name : Run Test (Non-Windows)
93
+ if : ${{ matrix.os != 'windows-2022' }}
94
+ run : ./build/FileSystem_Test
95
+
76
96
- name : Upload Artifacts (Linux)
77
97
if : ${{ matrix.os == 'ubuntu-22.04' }}
78
98
uses : actions/upload-artifact@v3
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ set(CMAKE_CXX_STANDARD 11)
5
5
set (CMAKE_CXX_STANDARD_REQUIRED ON )
6
6
set (CMAKE_CXX_EXTENSIONS OFF )
7
7
8
+ option (FILESYSTEM_BUILD_TESTS "Build tests" ON )
9
+
8
10
project (FileSystem CXX)
9
11
add_library (
10
12
FileSystem STATIC
@@ -17,8 +19,18 @@ target_include_directories(FileSystem
17
19
PUBLIC
18
20
${CMAKE_CURRENT_SOURCE_DIR} /include /
19
21
)
20
-
21
22
if (WIN32 OR CYGWIN )
22
23
target_compile_definitions (FileSystem PUBLIC FS_TARGET_WINDOWS)
23
24
endif ()
24
25
26
+ if (FILESYSTEM_BUILD_TESTS)
27
+ include (./FindCriterion.cmake)
28
+ if (NOT CRITERION_FOUND)
29
+ message (FATAL_ERROR "criterion not found" )
30
+ endif ()
31
+ project (FileSystem_Test CXX)
32
+ add_executable (FileSystem_Test ${CMAKE_CURRENT_SOURCE_DIR} /src/test .cpp)
33
+ target_include_directories (FileSystem_Test PUBLIC ${CRITERION_INCLUDE_DIRS} )
34
+ target_link_libraries (FileSystem_Test PUBLIC FileSystem ${CRITERION_LIBRARIES} criterion)
35
+ endif ()
36
+
Original file line number Diff line number Diff line change
1
+ # This file is licensed under the WTFPL version 2 -- you can see the full
2
+ # license over at http://www.wtfpl.net/txt/copying/
3
+ #
4
+ # - Try to find Criterion
5
+ #
6
+ # Once done this will define
7
+ # CRITERION_FOUND - System has Criterion
8
+ # CRITERION_INCLUDE_DIRS - The Criterion include directories
9
+ # CRITERION_LIBRARIES - The libraries needed to use Criterion
10
+
11
+ find_package (PkgConfig)
12
+
13
+ find_path (CRITERION_INCLUDE_DIR criterion/criterion.h
14
+ PATH_SUFFIXES criterion)
15
+
16
+ find_library (CRITERION_LIBRARY NAMES criterion libcriterion)
17
+
18
+ set (CRITERION_LIBRARIES ${CRITERION_LIBRARY} )
19
+ set (CRITERION_INCLUDE_DIRS ${CRITERION_INCLUDE_DIR} )
20
+
21
+ include (FindPackageHandleStandardArgs)
22
+ # handle the QUIET and REQUIRED arguments and set CRITERION_FOUND to TRUE
23
+ # if all listed variables are TRUE
24
+ find_package_handle_standard_args(Criterion DEFAULT_MSG
25
+ CRITERION_LIBRARY CRITERION_INCLUDE_DIR)
26
+
27
+ mark_as_advanced (CRITERION_INCLUDE_DIR CRITERION_LIBRARY)
28
+
Original file line number Diff line number Diff line change
1
+ #include < criterion/criterion.h>
2
+
3
+
4
+
You can’t perform that action at this time.
0 commit comments