Commit 056bbd0d authored by GILLES Sebastien's avatar GILLES Sebastien

#1217 Add a script to deploy CMake files in all directories related to a given...

#1217 Add a script to deploy CMake files in all directories related to a given library. Used so far on Utilities folder.
parent e16d8f5e
......@@ -11,8 +11,6 @@ include(CustomCommands)
include(Paths)
MESSAGE("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")
MESSAGE( STATUS "${CMAKE_BUILD_TYPE}: " ${CMAKE_BUILD_TYPE} )
# Check whether
# string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "" NO_BUILD_TYPE)
......@@ -23,9 +21,8 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --my-debug-flags")
MESSAGE( STATUS "${CMAKE_BUILD_TYPE}: " ${CMAKE_BUILD_TYPE} )
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Sources /
${CMAKE_CURRENT_SOURCE_DIR}/Sources/ThirdParty/Source/Tclap/include /
${OPS_DIR} /
${SELDON_DIR} /
${OPEN_MPI_INCL_DIR} /
......
import os
import Utilities
def FilterCppFiles(file_list):
"""Keep in the \a file_list given in input only the files which extension is cpp, hpp or hxx.
\param[in] file_list Initial file list.
\return The filtered list.
"""
ret = []
cpp_extension_list = ("cpp", "hpp", "hxx")
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)
return ret
def GenerateInModule(morefem_directory, subdirectory, library_name, ignore_list = None):
morefem_directory = Utilities.SubstituteEnvVariable(morefem_directory)
source_directory = directory = os.path.join(morefem_directory, "Sources")
directory = os.path.join(source_directory, subdirectory)
tab_prefix = "\t\t"
for root, dirs, files in os.walk(directory):
skip = False
# Skip files that are located within ignored folders.
if skip:
continue
file_list = FilterCppFiles(files)
file_list.sort()
reduced_source_root = os.path.relpath(root, source_directory)
reduced_morefem_root = os.path.relpath(root, morefem_directory)
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("{}\"{}\" / \n".format(tab_prefix, os.path.join(reduced_source_root, myfile)))
SourceList.write(")\n\n")
for directory in dirs:
SourceList.write("include({}/SourceList.cmake)\n".format(os.path.join(reduced_source_root, directory)))
if __name__ == "__main__":
GenerateInModule("${HOME}/Codes/Morefem", "Utilities", "morefem_utilities", None)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
include(Utilities)
add_library(morefem_utilities STATIC "")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty)
include(ThirdParty)
include(Utilities/SourceList.cmake)
include(ThirdParty/SourceList.cmake)
#add_subdirectory(Core)
#add_subdirectory(Geometry)
# add_subdirectory(FiniteElement)
# add_subdirectory(Parameters)
# add_subdirectory(Operators)
# add_subdirectory(OperatorInstances)
# add_subdirectory(ParameterInstances)
# add_subdirectory(FormulationSolver)
# add_subdirectory(Model)
# add_subdirectory(ModelInstances)
# add_subdirectory(Test)
# add_subdirectory(PostProcessing)
add_library(utilities STATIC ${UTILITIES_SRC} ${THIRD_PARTY_SRC})
target_sources(morefem_utilities
PRIVATE
"Utilities/Containers/Internal/Sort.hpp" /
"Utilities/Containers/Internal/Sort.hxx" /
"Utilities/Containers/Internal/TupleHelper.hpp" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Containers/Array.hpp" /
"Utilities/Containers/Array.hxx" /
"Utilities/Containers/BoolArray.cpp" /
"Utilities/Containers/BoolArray.hpp" /
"Utilities/Containers/BoolArray.hxx" /
"Utilities/Containers/EnumClass.hpp" /
"Utilities/Containers/PointerComparison.hpp" /
"Utilities/Containers/PointerComparison.hxx" /
"Utilities/Containers/Print.hpp" /
"Utilities/Containers/Sort.hpp" /
"Utilities/Containers/Tuple.hpp" /
"Utilities/Containers/UnorderedMap.hpp" /
"Utilities/Containers/UnorderedMap.hxx" /
"Utilities/Containers/Vector.hpp" /
)
include(Utilities/Containers/Internal/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/Environment/EnvironmentVariable.cpp" /
"Utilities/Environment/EnvironmentVariable.hpp" /
"Utilities/Environment/EnvironmentVariable.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Exceptions/Exception.cpp" /
"Utilities/Exceptions/Exception.hpp" /
"Utilities/Exceptions/Factory.cpp" /
"Utilities/Exceptions/Factory.hpp" /
"Utilities/Exceptions/PrintAndAbort.cpp" /
"Utilities/Exceptions/PrintAndAbort.hpp" /
"Utilities/Exceptions/PrintAndAbort.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Filesystem/File.cpp" /
"Utilities/Filesystem/File.hpp" /
"Utilities/Filesystem/Folder.cpp" /
"Utilities/Filesystem/Folder.hpp" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Crtp/InputParameter.hpp" /
"Utilities/InputParameterList/Crtp/InputParameter.hxx" /
"Utilities/InputParameterList/Crtp/Section.hpp" /
"Utilities/InputParameterList/Crtp/Section.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Exceptions/InputParameterList.cpp" /
"Utilities/InputParameterList/Exceptions/InputParameterList.hpp" /
"Utilities/InputParameterList/Exceptions/InputParameterList.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Internal/ExtractParameter/ExtractParameter.hpp" /
"Utilities/InputParameterList/Internal/ExtractParameter/ExtractParameter.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Internal/ManualParsing/ManualParsing.cpp" /
"Utilities/InputParameterList/Internal/ManualParsing/ManualParsing.hpp" /
)
target_sources(morefem_utilities
PRIVATE
)
include(Utilities/InputParameterList/Internal/ExtractParameter/SourceList.cmake)
include(Utilities/InputParameterList/Internal/TupleIteration/SourceList.cmake)
include(Utilities/InputParameterList/Internal/Subtuple/SourceList.cmake)
include(Utilities/InputParameterList/Internal/ManualParsing/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Internal/Subtuple/Subtuple.hpp" /
"Utilities/InputParameterList/Internal/Subtuple/Subtuple.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Internal/TupleIteration/Impl/OpsType.hpp" /
"Utilities/InputParameterList/Internal/TupleIteration/Impl/PrepareDefaultEntry.cpp" /
"Utilities/InputParameterList/Internal/TupleIteration/Impl/PrepareDefaultEntry.hpp" /
"Utilities/InputParameterList/Internal/TupleIteration/Impl/StaticIf.hpp" /
"Utilities/InputParameterList/Internal/TupleIteration/Impl/StaticIf.hxx" /
"Utilities/InputParameterList/Internal/TupleIteration/Impl/TupleItem.hpp" /
"Utilities/InputParameterList/Internal/TupleIteration/Impl/TupleItem.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Internal/TupleIteration/TupleIteration.hpp" /
"Utilities/InputParameterList/Internal/TupleIteration/TupleIteration.hxx" /
)
include(Utilities/InputParameterList/Internal/TupleIteration/Impl/SourceList.cmake)
include(Utilities/InputParameterList/Internal/TupleIteration/Traits/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Internal/TupleIteration/Traits/Traits.cpp" /
"Utilities/InputParameterList/Internal/TupleIteration/Traits/Traits.hpp" /
"Utilities/InputParameterList/Internal/TupleIteration/Traits/Traits.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/InputParameterList/Base.hpp" /
"Utilities/InputParameterList/Base.hxx" /
"Utilities/InputParameterList/Definitions.cpp" /
"Utilities/InputParameterList/Definitions.hpp" /
"Utilities/InputParameterList/ExtendedOps.cpp" /
"Utilities/InputParameterList/ExtendedOps.hpp" /
"Utilities/InputParameterList/OpsFunction.hpp" /
"Utilities/InputParameterList/OpsFunction.hxx" /
)
include(Utilities/InputParameterList/Crtp/SourceList.cmake)
include(Utilities/InputParameterList/Internal/SourceList.cmake)
include(Utilities/InputParameterList/Exceptions/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
)
include(Utilities/LinearAlgebra/Storage/SourceList.cmake)
include(Utilities/LinearAlgebra/SparseMatrix/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/LinearAlgebra/SparseMatrix/CSRPattern.hpp" /
"Utilities/LinearAlgebra/SparseMatrix/CSRPattern.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/LinearAlgebra/Storage/Global/Crtp/GlobalVectorTemporary.hpp" /
"Utilities/LinearAlgebra/Storage/Global/Crtp/GlobalVectorTemporary.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/LinearAlgebra/Storage/Global/Internal/GlobalVectorTemporaryAccess.hpp" /
"Utilities/LinearAlgebra/Storage/Global/Internal/GlobalVectorTemporaryAccess.hxx" /
"Utilities/LinearAlgebra/Storage/Global/Internal/GlobalVectorTemporaryStorage.hpp" /
"Utilities/LinearAlgebra/Storage/Global/Internal/GlobalVectorTemporaryStorage.hxx" /
)
target_sources(morefem_utilities
PRIVATE
)
include(Utilities/LinearAlgebra/Storage/Global/Crtp/SourceList.cmake)
include(Utilities/LinearAlgebra/Storage/Global/Internal/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/LinearAlgebra/Storage/Local/LocalMatrixStorage.hpp" /
"Utilities/LinearAlgebra/Storage/Local/LocalMatrixStorage.hxx" /
"Utilities/LinearAlgebra/Storage/Local/LocalVectorStorage.hpp" /
"Utilities/LinearAlgebra/Storage/Local/LocalVectorStorage.hxx" /
)
target_sources(morefem_utilities
PRIVATE
)
include(Utilities/LinearAlgebra/Storage/Local/SourceList.cmake)
include(Utilities/LinearAlgebra/Storage/Global/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/Mpi/Mpi.hpp" /
"Utilities/Mpi/Mpi.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Mutex/Mutex.hpp" /
"Utilities/Mutex/Mutex.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Numeric/Numeric.hpp" /
"Utilities/Numeric/Numeric.hxx" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Pragma/Pragma.hpp" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Singleton/Exceptions/Singleton.cpp" /
"Utilities/Singleton/Exceptions/Singleton.hpp" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/Singleton/Singleton.hpp" /
"Utilities/Singleton/Singleton.hxx" /
)
include(Utilities/Singleton/Exceptions/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/MatrixOrVector.hpp" /
"Utilities/Miscellaneous.hpp" /
)
include(Utilities/Mpi/SourceList.cmake)
include(Utilities/UniqueId/SourceList.cmake)
include(Utilities/Pragma/SourceList.cmake)
include(Utilities/Filesystem/SourceList.cmake)
include(Utilities/TimeKeep/SourceList.cmake)
include(Utilities/Exceptions/SourceList.cmake)
include(Utilities/Numeric/SourceList.cmake)
include(Utilities/InputParameterList/SourceList.cmake)
include(Utilities/Singleton/SourceList.cmake)
include(Utilities/Environment/SourceList.cmake)
include(Utilities/LinearAlgebra/SourceList.cmake)
include(Utilities/String/SourceList.cmake)
include(Utilities/Containers/SourceList.cmake)
include(Utilities/Mutex/SourceList.cmake)
target_sources(morefem_utilities
PRIVATE
"Utilities/String/EmptyString.cpp" /
"Utilities/String/EmptyString.hpp" /
"Utilities/String/String.cpp" /
"Utilities/String/String.hpp" /
"Utilities/String/String.hxx" /
"Utilities/String/Traits.hpp" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/TimeKeep/TimeKeep.cpp" /
"Utilities/TimeKeep/TimeKeep.hpp" /
)
target_sources(morefem_utilities
PRIVATE
"Utilities/UniqueId/UniqueId.hpp" /
"Utilities/UniqueId/UniqueId.hxx" /
)
set(UTILITIES_SRC /
Utilities/Filesystem/Folder.cpp /
Utilities/Filesystem/File.cpp /
Utilities/TimeKeep/TimeKeep.cpp /
Utilities/Exceptions/Exception.cpp /
Utilities/Exceptions/PrintAndAbort.cpp /
Utilities/Exceptions/Factory.cpp /
Utilities/InputParameterList/Definitions.cpp /
Utilities/InputParameterList/ExtendedOps.cpp /
Utilities/InputParameterList/Internal/TupleIteration/Impl/PrepareDefaultEntry.cpp /
Utilities/InputParameterList/Internal/TupleIteration/Traits/Traits.cpp /
Utilities/InputParameterList/Internal/ManualParsing/ManualParsing.cpp /
Utilities/InputParameterList/Exceptions/InputParameterList.cpp /
Utilities/Singleton/Exceptions/Singleton.cpp /
Utilities/Environment/EnvironmentVariable.cpp /
Utilities/String/EmptyString.cpp /
Utilities/String/String.cpp /
Utilities/Containers/BoolArray.cpp)
\ No newline at end of file
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