-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This just checks that files in the Check folders are compilable to avoid | ||
# committing incorrect examples. It's done here, separately and in bulk, so that | ||
# no overhead is added by default when submitting a new check. You'll hopefully | ||
# only have to know this exists if your example fails to compile | ||
|
||
cmake_minimum_required(VERSION 3.25) | ||
project("Test that the check examples compile") | ||
|
||
enable_language(Fortran OPTIONAL) | ||
# Build them as libraries, not executables | ||
set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) | ||
|
||
set (BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../Checks) | ||
message(STATUS "Looking for files in '${BASE_DIR}'") | ||
|
||
file(GLOB check_files | ||
${BASE_DIR}/*/*.c | ||
${BASE_DIR}/*/*.cpp | ||
${BASE_DIR}/*/*.f | ||
${BASE_DIR}/*/*.f90 | ||
) | ||
|
||
# PWR068: Has a module file that has to be compiled in order, and a compilation error on purpose | ||
# PWD003: GFortran catches the data transfer error | ||
set (excluded_checks_regex "PWR068|PWD003") | ||
|
||
list(FILTER check_files EXCLUDE REGEX ${excluded_checks_regex}) | ||
|
||
foreach(check_file ${check_files}) | ||
message(STATUS "Trying to compile ${check_file}") | ||
set (extra_flags "-fopenmp -fopenacc") | ||
try_compile( | ||
TRY_RESULT ${CMAKE_BINARY_DIR} | ||
SOURCES ${check_file} | ||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${extra_flags} | ||
OUTPUT_VARIABLE TRY_RESULT_OUTPUT | ||
) | ||
|
||
if (TRY_RESULT) | ||
message(STATUS "Trying to compile ${check_file} -- Good") | ||
else() | ||
message(STATUS "Trying to compile ${check_file} -- Bad") | ||
message("${TRY_RESULT_OUTPUT}") | ||
endif() | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/**' | ||
- 'Checks/**' | ||
|
||
jobs: | ||
# Let us run this job on Ubuntu only, so we can check at the moment that | ||
# examples compile at least on GCC && GFortran | ||
multiple-compilers: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
- name: Check that all check examples compile | ||
run: cmake -B build -DCMAKE_C_COMPILER=gcc -DCMAKE_Fortran_COMPILER=gfortran -S .github/utils/CheckExamples/ |