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

[CMake] Enable use of CMake in github actions .yml (continued from libocca/occa#342) #425

Merged
merged 20 commits into from
Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
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