Skip to content

Commit

Permalink
[cmake] Simplified ProcessLib setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilke committed Oct 29, 2024
1 parent 085587e commit 9be2fe4
Showing 1 changed file with 20 additions and 39 deletions.
59 changes: 20 additions & 39 deletions ProcessLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@
add_library(Processes INTERFACE)

# Check whether LIE processes are enabled
function(check_enabled_processes_for_LIE contains_LIE)
set(${contains_hm_process} FALSE PARENT_SCOPE)
foreach(process ${_enabled_processes})
if(process STREQUAL "LIE_M"
OR process STREQUAL "LIE_HM"
)
set(${contains_LIE} TRUE PARENT_SCOPE)
return()
endif()
endforeach()
endfunction()
check_enabled_processes_for_LIE(contains_LIE)

if (contains_LIE)
add_subdirectory(LIE/Common)
endif()
foreach(process ${_enabled_processes})
if(process STREQUAL "LIE_M" OR process STREQUAL "LIE_HM")
add_subdirectory(LIE/Common)
break()
endif()
endforeach()

foreach(process ${_enabled_processes})
if (process STREQUAL "LIE_HM")
if(process STREQUAL "LIE_HM")
add_subdirectory(LIE/HydroMechanics)
elseif (process STREQUAL "LIE_M")
elseif(process STREQUAL "LIE_M")
add_subdirectory(LIE/SmallDeformation)
else()
add_subdirectory(${process})
Expand All @@ -43,27 +33,18 @@ append_source_files(SOURCES Utils)
append_source_files(SOURCES Reflection)
append_source_files(SOURCES Graph)
# For processes that contains both hydraulical process and mechanical process
# Define a function to check if enabled_processes contains LIE, HydroMechanics,
# ThermoHydroMechanics, RichardsMechanics, or ThermoRichardsMechanics
function(check_enabled_processes contains_hm_process)
set(${contains_hm_process} FALSE PARENT_SCOPE)
foreach(process ${_enabled_processes})
if(process STREQUAL "LIE_HM"
OR process STREQUAL "HydroMechanics"
OR process STREQUAL "ThermoHydroMechanics"
OR process STREQUAL "RichardsMechanics"
OR process STREQUAL "TH2M"
OR process STREQUAL "ThermoRichardsMechanics"
)
set(${contains_hm_process} TRUE PARENT_SCOPE)
return()
endif()
endforeach()
endfunction()
check_enabled_processes(contains_hm_process)
if(contains_hm_process)
append_source_files(SOURCES Common/HydroMechanics)
endif()
foreach(process ${_enabled_processes})
if(process STREQUAL "LIE_HM"
OR process STREQUAL "HydroMechanics"
OR process STREQUAL "ThermoHydroMechanics"
OR process STREQUAL "RichardsMechanics"
OR process STREQUAL "TH2M"
OR process STREQUAL "ThermoRichardsMechanics"
)
append_source_files(SOURCES Common/HydroMechanics)
break()
endif()
endforeach()

ogs_add_library(ProcessLib GENERATE_EXPORT_HEADER ${SOURCES})

Expand Down

0 comments on commit 9be2fe4

Please sign in to comment.