-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from kgerheiser/master
Release 2.2.0
- Loading branch information
Showing
13 changed files
with
361 additions
and
69 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,55 @@ | ||
name: Build and Test | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: checkout-pfunit | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: Goddard-Fortran-Ecosystem/pFUnit | ||
path: pfunit | ||
|
||
- name: cache pfunit | ||
id: cache-pfunit | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/pfunit | ||
key: pfunit-${{ runner.os }}-${{ hashFiles('pfunit/VERSION') }} | ||
|
||
- name: build_pfunit | ||
env: | ||
FC: gfortran-9 | ||
if: steps.cache-pfunit.outputs.cache-hit != 'true' | ||
run: | | ||
pwd | ||
cd pfunit | ||
mkdir build | ||
cd build | ||
cmake .. -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit | ||
make -j2 | ||
make install | ||
- name: checkout-sp | ||
uses: actions/checkout@v2 | ||
with: | ||
path: sp | ||
|
||
- name: build_sp | ||
env: | ||
FC: gfortran-9 | ||
CC: gcc-9 | ||
run: | | ||
cd sp | ||
mkdir build | ||
cd build | ||
cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH=~/pfunit | ||
make -j2 | ||
- name: test_sp | ||
run: | | ||
cd $GITHUB_WORKSPACE/sp/build | ||
make test | ||
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,2 @@ | ||
.DS_Store | ||
build |
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 |
---|---|---|
@@ -1,77 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(sp VERSION 2.0.2) | ||
set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION} CACHE INTERNAL "${PROJECT_NAME} version number") | ||
enable_language (Fortran) | ||
|
||
if (NOT CMAKE_BUILD_TYPE) | ||
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING | ||
"Choose the type of build, options are: PRODUCTION Debug Release." | ||
FORCE) | ||
endif() | ||
file(STRINGS "VERSION" pVersion) | ||
|
||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") | ||
set(IntelComp true ) | ||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang*") | ||
set(GNUComp true ) | ||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") | ||
set(PGIComp true ) | ||
endif() | ||
project(sp VERSION ${pVersion} LANGUAGES Fortran) | ||
|
||
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) | ||
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) | ||
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) | ||
STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEBUG" BUILD_DEBUG) | ||
option(OPENMP "use OpenMP threading" OFF) | ||
option(ENABLE_TESTS "Enable tests" OFF) | ||
|
||
if(APPLE) | ||
set(platform_definition "APPLE") | ||
else() | ||
set(platform_definition "LINUX") | ||
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") | ||
message(STATUS "Setting build type to 'Release' as none was specified.") | ||
set(CMAKE_BUILD_TYPE | ||
"Release" | ||
CACHE STRING "Choose the type of build." FORCE) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" | ||
"MinSizeRel" "RelWithDebInfo") | ||
endif() | ||
|
||
if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) | ||
if(IntelComp) | ||
set(shared_fortran_flags "-O3" "-auto" "-qopenmp" "-convert" "big_endian" "-assume" "byterecl" | ||
"-fp-model" "strict" "-fpp") | ||
set(fortran_d_flags "-i4" "-r8") | ||
set(fortran_8_flags "-i8" "-r8") | ||
set(fortran_4_flags "-i4" "-real-size" "32") | ||
elseif(GNUComp) | ||
set(shared_fortran_flags "-O3" "-fconvert=big-endian") | ||
set(fortran_d_flags "-fdefault-real-8") | ||
set(fortran_8_flags "-fdefault-integer-8" "-fdefault-real-8") | ||
set(fortran_4_flags) | ||
else() | ||
message("unknown compiler!") | ||
exit() | ||
endif() | ||
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") | ||
message( | ||
WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") | ||
endif() | ||
|
||
add_subdirectory(src) | ||
|
||
file(GLOB fortran_src ${CMAKE_CURRENT_SOURCE_DIR}/src/*.f ${CMAKE_CURRENT_SOURCE_DIR}/src/*.F) | ||
set(kinds "4" "8" "d") | ||
foreach(kind ${kinds}) | ||
set(lib_name ${PROJECT_NAME}_${kind}) | ||
set(versioned_lib_name ${PROJECT_NAME}_v${PROJECT_VERSION}_${kind}) | ||
add_library(${lib_name} STATIC ${fortran_src}) | ||
set_target_properties(${lib_name} PROPERTIES OUTPUT_NAME "${versioned_lib_name}") | ||
|
||
target_compile_definitions(${lib_name} PRIVATE "${platform_definition}") | ||
target_compile_options(${lib_name} PRIVATE "${shared_fortran_flags};${fortran_${kind}_flags}") | ||
|
||
set(module_dir "${CMAKE_CURRENT_BINARY_DIR}/include_${kind}") | ||
set_target_properties(${lib_name} PROPERTIES Fortran_MODULE_DIRECTORY "${module_dir}") | ||
|
||
target_include_directories(${lib_name} PUBLIC | ||
$<BUILD_INTERFACE:${module_dir}> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include_${kind}>) | ||
|
||
install(TARGETS ${lib_name} | ||
EXPORT ${PROJECT_NAME}-config | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
install(DIRECTORY ${module_dir} DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
endforeach() | ||
if (${ENABLE_TESTS}) | ||
find_package(PFUNIT REQUIRED) | ||
enable_testing() | ||
add_subdirectory(tests) | ||
endif() | ||
|
||
install(EXPORT ${PROJECT_NAME}-config DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
|
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,34 @@ | ||
![Status](https://github.com/NOAA-EMC/NCEPLIBS-sp/workflows/Build%20and%20Test/badge.svg) | ||
|
||
# SPlib | ||
|
||
The spectral transform library (splib) contains FORTRAN subprograms | ||
to be used for a variety of spectral transform functions. | ||
For more detailed documentation see [README](README). | ||
|
||
Code Manager: Kyle Gerheiser | ||
|
||
### Prerequisites | ||
|
||
Compilers: GNU | Intel | Clang | AppleClang | ||
|
||
|
||
### Installing | ||
|
||
``` | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/NCEPLIBS-sp | ||
make -j2 | ||
make install | ||
``` | ||
|
||
|
||
### Version | ||
|
||
2.2.0 | ||
|
||
|
||
### Authors | ||
|
||
* **[NCEP/EMC](mailto:[email protected])** |
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 @@ | ||
2.2.0 |
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 @@ | ||
@PACKAGE_INIT@ | ||
|
||
# * @PROJECT_NAME@::@PROJECT_NAME@_4 - real32 library target | ||
# * @PROJECT_NAME@::@PROJECT_NAME@_8 - real64 library target | ||
# * @PROJECT_NAME@::@PROJECT_NAME@_d - mixed library target | ||
|
||
# Include targets file. This will create IMPORTED target @PROJECT_NAME@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
|
||
get_target_property(@PROJECT_NAME@_BUILD_TYPES @PROJECT_NAME@::@PROJECT_NAME@_4 IMPORTED_CONFIGURATIONS) | ||
|
||
|
||
check_required_components("@PROJECT_NAME@") | ||
|
||
get_target_property(location @PROJECT_NAME@::@PROJECT_NAME@_4 LOCATION) | ||
message(STATUS "Found @PROJECT_NAME@: ${location} (found version \"@PROJECT_VERSION@\")") |
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,85 @@ | ||
include("list_of_files.cmake") | ||
|
||
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") | ||
set(CMAKE_Fortran_FLAGS | ||
"-g -traceback -auto -convert big_endian -assume byterecl -fp-model strict -fpp" | ||
) | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3") | ||
set(fortran_d_flags "-i4 -r8") | ||
set(fortran_8_flags "-i8 -r8") | ||
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") | ||
set(CMAKE_Fortran_FLAGS "-g -fbacktrace -fconvert=big-endian") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3") | ||
set(fortran_d_flags "-fdefault-real-8") | ||
set(fortran_8_flags "-fdefault-integer-8 -fdefault-real-8") | ||
endif() | ||
|
||
if(APPLE) | ||
add_compile_definitions(APPLE) | ||
elseif(UNIX) | ||
add_compile_definitions(LINUX) | ||
endif() | ||
|
||
if(OPENMP) | ||
find_package(OpenMP REQUIRED COMPONENTS Fortran) | ||
endif() | ||
if(OpenMP_FOUND) | ||
add_compile_definitions(OPENMP) | ||
endif() | ||
|
||
set(kinds "4" "8" "d") | ||
foreach(kind ${kinds}) | ||
set(lib_name ${PROJECT_NAME}_${kind}) | ||
set(module_dir ${CMAKE_CURRENT_BINARY_DIR}/include_${kind}) | ||
|
||
set(BUILD_FLAGS "${fortran_${kind}_flags}") | ||
if(OpenMP_Fortran_FOUND) | ||
set(BUILD_FLAGS "${BUILD_FLAGS} ${OpenMP_Fortran_FLAGS}") | ||
endif() | ||
|
||
add_library(${lib_name} STATIC ${fortran_src}) | ||
add_library(${PROJECT_NAME}::${lib_name} ALIAS ${lib_name}) | ||
|
||
set_target_properties(${lib_name} PROPERTIES COMPILE_FLAGS "${BUILD_FLAGS}") | ||
set_target_properties(${lib_name} PROPERTIES Fortran_MODULE_DIRECTORY ${module_dir}) | ||
set_target_properties(${lib_name} PROPERTIES INTERFACE_LINK_LIBRARIES ${lib_name}) | ||
target_include_directories(${lib_name} PUBLIC | ||
$<BUILD_INTERFACE:${module_dir}> | ||
$<INSTALL_INTERFACE:include_${kind}>) | ||
|
||
list(APPEND LIB_TARGETS ${lib_name}) | ||
install(DIRECTORY ${module_dir} DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
endforeach() | ||
|
||
install( | ||
TARGETS ${LIB_TARGETS} | ||
EXPORT ${PROJECT_NAME}Exports | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
|
||
### Package config | ||
include(CMakePackageConfigHelpers) | ||
set(CONFIG_INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}) | ||
|
||
export(EXPORT ${PROJECT_NAME}Exports | ||
NAMESPACE ${PROJECT_NAME}:: | ||
FILE ${PROJECT_NAME}-targets.cmake) | ||
|
||
configure_package_config_file( | ||
${CMAKE_SOURCE_DIR}/cmake/PackageConfig.cmake.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.cmake | ||
INSTALL_DESTINATION ${CONFIG_INSTALL_DESTINATION}) | ||
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.cmake | ||
DESTINATION ${CONFIG_INSTALL_DESTINATION}) | ||
|
||
write_basic_package_version_file( | ||
${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY AnyNewerVersion) | ||
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake | ||
DESTINATION ${CONFIG_INSTALL_DESTINATION}) | ||
|
||
install(EXPORT ${PROJECT_NAME}Exports | ||
NAMESPACE ${PROJECT_NAME}:: | ||
FILE ${PROJECT_NAME}-targets.cmake | ||
DESTINATION ${CONFIG_INSTALL_DESTINATION}) |
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
Oops, something went wrong.