From 5269bb28ae943b41da4ef58019a1d83770a45a86 Mon Sep 17 00:00:00 2001 From: Lawrence Stubbs Date: Sat, 21 Dec 2024 08:01:35 -0500 Subject: [PATCH 1/3] Update CMakeList for Windows build and CI test --- .github/workflows/cmake.yml | 13 +++++++++++++ .gitignore | 19 ++++++++++++++++++- CMakeLists.txt | 25 +++++++++++++++++++------ 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ce98cc6..83bf681 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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: diff --git a/.gitignore b/.gitignore index fdaa5cf..8cb0707 100644 --- a/.gitignore +++ b/.gitignore @@ -55,4 +55,21 @@ build !.vscode/launch.json !.vscode/extensions.json -!.vscode/*.code-snippets \ No newline at end of file +!.vscode/*.code-snippets +ZERO_CHECK.* +unit-tests.* +test-c-vector.* +RUN_TESTS.* +c-vector.sln +c-vector-example.* +ALL_BUILD.vcxproj.* +ALL_BUILD.vcxproj +c-vector-example.dir +Debug +test-c-vector.dir +unit-tests.dir +x64 +.gitignore +unit-tests +test-c-vector +c-vector-example diff --git a/CMakeLists.txt b/CMakeLists.txt index b9b3b39..3d4142b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() @@ -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() # ---------------------------- @@ -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 "${CMAKE_BUILD_TYPE}" --target test-c-vector ) set_tests_properties(test_build PROPERTIES FIXTURES_SETUP test_fixture) @@ -69,14 +79,17 @@ add_executable(unit-tests add_test(NAME unit-tests COMMAND $) 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 "${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) From 57fb35a7c02fa9f6f4983f00d93bdb9b907fe236 Mon Sep 17 00:00:00 2001 From: Lawrence Stubbs Date: Sat, 21 Dec 2024 09:59:49 -0500 Subject: [PATCH 2/3] Update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8cb0707..19cd3c6 100644 --- a/.gitignore +++ b/.gitignore @@ -69,7 +69,6 @@ Debug test-c-vector.dir unit-tests.dir x64 -.gitignore unit-tests test-c-vector c-vector-example From db64adf8ce7c4a93f0dfe0db0397cdd8ce55276a Mon Sep 17 00:00:00 2001 From: Lawrence Stubbs Date: Sat, 21 Dec 2024 15:13:46 -0500 Subject: [PATCH 3/3] Update .gitignore --- .gitignore | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 19cd3c6..8b63e17 100644 --- a/.gitignore +++ b/.gitignore @@ -57,18 +57,13 @@ build !.vscode/*.code-snippets ZERO_CHECK.* -unit-tests.* -test-c-vector.* RUN_TESTS.* -c-vector.sln -c-vector-example.* -ALL_BUILD.vcxproj.* -ALL_BUILD.vcxproj -c-vector-example.dir +ALL_BUILD.* Debug -test-c-vector.dir -unit-tests.dir x64 +*.dir +test-* +c-vector.sln +c-vector-* unit-tests -test-c-vector -c-vector-example +unit-tests.*