From e42213ccc9a787d742cf844218cfa3665a02cd48 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 6 Dec 2022 08:44:49 -0600 Subject: [PATCH 1/9] adding aliases for libraries --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d714460e5..1ca66d7e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,11 @@ set ( LIB_NAME ${PROJECT_NAME} ) add_library ( ${LIB_NAME} SHARED ${JF_LIB_SRCS} ) add_library ( ${LIB_NAME}-static STATIC ${JF_LIB_SRCS} ) +# add an alias so that including json-fortran is agnostic +# of find_package or being directly compiled through add_subdirectory +add_library ( ${PACKAGE_NAME}::${LIB_NAME} ALIAS ${LIB_NAME} ) +add_library ( ${PACKAGE_NAME}::${LIB_NAME}-static ALIAS ${LIB_NAME}-static ) + if(JSON_FORTRAN_USE_OpenCoarrays) target_link_libraries(${LIB_NAME} PRIVATE OpenCoarrays::caf_mpi_static) From 97e8ca1aaa0a31fed7ca9426a231be24c3dadd08 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 6 Dec 2022 08:53:15 -0600 Subject: [PATCH 2/9] updating to cmake 3.0 and using cmake's version setting --- CMakeLists.txt | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d714460e5..c290337ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ # this software. The contributing author, Izaak Beekman, retains all # rights permitted by the terms of the JSON-Fortran license. -cmake_minimum_required ( VERSION 2.8.8 FATAL_ERROR ) +cmake_minimum_required ( VERSION 3.0 FATAL_ERROR ) # Use MSVS folders to organize projects on windows set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -34,7 +34,11 @@ include ( "cmake/checkOutOfSource.cmake" ) #--------------------- # Declare project name #--------------------- -project ( jsonfortran NONE ) +project ( + jsonfortran + VERSION 8.3.0 + LANGUAGES Fortran +) if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) option(JSON_FORTRAN_USE_OpenCoarrays @@ -70,16 +74,6 @@ elseif(${JSON_INT_KIND} MATCHES "INT64") add_definitions(-DINT64) endif() -#---------------------------------- -# Get version (semantic versioning) -# C.F. semver.org -#---------------------------------- -file ( STRINGS "${PROJECT_SOURCE_DIR}/.VERSION" VERSION ) -string( REPLACE "." ";" VERSION_LIST ${VERSION} ) -list(GET VERSION_LIST 0 VERSION_MAJOR) -list(GET VERSION_LIST 1 VERSION_MINOR) -list(GET VERSION_LIST 2 VERSION_PATCH) -set(PROJECT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") message ( STATUS "CMake build configuration for JSON-Fortran ${PROJECT_VERSION}" ) #------------------------------------- @@ -191,7 +185,7 @@ set_target_properties ( ${LIB_NAME}-static if(NOT MSVC_IDE) PREFIX lib endif() - VERSION ${VERSION} + VERSION ${PROJECT_VERSION} ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib Fortran_MODULE_DIRECTORY ${MODULE_DIR} ) set_target_properties ( ${LIB_NAME} @@ -200,8 +194,8 @@ set_target_properties ( ${LIB_NAME} if(NOT MSVC_IDE) PREFIX lib endif() - SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR} - VERSION ${VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + VERSION ${PROJECT_VERSION} LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR} ) @@ -452,7 +446,7 @@ install ( EXPORT ${PACKAGE_NAME}-targets include ( CMakePackageConfigHelpers ) # Standard CMake module write_basic_package_version_file( "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" - VERSION ${VERSION} + VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion ) # provides COMPILER_CONSISTENCY_CHECK From e9362a67df00d7d2705462402f5ac988bcdebdf8 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 6 Dec 2022 08:54:22 -0600 Subject: [PATCH 3/9] removing version file --- .VERSION | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .VERSION diff --git a/.VERSION b/.VERSION deleted file mode 100644 index 2bf50aaf1..000000000 --- a/.VERSION +++ /dev/null @@ -1 +0,0 @@ -8.3.0 From 842a33ec67e07dfa7dc741fe1ebff25cdff11669 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 6 Dec 2022 10:58:14 -0600 Subject: [PATCH 4/9] only installing if json-fortran is the top level project --- CMakeLists.txt | 58 ++-------------------------------------- packaging/CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 56 deletions(-) create mode 100644 packaging/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index d714460e5..2c0e14610 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -446,60 +446,6 @@ add_custom_target ( uninstall #----------------------------------------------------- # Publicize installed location to other CMake projects #----------------------------------------------------- -install ( EXPORT ${PACKAGE_NAME}-targets - NAMESPACE ${PACKAGE_NAME}:: - DESTINATION "${EXPORT_INSTALL_DIR}" ) - -include ( CMakePackageConfigHelpers ) # Standard CMake module -write_basic_package_version_file( "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" - VERSION ${VERSION} - COMPATIBILITY SameMajorVersion ) - -# provides COMPILER_CONSISTENCY_CHECK -include ( cmake/FCompilerConsistencyCheck.cmake ) - -# install package config file -configure_package_config_file ( - "${PROJECT_SOURCE_DIR}/cmake/pkg/${PROJECT_NAME}-config.cmake.in" - "${PROJECT_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake" - INSTALL_DESTINATION "${EXPORT_INSTALL_DIR}" - PATH_VARS EXPORT_INSTALL_DIR INSTALL_MOD_DIR ) - -# Install the config and version files so that we can find this project with others -install ( FILES - "${PROJECT_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake" - "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" - DESTINATION "${EXPORT_INSTALL_DIR}" ) - -#---------------------------------------------- -# Make build tree targets accessible for import -#---------------------------------------------- -export ( TARGETS ${LIB_NAME} ${LIB_NAME}-static FILE ${PACKAGE_NAME}-targets.cmake ) - -# build tree package config file, NOT installed -configure_file ( - "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in" - "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake" - @ONLY ) - -set ( ENABLE_BUILD_TREE_EXPORT FALSE CACHE BOOL - "Add the ${PACKAGE_NAME} build tree to the CMake package registry?" ) -if ( ENABLE_BUILD_TREE_EXPORT ) - export ( PACKAGE ${PACKAGE_NAME} ) -endif () - -# pkg-config stuff -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/json-fortran.pc.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/json-fortran.pc" - @ONLY -) -install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/json-fortran.pc" - DESTINATION "${INSTALL_LIB_DIR}/pkgconfig" -) - -if(MSVC_IDE) - INCLUDE_DIRECTORIES("src") - SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp") +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + add_subdirectory(packaging) endif() diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt new file mode 100644 index 000000000..8d90e2e6c --- /dev/null +++ b/packaging/CMakeLists.txt @@ -0,0 +1,57 @@ +install ( EXPORT ${PACKAGE_NAME}-targets + NAMESPACE ${PACKAGE_NAME}:: + DESTINATION "${EXPORT_INSTALL_DIR}" ) + +include ( CMakePackageConfigHelpers ) # Standard CMake module +write_basic_package_version_file( "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" + VERSION ${VERSION} + COMPATIBILITY SameMajorVersion ) + +# provides COMPILER_CONSISTENCY_CHECK +include ( ${PROJECT_SOURCE_DIR}/cmake/FCompilerConsistencyCheck.cmake ) + +# install package config file +configure_package_config_file ( + "${PROJECT_SOURCE_DIR}/cmake/pkg/${PROJECT_NAME}-config.cmake.in" + "${PROJECT_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake" + INSTALL_DESTINATION "${EXPORT_INSTALL_DIR}" + PATH_VARS EXPORT_INSTALL_DIR INSTALL_MOD_DIR ) + +# Install the config and version files so that we can find this project with others +install ( FILES + "${PROJECT_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake" + "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" + DESTINATION "${EXPORT_INSTALL_DIR}" ) + +#---------------------------------------------- +# Make build tree targets accessible for import +#---------------------------------------------- +export ( TARGETS ${LIB_NAME} ${LIB_NAME}-static FILE ${PACKAGE_NAME}-targets.cmake ) + +# build tree package config file, NOT installed +configure_file ( + "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in" + "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake" + @ONLY ) + +set ( ENABLE_BUILD_TREE_EXPORT FALSE CACHE BOOL + "Add the ${PACKAGE_NAME} build tree to the CMake package registry?" ) +if ( ENABLE_BUILD_TREE_EXPORT ) + export ( PACKAGE ${PACKAGE_NAME} ) +endif () + +# pkg-config stuff +configure_file( + "${PROJECT_SOURCE_DIR}/json-fortran.pc.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/json-fortran.pc" + @ONLY +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/json-fortran.pc" + DESTINATION "${INSTALL_LIB_DIR}/pkgconfig" +) + +if(MSVC_IDE) + INCLUDE_DIRECTORIES("src") + SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp") +endif() \ No newline at end of file From d7638fb7d23d2b1ac9122c312b3a1b8b7509b1d1 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 24 Apr 2023 09:23:50 -0500 Subject: [PATCH 5/9] configuring version file with cmake --- .VERSION | 1 + .VERSION.in | 1 + CMakeLists.txt | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 .VERSION create mode 100644 .VERSION.in diff --git a/.VERSION b/.VERSION new file mode 100644 index 000000000..2bf50aaf1 --- /dev/null +++ b/.VERSION @@ -0,0 +1 @@ +8.3.0 diff --git a/.VERSION.in b/.VERSION.in new file mode 100644 index 000000000..139c7d28b --- /dev/null +++ b/.VERSION.in @@ -0,0 +1 @@ +${PROJECT_VERSION} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index c6085e085..1e8f4369c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,9 @@ project ( LANGUAGES Fortran ) +# write the version file +configure_file(${CMAKE_SOURCE_DIR}/.VERSION.in ${CMAKE_SOURCE_DIR}/.VERSION) + if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) option(JSON_FORTRAN_USE_OpenCoarrays "Build JSON-Fortran with support for linking against OpenCoarray programs" OFF) From d307d1ec8efb2587f3e33e99c1b39aed9f67d219 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Mon, 24 Apr 2023 09:25:51 -0500 Subject: [PATCH 6/9] updating documentation for version --- pages/development-resources/release-checklist.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/development-resources/release-checklist.md b/pages/development-resources/release-checklist.md index 34f9a147b..114b2dd7f 100644 --- a/pages/development-resources/release-checklist.md +++ b/pages/development-resources/release-checklist.md @@ -14,8 +14,8 @@ remain accurate. 1. Look at the latest [changes committed to GitHub since the last release](https://github.com/jacobwilliams/json-fortran/compare/{!.VERSION!}...HEAD), {!.VERSION!}. This will only be accurate if you have - not yet updated `.VERSION`. If you *have* updated - `.VERSION` then edit the URL manually to view the + not yet updated the project version in cmake. If you *have* updated + the prouct version in cmake and run cmake (and therefore `.VERSION`) then edit the URL manually to view the changes. 1. Run the [`github_changelog_generator`](https://github.com/github-changelog-generator/github-changelog-generator) @@ -51,7 +51,8 @@ remain accurate. string 1. Add `pages/releases/index.md` to the git index: `git add pages/releases/index.md` 1. Update the version string in remaining files requiring manual edits: - 1. Edit the `.VERSION` file + 1. Edit the product version in cmake + 1. Run cmake to product the .VERSION file 1. Edit the CMake example on line 142 of `README.md` 1. Edit the `json_fortran_version` string in `json_module.F90` 1. Add these files to the git index: `git add .VERSION README.md ./src/json_module.F90` From 64cbea5c104777d2339effdc8208c6c8485ded05 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Tue, 6 Feb 2024 12:59:10 -0600 Subject: [PATCH 7/9] Update pages/development-resources/release-checklist.md Co-authored-by: EmilyBourne --- pages/development-resources/release-checklist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/development-resources/release-checklist.md b/pages/development-resources/release-checklist.md index 114b2dd7f..fb99d2a07 100644 --- a/pages/development-resources/release-checklist.md +++ b/pages/development-resources/release-checklist.md @@ -15,7 +15,7 @@ remain accurate. last release](https://github.com/jacobwilliams/json-fortran/compare/{!.VERSION!}...HEAD), {!.VERSION!}. This will only be accurate if you have not yet updated the project version in cmake. If you *have* updated - the prouct version in cmake and run cmake (and therefore `.VERSION`) then edit the URL manually to view the + the product version in cmake and run cmake (and therefore `.VERSION`) then edit the URL manually to view the changes. 1. Run the [`github_changelog_generator`](https://github.com/github-changelog-generator/github-changelog-generator) From 4620219c69fc8b5cb65cd29ca0dc9ad13dd45423 Mon Sep 17 00:00:00 2001 From: Jacob Williams Date: Sat, 25 May 2024 11:58:10 -0500 Subject: [PATCH 8/9] some cleanups --- CMakeLists.txt | 4 ++-- pages/development-resources/release-checklist.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19c6b68bc..eb7ba0eb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,8 @@ include ( "cmake/checkOutOfSource.cmake" ) # Declare project name #--------------------- project ( - jsonfortran - VERSION 8.3.0 + jsonfortran + VERSION 8.4.0 LANGUAGES Fortran ) diff --git a/pages/development-resources/release-checklist.md b/pages/development-resources/release-checklist.md index fb99d2a07..0678a3019 100644 --- a/pages/development-resources/release-checklist.md +++ b/pages/development-resources/release-checklist.md @@ -51,9 +51,9 @@ remain accurate. string 1. Add `pages/releases/index.md` to the git index: `git add pages/releases/index.md` 1. Update the version string in remaining files requiring manual edits: - 1. Edit the product version in cmake - 1. Run cmake to product the .VERSION file - 1. Edit the CMake example on line 142 of `README.md` + 1. Edit the product version in CMake + 1. Run cmake to generate the `.VERSION` file (or manually update this file if not running CMake) + 1. Edit the CMake example on line 141 of `README.md` 1. Edit the `json_fortran_version` string in `json_module.F90` 1. Add these files to the git index: `git add .VERSION README.md ./src/json_module.F90` 1. Commit the changes to the master branch: `git commit` From a22eebcb0c47f0fcd6e3589e8ed43b5da5d765ce Mon Sep 17 00:00:00 2001 From: Jacob Williams Date: Sat, 25 May 2024 12:01:28 -0500 Subject: [PATCH 9/9] bump required cmake to 3.5 to remove depreciation warning --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb7ba0eb0..3a435d292 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ # this software. The contributing author, Izaak Beekman, retains all # rights permitted by the terms of the JSON-Fortran license. -cmake_minimum_required ( VERSION 3.0 FATAL_ERROR ) +cmake_minimum_required ( VERSION 3.5 FATAL_ERROR ) # Use MSVS folders to organize projects on windows set_property(GLOBAL PROPERTY USE_FOLDERS ON)