From 4c5707359f8fa8830f3a16395551504dcea37aa3 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Thu, 22 Mar 2018 17:47:07 +0100
Subject: [PATCH] Create separate process libraries.

Separting each process implementation into own library.
All processes collected in the INTERFACE library 'processes'.
---
 Applications/ApplicationsLib/CMakeLists.txt   |  2 +-
 .../Utils/PostProcessing/CMakeLists.txt       |  2 +-
 ProcessLib/CMakeLists.txt                     | 78 +++++++++----------
 ProcessLib/ComponentTransport/CMakeLists.txt  |  9 +++
 ProcessLib/GroundwaterFlow/CMakeLists.txt     |  9 +++
 ProcessLib/HT/CMakeLists.txt                  |  6 ++
 ProcessLib/HeatConduction/CMakeLists.txt      |  6 ++
 ProcessLib/HydroMechanics/CMakeLists.txt      |  6 ++
 ProcessLib/LIE/CMakeLists.txt                 | 12 +++
 ProcessLib/LiquidFlow/CMakeLists.txt          |  6 ++
 ProcessLib/PhaseField/CMakeLists.txt          |  6 ++
 .../RichardsComponentTransport/CMakeLists.txt |  6 ++
 ProcessLib/RichardsFlow/CMakeLists.txt        |  6 ++
 ProcessLib/SmallDeformation/CMakeLists.txt    |  6 ++
 ProcessLib/TES/CMakeLists.txt                 |  6 ++
 .../ThermalTwoPhaseFlowWithPP/CMakeLists.txt  |  6 ++
 ProcessLib/ThermoMechanics/CMakeLists.txt     |  6 ++
 ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt  |  6 ++
 .../TwoPhaseFlowWithPrho/CMakeLists.txt       |  6 ++
 Tests/CMakeLists.txt                          |  1 +
 20 files changed, 147 insertions(+), 44 deletions(-)
 create mode 100644 ProcessLib/ComponentTransport/CMakeLists.txt
 create mode 100644 ProcessLib/GroundwaterFlow/CMakeLists.txt
 create mode 100644 ProcessLib/HT/CMakeLists.txt
 create mode 100644 ProcessLib/HeatConduction/CMakeLists.txt
 create mode 100644 ProcessLib/HydroMechanics/CMakeLists.txt
 create mode 100644 ProcessLib/LIE/CMakeLists.txt
 create mode 100644 ProcessLib/LiquidFlow/CMakeLists.txt
 create mode 100644 ProcessLib/PhaseField/CMakeLists.txt
 create mode 100644 ProcessLib/RichardsComponentTransport/CMakeLists.txt
 create mode 100644 ProcessLib/RichardsFlow/CMakeLists.txt
 create mode 100644 ProcessLib/SmallDeformation/CMakeLists.txt
 create mode 100644 ProcessLib/TES/CMakeLists.txt
 create mode 100644 ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
 create mode 100644 ProcessLib/ThermoMechanics/CMakeLists.txt
 create mode 100644 ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
 create mode 100644 ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt

diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt
index d9025f2aa8c..95d7537a72e 100644
--- a/Applications/ApplicationsLib/CMakeLists.txt
+++ b/Applications/ApplicationsLib/CMakeLists.txt
@@ -6,7 +6,7 @@ set(LIB_SOURCES ${SOURCES_APPLICATIONSLIB})
 add_library(ApplicationsLib ${LIB_SOURCES})
 
 target_link_libraries(ApplicationsLib
-    PUBLIC BaseLib GeoLib NumLib ProcessLib logog
+    PUBLIC BaseLib GeoLib Processes logog
     PRIVATE MathLib MeshLib
 )
 
diff --git a/Applications/Utils/PostProcessing/CMakeLists.txt b/Applications/Utils/PostProcessing/CMakeLists.txt
index f93930ff179..ee3f47121bf 100644
--- a/Applications/Utils/PostProcessing/CMakeLists.txt
+++ b/Applications/Utils/PostProcessing/CMakeLists.txt
@@ -1,6 +1,6 @@
 
 add_executable(postLIE postLIE.cpp)
-target_link_libraries(postLIE MeshLib ProcessLib)
+target_link_libraries(postLIE MeshLib LIE)
 set_target_properties(postLIE PROPERTIES FOLDER Utilities)
 
 ####################
diff --git a/ProcessLib/CMakeLists.txt b/ProcessLib/CMakeLists.txt
index 4e7fa3bb398..4ee0f5cc41d 100644
--- a/ProcessLib/CMakeLists.txt
+++ b/ProcessLib/CMakeLists.txt
@@ -1,5 +1,41 @@
 include(${PROJECT_SOURCE_DIR}/scripts/cmake/OGSEnabledElements.cmake)
 
+add_subdirectory(ComponentTransport)
+add_subdirectory(GroundwaterFlow)
+add_subdirectory(HT)
+add_subdirectory(HeatConduction)
+add_subdirectory(HydroMechanics)
+add_subdirectory(LiquidFlow)
+add_subdirectory(LIE)
+add_subdirectory(PhaseField)
+add_subdirectory(RichardsComponentTransport)
+add_subdirectory(RichardsFlow)
+add_subdirectory(SmallDeformation)
+add_subdirectory(TES)
+add_subdirectory(ThermalTwoPhaseFlowWithPP)
+add_subdirectory(ThermoMechanics)
+add_subdirectory(TwoPhaseFlowWithPP)
+add_subdirectory(TwoPhaseFlowWithPrho)
+
+add_library(Processes INTERFACE)
+target_link_libraries(Processes INTERFACE
+    ComponentTransport
+    GroundwaterFlow
+    HT
+    HeatConduction
+    HydroMechanics
+    LiquidFlow
+    LIE
+    PhaseField
+    RichardsComponentTransport
+    RichardsFlow
+    SmallDeformation
+    TES
+    ThermalTwoPhaseFlowWithPP
+    ThermoMechanics
+    TwoPhaseFlowWithPP
+    TwoPhaseFlowWithPrho)
+
 APPEND_SOURCE_FILES(SOURCES)
 APPEND_SOURCE_FILES(SOURCES BoundaryCondition)
 APPEND_SOURCE_FILES(SOURCES CalculateSurfaceFlux)
@@ -8,29 +44,6 @@ APPEND_SOURCE_FILES(SOURCES Parameter)
 APPEND_SOURCE_FILES(SOURCES SourceTerms)
 APPEND_SOURCE_FILES(SOURCES Utils)
 
-APPEND_SOURCE_FILES(SOURCES ComponentTransport)
-APPEND_SOURCE_FILES(SOURCES Deformation)
-APPEND_SOURCE_FILES(SOURCES GroundwaterFlow)
-APPEND_SOURCE_FILES(SOURCES HT)
-APPEND_SOURCE_FILES(SOURCES HeatConduction)
-APPEND_SOURCE_FILES(SOURCES HydroMechanics)
-APPEND_SOURCE_FILES(SOURCES LIE/BoundaryCondition)
-APPEND_SOURCE_FILES(SOURCES LIE/Common)
-APPEND_SOURCE_FILES(SOURCES LIE/HydroMechanics)
-APPEND_SOURCE_FILES(SOURCES LIE/HydroMechanics/LocalAssembler)
-APPEND_SOURCE_FILES(SOURCES LIE/SmallDeformation)
-APPEND_SOURCE_FILES(SOURCES LIE/SmallDeformation/LocalAssembler)
-APPEND_SOURCE_FILES(SOURCES LiquidFlow)
-APPEND_SOURCE_FILES(SOURCES PhaseField)
-APPEND_SOURCE_FILES(SOURCES RichardsComponentTransport)
-APPEND_SOURCE_FILES(SOURCES RichardsFlow)
-APPEND_SOURCE_FILES(SOURCES SmallDeformation)
-APPEND_SOURCE_FILES(SOURCES TES)
-APPEND_SOURCE_FILES(SOURCES ThermalTwoPhaseFlowWithPP)
-APPEND_SOURCE_FILES(SOURCES ThermoMechanics)
-APPEND_SOURCE_FILES(SOURCES TwoPhaseFlowWithPP)
-APPEND_SOURCE_FILES(SOURCES TwoPhaseFlowWithPrho)
-
 add_library(ProcessLib ${SOURCES})
 
 target_link_libraries(ProcessLib
@@ -51,22 +64,3 @@ endif()
 if(OGS_USE_PCH)
     cotire(ProcessLib)
 endif()
-
-### Tests ###
-include(ComponentTransport/Tests.cmake)
-include(GroundwaterFlow/Tests.cmake)
-include(HeatConduction/Tests.cmake)
-include(HT/Tests.cmake)
-include(HydroMechanics/Tests.cmake)
-include(LIE/HydroMechanics/Tests.cmake)
-include(LIE/SmallDeformation/Tests.cmake)
-include(LiquidFlow/Tests.cmake)
-include(PhaseField/Tests.cmake)
-include(RichardsFlow/Tests.cmake)
-include(RichardsComponentTransport/Tests.cmake)
-include(SmallDeformation/Tests.cmake)
-include(TES/Tests.cmake)
-include(ThermoMechanics/Tests.cmake)
-include(TwoPhaseFlowWithPP/Tests.cmake)
-include(TwoPhaseFlowWithPrho/Tests.cmake)
-include(ThermalTwoPhaseFlowWithPP/Tests.cmake)
diff --git a/ProcessLib/ComponentTransport/CMakeLists.txt b/ProcessLib/ComponentTransport/CMakeLists.txt
new file mode 100644
index 00000000000..8fd79d9b1ac
--- /dev/null
+++ b/ProcessLib/ComponentTransport/CMakeLists.txt
@@ -0,0 +1,9 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(ComponentTransport ${SOURCES})
+
+target_link_libraries(ComponentTransport
+    PUBLIC ProcessLib
+)
+
+include(Tests.cmake)
diff --git a/ProcessLib/GroundwaterFlow/CMakeLists.txt b/ProcessLib/GroundwaterFlow/CMakeLists.txt
new file mode 100644
index 00000000000..df390e0d3eb
--- /dev/null
+++ b/ProcessLib/GroundwaterFlow/CMakeLists.txt
@@ -0,0 +1,9 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(GroundwaterFlow ${SOURCES})
+
+target_link_libraries(GroundwaterFlow
+    PUBLIC ProcessLib
+)
+
+include(Tests.cmake)
diff --git a/ProcessLib/HT/CMakeLists.txt b/ProcessLib/HT/CMakeLists.txt
new file mode 100644
index 00000000000..ad8493534eb
--- /dev/null
+++ b/ProcessLib/HT/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(HT ${SOURCES})
+target_link_libraries(HT PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/HeatConduction/CMakeLists.txt b/ProcessLib/HeatConduction/CMakeLists.txt
new file mode 100644
index 00000000000..dab843c3693
--- /dev/null
+++ b/ProcessLib/HeatConduction/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(HeatConduction ${SOURCES})
+target_link_libraries(HeatConduction PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/HydroMechanics/CMakeLists.txt b/ProcessLib/HydroMechanics/CMakeLists.txt
new file mode 100644
index 00000000000..5ac96f99ae4
--- /dev/null
+++ b/ProcessLib/HydroMechanics/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(HydroMechanics ${SOURCES})
+target_link_libraries(HydroMechanics PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/LIE/CMakeLists.txt b/ProcessLib/LIE/CMakeLists.txt
new file mode 100644
index 00000000000..0e236b03b9b
--- /dev/null
+++ b/ProcessLib/LIE/CMakeLists.txt
@@ -0,0 +1,12 @@
+APPEND_SOURCE_FILES(SOURCES BoundaryCondition)
+APPEND_SOURCE_FILES(SOURCES Common)
+APPEND_SOURCE_FILES(SOURCES HydroMechanics)
+APPEND_SOURCE_FILES(SOURCES HydroMechanics/LocalAssembler)
+APPEND_SOURCE_FILES(SOURCES SmallDeformation)
+APPEND_SOURCE_FILES(SOURCES SmallDeformation/LocalAssembler)
+
+add_library(LIE ${SOURCES})
+target_link_libraries(LIE PUBLIC ProcessLib)
+
+include(HydroMechanics/Tests.cmake)
+include(SmallDeformation/Tests.cmake)
diff --git a/ProcessLib/LiquidFlow/CMakeLists.txt b/ProcessLib/LiquidFlow/CMakeLists.txt
new file mode 100644
index 00000000000..9324f6ac396
--- /dev/null
+++ b/ProcessLib/LiquidFlow/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(LiquidFlow ${SOURCES})
+target_link_libraries(LiquidFlow PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/PhaseField/CMakeLists.txt b/ProcessLib/PhaseField/CMakeLists.txt
new file mode 100644
index 00000000000..6a541ed532b
--- /dev/null
+++ b/ProcessLib/PhaseField/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(PhaseField ${SOURCES})
+target_link_libraries(PhaseField PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/RichardsComponentTransport/CMakeLists.txt b/ProcessLib/RichardsComponentTransport/CMakeLists.txt
new file mode 100644
index 00000000000..8a8a9ec2f73
--- /dev/null
+++ b/ProcessLib/RichardsComponentTransport/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(RichardsComponentTransport ${SOURCES})
+target_link_libraries(RichardsComponentTransport PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/RichardsFlow/CMakeLists.txt b/ProcessLib/RichardsFlow/CMakeLists.txt
new file mode 100644
index 00000000000..b7647cf90ff
--- /dev/null
+++ b/ProcessLib/RichardsFlow/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(RichardsFlow ${SOURCES})
+target_link_libraries(RichardsFlow PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/SmallDeformation/CMakeLists.txt b/ProcessLib/SmallDeformation/CMakeLists.txt
new file mode 100644
index 00000000000..341d2ebe76b
--- /dev/null
+++ b/ProcessLib/SmallDeformation/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(SmallDeformation ${SOURCES})
+target_link_libraries(SmallDeformation PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/TES/CMakeLists.txt b/ProcessLib/TES/CMakeLists.txt
new file mode 100644
index 00000000000..1a80afc2301
--- /dev/null
+++ b/ProcessLib/TES/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(TES ${SOURCES})
+target_link_libraries(TES PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt b/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
new file mode 100644
index 00000000000..141baacb344
--- /dev/null
+++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(ThermalTwoPhaseFlowWithPP ${SOURCES})
+target_link_libraries(ThermalTwoPhaseFlowWithPP PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/ThermoMechanics/CMakeLists.txt b/ProcessLib/ThermoMechanics/CMakeLists.txt
new file mode 100644
index 00000000000..3d6de7a861c
--- /dev/null
+++ b/ProcessLib/ThermoMechanics/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(ThermoMechanics ${SOURCES})
+target_link_libraries(ThermoMechanics PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt b/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
new file mode 100644
index 00000000000..1a186fc256b
--- /dev/null
+++ b/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(TwoPhaseFlowWithPP ${SOURCES})
+target_link_libraries(TwoPhaseFlowWithPP PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt b/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
new file mode 100644
index 00000000000..cc04858fe35
--- /dev/null
+++ b/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
@@ -0,0 +1,6 @@
+APPEND_SOURCE_FILES(SOURCES)
+
+add_library(TwoPhaseFlowWithPrho ${SOURCES})
+target_link_libraries(TwoPhaseFlowWithPrho PUBLIC ProcessLib)
+
+include(Tests.cmake)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index d3b242552b9..9be123f0799 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -38,6 +38,7 @@ target_link_libraries(testrunner
     ApplicationsLib
     ApplicationsFileIO
     GTest
+    LIE
     MeshGeoToolsLib
     MaterialLib
     MeshLib
-- 
GitLab