Skip to content

Commit

Permalink
Make source headers consistent (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Feb 25, 2024
1 parent 4b692d6 commit 02631a0
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 28 deletions.
59 changes: 31 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 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 #
]=================================================================================================]
Expand All @@ -13,7 +20,6 @@ project(
LANGUAGES Fortran
)


#[=================================================================================================[
# Options #
]=================================================================================================]
Expand Down Expand Up @@ -41,7 +47,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(FortunoHelpers)

if (FORTUNO_INSTALL)
include(CMakePackageConfigHelpers)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
endif ()

Expand All @@ -51,14 +57,13 @@ set(BUILD_SHARED_LIBS ${FORTUNO_BUILD_SHARED_LIBS})
# Report configuration
feature_summary(
FILENAME ${CMAKE_CURRENT_BINARY_DIR}/Fortuno.info
VAR Fortuno_Info
DESCRIPTION "Fortuno features and external libraries"
FATAL_ON_MISSING_REQUIRED_PACKAGES
WHAT ALL
VAR Fortuno_Info
DESCRIPTION "Fortuno features and external libraries"
FATAL_ON_MISSING_REQUIRED_PACKAGES
WHAT ALL
)
message(STATUS ${Fortuno_Info})


#[=================================================================================================[
# Main definition #
]=================================================================================================]
Expand All @@ -79,23 +84,22 @@ 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(
# 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
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT Fortuno_development
)

# cmake export files
write_basic_package_version_file(
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/FortunoConfigVersion.cmake
VERSION ${PROJECT_VERSION}
# COMPATIBILITY SameMajorVersion
Expand Down Expand Up @@ -127,25 +131,24 @@ if (FORTUNO_INSTALL)
)
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(
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 ()
Fortuno_VERSION_PATCH
Fortuno_VERSION_TWEAK
)
endif ()
endif ()
4 changes: 4 additions & 0 deletions cmake/FortunoHelpers.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

# Sets up the build type.
function (fortuno_setup_build_type default_build_type)

Expand Down
Empty file removed cmake/config.cmake
Empty file.
4 changes: 4 additions & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

list(APPEND CMAKE_MESSAGE_CONTEXT Example)

add_library(Fortuno_example_mylib)
Expand Down
4 changes: 4 additions & 0 deletions example/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

example_mylib_lib = library(
'mylib',
sources: ['mylib.f90'],
Expand Down
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

project(
'fortuno',
'fortran',
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

option('build_examples', type: 'boolean', value: false, description: 'Build examples')
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

target_sources(
Fortuno PRIVATE
fortuno.f90
Expand Down
4 changes: 4 additions & 0 deletions src/fortuno/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

target_sources(
Fortuno PRIVATE
argumentparser.f90
Expand Down
4 changes: 4 additions & 0 deletions src/fortuno/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

sources += files(
'argumentparser.f90',
'basetypes.f90',
Expand Down
4 changes: 4 additions & 0 deletions src/fortuno/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

target_sources(
Fortuno PRIVATE
serialbasetypes.f90
Expand Down
4 changes: 4 additions & 0 deletions src/fortuno/serial/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

sources += files(
'serialbasetypes.f90',
'serialcase.f90',
Expand Down
4 changes: 4 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

sources += files(
'fortuno.f90'
)
Expand Down
4 changes: 4 additions & 0 deletions test/export/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

cmake_minimum_required(VERSION 3.22...3.28)

project(
Expand Down
4 changes: 4 additions & 0 deletions test/export/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

target_sources(testapp PRIVATE testapp.f90)
target_link_libraries(testapp PRIVATE Fortuno::Fortuno)
4 changes: 4 additions & 0 deletions test/export/app/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

sources += files(
'testapp.f90'
)
4 changes: 4 additions & 0 deletions test/export/app/testapp.f90
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
! This file is part of Fortuno.
! Licensed under the BSD-2-Clause Plus Patent license.
! SPDX-License-Identifier: BSD-2-Clause-Patent

!> Test app driving Fortuno unit tests.
program testapp
use fortuno, only : execute_serial_cmd_app, is_equal, test => serial_case_item,&
Expand Down
4 changes: 4 additions & 0 deletions test/export/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

project(
'fortuno_test_export',
'fortran',
Expand Down
4 changes: 4 additions & 0 deletions test/export/meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This file is part of Fortuno.
# Licensed under the BSD-2-Clause Plus Patent license.
# SPDX-License-Identifier: BSD-2-Clause-Patent

option(
'fortuno_subproject',
type: 'boolean',
Expand Down

0 comments on commit 02631a0

Please sign in to comment.