From fc7107de1163cbe1d5f94fce922d8acb7c611e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Aradi?= Date: Sat, 16 Mar 2024 11:34:54 +0100 Subject: [PATCH] Separate base and serial components --- CMakeLists.txt | 20 +++++++++++++++++--- example/fixtured_tests.f90 | 6 +++--- example/simple_tests.f90 | 5 +++-- example/testapp.f90 | 2 +- src/CMakeLists.txt | 4 ---- src/fortuno.f90 | 11 ----------- src/fortuno/CMakeLists.txt | 14 ++++++++++++-- 7 files changed, 36 insertions(+), 26 deletions(-) delete mode 100644 src/fortuno.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index cba1e37..bf9aab9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,11 +24,25 @@ project( # Options # ]=================================================================================================] +include(CMakeDependentOption) + 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_SERIAL_INTERFACE + "Fortuno: whether serial interface should be built (or only base library)" + ${PROJECT_IS_TOP_LEVEL} +) -option(FORTUNO_BUILD_EXAMPLES "Fortuno: Build example apps" ${PROJECT_IS_TOP_LEVEL}) +cmake_dependent_option( + FORTUNO_BUILD_TESTS "Fortuno: Build test suite" ${PROJECT_IS_TOP_LEVEL} + "FORTUNO_BUILD_SERIAL_INTERFACE" OFF +) + +cmake_dependent_option( + FORTUNO_BUILD_EXAMPLES "Fortuno: Build example apps" ${PROJECT_IS_TOP_LEVEL} + "FORTUNO_BUILD_SERIAL_INTERFACE" OFF +) option(FORTUNO_INSTALL "Fortuno: Install project" ${PROJECT_IS_TOP_LEVEL}) @@ -57,7 +71,7 @@ set(BUILD_SHARED_LIBS ${FORTUNO_BUILD_SHARED_LIBS}) ]=================================================================================================] add_subdirectory(src) -if (FORTUNO_BUILD_EXAMPLES) +if (FORTUNO_BUILD_SERIAL_INTERFACE AND FORTUNO_BUILD_EXAMPLES) add_subdirectory(example) endif () diff --git a/example/fixtured_tests.f90 b/example/fixtured_tests.f90 index 74ac588..587d40d 100644 --- a/example/fixtured_tests.f90 +++ b/example/fixtured_tests.f90 @@ -4,9 +4,9 @@ module fixtured_tests use mylib, only : factorial - use fortuno, only : check => serial_check, test => serial_case_item,& - & suite => serial_suite_item, test_item, test_ptr_item,& - & serial_suite, serial_case_base + use fortuno_base, only : test_item + use fortuno_serial, only : check => serial_check, test => serial_case_item,& + & suite => serial_suite_item, serial_case_base implicit none private diff --git a/example/simple_tests.f90 b/example/simple_tests.f90 index 21f739d..57dc530 100644 --- a/example/simple_tests.f90 +++ b/example/simple_tests.f90 @@ -4,8 +4,9 @@ module simple_tests use mylib, only : factorial - use fortuno, only : is_equal, test => serial_case_item, check => serial_check,& - & suite => serial_suite_item, test_item + use fortuno_base, only : is_equal, test_item + use fortuno_serial, only : test => serial_case_item, check => serial_check,& + & suite => serial_suite_item implicit none private diff --git a/example/testapp.f90 b/example/testapp.f90 index 731cf0a..9a50655 100644 --- a/example/testapp.f90 +++ b/example/testapp.f90 @@ -4,7 +4,7 @@ !> Test app, collecting and executing the tests program testapp - use fortuno, only : execute_serial_cmd_app + use fortuno_serial, only : execute_serial_cmd_app use simple_tests, only : get_simple_tests use fixtured_tests, only : get_fixtured_tests implicit none diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7d0bc5a..10fd2cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,10 +13,6 @@ set_target_properties( ) add_library(Fortuno::Fortuno ALIAS Fortuno) -target_sources( - Fortuno PRIVATE - fortuno.f90 -) add_subdirectory(fortuno) # Store generated mod-files in a separate folder diff --git a/src/fortuno.f90 b/src/fortuno.f90 deleted file mode 100644 index fec0a7f..0000000 --- a/src/fortuno.f90 +++ /dev/null @@ -1,11 +0,0 @@ -! This file is part of Fortuno. -! Licensed under the BSD-2-Clause Plus Patent license. -! SPDX-License-Identifier: BSD-2-Clause-Patent - -!> Interface module for the Fortuno testing framework -module fortuno - use fortuno_base - use fortuno_serial - implicit none - -end module fortuno diff --git a/src/fortuno/CMakeLists.txt b/src/fortuno/CMakeLists.txt index b198a3d..7e4f388 100644 --- a/src/fortuno/CMakeLists.txt +++ b/src/fortuno/CMakeLists.txt @@ -6,7 +6,17 @@ target_sources( Fortuno PRIVATE base.f90 - serial.f90 ) add_subdirectory(base) -add_subdirectory(serial) + + +if (FORTUNO_BUILD_SERIAL_INTERFACE) + + target_sources( + Fortuno PRIVATE + serial.f90 + ) + add_subdirectory(serial) + target_compile_definitions(Fortuno PRIVATE "WITH_SERIAL_INTERFACE") + +endif () \ No newline at end of file