Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow windows builds #31

Merged
merged 9 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
7 changes: 2 additions & 5 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ inputs:
runs:
using: "composite"
steps:
- name: "install lcov for coverage"
run: sudo apt install lcov
shell: bash

- name: "check cache CPM"
id: cache-cpm
Expand All @@ -20,7 +17,7 @@ runs:
path: |
cmake/CPM.cmake
cmake/CodeCoverage.cmake
cmake/catch2
cmake/catch2/**
${{ inputs.build_type }}/_deps/**
key: ${{ hashFiles('CMakeLists.txt') }}--cpm

Expand All @@ -29,6 +26,6 @@ runs:
shell: bash

- name: "cmake build targets"
run: cmake --build build_${{inputs.build_type}} -j4
run: cmake --build build_${{inputs.build_type}} -j8
shell: bash

26 changes: 23 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: "install lcov for coverage"
run: sudo apt install lcov
shell: bash
ryan597 marked this conversation as resolved.
Show resolved Hide resolved

- name: "checkout repo"
uses: actions/checkout@v4

Expand Down Expand Up @@ -50,6 +54,22 @@ jobs:
with:
build_type: Release

#- name: "test Release"
# working-directory: ./build_Release
# run: make test
- name: "test Release"
working-directory: ./build_Release
run: make test

build-windows:
runs-on: windows-latest

steps:
- name: "checkout repo"
uses: actions/checkout@v4

- name: "build Release"
uses: ./.github/actions
with:
build_type: Release

- name: "test Release"
working-directory: ./build_Release
run: make test
ryan597 marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
cmake
.vscode/
.vscode
.vs
cmake
30 changes: 17 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ set(CMAKE_CXX_STANDARD 20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

if(CMAKE_BUILD_TYPE MATCHES Debug)
# Flags to be added once refactor is done
#-Werror
add_compile_options(-Wno-unused-parameter)
if(MSVC)
#/WX
add_compile_options(/W4)
else()
# Flags to be added once refactor is done
#-Werror
add_compile_options(-Wno-unused-parameter)

# Code Coverage - download and append compiler flags
message(STATUS "Download Code Coverage cmake file")
file(DOWNLOAD
https://raw.githubusercontent.com/bilke/cmake-modules/master/CodeCoverage.cmake
${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake
SHOW_PROGRESS
)
include(CodeCoverage)
append_coverage_compiler_flags()
# Code Coverage - download and append compiler flags
file(DOWNLOAD
https://raw.githubusercontent.com/bilke/cmake-modules/master/CodeCoverage.cmake
${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake
SHOW_PROGRESS
)
include(CodeCoverage)
append_coverage_compiler_flags()
endif()
endif()

if(CMAKE_PROJECT_NAME STREQUAL ChessNGin AND BUILD_TESTING)
Expand All @@ -30,4 +34,4 @@ if(CMAKE_PROJECT_NAME STREQUAL ChessNGin AND BUILD_TESTING)
add_subdirectory(tests)
endif()

add_subdirectory(src)
add_subdirectory(src)
12 changes: 8 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ add_library(nginlib STATIC

add_executable(NGin ${SOURCES})

set(ENABLED_WARNING -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -Wold-style-cast -Wcast-align
-Woverloaded-virtual -Wconversion -Wsign-conversion -Wmisleading-indentation -Wduplicated-cond
-Wduplicated-branches -Wlogical-op -Wnull-dereference -Wuseless-cast -Wdouble-promotion
-Wformat=2)
if(MSVC)
set(ENABLED_WARNINGS /Wall)
else()
set(ENABLED_WARNING -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -Wold-style-cast -Wcast-align
-Woverloaded-virtual -Wconversion -Wsign-conversion -Wmisleading-indentation -Wduplicated-cond
-Wduplicated-branches -Wlogical-op -Wnull-dereference -Wuseless-cast -Wdouble-promotion
-Wformat=2)
endif()

target_compile_options(nginlib PRIVATE ${ENABLED_WARNING})
target_compile_options(NGin PRIVATE ${ENABLED_WARNING})
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ CPMAddPackage(
GIT_REPOSITORY "https://github.com/catchorg/Catch2.git"
GIT_TAG "v3.5.0"
)
list(APPEND CMAKE_MODULE_PATH "${Catch2_SOURCE_DIR}/extras")

list(APPEND CMAKE_MODULE_PATH "${Catch2_SOURCE_DIR}/extras")

# These tests can use the Catch2-provided main
add_executable(tests test.cpp)
Expand All @@ -26,7 +26,7 @@ include(CTest)
include(Catch)
catch_discover_tests(tests)

if(CMAKE_PROJECT_NAME STREQUAL ChessNGin AND CMAKE_BUILD_TYPE MATCHES Debug)
if(!MSVC AND CMAKE_BUILD_TYPE MATCHES Debug)
ryan597 marked this conversation as resolved.
Show resolved Hide resolved
setup_target_for_coverage_lcov(NAME coverage
EXECUTABLE tests
EXCLUDE "/usr/*" "cmake/catch2/*"
Expand Down
Loading