Skip to content

Commit

Permalink
Merge pull request #7 from jchristopherson/v1.5.2
Browse files Browse the repository at this point in the history
Bug Fix - Build Script
  • Loading branch information
jchristopherson authored Feb 28, 2024
2 parents 72a027d + 7ca22cf commit 1559032
Show file tree
Hide file tree
Showing 199 changed files with 10,054 additions and 8,378 deletions.
57 changes: 28 additions & 29 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,39 @@ env:
BUILD_TYPE: Release

jobs:
build:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
fortran_compiler: [gfortran, ifort]
os: [ubuntu-latest, macos-latest] # issue with windows-latest & CMake with CMake not recognizing defined compilers
os: [ubuntu-latest, macos-latest]
toolchain:
- {compiler: gcc, version: 11}
- {compiler: intel-classic, version: '2021.9'}
include:
- os: ubuntu-latest
toolchain: {compiler: intel, version: '2023.2'}

steps:

- name: Setup IFORT
if: contains( matrix.fortran_compiler, 'ifort' )
uses: modflowpy/install-intelfortran-action@v1

- name: Setup GFORTRAN
if: contains( matrix.fortran_compiler, 'gfortran')
uses: awvwgk/setup-fortran@main
id: setup-fortran
with:
compiler: gcc
version: 12

env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}

- uses: actions/checkout@v3

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=${{ env.CC }} -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DBUILD_TESTING=TRUE
- uses: awvwgk/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- run: ${{ env.FC }} --version
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}

- uses: actions/checkout@v3

- name: Build with CMake
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DBUILD_TESTING=TRUE

- name: Build with CMake
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test with CMake
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
- name: Test with CMake
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.24)
project(
nonlin
LANGUAGES Fortran
VERSION 1.5.0
VERSION 1.5.2
)

# Get helper macros and functions
Expand Down Expand Up @@ -35,9 +35,6 @@ target_link_libraries(
link_library(${PROJECT_NAME} ${ferror_LIBRARY} ${ferror_INCLUDE_DIR})
link_library(${PROJECT_NAME} ${linalg_LIBRARY} ${linalg_INCLUDE_DIR})

# Installation
add_subdirectory(install)

# Testing
option(BUILD_TESTING "Build tests")
include(CTest)
Expand Down
7 changes: 0 additions & 7 deletions dependencies/BLAS/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# Get the macros and functions we'll need
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
include(FetchContent)

# Get BLAS
add_subdirectory(BLAS)

# Get LAPACK
add_subdirectory(LAPACK)

# Get FERROR
add_subdirectory(ferror)
set(ferror_LIBRARY ${ferror_LIBRARY} PARENT_SCOPE)
Expand Down
27 changes: 0 additions & 27 deletions dependencies/LAPACK/CMakeLists.txt

This file was deleted.

18 changes: 1 addition & 17 deletions dependencies/ferror/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,18 @@
# Get the macros and functions we'll need
include("${PROJECT_SOURCE_DIR}/cmake/helper.cmake")
include(FetchContent)

# Fetch the proper content
FetchContent_Declare(
ferror
GIT_REPOSITORY "https://github.com/jchristopherson/ferror"
)

FetchContent_MakeAvailable(ferror)

if (WIN32)
if (BUILD_SHARED_LIBS)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:ferror>
$<TARGET_FILE_DIR:${PROJECT_NAME}
)
endif()
endif()

set(ferror_INCLUDE_DIR ${ferror_BINARY_DIR}/include)
set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE)
configure_file(
"${ferror_SOURCE_DIR}/include/ferror.h"
"${ferror_INCLUDE_DIR}/ferror.h"
COPYONLY
)

# Make a parent-scope variable for the library
set(ferror_LIBRARY ferror)
set(ferror_INCLUDE_DIR ${ferror_INCLUDE_DIR} PARENT_SCOPE)
set(ferror_LIBRARY ${ferror_LIBRARY} PARENT_SCOPE)
15 changes: 0 additions & 15 deletions dependencies/linalg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,25 +8,12 @@ FetchContent_Declare(

FetchContent_MakeAvailable(linalg)

if (WIN32)
if (BUILD_SHARED_LIBS)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:linalg>
$<TARGET_FILE_DIR:${PROJECT_NAME}
)
endif()
endif()

set(linalg_INCLUDE_DIR ${linalg_BINARY_DIR}/include)
set(linalg_INCLUDE_DIR ${linalg_INCLUDE_DIR} PARENT_SCOPE)
configure_file(
"${linalg_SOURCE_DIR}/include/linalg.h"
"${linalg_INCLUDE_DIR}/linalg.h"
COPYONLY
)

# Make a parent-scope variable for the library
set(linalg_LIBRARY linalg)
set(linalg_LIBRARY ${linalg_LIBRARY} PARENT_SCOPE)
Loading

0 comments on commit 1559032

Please sign in to comment.