From 33833288965cf8902686da16166f61b840089767 Mon Sep 17 00:00:00 2001 From: jchristopherson Date: Wed, 24 Sep 2025 13:51:03 -0500 Subject: [PATCH 1/3] Clean up --- .github/workflows/fpm.yml | 93 +------------------- CMakeLists.txt | 51 ++++------- cmake/helper.cmake | 75 ---------------- configure/CMakeLists.txt | 64 ++++++++++++-- configure/template.cmake | 5 ++ configure/template.pc | 10 +++ dependencies/CMakeLists.txt | 24 ----- dependencies/collections/CMakeLists.txt | 18 ---- dependencies/ferror/CMakeLists.txt | 18 ---- dependencies/forcolormap/CMakeLists.txt | 18 ---- dependencies/fstring/CMakeLists.txt | 18 ---- dependencies/geompack/CMakeLists.txt | 18 ---- src/CMakeLists.txt | 111 ++++++++++++++++++++++++ test/CMakeLists.txt | 35 +++++++- test/fortran_test_helper/CMakeLists.txt | 2 - 15 files changed, 233 insertions(+), 327 deletions(-) delete mode 100644 cmake/helper.cmake create mode 100644 configure/template.cmake create mode 100644 configure/template.pc delete mode 100644 dependencies/CMakeLists.txt delete mode 100644 dependencies/collections/CMakeLists.txt delete mode 100644 dependencies/ferror/CMakeLists.txt delete mode 100644 dependencies/forcolormap/CMakeLists.txt delete mode 100644 dependencies/fstring/CMakeLists.txt delete mode 100644 dependencies/geompack/CMakeLists.txt diff --git a/.github/workflows/fpm.yml b/.github/workflows/fpm.yml index 7a001b8f..79777034 100644 --- a/.github/workflows/fpm.yml +++ b/.github/workflows/fpm.yml @@ -28,19 +28,13 @@ jobs: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V} - - - name: Install BLAS & LAPACK - if: contains(matrix.os, 'ubuntu') - run: | - sudo apt-get update - sudo apt-get install libopenblas-dev liblapack-dev - + - name: Install fpm uses: fortran-lang/setup-fpm@v5 with: fpm-version: 'v0.10.1' - - name: Build LINALG + - name: Build FPLOT run: | gfortran --version fpm build @@ -48,85 +42,4 @@ jobs: - name: Run tests run: | gfortran --version - fpm test - - msys2-build: - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - - steps: - - uses: actions/checkout@v2 - - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - path-type: inherit - install: | - mingw-w64-x86_64-gcc-fortran - mingw-w64-x86_64-fpm - mingw-w64-x86_64-openblas - mingw-w64-x86_64-lapack - - - name: fpm build - run: | - gfortran --version - fpm --version - fpm build - - - name: fpm test - run: | - fpm test - - # intel-build: - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - - # env: - # FPM_FC: ifx - # FC: ifx - - # steps: - # - name: Checkout code - # uses: actions/checkout@v3 - - # - name: Add Intel repository (Linux) - # run: | - # wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - # sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - # rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - # echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - # sudo apt-get update - - # - name: Install Intel oneAPI compiler (Linux) - # run: | - # sudo apt-get install intel-oneapi-compiler-fortran - - # - name: Setup Intel oneAPI environment - # run: | - # source /opt/intel/oneapi/setvars.sh - # printenv >> $GITHUB_ENV - - # - name: Install MKL - # run: | - # sudo apt-get update - # sudo apt-get -y install intel-mkl - # sudo apt update - # sudo apt -y install intel-mkl - - # - name: Install fpm - # uses: fortran-lang/setup-fpm@v3 - # with: - # fpm-version: 'v0.8.2' - - # - name: fpm build - # run: | - # ifx --version - # fpm --version - # fpm build --profile debug --flag "-warn nointerfaces" - - # - name: fpm test - # run: | - # fpm test --profile debug --flag "-warn nointerfaces" \ No newline at end of file + fpm test \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 157e2ab9..3ef62f35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,53 +3,34 @@ cmake_minimum_required(VERSION 3.24) project( fplot LANGUAGES Fortran - VERSION 1.8.0 + VERSION 1.8.1 ) -# Get helper macros and functions -include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake") - # Confgiure everything add_subdirectory(configure) -# Locate Dependencies -add_subdirectory(dependencies) - # Source add_subdirectory(src) -add_fortran_library( - ${PROJECT_NAME} - ${PROJECT_INCLUDE_DIR} - ${CMAKE_INSTALL_INCLUDEDIR} - ${PROJECT_VERSION} - ${PROJECT_VERSION_MAJOR} - ${FPLOT_SOURCES} -) -link_library(${PROJECT_NAME} ${ferror_LIBRARY} ${ferror_INCLUDE_DIR}) -link_library(${PROJECT_NAME} ${fstring_LIBRARY} ${fstring_INCLUDE_DIR}) -link_library(${PROJECT_NAME} ${collections_LIBRARY} ${collections_INCLUDE_DIR}) -link_library(${PROJECT_NAME} ${geompack_LIBRARY} ${geompack_INCLUDE_DIR}) -link_library(${PROJECT_NAME} ${forcolormap_LIBRARY} ${forcolormap_INCLUDE_DIR}) -# ------------------------------------------------------------------------------ -# EXAMPLES -# ------------------------------------------------------------------------------ -option(BUILD_FPLOT_EXAMPLES "Build FPLOT examples?" OFF) -if (BUILD_FPLOT_EXAMPLES) - # Inform the user we're building the examples - message(STATUS "Building FPLOT examples.") - - # Build the examples - add_subdirectory(examples) -endif() +# Install +install( + EXPORT ${PROJECT_NAME}-targets + NAMESPACE ${PROJECT_NAME}:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" +) -# ------------------------------------------------------------------------------ -# TESTING -# ------------------------------------------------------------------------------ +# Testing option(BUILD_TESTING "Build tests") include(CTest) -message(STATUS "Build tests: ${BUILD_TESTING}") +message(STATUS "Build FPLOT tests: ${BUILD_TESTING}") if (BUILD_TESTING) enable_testing() add_subdirectory(test) +endif() + +# Examples +option(BUILD_FPLOT_EXAMPLES "Build FPLOT examples") +message(STATUS "Build FPLOT examples: ${BUILD_FPLOT_EXAMPLES}") +if (BUILD_FPLOT_EXAMPLES) + add_subdirectory(examples) endif() \ No newline at end of file diff --git a/cmake/helper.cmake b/cmake/helper.cmake deleted file mode 100644 index 7aaee53c..00000000 --- a/cmake/helper.cmake +++ /dev/null @@ -1,75 +0,0 @@ -# helper.cmake -# -# A collection of macros and functions making life with CMake and Fortran a -# bit simpler. - -# Use to include and export headers -function(include_headers lib dir install_dir) - target_include_directories( - ${lib} - INTERFACE - $ - $ - ) -endfunction() - -# Use instead of add_library. -function(add_fortran_library lib_name mod_dir include_install_dir version major) - add_library(${lib_name} ${ARGN}) - set_target_properties( - ${lib_name} - PROPERTIES - POSITION_INDEPENDENT_CODE TRUE - OUTPUT_NAME ${lib_name} - VERSION ${version} - SOVERSION ${major} - Fortran_MODULE_DIRECTORY ${include_install_dir} - ) - target_include_directories( - ${lib_name} - PUBLIC - $ - $ - ) -endfunction() - -# Installs the library -function(install_library lib_name lib_install_dir bin_install_dir mod_dir install_dir) - install( - TARGETS ${lib_name} - EXPORT ${lib_name}Targets - RUNTIME DESTINATION ${bin_install_dir} - LIBRARY DESTINATION ${lib_install_dir} - ARCHIVE DESTINATION ${lib_install_dir} - INCLUDES DESTINATION ${install_dir}/include - ) - install( - DIRECTORY ${mod_dir} - DESTINATION ${install_dir} - ) -endfunction() - -# Install the documentation files -function(install_documentation doc_dir install_dir) - install( - DIRECTORY ${doc_dir} - DESTINATION ${install_dir} - ) -endfunction() - -# Links the supplied library -function(link_library targ lib include_dir) - target_link_libraries(${targ} PRIVATE ${lib}) - target_include_directories(${targ} PUBLIC $) -endfunction() - -# ------------------------------------------------------------------------------ -# Helpful Macros -macro(print_all_variables) - message(STATUS "---------- CURRENTLY DEFINED VARIABLES -----------") - get_cmake_property(varNames VARIABLES) - foreach(varName ${varNames}) - message(STATUS ${varName} = ${${varName}}) - endforeach() - message(STATUS "---------- END ----------") -endmacro() \ No newline at end of file diff --git a/configure/CMakeLists.txt b/configure/CMakeLists.txt index f114e3c5..3b9639fa 100644 --- a/configure/CMakeLists.txt +++ b/configure/CMakeLists.txt @@ -1,6 +1,3 @@ -# Get the macros and functions we'll need -include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake") - # 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.") @@ -13,11 +10,64 @@ endif() option(BUILD_SHARED_LIBS "Build shared libraries" OFF) # Export all symbols on Windows when building libraries -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) # Utilize the GNU installation structure include(GNUInstallDirs) -# Locate the local include directory -set(PROJECT_INCLUDE_DIR ${PROJECT_BINARY_DIR}/include) -set(PROJECT_INCLUDE_DIR ${PROJECT_INCLUDE_DIR} PARENT_SCOPE) \ No newline at end of file +# Module directory +if(NOT DEFINED CMAKE_INSTALL_MODULEDIR) + set( + CMAKE_INSTALL_MODULEDIR + "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}" + CACHE + STRING + "Directory in prefix to install generated module files" + ) +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE) + +# Export a pkg-config file +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/template.pc" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" + @ONLY +) + +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" +) + +# Export CMake package file +include(CMakePackageConfigHelpers) +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/template.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" +) + +if(BUILD_SHARED_LIBS OR PROJECT_VERSION_MAJOR EQUAL 0) + # Due to the uncertain ABI compatibility of Fortran shared libraries + # limit compatibility for dynamic linking to same minor version. + set(COMPATIBILITY SameMinorVersion) +else() + # Require API compatibility via semantic versioning for static linking. + set(COMPATIBILITY SameMajorVersion) +endif() + +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" + VERSION "${PROJECT_VERSION}" + COMPATIBILITY ${COMPATIBILITY} +) + +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" +) diff --git a/configure/template.cmake b/configure/template.cmake new file mode 100644 index 00000000..ffdb09b3 --- /dev/null +++ b/configure/template.cmake @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@") + include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") +endif() \ No newline at end of file diff --git a/configure/template.pc b/configure/template.pc new file mode 100644 index 00000000..653b13d7 --- /dev/null +++ b/configure/template.pc @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +moduledir=${prefix}/@CMAKE_INSTALL_MODULEDIR@ + +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@ +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -l@PROJECT_NAME@ +Cflags: -I${includedir} -I${moduledir} \ No newline at end of file diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt deleted file mode 100644 index f7796093..00000000 --- a/dependencies/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Get FERROR -add_subdirectory(ferror) -set(ferror_LIBRARY ${ferror_LIBRARY} PARENT_SCOPE) -set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE) - -# Get FSTRING -add_subdirectory(fstring) -set(fstring_LIBRARY ${fstring_LIBRARY} PARENT_SCOPE) -set(fstring_INCLUDE_DIR ${fstring_INCLUDE_DIR} PARENT_SCOPE) - -# Get COLLECTIONS -add_subdirectory(collections) -set(collections_LIBRARY ${collections_LIBRARY} PARENT_SCOPE) -set(collections_INCLUDE_DIR ${collections_INCLUDE_DIR} PARENT_SCOPE) - -# Get GEOMPACK -add_subdirectory(geompack) -set(geompack_LIBRARY ${geompack_LIBRARY} PARENT_SCOPE) -set(geompack_INCLUDE_DIR ${geompack_INCLUDE_DIR} PARENT_SCOPE) - -# Get FORCOLORMAP -add_subdirectory(forcolormap) -set(forcolormap_LIBRARY ${forcolormap_LIBRARY} PARENT_SCOPE) -set(forcolormap_INCLUDE_DIR ${forcolormap_INCLUDE_DIR} PARENT_SCOPE) diff --git a/dependencies/collections/CMakeLists.txt b/dependencies/collections/CMakeLists.txt deleted file mode 100644 index 5d078fab..00000000 --- a/dependencies/collections/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Get the macros and functions we'll need -include(FetchContent) - -# Fetch the proper content -FetchContent_Declare( - collections - GIT_REPOSITORY "https://github.com/jchristopherson/collections" - GIT_TAG main -) - -FetchContent_MakeAvailable(collections) - -set(collections_INCLUDE_DIR ${collections_BINARY_DIR}/include) -set(collections_INCLUDE_DIR ${collections_INCLUDE_DIR} PARENT_SCOPE) - -# Make a parent-scope variable for the library -set(collections_LIBRARY collections) -set(collections_LIBRARY ${collections_LIBRARY} PARENT_SCOPE) diff --git a/dependencies/ferror/CMakeLists.txt b/dependencies/ferror/CMakeLists.txt deleted file mode 100644 index c78fc2cc..00000000 --- a/dependencies/ferror/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -include(FetchContent) - -# Fetch the proper content -FetchContent_Declare( - ferror - GIT_REPOSITORY "https://github.com/jchristopherson/ferror" -) -FetchContent_MakeAvailable(ferror) - -set(ferror_INCLUDE_DIR ${ferror_BINARY_DIR}/include) -configure_file( - "${ferror_SOURCE_DIR}/include/ferror.h" - "${ferror_INCLUDE_DIR}/ferror.h" - COPYONLY -) -set(ferror_LIBRARY ferror) -set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE) -set(ferror_LIBRARY ${ferror_LIBRARY} PARENT_SCOPE) diff --git a/dependencies/forcolormap/CMakeLists.txt b/dependencies/forcolormap/CMakeLists.txt deleted file mode 100644 index 321cfaa6..00000000 --- a/dependencies/forcolormap/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Get the macros and functions we'll need -include(FetchContent) - -# Fetch the proper content -FetchContent_Declare( - forcolormap - GIT_REPOSITORY "https://github.com/vmagnin/forcolormap" - GIT_TAG main -) - -FetchContent_MakeAvailable(forcolormap) - -set(forcolormap_INCLUDE_DIR ${forcolormap_BINARY_DIR}/include) -set(forcolormap_INCLUDE_DIR ${forcolormap_INCLUDE_DIR} PARENT_SCOPE) - -# Make a parent-scope variable for the library -set(forcolormap_LIBRARY forcolormap) -set(forcolormap_LIBRARY ${forcolormap_LIBRARY} PARENT_SCOPE) diff --git a/dependencies/fstring/CMakeLists.txt b/dependencies/fstring/CMakeLists.txt deleted file mode 100644 index 73ffb0f4..00000000 --- a/dependencies/fstring/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Get the macros and functions we'll need -include(FetchContent) - -# Fetch the proper content -FetchContent_Declare( - fstring - GIT_REPOSITORY "https://github.com/jchristopherson/fstring" - GIT_TAG main -) - -FetchContent_MakeAvailable(fstring) - -set(fstring_INCLUDE_DIR ${fstring_BINARY_DIR}/include) -set(fstring_INCLUDE_DIR ${fstring_INCLUDE_DIR} PARENT_SCOPE) - -# Make a parent-scope variable for the library -set(fstring_LIBRARY fstring) -set(fstring_LIBRARY ${fstring_LIBRARY} PARENT_SCOPE) diff --git a/dependencies/geompack/CMakeLists.txt b/dependencies/geompack/CMakeLists.txt deleted file mode 100644 index 094ae839..00000000 --- a/dependencies/geompack/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Get the macros and functions we'll need -include(FetchContent) - -# Fetch the proper content -FetchContent_Declare( - geompack - GIT_REPOSITORY "https://github.com/jchristopherson/geompack" - GIT_TAG main -) - -FetchContent_MakeAvailable(geompack) - -set(geompack_INCLUDE_DIR ${geompack_BINARY_DIR}/include) -set(geompack_INCLUDE_DIR ${geompack_INCLUDE_DIR} PARENT_SCOPE) - -# Make a parent-scope variable for the library -set(geompack_LIBRARY geompack) -set(geompack_LIBRARY ${geompack_LIBRARY} PARENT_SCOPE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0141f138..b18c6952 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -44,3 +44,114 @@ set(FPLOT_SOURCES ${dir}/fplot_stats_plots.f90 ) set(FPLOT_SOURCES ${FPLOT_SOURCES} PARENT_SCOPE) + +# Dependencies +include(FetchContent) +find_package(ferror QUIET) +find_package(collections QUIET) +if (NOT ferror_FOUND) + message(STATUS "FERROR could not be found. A reference version will be employed.") + FetchContent_Declare( + ferror + GIT_REPOSITORY "https://github.com/jchristopherson/ferror" + ) + FetchContent_MakeAvailable(ferror) + set(FERROR_LIBRARIES ferror) + set(BUILD_FERROR TRUE) +else() + set(FERROR_LIBRARIES ferror::ferror) + set(BUILD_FERROR FALSE) +endif() + +if (NOT collections_FOUND) + message(STATUS "COLLECTIONS could not be found. A reference version will be employed.") + FetchContent_Declare( + collections + GIT_REPOSITORY "https://github.com/jchristopherson/collections" + GIT_TAG main + ) + FetchContent_MakeAvailable(collections) + set(COLLECTIONS_LIBRARIES collections) + set(BUILD_COLLECTIONS TRUE) +else() + set(COLLECTIONS_LIBRARIES collections::collections) + set(BUILD_COLLECTIONS FALSE) +endif() + +FetchContent_Declare( + geompack + GIT_REPOSITORY "https://github.com/jchristopherson/geompack" + GIT_TAG main +) +FetchContent_MakeAvailable(geompack) + +FetchContent_Declare( + forcolormap + GIT_REPOSITORY "https://github.com/vmagnin/forcolormap" + GIT_TAG main +) +FetchContent_MakeAvailable(forcolormap) + +FetchContent_Declare( + fstring + GIT_REPOSITORY "https://github.com/jchristopherson/fstring" + GIT_TAG main +) +FetchContent_MakeAvailable(fstring) + +# Build +add_library(${PROJECT_NAME} ${FPLOT_SOURCES}) +target_link_libraries( + ${PROJECT_NAME} + PUBLIC + ${FERROR_LIBRARIES} + ${COLLECTIONS_LIBRARIES} +) +target_link_libraries( + ${PROJECT_NAME} + PRIVATE + $ + $ + $ +) + +set_target_properties( + ${PROJECT_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + +set(FPLOT_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/) +if (NOT EXISTS "${FPLOT_MOD_DIR}") + file(MAKE_DIRECTORY "${FPLOT_MOD_DIR}") +endif() + +set_target_properties( + ${PROJECT_NAME} PROPERTIES + Fortran_MODULE_DIRECTORY ${FPLOT_MOD_DIR} +) +target_include_directories( + ${PROJECT_NAME} PUBLIC + $ + $ +) + +# Install +install( + TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY ${FPLOT_MOD_DIR} DESTINATION ${CMAKE_INSTALL_MODULEDIR}) + +if (${BUILD_FERROR} AND ${BUILD_SHARED_LIBS}) + install(IMPORTED_RUNTIME_ARTIFACTS ${FERROR_LIBRARIES}) +endif() + +if (${BUILD_COLLECTIONS} AND ${BUILD_SHARED_LIBS}) + install(IMPORTED_RUNTIME_ARTIFACTS ${COLLECTIONS_LIBRARIES}) +endif() + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bf7341f2..019a11bd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,3 @@ -include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake") add_subdirectory(fortran_test_helper) set(fplot_test_sources @@ -7,11 +6,39 @@ set(fplot_test_sources fplot_arrow_test.f90 ) +find_package(fotran_test_helper QUIET) +if (NOT fortran_test_helper_FOUND) + include(FetchContent) + FetchContent_Declare( + fortran_test_helper + GIT_TAG "origin/main" + GIT_REPOSITORY https://github.com/jchristopherson/fortran_test_helper + ) + FetchContent_MakeAvailable(fortran_test_helper) + set(FTH_LIBRARIES fortran_test_helper) +else() + set(FTH_LIBRARIES fortran_test_helper::fortran_test_helper) +endif() + add_executable(fplot_test ${fplot_test_sources}) -link_library(fplot_test ${PROJECT_NAME} ${PROJECT_INCLUDE_DIR}) -link_library(fplot_test ${fortran_test_helper_LIBRARY} ${fortran_test_helper_INCLUDE_DIR}) +target_link_libraries( + fplot_test + fplot + ${FTH_LIBRARIES} +) add_test( NAME fplot_test WORKING_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND $ -) \ No newline at end of file +) + +if (${BUILD_SHARED_LIBS} AND WIN32) + add_custom_command( + TARGET fplot_test + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + $ + $ + COMMAND_EXPAND_LISTS + ) +endif() diff --git a/test/fortran_test_helper/CMakeLists.txt b/test/fortran_test_helper/CMakeLists.txt index a3f66eae..92cd87fb 100644 --- a/test/fortran_test_helper/CMakeLists.txt +++ b/test/fortran_test_helper/CMakeLists.txt @@ -1,5 +1,3 @@ -# Get the macros and functions we'll need -include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake") include(FetchContent) # Fetch the proper content From cc7c70df0b335ba20b12b01829e6b83d9c673fa5 Mon Sep 17 00:00:00 2001 From: jchristopherson Date: Wed, 24 Sep 2025 13:59:40 -0500 Subject: [PATCH 2/3] Update version info --- fpm.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fpm.toml b/fpm.toml index 3f8f9635..327b706e 100644 --- a/fpm.toml +++ b/fpm.toml @@ -1,5 +1,5 @@ name = "fplot" -version = "1.8.0" +version = "1.8.1" license = "GPL-3.0" author = "Jason Christopherson" maintainer = "Jason Christopherson" From 82145c9eff9e1a167f3bf3a77117fc773f507039 Mon Sep 17 00:00:00 2001 From: jchristopherson Date: Wed, 24 Sep 2025 14:02:12 -0500 Subject: [PATCH 3/3] Clean up --- subprojects/fcore.wrap | 3 --- subprojects/ferror.wrap | 2 -- 2 files changed, 5 deletions(-) delete mode 100644 subprojects/fcore.wrap delete mode 100644 subprojects/ferror.wrap diff --git a/subprojects/fcore.wrap b/subprojects/fcore.wrap deleted file mode 100644 index 253f3e68..00000000 --- a/subprojects/fcore.wrap +++ /dev/null @@ -1,3 +0,0 @@ -[wrap-git] -url=git@github.com:AtilaSaraiva/fcore.git -revision=meson diff --git a/subprojects/ferror.wrap b/subprojects/ferror.wrap deleted file mode 100644 index 1eb9b39c..00000000 --- a/subprojects/ferror.wrap +++ /dev/null @@ -1,2 +0,0 @@ -[wrap-redirect] -filename = fcore/subprojects/ferror.wrap