Skip to content

Commit

Permalink
[CMake] Enable use of CMake in github actions .yml (continued from #342
Browse files Browse the repository at this point in the history
…) (#425)
  • Loading branch information
noelchalmers authored Dec 28, 2020
1 parent 6c98e86 commit 246d25d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ jobs:
OCCA_COVERAGE: 1
OCCA_FORTRAN_ENABLED: 1

- name: (Ubuntu) CMake + gcc-8
os: ubuntu-18.04
CC: gcc-8
CXX: g++-8
CXXFLAGS: -Wno-maybe-uninitialized -Wno-cpp
GCOV: gcov-8
OCCA_COVERAGE: 1
useCMake: true

- name: (Ubuntu) gcc-9
os: ubuntu-18.04
CC: gcc-9
Expand Down Expand Up @@ -79,18 +88,37 @@ jobs:

- name: Compiler info
run: make -j 16 info
if: ${{ !matrix.useCMake }}

- name: CMake build
run: |
cmake -E make_directory ${{runner.workspace}}/occa/build
cd ${{runner.workspace}}/occa/build
cmake -DENABLE_TESTS=On -DENABLE_EXAMPLES=On ${{runner.workspace}}/occa
make -j 16
if: ${{ matrix.useCMake }}

- name: Compile library
run: make -j 16
if: ${{ !matrix.useCMake }}

- name: Compile tests
run: make -j 16 tests
if: ${{ !matrix.useCMake }}

- name: Run unit tests
run: ./tests/run_tests
if: ${{ !matrix.useCMake }}

- name: Run examples
run: ./tests/run_examples
if: ${{ !matrix.useCMake }}

- name: Run CTests
run: |
cd ${{runner.workspace}}/occa/build
make test
if: ${{ matrix.useCMake }}

- name: Upload code coverage
run: bash <(curl --no-buffer -s https://codecov.io/bash) -x "${GCOV}"
Expand Down
8 changes: 4 additions & 4 deletions cmake/SetCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
set(CMAKE_CXX_FLAGS_RELEASE "-O1 -DNDEBUG")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SUPPORTED_WARN_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${SUPPORTED_WARN_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")

set_optional_cxx_flag(SUPPORTED_WERROR_CXX_FLAGS "-Werror")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SUPPORTED_WERROR_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${SUPPORTED_WERROR_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")

include(CheckCCompilerFlag)

Expand All @@ -56,10 +56,10 @@ set_optional_c_flag(SUPPORTED_WARN_C_FLAGS "-Wno-c++11-long-long")
set_optional_c_flag(SUPPORTED_WARN_C_FLAGS "-diag-disable 11074 -diag-disable 11076") # Disable warnings about inline limits reached
set_optional_c_flag(SUPPORTED_WARN_C_FLAGS "--display_error_number") # Show PGI error numbers

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SUPPORTED_WARN_C_FLAGS}")
set(CMAKE_C_FLAGS "${SUPPORTED_WARN_C_FLAGS} ${CMAKE_C_FLAGS}")

set_optional_c_flag(SUPPORTED_WERROR_C_FLAGS "-Werror")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${SUPPORTED_WERROR_C_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${SUPPORTED_WERROR_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")

if (ENABLE_FORTRAN)
include(CheckFortranCompilerFlag)
Expand Down

0 comments on commit 246d25d

Please sign in to comment.