CMakeLists.txt 4.36 KB
Newer Older
1
if (BUILD_MOREFEM_UNIQUE_LIBRARY)
2
    add_library(MoReFEM ${LIBRARY_TYPE} "")
3 4
endif()

5 6 7 8 9 10 11 12 13 14
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)
15 16

if (BUILD_MOREFEM_UNIQUE_LIBRARY)
17
    target_link_libraries(MoReFEM ${MOREFEM_COMMON_DEP})
18
else()
19
    
20 21 22 23 24 25 26 27 28 29
    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)
30 31 32
endif()


33 34
include(Utilities/SourceList.cmake)
include(ThirdParty/SourceList.cmake)
35 36 37 38 39 40 41 42 43 44 45 46
include(ThirdParty/Source/CMakeLists.txt)

include(Core/SourceList.cmake)

include(Geometry/SourceList.cmake)

include(FiniteElement/SourceList.cmake)

include(Parameters/SourceList.cmake)

include(Operators/SourceList.cmake)

47 48
include(ParameterInstances/SourceList.cmake)

49 50 51 52 53 54
include(OperatorInstances/SourceList.cmake)

include(FormulationSolver/SourceList.cmake)

include(Model/SourceList.cmake)

55 56

if (BUILD_MOREFEM_UNIQUE_LIBRARY)
57
    morefem_install(MoReFEM)
58
else()
59
    morefem_install(MoReFEM_utilities MoReFEM_core MoReFEM_geometry MoReFEM_felt MoReFEM_param MoReFEM_op MoReFEM_param_instances MoReFEM_op_instances MoReFEM_formulation_solver MoReFEM_model)
60 61 62 63
endif()



64
include(PostProcessing/CMakeLists.txt)
65

66
include(ModelInstances/CMakeLists.txt)
67 68
include(Test/CMakeLists.txt)

69 70 71
# Tclap
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_INCL}
        FILES_MATCHING PATTERN "*.h")
72 73 74 75 76 77

install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_INCL}
        FILES_MATCHING PATTERN "*.hpp")

install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_INCL}
        FILES_MATCHING PATTERN "*.hxx")
GILLES Sebastien's avatar
GILLES Sebastien committed
78 79 80 81

# Only for Seldon...        
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_INCL}
        FILES_MATCHING PATTERN "*.cxx")
82
        
83

84
#
85
# #### Lifted and adapted from Xtl
86
#
87 88
add_library(morefem_cmake INTERFACE)
target_include_directories(morefem_cmake INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
89
                                                   $<INSTALL_INTERFACE:${PROJECT_NAME}/include>)
GILLES Sebastien's avatar
GILLES Sebastien committed
90 91 92
                                                   
target_link_libraries(morefem_cmake INTERFACE ${MOREFEM_MODEL} )
                                                   
93 94 95 96 97 98
# #
#
#
# # Installation
# # ============
#
99

100
include(CMakePackageConfigHelpers)
101

102
install(TARGETS morefem_cmake ${MOREFEM_MAIN_LIBS} Seldon MoReFEMPostProcessing_lib 
GILLES Sebastien's avatar
GILLES Sebastien committed
103 104
        EXPORT ${PROJECT_NAME}-targets
        LIBRARY DESTINATION ${MOREFEM_INSTALL_DIR_LIB}
105
        ARCHIVE DESTINATION ${MOREFEM_INSTALL_DIR_LIB}
GILLES Sebastien's avatar
GILLES Sebastien committed
106
    )
107 108
#
# # Makes the project importable from the build directory
109 110 111 112 113 114
export(EXPORT ${PROJECT_NAME}-targets
       FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")

configure_package_config_file(../cmake/${PROJECT_NAME}Config.cmake.in
                              "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
                              INSTALL_DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
115

116 117 118
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
        DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
        
GILLES Sebastien's avatar
GILLES Sebastien committed
119 120
install(FILES 
            ${CMAKE_CURRENT_BINARY_DIR}/../../cmake/CustomCommands.cmake
121
            ${CMAKE_CURRENT_BINARY_DIR}/../../cmake/MoReFEMSettings.cmake
122 123 124 125 126
        DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})        
        
install(EXPORT ${PROJECT_NAME}-targets
        FILE ${PROJECT_NAME}Targets.cmake
        DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})