Skip to content
Open
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
13 changes: 13 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ jobs:
run: |
make test

windows-latest:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -C ${{env.BUILD_TYPE}}

clang-format-checking:
runs-on: ubuntu-latest
steps:
Expand Down
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,15 @@ build
!.vscode/launch.json
!.vscode/extensions.json

!.vscode/*.code-snippets
!.vscode/*.code-snippets
ZERO_CHECK.*
RUN_TESTS.*
ALL_BUILD.*
Debug
x64
*.dir
test-*
c-vector.sln
c-vector-*
unit-tests
unit-tests.*
25 changes: 19 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
cmake_minimum_required(VERSION 3.7.0)
cmake_minimum_required(VERSION 3.7...3.14)

if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()

project(c-vector VERSION 0.1.0)
enable_testing()

Expand All @@ -23,7 +28,10 @@ PUBLIC
)

set_target_properties(c-vector-example PROPERTIES C_STANDARD 90)
target_compile_options(c-vector-example PUBLIC -Wall -Werror -Wextra)

if(UNIX)
target_compile_options(c-vector-example PUBLIC -Wall -Werror -Wextra)
endif()

# ----------------------------

Expand All @@ -35,12 +43,14 @@ add_executable(test-c-vector

add_test(NAME test-c-vector COMMAND test-c-vector)
set_target_properties(test-c-vector PROPERTIES C_STANDARD 90)
target_compile_options(test-c-vector PUBLIC -Wall -Werror -Wextra)
if(UNIX)
target_compile_options(test-c-vector PUBLIC -Wall -Werror -Wextra)
endif()

add_test(test_build
"${CMAKE_COMMAND}"
--build "${CMAKE_BINARY_DIR}"
--config "$<CONFIG>"
--config "${CMAKE_BUILD_TYPE}"
--target test-c-vector
)
set_tests_properties(test_build PROPERTIES FIXTURES_SETUP test_fixture)
Expand Down Expand Up @@ -69,14 +79,17 @@ add_executable(unit-tests

add_test(NAME unit-tests COMMAND $<TARGET_FILE:unit-tests>)
set_target_properties(unit-tests PROPERTIES C_STANDARD 90)
target_compile_options(unit-tests PUBLIC -Wall -Werror -Wextra)
if(UNIX)
target_compile_options(unit-tests PUBLIC -Wall -Werror -Wextra)
endif()

add_test(unit_test_build
"${CMAKE_COMMAND}"
--build "${CMAKE_BINARY_DIR}"
--config "$<CONFIG>"
--config "${CMAKE_BUILD_TYPE}"
--target unit-tests
)

set_tests_properties(unit_test_build PROPERTIES FIXTURES_SETUP test_fixture)
set_tests_properties(unit-tests PROPERTIES FIXTURES_REQUIRED test_fixture)

Expand Down
Loading