-
Notifications
You must be signed in to change notification settings - Fork 4
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 #11 from kgerheiser/master
Release 1.3.0
- Loading branch information
Showing
9 changed files
with
206 additions
and
51 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,53 @@ | ||
name: Build and Test | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
FC: gfortran-9 | ||
CC: gcc-9 | ||
|
||
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 | ||
if: steps.cache-pfunit.outputs.cache-hit != 'true' | ||
run: | | ||
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 | ||
uses: actions/checkout@v2 | ||
with: | ||
path: sfcio | ||
submodules: true | ||
|
||
- name: build | ||
run: | | ||
cd sfcio | ||
mkdir build | ||
cd build | ||
cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit;~/" | ||
make -j2 | ||
- name: test | ||
run: | | ||
cd $GITHUB_WORKSPACE/sfcio/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,8 @@ | ||
build/ | ||
install/ | ||
|
||
*.[ao] | ||
*.mod | ||
*.so | ||
|
||
*.swp |
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,60 +1,29 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(sfcio VERSION 1.1.0) | ||
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(sfcio 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(ENABLE_TESTS "Enable tests" OFF) | ||
|
||
if( (BUILD_RELEASE) OR (BUILD_PRODUCTION) ) | ||
if(IntelComp) | ||
set(fortran_flags "-O2" "-g" "-xHOST" "-traceback" "-free" "-convert" "big_endian" | ||
"-assume" "byterecl") | ||
elseif(GNUComp) | ||
set(fortran_flags "-O2" "-ggdb" "-fbacktrace" "-ffree-form" | ||
"-fconvert=big-endian" "-funroll-loops" "-Wall") | ||
else() | ||
message("unknown compiler!") | ||
exit() | ||
endif() | ||
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() | ||
|
||
set(lib_name ${PROJECT_NAME}) | ||
set(versioned_lib_name ${PROJECT_NAME}_v${PROJECT_VERSION}) | ||
|
||
file(GLOB fortran_src ${CMAKE_CURRENT_SOURCE_DIR}/src/*.f) | ||
add_library(${lib_name} STATIC ${fortran_src}) | ||
set_target_properties(${lib_name} PROPERTIES OUTPUT_NAME "${versioned_lib_name}") | ||
|
||
target_compile_options(${lib_name} PRIVATE ${fortran_flags}) | ||
|
||
set(module_dir "${PROJECT_BINARY_DIR}/include_4") | ||
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_4>) | ||
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") | ||
message( | ||
WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") | ||
endif() | ||
|
||
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}) | ||
install(EXPORT ${PROJECT_NAME}-config DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
add_subdirectory(src) | ||
|
||
if (ENABLE_TESTS) | ||
find_package(PFUNIT REQUIRED) | ||
enable_testing() | ||
add_subdirectory(tests) | ||
endif() |
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,30 @@ | ||
# SFCIO | ||
|
||
API for surface files I/O | ||
|
||
Code manager: George Vandenberghe | ||
|
||
|
||
### Prerequisites | ||
|
||
Compilers: GNU | Intel | Clang | AppleClang | ||
|
||
|
||
### Installing | ||
|
||
``` | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install /path/to/NCEPLIBS-sfcio | ||
make -j2 | ||
make install | ||
``` | ||
|
||
|
||
### Version | ||
1.3.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 @@ | ||
1.3.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,15 @@ | ||
@PACKAGE_INIT@ | ||
|
||
#@[email protected] | ||
# Imported interface targets provided: | ||
# * @PROJECT_NAME@::@PROJECT_NAME@ | ||
|
||
# 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@ IMPORTED_CONFIGURATIONS) | ||
|
||
check_required_components("@PROJECT_NAME@") | ||
|
||
get_target_property(location @PROJECT_NAME@::@PROJECT_NAME@ 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,62 @@ | ||
|
||
|
||
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") | ||
set(CMAKE_Fortran_FLAGS | ||
"-g -xHOST -traceback -free -convert big_endian -assume byterecl") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2") | ||
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") | ||
set(CMAKE_Fortran_FLAGS | ||
"-g -fbacktrace -ffree-form -fconvert=big-endian -funroll-loops") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -Wall") | ||
endif() | ||
|
||
set(fortran_src sfcio_module.f) | ||
|
||
set(lib_name ${PROJECT_NAME}) | ||
set(module_dir ${CMAKE_CURRENT_BINARY_DIR}/include) | ||
|
||
add_library(${lib_name} STATIC ${fortran_src}) | ||
add_library(${PROJECT_NAME}::${lib_name} ALIAS ${lib_name}) | ||
|
||
set_target_properties(${lib_name} PROPERTIES Fortran_MODULE_DIRECTORY ${module_dir}) | ||
target_include_directories(${lib_name} PUBLIC | ||
$<BUILD_INTERFACE:${module_dir}> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
list(APPEND LIB_TARGETS ${lib_name}) | ||
|
||
install(DIRECTORY ${module_dir} DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
add_pfunit_ctest (sfcio_test | ||
TEST_SOURCES test_mod.pf | ||
LINK_LIBRARIES sfcio::sfcio | ||
) |
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,12 @@ | ||
module test_mod | ||
use funit | ||
use iso_fortran_env, only: real32, real64 | ||
|
||
contains | ||
|
||
@test | ||
subroutine test_sigio() | ||
@assertTrue(.true., "true is true") | ||
end subroutine test_sigio | ||
|
||
end module test_mod |