amdis_extensions.cmake 4.83 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

if (ENABLE_EXTENSIONS)
    option(ENABLE_BASE_PROBLEMS "Use base_problems" true)

    find_path(EXTENSIONS_DIR NAMES Helpers.h
        HINTS ${BASE_DIR}/../extensions
        DOC "Path to AMDiS extensions.")
    if (EXTENSIONS_DIR)
        if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/ExtendedProblemStat.h)
            message(FATAL_ERROR "Wrong extensions directory! Directory must contain the files 'Helpers.h' and 'ExtendedProblemStath'")
        endif ()
        
        add_library(amdis_extensions
            ${EXTENSIONS_DIR}/Helpers.cc
            ${EXTENSIONS_DIR}/BackgroundMesh.cc
            ${EXTENSIONS_DIR}/GeometryTools.cc
            ${EXTENSIONS_DIR}/POperators.cc
            ${EXTENSIONS_DIR}/SingularDirichletBC2.cc
            ${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
            ${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp
        )
        add_library(AMDiS::extensions ALIAS amdis_extensions)
        
        target_compile_definitions(amdis_extensions PRIVATE HAVE_EXTENSIONS=1)
        target_include_directories(amdis_extensions PRIVATE
            ${EXTENSIONS_DIR}
            ${EXTENSIONS_DIR}/time
            ${EXTENSIONS_DIR}/nanoflann
            ${EXTENSIONS_DIR}/pugixml/src
        )
        
        set(INSTALL_SUBDIRS . time preconditioner nanflann)

        if (ENABLE_SEQ_PETSC)
            target_sources(amdis_extensions PRIVATE
                ${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
                ${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
                ${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
        endif (ENABLE_SEQ_PETSC)

        if (ENABLE_PARALLEL_DOMAIN)
            target_sources(amdis_extensions PRIVATE
                ${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
                ${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
            target_link_libraries(amdis_extensions amdis_parallel)
        endif (ENABLE_PARALLEL_DOMAIN)
        
      if (ENABLE_BASE_PROBLEMS)
            target_sources(amdis_extensions PRIVATE
                ${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
                ${EXTENSIONS_DIR}/base_problems/CahnHilliard_RB.cc
                ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes.cc
                ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_RB.cc
                ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase.cc
                ${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc
                ${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
                ${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
                ${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
                ${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc
                ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
                ${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
                ${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
                ${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
                ${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
                ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
                ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
                ${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc
                ${EXTENSIONS_DIR}/base_problems/PolarizationField.cc
                ${EXTENSIONS_DIR}/base_problems/QuasiCrystal.cc
                ${EXTENSIONS_DIR}/base_problems/QuasiCrystal_RB.cc)
                # 		  ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
                # 		  ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
                # 		  ${EXTENSIONS_DIR}/base_problems/VacancyPhaseFieldCrystal.cc
            
            target_compile_definitions(amdis_extensions PRIVATE HAVE_BASE_PROBLEMS=1)
            target_include_directories(amdis_extensions PRIVATE ${EXTENSIONS_DIR}/base_problems)
            
            list(APPEND INSTALL_SUBDIRS base_problems)
        endif (ENABLE_BASE_PROBLEMS)
        
        target_link_libraries(amdis_extensions amdis amdis_reinit)

        # specify how to install this target:
        # -----------------------------------

        foreach (SUBDIR ${INSTALL_SUBDIRS})
            file(GLOB HEADERS "${EXTENSIONS_DIR}/${SUBDIR}/*.h*")
            install(FILES ${HEADERS} DESTINATION include/amdis/extensions/${SUBDIR}/)
        endforeach ()

        file(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
        install(FILES ${HEADERS} DESTINATION include/amdis/extensions/pugixml/)

        install(TARGETS amdis_extensions DESTINATION lib/amdis/)

    endif (EXTENSIONS_DIR)
endif (ENABLE_EXTENSIONS)