Skip to content

Commit

Permalink
WIP: slightly reorganized sources (preparation for splitting codebase…
Browse files Browse the repository at this point in the history
… in multiple libraries)
  • Loading branch information
MircoValentiniECMWF committed Dec 30, 2024
1 parent 9064d85 commit cc51340
Show file tree
Hide file tree
Showing 17 changed files with 11,961 additions and 28,276 deletions.
121 changes: 118 additions & 3 deletions src/multiom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ add_subdirectory( containers )
add_subdirectory( data-structures )
add_subdirectory( hooks )
add_subdirectory( filters )
add_subdirectory( encoders-base )
add_subdirectory( encoders )
add_subdirectory( metadata )
add_subdirectory( operations )
Expand All @@ -129,6 +130,7 @@ list( APPEND output_manager_src
${MULTIOM_DATA_STRUCTURES_SOURCES}
${MULTIOM_HOOKS_SOURCES}
${MULTIOM_FILTERS_SOURCES}
${MULTIOM_ENCODERS_BASE_SOURCES}
${MULTIOM_ENCODERS_SOURCES}
${MULTIOM_METADATA_SOURCES}
${MULTIOM_OPERATIONS_SOURCES}
Expand Down Expand Up @@ -164,11 +166,64 @@ endif()
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")


if (TRUE)

ecbuild_add_library(
TARGET
multiom-core

SOURCES
# ${MULTIOM_API_SOURCES}
${MULTIOM_COMMON_SOURCES}
${MULTIOM_CONFIGURATION_SOURCES}
${MULTIOM_CONTAINERS_SOURCES}
${MULTIOM_DATA_STRUCTURES_SOURCES}
${MULTIOM_HOOKS_SOURCES}
${MULTIOM_FILTERS_SOURCES}
${MULTIOM_ENCODERS_BASE_SOURCES}
# ${MULTIOM_ENCODERS_SOURCES}
${MULTIOM_METADATA_SOURCES}
${MULTIOM_OPERATIONS_SOURCES}
# ${MULTIOM_MAPPING_RULES_SOURCES}
# ${MULTIOM_ENCODING_RULES_SOURCES}
${MULTIOM_IFS_INTERFACE_SOURCES}
# ${MULTIOM_OUTPUT_MANAGER_SOURCES}
${MULTIOM_SINKS_SOURCES}
# ${MULTIOM_IFS_ENCODERS_SOURCES}
${MULTIOM_IFS2MARS_SOURCES}
${CMAKE_CURRENT_BINARY_DIR}/output_manager_version_mod.F90

DEFINITIONS
${OUTPUT_MANAGER_BUILD_FLAVOUR}

PRIVATE_INCLUDES
$<BUILD_INTERFACE:${ECOM_INCLUDE_DIR}>

PUBLIC_LIBS
fckit
eccodes
eccodes_f90
multio-fapi
)


# Module directory
set_target_properties( multiom-core PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module/multiom )
target_include_directories( multiom-core PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/module/multiom> )


ecbuild_add_library(
TARGET multiom
SOURCES ${output_manager_src}
TARGET
multiom-encoders

SOURCES
${MULTIOM_MAPPING_RULES_SOURCES}
${MULTIOM_ENCODING_RULES_SOURCES}
${MULTIOM_ENCODERS_SOURCES}

DEFINITIONS ${OUTPUT_MANAGER_BUILD_FLAVOUR}
DEFINITIONS
${OUTPUT_MANAGER_BUILD_FLAVOUR}

PRIVATE_INCLUDES
$<BUILD_INTERFACE:${ECOM_INCLUDE_DIR}>
Expand All @@ -178,13 +233,73 @@ ecbuild_add_library(
eccodes
eccodes_f90
multio-fapi
multiom-core
)


# Module directory
set_target_properties( multiom-encoders PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module/multiom )
target_include_directories( multiom-encoders PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/module/multiom> )



ecbuild_add_library(
TARGET
multiom

SOURCES
${MULTIOM_API_SOURCES}
${MULTIOM_IFS_ENCODERS_SOURCES}
${MULTIOM_OUTPUT_MANAGER_SOURCES}
./multiom_api.F90

DEFINITIONS
${OUTPUT_MANAGER_BUILD_FLAVOUR}

PRIVATE_INCLUDES
$<BUILD_INTERFACE:${ECOM_INCLUDE_DIR}>

PUBLIC_LIBS
fckit
eccodes
eccodes_f90
multio-fapi
multiom-core
multiom-encoders
)


# Module directory
set_target_properties( multiom PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module/multiom )
target_include_directories( multiom PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/module/multiom> )

else()
ecbuild_add_library(
TARGET
multiom

SOURCES
${output_manager_src}

DEFINITIONS
${OUTPUT_MANAGER_BUILD_FLAVOUR}

PRIVATE_INCLUDES
$<BUILD_INTERFACE:${ECOM_INCLUDE_DIR}>

PUBLIC_LIBS
fckit
eccodes
eccodes_f90
multio-fapi
)


# Module directory
set_target_properties( multiom PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module/multiom )
target_include_directories( multiom PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/module/multiom> )

endif()

# add tests
set(HAVE_OUTPUT_MANAGER_TESTS 1)
Expand Down
22,201 changes: 0 additions & 22,201 deletions src/multiom/all_errflags.txt

This file was deleted.

32 changes: 16 additions & 16 deletions src/multiom/containers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,21 @@ set(TEMPLATE_VALUE_NAME "PAR_DICT" )
configure_file( ${MULTIOM_CONTAINERS_DIR}/map_mod.F90 ${CMAKE_CURRENT_BINARY_DIR}/map_${TEMPLATE_KEY_FNAME}_${TEMPLATE_VALUE_FNAME}_mod.F90 )


set(TEMPLATE_USE_VALUE "USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: INT64")
set(TEMPLATE_KEY_DUMMY_TYPE "INTEGER(KIND=INT64)")
set(TEMPLATE_KEY_TYPE "INTEGER(KIND=INT64)")
set(TEMPLATE_KEY_INITIAL_VALUE "0_INT64" )
set(TEMPLATE_KEY_FNAME "int64")
set(TEMPLATE_KEY_NAME "INT64")
set(TEMPLATE_IS_EQUAL "KEY1 .EQ. KEY2")
set(TEMPLATE_IS_LOWER_THAN "KEY1 .LT. KEY2")

set(TEMPLATE_USE_VALUE "USE :: MULTIOM_CACHED_ENCODER_MOD, ONLY: MULTIOM_CACHED_ENCODERS_T")
set(TEMPLATE_VALUE_DUMMY_TYPE "TYPE(MULTIOM_CACHED_ENCODERS_T)")
set(TEMPLATE_VALUE_TYPE "TYPE(MULTIOM_CACHED_ENCODERS_T)")
set(TEMPLATE_VALUE_FNAME "encoder" )
set(TEMPLATE_VALUE_NAME "ENCODER" )
configure_file( ${MULTIOM_CONTAINERS_DIR}/map_mod.F90 ${CMAKE_CURRENT_BINARY_DIR}/map_${TEMPLATE_KEY_FNAME}_${TEMPLATE_VALUE_FNAME}_mod.F90 )
# set(TEMPLATE_USE_VALUE "USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: INT64")
# set(TEMPLATE_KEY_DUMMY_TYPE "INTEGER(KIND=INT64)")
# set(TEMPLATE_KEY_TYPE "INTEGER(KIND=INT64)")
# set(TEMPLATE_KEY_INITIAL_VALUE "0_INT64" )
# set(TEMPLATE_KEY_FNAME "int64")
# set(TEMPLATE_KEY_NAME "INT64")
# set(TEMPLATE_IS_EQUAL "KEY1 .EQ. KEY2")
# set(TEMPLATE_IS_LOWER_THAN "KEY1 .LT. KEY2")
#
# set(TEMPLATE_USE_VALUE "USE :: MULTIOM_CACHED_ENCODER_MOD, ONLY: MULTIOM_CACHED_ENCODERS_T")
# set(TEMPLATE_VALUE_DUMMY_TYPE "TYPE(MULTIOM_CACHED_ENCODERS_T)")
# set(TEMPLATE_VALUE_TYPE "TYPE(MULTIOM_CACHED_ENCODERS_T)")
# set(TEMPLATE_VALUE_FNAME "encoder" )
# set(TEMPLATE_VALUE_NAME "ENCODER" )
# configure_file( ${MULTIOM_CONTAINERS_DIR}/map_mod.F90 ${CMAKE_CURRENT_BINARY_DIR}/map_${TEMPLATE_KEY_FNAME}_${TEMPLATE_VALUE_FNAME}_mod.F90 )


# Collect source files in module2
Expand All @@ -240,7 +240,7 @@ set( MULTIOM_CONTAINERS_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/map_int64_int64_mod.F90
${CMAKE_CURRENT_BINARY_DIR}/map_int64_mars_dict_mod.F90
${CMAKE_CURRENT_BINARY_DIR}/map_int64_par_dict_mod.F90
${CMAKE_CURRENT_BINARY_DIR}/map_int64_encoder_mod.F90
# ${CMAKE_CURRENT_BINARY_DIR}/map_int64_encoder_mod.F90
CACHE INTERNAL "List of all sources in containers directory"
)

Expand Down
35 changes: 35 additions & 0 deletions src/multiom/encoders-base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
set(MULTIOM_ENCODERS_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

# Enter in the module
message("${OFFSET} + encoders_base sources: ${MULTIOM_ENCODERS_BASE_DIR}")

# Recursive print
set(OFFSET ${OFFSET}${DOFFSET})

# Collect source files in module2
set( MULTIOM_ENCODERS_BASE_MAIN_SOURCES
${MULTIOM_ENCODERS_BASE_DIR}/grib_section_base_mod.F90
${MULTIOM_ENCODERS_BASE_DIR}/grib_encoder_options_mod.F90
${MULTIOM_ENCODERS_BASE_DIR}/grib_encoder_register_mod.F90
${MULTIOM_ENCODERS_BASE_DIR}/grib_encoder_tunneling_mod.F90
${MULTIOM_ENCODERS_BASE_DIR}/grib_encoder_lazy_rules_mod.F90
${MULTIOM_ENCODERS_BASE_DIR}/mapping_options_mod.F90
${MULTIOM_ENCODERS_BASE_DIR}/filter_options_mod.F90
)

# Collect source files in module2
set( MULTIOM_ENCODERS_BASE_SOURCES
${MULTIOM_ENCODERS_BASE_MAIN_SOURCES}
${MULTIOM_ENCODER_GRIB2_SOURCES}
CACHE INTERNAL "List of all sources in operations directory"
)

# Optionally, message what has been appended for debugging
foreach(source_file IN LISTS MULTIOM_ENCODERS_BASE_MAIN_SOURCES)

# Extract the filename (without the directory)
get_filename_component(filename ${source_file} NAME)

# Print the filename
message("${OFFSET} - ${filename}")
endforeach()
13 changes: 13 additions & 0 deletions src/multiom/encoders-base/filter_options_mod.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MODULE FILTER_OPTIONS_MOD

PRIVATE

TYPE :: FILTER_OPTIONS_T

INTEGER :: TEST

END TYPE

PUBLIC :: FILTER_OPTIONS_T

END MODULE FILTER_OPTIONS_MOD
Loading

0 comments on commit cc51340

Please sign in to comment.