From 4ddb17ef844938c3d619bf417295ad9bfaf9735a Mon Sep 17 00:00:00 2001 From: Hang-Lei-NOAA <44901908+Hang-Lei-NOAA@users.noreply.github.com> Date: Tue, 25 Feb 2020 11:21:04 -0500 Subject: [PATCH 1/8] Create LICENSE.md --- LICENSE.md | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0927556 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,157 @@ +### GNU LESSER GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the +terms and conditions of version 3 of the GNU General Public License, +supplemented by the additional permissions listed below. + +#### 0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the +GNU General Public License. + +"The Library" refers to a covered work governed by this License, other +than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + +The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + +#### 1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + +#### 2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + +- a) under this License, provided that you make a good faith effort + to ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or +- b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + +#### 3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a +header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + +- a) Give prominent notice with each copy of the object code that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the object code with a copy of the GNU GPL and this + license document. + +#### 4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken +together, effectively do not restrict modification of the portions of +the Library contained in the Combined Work and reverse engineering for +debugging such modifications, if you also do each of the following: + +- a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. +- b) Accompany the Combined Work with a copy of the GNU GPL and this + license document. +- c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. +- d) Do one of the following: + - 0) Convey the Minimal Corresponding Source under the terms of + this License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + - 1) Use a suitable shared library mechanism for linking with + the Library. A suitable mechanism is one that (a) uses at run + time a copy of the Library already present on the user's + computer system, and (b) will operate properly with a modified + version of the Library that is interface-compatible with the + Linked Version. +- e) Provide Installation Information, but only if you would + otherwise be required to provide such information under section 6 + of the GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the Application + with a modified version of the Linked Version. (If you use option + 4d0, the Installation Information must accompany the Minimal + Corresponding Source and Corresponding Application Code. If you + use option 4d1, you must provide the Installation Information in + the manner specified by section 6 of the GNU GPL for conveying + Corresponding Source.) + +#### 5. Combined Libraries. + +You may place library facilities that are a work based on the Library +side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + +- a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities, conveyed under the terms of this License. +- b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + +#### 6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +as you received it specifies that a certain numbered version of the +GNU Lesser General Public License "or any later version" applies to +it, you have the option of following the terms and conditions either +of that published version or of any later version published by the +Free Software Foundation. If the Library as you received it does not +specify a version number of the GNU Lesser General Public License, you +may choose any version of the GNU Lesser General Public License ever +published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. From 564aada56b3de62912481aaa81320f19389f1cba Mon Sep 17 00:00:00 2001 From: Hang-Lei-NOAA <44901908+Hang-Lei-NOAA@users.noreply.github.com> Date: Tue, 3 Mar 2020 20:01:30 -0500 Subject: [PATCH 2/8] Update LICENSE.md --- LICENSE.md | 158 ++--------------------------------------------------- 1 file changed, 5 insertions(+), 153 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 0927556..b0d5e21 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,157 +1,9 @@ -### GNU LESSER GENERAL PUBLIC LICENSE +Copyright 2020 National Oceanic and Atmospheric Administration (by assignment from I. M. Systems Group) -Version 3, 29 June 2007 +The [NCEPLIBS-sfcio] code incorporated in the Unified Forecast System (UFS) was jointly developed by the National Oceanic and Atmospheric Administration and the I. M. Systems Group. The gold standard copy of the Code will be maintained by NOAA at [https://github.com/NOAA-EMC/NCEPLIBS-sfcio]. -Copyright (C) 2007 Free Software Foundation, Inc. - +The National Oceanic and Atmospheric Administration is releasing this code under the GNU Lesser General Public License v3.0 (the "License"); you may not use this code except in compliance with the License. -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. +You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html -This version of the GNU Lesser General Public License incorporates the -terms and conditions of version 3 of the GNU General Public License, -supplemented by the additional permissions listed below. - -#### 0. Additional Definitions. - -As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the -GNU General Public License. - -"The Library" refers to a covered work governed by this License, other -than an Application or a Combined Work as defined below. - -An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - -A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - -The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - -The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - -#### 1. Exception to Section 3 of the GNU GPL. - -You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - -#### 2. Conveying Modified Versions. - -If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - -- a) under this License, provided that you make a good faith effort - to ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or -- b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - -#### 3. Object Code Incorporating Material from Library Header Files. - -The object code form of an Application may incorporate material from a -header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - -- a) Give prominent notice with each copy of the object code that - the Library is used in it and that the Library and its use are - covered by this License. -- b) Accompany the object code with a copy of the GNU GPL and this - license document. - -#### 4. Combined Works. - -You may convey a Combined Work under terms of your choice that, taken -together, effectively do not restrict modification of the portions of -the Library contained in the Combined Work and reverse engineering for -debugging such modifications, if you also do each of the following: - -- a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. -- b) Accompany the Combined Work with a copy of the GNU GPL and this - license document. -- c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. -- d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of - this License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with - the Library. A suitable mechanism is one that (a) uses at run - time a copy of the Library already present on the user's - computer system, and (b) will operate properly with a modified - version of the Library that is interface-compatible with the - Linked Version. -- e) Provide Installation Information, but only if you would - otherwise be required to provide such information under section 6 - of the GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the Application - with a modified version of the Linked Version. (If you use option - 4d0, the Installation Information must accompany the Minimal - Corresponding Source and Corresponding Application Code. If you - use option 4d1, you must provide the Installation Information in - the manner specified by section 6 of the GNU GPL for conveying - Corresponding Source.) - -#### 5. Combined Libraries. - -You may place library facilities that are a work based on the Library -side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - -- a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities, conveyed under the terms of this License. -- b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - -#### 6. Revised Versions of the GNU Lesser General Public License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -as you received it specifies that a certain numbered version of the -GNU Lesser General Public License "or any later version" applies to -it, you have the option of following the terms and conditions either -of that published version or of any later version published by the -Free Software Foundation. If the Library as you received it does not -specify a version number of the GNU Lesser General Public License, you -may choose any version of the GNU Lesser General Public License ever -published by the Free Software Foundation. - -If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License From 4957a193495db2470aabff472daa8bbc7abebdf4 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Tue, 16 Jun 2020 12:45:35 -0400 Subject: [PATCH 3/8] CMake and Tests (#10) * Merge release/public-v1 into develop retaining old build system and related files * Tests, CMake, CI --- .github/workflows/main.yml | 53 +++++++++++++++++++++++++++ .gitignore | 8 ++++ CMakeLists.txt | 71 ++++++++++-------------------------- README.md | 30 +++++++++++++++ VERSION | 1 + cmake/PackageConfig.cmake.in | 12 ++++++ src/CMakeLists.txt | 62 +++++++++++++++++++++++++++++++ tests/CMakeLists.txt | 5 +++ tests/test_mod.pf | 12 ++++++ 9 files changed, 203 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 VERSION create mode 100644 cmake/PackageConfig.cmake.in create mode 100644 src/CMakeLists.txt create mode 100644 tests/CMakeLists.txt create mode 100644 tests/test_mod.pf diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ca77106 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f50dddf --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +build/ +install/ + +*.[ao] +*.mod +*.so + +*.swp diff --git a/CMakeLists.txt b/CMakeLists.txt index b01d685..15c79d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 - $ - $) +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() diff --git a/README.md b/README.md new file mode 100644 index 0000000..571e639 --- /dev/null +++ b/README.md @@ -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.2.0 + + +### Authors + +* **[NCEP/EMC](mailto:NCEP.List.EMC.nceplibs.Developers@noaa.gov)** diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..26aaba0 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.2.0 diff --git a/cmake/PackageConfig.cmake.in b/cmake/PackageConfig.cmake.in new file mode 100644 index 0000000..332af8f --- /dev/null +++ b/cmake/PackageConfig.cmake.in @@ -0,0 +1,12 @@ +@PACKAGE_INIT@ + +#@PROJECT_NAME@-config.cmake +# Imported interface targets provided: +# * @PROJECT_NAME@::@PROJECT_NAME@ + +# Include targets file. This will create IMPORTED target @PROJECT_NAME@ +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") + +get_target_property(@PROJECT_NAME@_BUILD_TYPES @PROJECT_NAME@::@PROJECT_NAME@ IMPORTED_CONFIGURATIONS) + +check_required_components("@PROJECT_NAME@") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..c9d08f7 --- /dev/null +++ b/src/CMakeLists.txt @@ -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 + $ + $) + +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}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..77fb440 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,5 @@ + +add_pfunit_ctest (sfcio_test + TEST_SOURCES test_mod.pf + LINK_LIBRARIES sfcio::sfcio +) diff --git a/tests/test_mod.pf b/tests/test_mod.pf new file mode 100644 index 0000000..6e987fa --- /dev/null +++ b/tests/test_mod.pf @@ -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 From 2382466e465c5844cf91dbe354f0dfab3462aeef Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Mon, 22 Jun 2020 13:14:20 -0400 Subject: [PATCH 4/8] Add message to PackageConfig when library is found --- cmake/PackageConfig.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/PackageConfig.cmake.in b/cmake/PackageConfig.cmake.in index 332af8f..76b495f 100644 --- a/cmake/PackageConfig.cmake.in +++ b/cmake/PackageConfig.cmake.in @@ -10,3 +10,6 @@ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") 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@)") From 55379e70390a5fef73ca8b026c4587ad2880bd93 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:37:44 -0400 Subject: [PATCH 5/8] Add quotes to version --- cmake/PackageConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/PackageConfig.cmake.in b/cmake/PackageConfig.cmake.in index 76b495f..3d4c7b4 100644 --- a/cmake/PackageConfig.cmake.in +++ b/cmake/PackageConfig.cmake.in @@ -12,4 +12,4 @@ get_target_property(@PROJECT_NAME@_BUILD_TYPES @PROJECT_NAME@::@PROJECT_NAME@ IM check_required_components("@PROJECT_NAME@") get_target_property(location @PROJECT_NAME@::@PROJECT_NAME@ LOCATION) -message(STATUS "Found @PROJECT_NAME@: ${location} (found version @PROJECT_VERSION@)") +message(STATUS "Found @PROJECT_NAME@: ${location} (found version \"@PROJECT_VERSION@\")") From 77bc2262c0c13a4df1da6407f3618ad8253a60c3 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Tue, 23 Jun 2020 13:59:02 -0400 Subject: [PATCH 6/8] Make install relocatable --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9d08f7..a8f8e69 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,7 @@ 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 $ - $) + $) list(APPEND LIB_TARGETS ${lib_name}) From e84018fb5979532b7ac60e02d064580c6cc20197 Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Thu, 25 Jun 2020 23:05:28 -0400 Subject: [PATCH 7/8] Update VERSION to 1.3.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 26aaba0..f0bb29e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.0 +1.3.0 From 3a14ee18e9c82aecd34d990d6bcb54f5a885f9d0 Mon Sep 17 00:00:00 2001 From: kgerheiser Date: Fri, 26 Jun 2020 11:38:33 -0400 Subject: [PATCH 8/8] Update version in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 571e639..a6c769a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ make install ### Version -1.2.0 +1.3.0 ### Authors