Commit df697747 authored by GILLES Sebastien's avatar GILLES Sebastien

#1217 Move header files into INTERFACE.

parent c22ed141
# A minimum version for cmake command is required.
cmake_minimum_required(VERSION 3.8)
project( "MoReFEM")
project( "MoReFEM_CMAKE")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
......
......@@ -8,24 +8,31 @@ def FilterCppFiles(file_list):
\param[in] file_list Initial file list.
\return The filtered list.
\return A pair with cpp file list in the first slot and header file list (hpp and hxx) in the second one.
"""
ret = []
cpp_extension_list = ("cpp", "hpp", "hxx")
cpp_extension = "cpp"
header_extension_list = ("hpp", "hxx")
source_list = []
header_list = []
for myfile in file_list:
extension = os.path.splitext(myfile)[1]
if extension.startswith('.'):
extension = extension[1:]
if extension not in cpp_extension_list:
continue
ret.append(myfile)
if extension == cpp_extension:
source_list.append(myfile)
elif extension in header_extension_list:
header_list.append(myfile)
source_list.sort()
header_list.sort()
return ret
return (source_list, header_list)
......@@ -47,17 +54,26 @@ def GenerateInModule(morefem_directory, subdirectory, library_name, ignore_list
if ignore_list:
dirs[:] = [d for d in dirs if d not in ignore_list]
file_list = FilterCppFiles(files)
file_list.sort()
(source_list, header_list) = FilterCppFiles(files)
reduced_source_root = os.path.relpath(root, source_directory)
# reduced_source_root = os.path.relpath(root, source_directory)
with open(os.path.join(root, "SourceList.cmake"), "w") as SourceList:
SourceList.write("target_sources({}\n\tPRIVATE\n".format(library_name))
SourceList.write("target_sources({}\n".format(library_name))
if source_list:
SourceList.write("\n\tPRIVATE\n")
for myfile in file_list:
for myfile in source_list:
SourceList.write("{}\"{}/{}\" / \n".format(tab_prefix, r"${CMAKE_CURRENT_LIST_DIR}", myfile))
SourceList.write("\n\tINTERFACE\n")
for myfile in header_list:
SourceList.write("{}\"{}/{}\" / \n".format(tab_prefix, r"${CMAKE_CURRENT_LIST_DIR}", myfile))
SourceList.write(")\n\n")
for directory in dirs:
......
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetForMatrix.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetForMatrix.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Section.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Section.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Section.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hpp" /
)
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Unknown.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Unknown.hpp" /
)
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hpp" /
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Domain.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Domain.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Mesh.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Mesh.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/PseudoNormals.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Domain.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Mesh.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/PseudoNormals.hpp" /
)
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Domain.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Domain.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.hpp" /
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hpp" /
)
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hpp" /
)
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Density.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Diffusion.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/TransfertCoefficient.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Diffusion.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Diffusion.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/TransfertCoefficient.cpp" /
)
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Fiber.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Fiber.hpp" /
)
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Fiber.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Fiber.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Fluid.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Fluid.hpp" /
)
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Heart.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Heart.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Heart.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ParameterUsualDescription.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/ParameterUsualDescription.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/ParameterUsualDescription.hxx" /
)
......
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/VolumicMass.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/VolumicMass.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/C_i_Mu_i.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/HyperelasticBulk.cpp" /
......@@ -8,8 +9,10 @@ target_sources(morefem_core
"${CMAKE_CURRENT_LIST_DIR}/LameMu.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/PoissonRatio.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Solid.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Solid.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Viscosity.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/YoungModulus.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Solid.hpp" /
)
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/RectangularSourceTimeParameter.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/RectangularSourceTimeParameter.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/TransientSource.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/RectangularSourceTimeParameter.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/TransientSource.hpp" /
)
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Pressure.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Pressure.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Pressure.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/RectangularSourceTimeParameter.hpp" /
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/SpatialFunction.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/SpatialFunction.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/SpatialFunction.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ViscoelasticBoundaryCondition.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/ViscoelasticBoundaryCondition.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/ViscoelasticBoundaryCondition.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/FitzHughNagumo.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/MitchellSchaeffer.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/ReactionCoefficient.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/FitzHughNagumo.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/FitzHughNagumo.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/MitchellSchaeffer.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/MitchellSchaeffer.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/MitchellSchaeffer.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/ReactionCoefficient.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/ReactionCoefficient.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/ReactionCoefficient.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Petsc.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Petsc.hpp" /
)
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ConvergenceTest.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/ConvergenceTest.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/ConvergenceTest.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/Petsc.hpp" /
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialConditionGate.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Result.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitialConditionGate.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/OutputDeformedMesh.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/OutputDeformedMesh.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/Result.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Result.hpp" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/TimeManager.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/TimeManager.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/TimeManager.hxx" /
)
......
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/SetFromInputParameterData.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/SetFromInputParameterData.hxx" /
)
......
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InputParameterList.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InputParameterList.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/GlobalDiagonalMatrix.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalMatrix.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalVector.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/GlobalDiagonalMatrix.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalDiagonalMatrix.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalMatrix.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalMatrix.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalMatrix.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalVector.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalVector.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/GlobalVector.hxx" /
)
......
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/MoReFEMData.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/MoReFEMData.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetManager.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/FetchFunction.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/FetchFunction.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/FindFunctor.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/FindFunctor.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetManager.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetManager.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetManager.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hxx" /
)
......
target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Solver.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Solver.hxx" /
)
......
target_sources(morefem_core
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Enum.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InitTimeKeepLog.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Enum.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InitTimeKeepLog.hpp" /
)
......