-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c6d9162
Showing
50 changed files
with
4,270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
env: | ||
BUILD_DIR: _build | ||
INSTALL_DIR: _install | ||
|
||
jobs: | ||
|
||
# | ||
# Test Fortuno in various system configurations | ||
# | ||
fortuno-test: | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
toolchain: [Intel, GNU] | ||
exclude: | ||
- os: macos-latest | ||
toolchain: Intel | ||
|
||
steps: | ||
|
||
- name: Check-out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Intel compiler | ||
if: ${{ contains(matrix.toolchain, 'Intel') }} | ||
uses: rscohn2/setup-oneapi@v0 | ||
with: | ||
components: ifx | ||
|
||
- name: Setup Intel environment | ||
if: ${{ contains(matrix.toolchain, 'Intel') }} | ||
run: | | ||
source /opt/intel/oneapi/setvars.sh | ||
printenv >> ${GITHUB_ENV} | ||
echo "FC=ifx" >> ${GITHUB_ENV} | ||
echo "FPM_FC=ifx" >> ${GITHUB_ENV} | ||
- name: Setup GNU compiler | ||
if: ${{ contains(matrix.toolchain, 'GNU') }} | ||
uses: fortran-lang/setup-fortran@v1 | ||
with: | ||
compiler: gcc | ||
version: 13 | ||
|
||
- name: Setup GNU environment | ||
if: ${{ contains(matrix.toolchain, 'GNU') }} | ||
run: | | ||
echo "FC=${{ env.FC }}" >> ${GITHUB_ENV} | ||
echo "FPM_FC=${{ env.FC }}" >> ${GITHUB_ENV} | ||
- name: Setup build tools | ||
run: | | ||
pip install cmake fpm meson ninja | ||
- name: Build Fortuno | ||
run: | | ||
cmake -B ${BUILD_DIR} -G Ninja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} | ||
cmake --build ${BUILD_DIR} | ||
cmake --install ${BUILD_DIR} | ||
rm -rf ${BUILD_DIR} | ||
- name: Test CMake export | ||
run: | | ||
CMAKE_PREFIX_PATH=${INSTALL_DIR} cmake -B ${BUILD_DIR} -G Ninja test/export | ||
cmake --build ${BUILD_DIR} | ||
${BUILD_DIR}/testapp | ||
rm -rf ${BUILD_DIR} | ||
- name: Test fpm export | ||
run: | | ||
cd test/export | ||
fpm run testapp | ||
- name: Test Meson pkgconfig export | ||
run: | | ||
export PKG_CONFIG_PATH="${PWD}/${INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}" | ||
cd test/export | ||
meson setup -Dfortuno_subproject=false ${BUILD_DIR} | ||
ninja -C ${BUILD_DIR} | ||
${BUILD_DIR}/testapp | ||
rm -rf ./${BUILD_DIR} | ||
- name: Test Meson subproject export | ||
run: | | ||
FORTUNO_DIR=${PWD} | ||
GIT_REV=$(git rev-parse HEAD) | ||
cd test/export | ||
mkdir subprojects | ||
echo -e "[wrap-git]\ndirectory=fortuno\n" > subprojects/fortuno.wrap | ||
echo -e "url=file://${FORTUNO_DIR}\nrevision=${GIT_REV}\n" >> subprojects/fortuno.wrap | ||
meson setup -Dfortuno_subproject=true ${BUILD_DIR} | ||
ninja -C ${BUILD_DIR} | ||
${BUILD_DIR}/testapp | ||
rm -rf subprojects ${BUILD_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/_* | ||
/build | ||
*.mod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# This file is part of Fortuno. | ||
# Licensed under the BSD-2-Clause Plus Patent license. | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
|
||
# The CMake config files were created based on the public template at | ||
# https://github.com/LecrisUT/CMake-Template | ||
|
||
#[=================================================================================================[ | ||
# Basic project definition # | ||
]=================================================================================================] | ||
|
||
cmake_minimum_required(VERSION 3.22...3.28) | ||
|
||
list(APPEND CMAKE_MESSAGE_CONTEXT Fortuno) | ||
project( | ||
Fortuno | ||
VERSION 0.1.0 | ||
DESCRIPTION "Extensible unit testing framework for Fortran" | ||
HOMEPAGE_URL "https://github.com/fortuno-repos/fortuno" | ||
LANGUAGES Fortran | ||
) | ||
|
||
#[=================================================================================================[ | ||
# Options # | ||
]=================================================================================================] | ||
|
||
include(FeatureSummary) | ||
|
||
option(FORTUNO_BUILD_SHARED_LIBS "Fortuno: Build as shared library" ${PROJECT_IS_TOP_LEVEL}) | ||
|
||
option(FORTUNO_BUILD_TESTS "Fortuno: Build test suite" ${PROJECT_IS_TOP_LEVEL}) | ||
|
||
option(FORTUNO_BUILD_EXAMPLES "Fortuno: Build example apps" ${PROJECT_IS_TOP_LEVEL}) | ||
|
||
option(FORTUNO_INSTALL "Fortuno: Install project" ${PROJECT_IS_TOP_LEVEL}) | ||
|
||
set( | ||
FORTUNO_INSTALL_MODULEDIR "modules" CACHE STRING | ||
"Sub-directory to install the Fortran module files into (relative to CMAKE_INSTALL_LIBDIR)" | ||
) | ||
|
||
#[=================================================================================================[ | ||
# Project configuration # | ||
]=================================================================================================] | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | ||
include(FortunoHelpers) | ||
|
||
if (FORTUNO_INSTALL) | ||
include(CMakePackageConfigHelpers) | ||
include(GNUInstallDirs) | ||
endif () | ||
|
||
fortuno_setup_build_type("RelWithDebInfo") | ||
set(BUILD_SHARED_LIBS ${FORTUNO_BUILD_SHARED_LIBS}) | ||
|
||
#[=================================================================================================[ | ||
# Main definition # | ||
]=================================================================================================] | ||
|
||
add_subdirectory(src) | ||
if (FORTUNO_BUILD_EXAMPLES) | ||
add_subdirectory(example) | ||
endif () | ||
|
||
#[=================================================================================================[ | ||
# Install or Export # | ||
]=================================================================================================] | ||
|
||
if (FORTUNO_INSTALL) | ||
|
||
# pkg-config files | ||
configure_file(cmake/fortuno.pc.in fortuno.pc @ONLY) | ||
install( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/fortuno.pc | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig | ||
COMPONENT Fortuno_development | ||
) | ||
|
||
# cmake export files | ||
write_basic_package_version_file( | ||
${CMAKE_CURRENT_BINARY_DIR}/FortunoConfigVersion.cmake | ||
VERSION ${PROJECT_VERSION} | ||
# COMPATIBILITY SameMajorVersion | ||
COMPATIBILITY SameMinorVersion | ||
) | ||
configure_package_config_file( | ||
cmake/FortunoConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/FortunoConfig.cmake | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Fortuno | ||
) | ||
install( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/FortunoConfigVersion.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/FortunoConfig.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Fortuno | ||
COMPONENT Fortuno_development | ||
) | ||
|
||
export( | ||
EXPORT FortunoTargets | ||
FILE FortunoTargets.cmake | ||
NAMESPACE Fortuno:: | ||
) | ||
install( | ||
EXPORT FortunoTargets | ||
FILE FortunoTargets.cmake | ||
NAMESPACE Fortuno:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Fortuno | ||
COMPONENT Fortuno_development | ||
) | ||
endif () | ||
|
||
# Make project available for FetchContent | ||
if (NOT PROJECT_IS_TOP_LEVEL) | ||
# Propagate variables | ||
if (CMAKE_VERSION VERSION_LESS 3.25) | ||
# TODO: Remove when required minimum cmake version is >= 3.25 | ||
set(Fortuno_VERSION ${Fortuno_VERSION} PARENT_SCOPE) | ||
set(Fortuno_VERSION_MAJOR ${Fortuno_VERSION_MAJOR} PARENT_SCOPE) | ||
set(Fortuno_VERSION_MINOR ${Fortuno_VERSION_MINOR} PARENT_SCOPE) | ||
set(Fortuno_VERSION_PATCH ${Fortuno_VERSION_PATCH} PARENT_SCOPE) | ||
set(Fortuno_VERSION_TWEAK ${Fortuno_VERSION_TWEAK} PARENT_SCOPE) | ||
else () | ||
return( | ||
PROPAGATE | ||
Fortuno_VERSION | ||
Fortuno_VERSION_MAJOR | ||
Fortuno_VERSION_MINOR | ||
Fortuno_VERSION_PATCH | ||
Fortuno_VERSION_TWEAK | ||
) | ||
endif () | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Copyright (c) 2024 Fortuno authors | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
Subject to the terms and conditions of this license, each copyright holder and | ||
contributor hereby grants to those receiving rights under this license a | ||
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
(except for failure to satisfy the conditions of this license) patent license to | ||
make, have made, use, offer to sell, sell, import, and otherwise transfer this | ||
software, where such license applies only to those patent claims, already | ||
acquired or hereafter acquired, licensable by such copyright holder or | ||
contributor that are necessarily infringed by: | ||
|
||
(a) their Contribution(s) (the licensed copyrights of copyright holders and | ||
non-copyrightable additions of contributors, in source or binary form) | ||
alone; or | ||
|
||
(b) combination of their Contribution(s) with the work of authorship to which | ||
such Contribution(s) was added by such copyright holder or contributor, if, | ||
at the time the Contribution is added, such addition causes such combination | ||
to be necessarily infringed. The patent license shall not apply to any other | ||
combinations which include the Contribution. | ||
|
||
Except as expressly stated above, no rights or licenses from any copyright | ||
holder or contributor is granted under this license, whether expressly, by | ||
implication, estoppel or otherwise. | ||
|
||
DISCLAIMER | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.