Commit df697747 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1217 Move header files into INTERFACE.

parent c22ed141
# A minimum version for cmake command is required. # A minimum version for cmake command is required.
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.8)
project( "MoReFEM") project( "MoReFEM_CMAKE")
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
......
...@@ -8,11 +8,15 @@ def FilterCppFiles(file_list): ...@@ -8,11 +8,15 @@ def FilterCppFiles(file_list):
\param[in] file_list Initial 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 = [] ret = []
cpp_extension_list = ("cpp", "hpp", "hxx") cpp_extension = "cpp"
header_extension_list = ("hpp", "hxx")
source_list = []
header_list = []
for myfile in file_list: for myfile in file_list:
extension = os.path.splitext(myfile)[1] extension = os.path.splitext(myfile)[1]
...@@ -20,12 +24,15 @@ def FilterCppFiles(file_list): ...@@ -20,12 +24,15 @@ def FilterCppFiles(file_list):
if extension.startswith('.'): if extension.startswith('.'):
extension = extension[1:] extension = extension[1:]
if extension not in cpp_extension_list: if extension == cpp_extension:
continue source_list.append(myfile)
elif extension in header_extension_list:
header_list.append(myfile)
ret.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 ...@@ -47,17 +54,26 @@ def GenerateInModule(morefem_directory, subdirectory, library_name, ignore_list
if ignore_list: if ignore_list:
dirs[:] = [d for d in dirs if d not in ignore_list] dirs[:] = [d for d in dirs if d not in ignore_list]
file_list = FilterCppFiles(files) (source_list, header_list) = FilterCppFiles(files)
file_list.sort()
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: with open(os.path.join(root, "SourceList.cmake"), "w") as SourceList:
SourceList.write("target_sources({}\n\tPRIVATE\n".format(library_name))
for myfile in file_list: SourceList.write("target_sources({}\n".format(library_name))
if source_list:
SourceList.write("\n\tPRIVATE\n")
for myfile in source_list:
SourceList.write("{}\"{}/{}\" / \n".format(tab_prefix, r"${CMAKE_CURRENT_LIST_DIR}", myfile)) 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") SourceList.write(")\n\n")
for directory in dirs: for directory in dirs:
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetForMatrix.hpp" / "${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetForMatrix.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetForMatrix.hxx" / "${CMAKE_CURRENT_LIST_DIR}/NumberingSubsetForMatrix.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.cpp" / "${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.hpp" / "${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.hxx" / "${CMAKE_CURRENT_LIST_DIR}/EnsightCaseReader.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Section.cpp" / "${CMAKE_CURRENT_LIST_DIR}/Section.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Section.hpp" / "${CMAKE_CURRENT_LIST_DIR}/Section.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Section.hxx" / "${CMAKE_CURRENT_LIST_DIR}/Section.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.cpp" / "${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hpp" / "${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hpp" /
) )
target_sources(morefem_core target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hpp" / "${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hxx" / "${CMAKE_CURRENT_LIST_DIR}/DirichletBoundaryCondition.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.cpp" / "${CMAKE_CURRENT_LIST_DIR}/FEltSpace.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.cpp" / "${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Unknown.cpp" / "${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" / "${CMAKE_CURRENT_LIST_DIR}/Unknown.hpp" /
) )
target_sources(morefem_core target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hpp" / "${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hxx" / "${CMAKE_CURRENT_LIST_DIR}/FEltSpace.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hpp" / "${CMAKE_CURRENT_LIST_DIR}/NumberingSubset.hpp" /
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Domain.cpp" / "${CMAKE_CURRENT_LIST_DIR}/Domain.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Domain.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.cpp" / "${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Mesh.cpp" / "${CMAKE_CURRENT_LIST_DIR}/Mesh.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Mesh.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/PseudoNormals.cpp" / "${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" / "${CMAKE_CURRENT_LIST_DIR}/PseudoNormals.hpp" /
) )
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Domain.hpp" / "${CMAKE_CURRENT_LIST_DIR}/Domain.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Domain.hxx" / "${CMAKE_CURRENT_LIST_DIR}/Domain.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.hpp" / "${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.hxx" / "${CMAKE_CURRENT_LIST_DIR}/InterpolationFile.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.hpp" / "${CMAKE_CURRENT_LIST_DIR}/LightweightDomainList.hpp" /
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.cpp" / "${CMAKE_CURRENT_LIST_DIR}/InitialCondition.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hpp" / "${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hpp" /
) )
target_sources(morefem_core target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hpp" / "${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hxx" / "${CMAKE_CURRENT_LIST_DIR}/InitialCondition.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.cpp" / "${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hpp" / "${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hpp" /
) )
target_sources(morefem_core target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hpp" / "${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hxx" / "${CMAKE_CURRENT_LIST_DIR}/InitVertexMatching.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.cpp" / "${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.hpp" / "${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.hxx" / "${CMAKE_CURRENT_LIST_DIR}/AnalyticalPrestress.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Density.cpp" / "${CMAKE_CURRENT_LIST_DIR}/Density.cpp" /
"${CMAKE_CURRENT_LIST_DIR}/Diffusion.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.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Diffusion.hxx" / "${CMAKE_CURRENT_LIST_DIR}/Diffusion.hxx" /
"${CMAKE_CURRENT_LIST_DIR}/TransfertCoefficient.cpp" /
) )
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.cpp" / "${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.hpp" / "${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.hxx" / "${CMAKE_CURRENT_LIST_DIR}/ElectricalActivation.hxx" /
) )
......
target_sources(morefem_core target_sources(morefem_core
PRIVATE PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Fiber.cpp" / "${CMAKE_CURRENT_LIST_DIR}/Fiber.cpp" /
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Fiber.hpp" / "${CMAKE_CURRENT_LIST_DIR}/Fiber.hpp" /
) )
target_sources(morefem_core target_sources(morefem_core
PRIVATE
INTERFACE
"${CMAKE_CURRENT_LIST_DIR}/Fiber.hpp" / "${CMAKE_CURRENT_LIST_DIR}/Fiber.hpp" /
"${CMAKE_CURRENT_LIST_DIR}/Fiber.hxx" / "${CMAKE_CURRENT_LIST_DIR}/Fiber.hxx" /
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment