Commit 5bed9cdb authored by GILLES Sebastien's avatar GILLES Sebastien

#1217 Improve the CMake build so that now either a unique MoReFEM library...

#1217 Improve the CMake build so that now either a unique MoReFEM library might be built or one per module as previously.
parent 05f01e74
# A minimum version for cmake command is required.
cmake_minimum_required(VERSION 3.8)
# IF(DEFINED CMAKE_BUILD_TYPE)
# SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of
# build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug
# Release RelWithDebInfo MinSizeRel.")
# ELSE()
# SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build,
# options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release
# RelWithDebInfo MinSizeRel.")
# ENDIF()
project( "MoReFEM_CMAKE")
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
......
......@@ -36,11 +36,11 @@ def FilterCppFiles(file_list):
def GenerateInModule(morefem_directory, subdirectory, library_name, ignore_list = None):
def GenerateInModule(morefem_directory, subdirectory, module_alias, ignore_list = None):
"""
\param[in] morefem_directory Path to the Morefem directory. Current file should be in {morefem_directory}/Scripts directory.
\param[in] subdirectory Name of the subdirectory being investigated, within "Sources" directory. e.g 'Utilities', 'ThirdParty', etc...
\param[in] library_name Name of the library being built. e.g. 'morefem_utilities'.
\param[in] module_alias Alias to the library being built, e.g. 'MOREFEM_UTILITIES'. If BUILD_MOREFEM_UNIQUE_LIBRARY is set, this alias will actually point to the MoReFEM library.
\param[in] ignore_list If None, all subdirectories of \a subdirectory are included. If a list is given, each subfolder named after an element of the list is ignored. For instance for 'ThirdParty' there is 'Tclap'in the list; Tclap is a header only library embedded in MoReFEM which source files aren't required in the build.
"""
morefem_directory = Utilities.SubstituteEnvVariable(morefem_directory)
......@@ -61,7 +61,7 @@ def GenerateInModule(morefem_directory, subdirectory, library_name, ignore_list
with open(os.path.join(root, "SourceList.cmake"), "w") as SourceList:
SourceList.write("target_sources({}\n".format(library_name))
SourceList.write("target_sources({}{}{}\n".format("${", module_alias, "}"))
if source_list:
SourceList.write("\n\tPRIVATE\n")
......@@ -88,18 +88,18 @@ def GenerateInModule(morefem_directory, subdirectory, library_name, ignore_list
if __name__ == "__main__":
morefem_path = "${HOME}/Codes/Morefem"
GenerateInModule(morefem_path, "Utilities", "morefem_utilities", None)
GenerateInModule(morefem_path, "ThirdParty", "morefem_utilities", ['Tclap', 'Legacy'])
GenerateInModule(morefem_path, "Core", "morefem_core")
GenerateInModule(morefem_path, "Geometry", "morefem_geometry")
GenerateInModule(morefem_path, "FiniteElement", "morefem_felt")
GenerateInModule(morefem_path, "Parameters", "morefem_param")
GenerateInModule(morefem_path, "Operators", "morefem_op")
GenerateInModule(morefem_path, "OperatorInstances", "morefem_op_instances")
GenerateInModule(morefem_path, "ParameterInstances", "morefem_param_instances")
GenerateInModule(morefem_path, "FormulationSolver", "morefem_formulation_solver")
GenerateInModule(morefem_path, "Model", "morefem_model")
GenerateInModule(morefem_path, "PostProcessing", "morefem_post_processing")
GenerateInModule(morefem_path, "Utilities", "MOREFEM_UTILITIES", None)
GenerateInModule(morefem_path, "ThirdParty", "MOREFEM_UTILITIES", ['Tclap', 'Legacy'])
GenerateInModule(morefem_path, "Core", "MOREFEM_CORE")
GenerateInModule(morefem_path, "Geometry", "MOREFEM_GEOMETRY")
GenerateInModule(morefem_path, "FiniteElement", "MOREFEM_FELT")
GenerateInModule(morefem_path, "Parameters", "MOREFEM_PARAM")
GenerateInModule(morefem_path, "Operators", "MOREFEM_OP")
GenerateInModule(morefem_path, "OperatorInstances", "MOREFEM_OP_INSTANCES")
GenerateInModule(morefem_path, "ParameterInstances", "MOREFEM_PARAM_INSTANCES")
GenerateInModule(morefem_path, "FormulationSolver", "MOREFEM_FORMULATION_SOLVER")
GenerateInModule(morefem_path, "Model", "MOREFEM_MODEL")
GenerateInModule(morefem_path, "PostProcessing", "MOREFEM_POST_PROCESSING")
add_library(morefem_utilities ${LIBRARY_TYPE} "")
target_link_libraries(morefem_utilities ${MOREFEM_COMMON_DEP})
if (BUILD_MOREFEM_UNIQUE_LIBRARY)
add_library(morefem ${LIBRARY_TYPE} "")
endif()
morefem_library_module(MOREFEM_UTILITIES morefem_utilities)
morefem_library_module(MOREFEM_CORE morefem_core)
morefem_library_module(MOREFEM_GEOMETRY morefem_geometry)
morefem_library_module(MOREFEM_FELT morefem_felt)
morefem_library_module(MOREFEM_PARAM morefem_param)
morefem_library_module(MOREFEM_OP morefem_op)
morefem_library_module(MOREFEM_PARAM_INSTANCES morefem_param_instances)
morefem_library_module(MOREFEM_OP_INSTANCES morefem_op_instances)
morefem_library_module(MOREFEM_FORMULATION_SOLVER morefem_formulation_solver)
morefem_library_module(MOREFEM_MODEL morefem_model)
if (BUILD_MOREFEM_UNIQUE_LIBRARY)
target_link_libraries(morefem ${MOREFEM_COMMON_DEP})
else()
target_link_libraries(morefem_utilities ${MOREFEM_COMMON_DEP})
target_link_libraries(morefem_core morefem_utilities)
target_link_libraries(morefem_geometry morefem_core)
target_link_libraries(morefem_felt morefem_geometry)
target_link_libraries(morefem_param morefem_felt)
target_link_libraries(morefem_op morefem_param)
target_link_libraries(morefem_param_instances morefem_op)
target_link_libraries(morefem_op_instances morefem_param_instances)
target_link_libraries(morefem_formulation_solver morefem_op_instances)
target_link_libraries(morefem_model morefem_formulation_solver)
endif()
include(Utilities/SourceList.cmake)
include(ThirdParty/SourceList.cmake)
include(ThirdParty/Ops.cmake)
include(ThirdParty/Seldon.cmake)
include(ThirdParty/Source/CMakeLists.txt)
add_library(morefem_core ${LIBRARY_TYPE} "")
target_link_libraries(morefem_core morefem_utilities)
include(Core/SourceList.cmake)
add_library(morefem_geometry ${LIBRARY_TYPE} "")
target_link_libraries(morefem_geometry morefem_core)
include(Geometry/SourceList.cmake)
add_library(morefem_felt ${LIBRARY_TYPE} "")
target_link_libraries(morefem_felt morefem_geometry)
include(FiniteElement/SourceList.cmake)
add_library(morefem_param ${LIBRARY_TYPE} "")
target_link_libraries(morefem_param morefem_felt)
include(Parameters/SourceList.cmake)
add_library(morefem_op ${LIBRARY_TYPE} "")
target_link_libraries(morefem_op morefem_param)
include(Operators/SourceList.cmake)
add_library(morefem_param_instances ${LIBRARY_TYPE} "")
target_link_libraries(morefem_param_instances morefem_op)
include(ParameterInstances/SourceList.cmake)
add_library(morefem_op_instances ${LIBRARY_TYPE} "")
target_link_libraries(morefem_op_instances morefem_param_instances)
include(OperatorInstances/SourceList.cmake)
add_library(morefem_formulation_solver ${LIBRARY_TYPE} "")
target_link_libraries(morefem_formulation_solver morefem_op_instances)
include(FormulationSolver/SourceList.cmake)
add_library(morefem_model ${LIBRARY_TYPE} "")
target_link_libraries(morefem_model morefem_formulation_solver)
include(Model/SourceList.cmake)
# add_library(morefem_post_processing ${LIBRARY_TYPE} "")
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetForMatrix.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Section.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Domain.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Density.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Fiber.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/Fiber.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Fluid.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Heart.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ParameterUsualDescription.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/VolumicMass.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/C_i_Mu_i.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/RectangularSourceTimeParameter.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Pressure.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/SpatialFunction.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ViscoelasticBoundaryCondition.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/FitzHughNagumo.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Petsc.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ConvergenceTest.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialConditionGate.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/TimeManager.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/SetFromInputParameterData.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/InputParameterList.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/GlobalDiagonalMatrix.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/MoReFEMData.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetManager.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/Solver.hpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitTimeKeepLog.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ConstantTimeStep.cpp" /
......
target_sources(morefem_core
target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/TimeManager.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Comp1.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/DofStorage.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Local2GlobalStorage.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/FElt.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/AttributeProcessorHelper.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/BreakCircularDependancy.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/AllocateGlobalLinearAlgebra.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Dof.cpp" /
......
target_sources(morefem_felt
target_sources(${MOREFEM_FELT}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Dof.cpp" /
......