Skip to content

Commit

Permalink
Separate base and serial components
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Mar 16, 2024
1 parent a7e779f commit fc7107d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 26 deletions.
20 changes: 17 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down Expand Up @@ -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 ()

Expand Down
6 changes: 3 additions & 3 deletions example/fixtured_tests.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions example/simple_tests.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/testapp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions src/fortuno.f90

This file was deleted.

14 changes: 12 additions & 2 deletions src/fortuno/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()

0 comments on commit fc7107d

Please sign in to comment.