From 6a76f397e62adb4804a4f89f71f6650699293191 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 4 Oct 2024 19:54:58 -0600 Subject: [PATCH 1/7] Build and test on Windows --- .github/workflows/test.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03b4725..85b2488 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,3 +53,42 @@ jobs: run: | test -h $CONDA_PREFIX/lib/libbmigiplf${{ env.SHLIB_EXT }} ctest + + build-on-windows: + + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + + runs-on: windows-latest + + env: + LIBRARY_PREFIX: $env:CONDA_PREFIX\Library + + steps: + - uses: actions/checkout@v4 + - uses: ilammy/msvc-dev-cmd@v1 + - uses: mamba-org/setup-micromamba@v2 + with: + micromamba-version: latest + environment-name: testing + create-args: >- + cmake + cxx-compiler + init-shell: >- + powershell + + - name: Make cmake build directory + run: cmake -E make_directory build + + - name: Configure, build, and install + working-directory: ${{ github.workspace }}/build + run: | + cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release + cmake --build . --target install --config Release + + - name: Test + working-directory: ${{ github.workspace }}/build + run: | + if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmigiplf.a ) ){ exit 1 } + ctest From 16177e19c90a853330321b02ca49267040bd6546 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 4 Oct 2024 21:51:16 -0600 Subject: [PATCH 2/7] Use GnuInstallDirs --- CMakeLists.txt | 6 ++---- GIPL/CMakeLists.txt | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0460127..36ded18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,9 @@ cmake_minimum_required(VERSION 3.12) -# set fortran compiler -# set(CMAKE_Fortran_COMPILER gfortran-mp-9) -#set(CMAKE_Fortran_FLAGS --std=legacy) - project(bmigipl Fortran) +include(GNUInstallDirs) + set(bmi_version 1.0) set(bmigipl_lib bmigiplf) set(data_dir ${CMAKE_SOURCE_DIR}/data) diff --git a/GIPL/CMakeLists.txt b/GIPL/CMakeLists.txt index e99e9ba..63e8db0 100644 --- a/GIPL/CMakeLists.txt +++ b/GIPL/CMakeLists.txt @@ -11,18 +11,21 @@ add_executable(run_bmi${pkg_name} bmi_main.f90) target_link_libraries(run_bmi${pkg_name} ${bmigipl_lib}) install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/run_${pkg_name} - DESTINATION bin - COMPONENT ${pkg_name}) + TARGETS run_${pkg_name} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) install( - PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/run_bmi${pkg_name} - DESTINATION bin - COMPONENT ${pkg_name}) + TARGETS run_bmi${pkg_name} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) install( TARGETS ${bmigipl_lib} - DESTINATION lib - COMPONENT ${pkg_name}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) install( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/${mod_name}.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/${bmigipl_lib}.mod - DESTINATION include) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) From 354367ca24a0f47e17218ef769c0508eaebd6667 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 4 Oct 2024 22:01:01 -0600 Subject: [PATCH 3/7] Run ctest first --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 85b2488..55aef1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,5 +90,5 @@ jobs: - name: Test working-directory: ${{ github.workspace }}/build run: | - if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmigiplf.a ) ){ exit 1 } ctest + if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmigiplf.a ) ){ exit 1 } From 50456de58cdd4a45b81e4aed6e33e72bb4f9a73c Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 4 Oct 2024 22:18:27 -0600 Subject: [PATCH 4/7] Include project version --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36ded18..5c8bae9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.12) -project(bmigipl Fortran) +project(bmigipl + VERSION 1.3.dev0 + LANGUAGES Fortran +) include(GNUInstallDirs) From cf0347933a5071f5d0f24e6ff4de44ad1fdaf21d Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 4 Oct 2024 22:22:26 -0600 Subject: [PATCH 5/7] Look for shared library --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 55aef1c..bd6741d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,5 +90,6 @@ jobs: - name: Test working-directory: ${{ github.workspace }}/build run: | + Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmigiplf.dll.a + Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\libbmigiplf.dll ctest - if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmigiplf.a ) ){ exit 1 } From 1b9cf08422eeabb308b2a063fe5da1e0768e7542 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 4 Oct 2024 22:27:04 -0600 Subject: [PATCH 6/7] Revert "Include project version" This reverts commit 50456de58cdd4a45b81e4aed6e33e72bb4f9a73c. --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8bae9..36ded18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.12) -project(bmigipl - VERSION 1.3.dev0 - LANGUAGES Fortran -) +project(bmigipl Fortran) include(GNUInstallDirs) From 12d83c5f9cd77d3835cc3e8eef6a81f0791aa3cb Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 4 Oct 2024 22:33:35 -0600 Subject: [PATCH 7/7] Fail tests if files not found --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd6741d..69154ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,6 +90,6 @@ jobs: - name: Test working-directory: ${{ github.workspace }}/build run: | - Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmigiplf.dll.a - Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\libbmigiplf.dll + if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\lib\libbmigiplf.dll.a ) ){ exit 1 } + if ( -not ( Test-Path -Path ${{ env.LIBRARY_PREFIX }}\bin\libbmigiplf.dll ) ){ exit 1 } ctest