-
Notifications
You must be signed in to change notification settings - Fork 65
Testing refactor #612
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
Testing refactor #612
Changes from 19 commits
bcf4097
340c2f9
1285ea9
c707b20
fd66d0f
278b2bd
9ce27bf
68f2575
c256bed
e7f84f4
c886348
20feac2
efff984
84cdd96
cc43fda
890ea0e
cfe3921
9b66008
df44e3a
585405f
afee04c
8270b07
96dd11a
d4c4fb8
ad60987
5346e6a
d536aa7
eee0f1d
9f90b8e
c0ccfaf
84a2e3e
b447039
d6218a3
6959e43
2fe885b
4b15859
cfb1fdb
4006597
fc79f04
e802031
082c332
dfc0ec1
c0e01f1
b4d3ae1
d8a5731
9f82c57
8b5ead1
cfe8c54
a801b9a
ce104f9
a5c6884
a9a21c6
a1bbde0
af03ea5
15646da
8155f81
f5b4af2
1e38c9f
675dec7
4deed39
9603f77
48e2f2a
f4fab29
7e8ea47
8c5ee10
6fb121e
a175756
017da94
f11f92d
142381e
1d0d0db
a3fd180
2ba46ea
74bde66
40ecc20
d1e5195
6b6a410
bd52ac5
32b75e6
f45f3fd
29b657d
d0e1095
c8b3568
3c896c4
7b96750
1f30515
cf398b5
dfa3bf0
2071507
23f6ce7
eda7676
fd9d58e
fe9da6e
00fc8a9
6ff1205
4b7f00e
6f87d73
1df0d8a
9533fca
850a295
d3a2eb2
c5a615d
20956e6
b52536a
ab128aa
0cb54ce
5a4b60b
996c108
fd910da
8b33cb8
674de31
ebff27f
e10df98
6cfd499
b8f5334
461f42e
9e8498e
cda0028
3013128
da2d9d2
d2577a2
75cbe98
ca34e38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,33 +4,80 @@ project(ccpp_framework | |
| VERSION 5.0.0 | ||
| LANGUAGES Fortran) | ||
|
|
||
| enable_language(C CXX) | ||
| include(FetchContent) | ||
| include(cmake/ccpp_capgen.cmake) | ||
| set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake") | ||
|
|
||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set package definitions | ||
| set(PACKAGE "ccpp-framework") | ||
| set(AUTHORS "Dom Heinzeller" "Grant Firl" "Mike Kavulich" "Dustin Swales" "Courtney Peverley") | ||
|
||
| string(TIMESTAMP YEAR "%Y") | ||
|
|
||
| option(CCPP_FRAMEWORK_BUILD_DOCUMENTATION | ||
| "Create and install the HTML documentation (requires Doxygen)" OFF) | ||
peverwhee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| option(CCPP_FRAMEWORK_ENABLE_OPENMP "Enable OpenMP support for the framework" OFF) | ||
| option(CCPP_FRAMEWORK_ENABLE_TESTS "Enable building/running tests" OFF) | ||
| option(BUILD_SHARED_LIBS "Build a static library" OFF) | ||
climbfuji marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| set(CCPP_VERBOSITY "0" CACHE STRING "Verbosity level of output (default: 0)") | ||
|
|
||
| if(CCPP_FRAMEWORK_ENABLE_TESTS) | ||
|
||
| FetchContent_Declare( | ||
| pFUnit | ||
| GIT_REPOSITORY https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git | ||
| GIT_TAG 26dadb1157819ea1bd9c355c60ed52f42dd36432 # v4.10.0 | ||
| ) | ||
| FetchContent_MakeAvailable(pFUnit) | ||
| enable_testing() | ||
| endif() | ||
|
|
||
| # Use rpaths on MacOSX | ||
| set(CMAKE_MACOSX_RPATH 1) | ||
|
|
||
| ADD_COMPILE_OPTIONS(-O0) | ||
| message(STATUS "Compiling Fortran with ${CMAKE_Fortran_COMPILER_ID}") | ||
| if(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") | ||
| ADD_COMPILE_OPTIONS(-fcheck=all) | ||
| ADD_COMPILE_OPTIONS(-fbacktrace) | ||
| ADD_COMPILE_OPTIONS(-ffpe-trap=zero) | ||
| ADD_COMPILE_OPTIONS(-finit-real=nan) | ||
| ADD_COMPILE_OPTIONS(-ggdb) | ||
| ADD_COMPILE_OPTIONS(-ffree-line-length-none) | ||
| ADD_COMPILE_OPTIONS(-cpp) | ||
| elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "IntelLLVM") | ||
|
||
| #ADD_COMPILE_OPTIONS(-check all) | ||
| ADD_COMPILE_OPTIONS(-fpe0) | ||
| ADD_COMPILE_OPTIONS(-warn) | ||
| ADD_COMPILE_OPTIONS(-traceback) | ||
| ADD_COMPILE_OPTIONS(-debug full) | ||
| ADD_COMPILE_OPTIONS(-fpp) | ||
| else() | ||
| message (WARNING "This program has only been compiled with gfortran and ifx.") | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set MPI flags for Fortran with MPI F08 interface | ||
| find_package(MPI REQUIRED Fortran) | ||
| find_package(MPI REQUIRED COMPONENTS Fortran) | ||
| if(NOT MPI_Fortran_HAVE_F08_MODULE) | ||
| message(FATAL_ERROR "MPI implementation does not support the Fortran 2008 mpi_f08 interface") | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set OpenMP flags for C/C++/Fortran | ||
| if (OPENMP) | ||
| if (CCPP_FRAMEWORK_ENABLE_OPENMP) | ||
| find_package(OpenMP REQUIRED) | ||
| set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") | ||
| set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
|
||
| set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}") | ||
| endif (OPENMP) | ||
| endif (CCPP_FRAMEWORK_ENABLE_OPENMP) | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set a default build type if none was specified | ||
| if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
| message(STATUS "Setting build type to 'Release' as none was specified.") | ||
| set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) | ||
|
||
| # Set the possible values of build type for cmake-gui | ||
| set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "Coverage") | ||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
|
|
@@ -39,11 +86,19 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") | |
| add_definitions(-DDEBUG) | ||
climbfuji marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| endif() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Request a static build | ||
| option(BUILD_SHARED_LIBS "Build a static library" OFF) | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Add the sub-directories | ||
| add_subdirectory(src) | ||
| add_subdirectory(doc) | ||
|
|
||
| if(CCPP_FRAMEWORK_ENABLE_TESTS) | ||
| add_subdirectory(test) | ||
| endif() | ||
|
|
||
| if (CCPP_FRAMEWORK_BUILD_DOCUMENTATION) | ||
| find_package(Doxygen REQUIRED) | ||
| if(NOT DOXYGEN_FOUND) | ||
| message(FATAL_ERROR "Doxygen is needed to build the documentation.") | ||
| endif() | ||
| add_subdirectory(doc) | ||
| endif() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| function(ccpp_capgen) | ||
| set(optionalArgs CAPGEN_DEBUG) | ||
| set(oneValueArgs HOSTFILES SCHEMEFILES SUITES HOST_NAME OUTPUT_ROOT VERBOSITY) | ||
|
|
||
| cmake_parse_arguments(arg "${optionalArgs}" "${oneValueArgs}" "" ${ARGN}) | ||
|
|
||
| list(APPEND CCPP_CAPGEN_CMD "${CMAKE_SOURCE_DIR}/scripts/ccpp_capgen.py") | ||
|
|
||
| if(DEFINED arg_CAPGEN_DEBUG AND arg_CAPGEN_DEBUG) | ||
| list(APPEND CCPP_CAPGEN_CMD "--debug") | ||
| endif() | ||
|
|
||
| if(DEFINED arg_HOSTFILES) | ||
| list(APPEND CCPP_CAPGEN_CMD "--host-files" "${arg_HOSTFILES}") | ||
| endif() | ||
| if(DEFINED arg_SCHEMEFILES) | ||
| list(APPEND CCPP_CAPGEN_CMD "--scheme-files" "${arg_SCHEMEFILES}") | ||
| endif() | ||
| if(DEFINED arg_SUITES) | ||
| list(APPEND CCPP_CAPGEN_CMD "--suites" "${arg_SUITES}") | ||
| endif() | ||
| if(DEFINED arg_HOST_NAME) | ||
| list(APPEND CCPP_CAPGEN_CMD "--host-name" "${arg_HOST_NAME}") | ||
| endif() | ||
| if(DEFINED arg_OUTPUT_ROOT) | ||
| message(STATUS "Creating output directory: ${arg_OUTPUT_ROOT}") | ||
| file(MAKE_DIRECTORY "${arg_OUTPUT_ROOT}") | ||
| list(APPEND CCPP_CAPGEN_CMD "--output-root" "${arg_OUTPUT_ROOT}") | ||
| endif() | ||
| if(DEFINED arg_VERBOSITY) | ||
| string(REPEAT "--verbose" ${arg_VERBOSITY} VERBOSE_PARAMS_SEPERATED) | ||
| separate_arguments(VERBOSE_PARAMS UNIX_COMMAND "${VERBOSE_PARAMS_SEPERATED}") | ||
| list(APPEND CCPP_CAPGEN_CMD ${VERBOSE_PARAMS}) | ||
| endif() | ||
|
|
||
| message(STATUS "Running ccpp_capgen from ${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
|
||
| string(REPLACE ";" " " CAPGEN_CMD_PARAMS_LIST "${CCPP_CAPGEN_CMD}") | ||
| message(STATUS "Running ccpp_capgen: ${CAPGEN_CMD_PARAMS_LIST}") | ||
|
|
||
| execute_process(COMMAND ${CCPP_CAPGEN_CMD} | ||
| WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
| OUTPUT_VARIABLE CAPGEN_OUT | ||
| ERROR_VARIABLE CAPGEN_OUT | ||
| RESULT_VARIABLE RES) | ||
|
|
||
| message(STATUS "ccpp-capgen stdout:" ${CAPGEN_OUT}) | ||
|
|
||
| if(RES EQUAL 0) | ||
| message(STATUS "ccpp-capgen completed successfully") | ||
| else() | ||
| message(FATAL_ERROR "CCPP cap generation FAILED: result = ${RES}") | ||
| endif() | ||
| endfunction() | ||
|
|
||
|
|
||
|
|
||
| function(ccpp_datafile) | ||
| set(oneValueArgs DATATABLE REPORT_NAME CCPP_CAPS_LIB_FILES) | ||
| cmake_parse_arguments(arg "" "${oneValueArgs}" "" ${ARGN}) | ||
|
|
||
| set(CCPP_DATAFILE_CMD "${CMAKE_SOURCE_DIR}/scripts/ccpp_datafile.py") | ||
|
|
||
| if(NOT DEFINED arg_DATATABLE) | ||
| message(FATAL_ERROR "function(ccpp_datafile): DATATABLE not set. A datatable file must be configured to call ccpp_datafile.") | ||
| endif() | ||
| list(APPEND CCPP_DATAFILE_CMD "${arg_DATATABLE}") | ||
|
|
||
| if(NOT DEFINED arg_REPORT_NAME) | ||
| message(FATAL_ERROR "function(ccpp_datafile): REPORT_NAME not set. Must specify the report to generate to run cpp_datafile.py") | ||
| endif() | ||
| list(APPEND CCPP_DATAFILE_CMD "${arg_REPORT_NAME}") | ||
|
|
||
| message(STATUS "${CCPP_DATAFILE_CMD}") | ||
| message(STATUS "Running ccpp_datafile from ${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
|
||
| string(REPLACE ";" " " CCPP_DATAFILE_CMD_SEPERATED "${CCPP_DATAFILE_CMD}") | ||
| message(STATUS "Running ccpp_datafile.py command: ${CCPP_DATAFILE_CMD_SEPERATED}") | ||
|
|
||
| execute_process(COMMAND ${CCPP_DATAFILE_CMD} | ||
| WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
| OUTPUT_VARIABLE CCPP_CAPS | ||
| RESULT_VARIABLE RES | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ERROR_STRIP_TRAILING_WHITESPACE) | ||
| message(STATUS "CCPP_CAPS = ${CCPP_CAPS}") | ||
| if(RES EQUAL 0) | ||
| message(STATUS "CCPP cap files retrieved") | ||
| else() | ||
| message(FATAL_ERROR "CCPP cap file retrieval FAILED: result = ${RES}") | ||
| endif() | ||
| set(CCPP_CAPS "${CCPP_CAPS}" PARENT_SCOPE) | ||
| endfunction() | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.