ExternalSimulatorSupport.cmake 4.13 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
# External Simulator supports
# Define all variables and settings for supporting external simulators:
# - Sofa
# - Ansys
# - Artisynth

# +----------------+
# |  SOFA SUPPORT  |
# +----------------+
if (SOFA_SUPPORT)
    # Defines the following variables 
    # - MML_SOFA_HEADERS
    # - MML_SOFA_SRC
    
    # add the sofa widget
    if(MML_GENERATE_GUI)
        set(SOFA_MOC_SRCS SofaWidget.h)
        set(SOFA_UIS SofaWidget.ui)
        qt4_wrap_ui(SOFA_UIS_H ${SOFA_UIS})
        qt4_wrap_cpp(SOFA_MOCS ${SOFA_MOC_SRCS})
        set(SOFA_GUI_SRC SofaWidget.cpp)
    endif()

    # define all the sources needed to support Sofa
    set(MML_SOFA_HEADERS SofaSimulator.h
                         TranslationConstraint.h
                         ${SOFA_UIS_H}
                         ${SOFA_MOC_SRCS}
    )
    set(MML_SOFA_SRC SofaSimulator.cpp
                     TranslationConstraint.cpp
                     TranslationConstraint.inl
                     ${SOFA_MOCS}
                     ${SOFA_MOC_UI}
                     ${SOFA_GUI_SRC}
    )
37
38
39

    # specific flags needed (C++ code)
    add_definitions(-DSOFA_SUPPORT)
40
41
    add_definitions(-DSOFA_BUILD_DIR="${SOFA_BUILD_DIR}")
    add_definitions(-DSOFA_SOURCE_DIR="${SOFA_SOURCE_DIR}")
42
    add_definitions(-DSOFA_STABLE)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
endif()

# +-----------------+
# |  ANSYS SUPPORT  |
# +-----------------+
set(MML_ANSYS_BIN $ENV{MML_ANSYS_BIN} CACHE FILE "Where to find Ansys binary")
set(MML_ANSYS_WORKING_DIR $ENV{MML_ANSYS_WORKING_DIR} CACHE PATH "Specify a folder for ansys working files")
if((EXISTS ${MML_ANSYS_BIN}) AND (EXISTS ${MML_ANSYS_WORKING_DIR}))
    # Compile Ansys simulator files (ON or OFF)
    option(MML_ANSYS_SUPPORT "Compile Ansys simulator?" ON)

    # ansys settings
    if(MML_ANSYS_SUPPORT)
        # compilation flag
        add_definitions(-DANSYS_SUPPORT)
        add_definitions(-DANSYS_BIN="${MML_ANSYS_BIN}" -DANSYS_WORKING_DIR="${MML_ANSYS_WORKING_DIR}")

        if(MML_GENERATE_GUI)
            set(ansys_MOC_SRCS  AnsysWidget.h)
            set(ansys_UIS       AnsysWidget.ui)
            qt4_wrap_ui(ansys_UIS_H ${ansys_UIS})
            qt4_wrap_cpp(ansys_MOC_UI ${ansys_UIS_H})
            qt4_wrap_cpp(ansys_MOCS ${ansys_MOC_SRCS})
            set(ansys_QT_SRC AnsysWidget.cpp)
        endif(MML_GENERATE_GUI)

        set(MML_ANSYS_HEADERS       AnsysBatch.h  
                                    AnsysBatchWriter.h
                                    PrepWriter.h
                                    SoluWriter.h
                                    PostWriter.h
                                    ParametersWriter.h
                                    AnsysSimulator.h
                                    ${ansys_UIS_H}
                                    ${ansys_MOC_SRCS}
        )

        set(MML_ANSYS_SRC           AnsysBatch.cpp
                                    AnsysBatchWriter.cpp
                                    PrepWriter.cpp
                                    SoluWriter.cpp
                                    PostWriter.cpp
                                    ParametersWriter.cpp
                                    AnsysSimulator.cpp
                                    ${ansys_MOCS}
                                    ${ansys_MOC_UI}
                                    ${ansys_QT_SRC}
        )
    endif()
endif()

# +---------------------+
# |  ARTISYNTH SUPPORT  |
# +---------------------+
set(MML_ARTISYNTH_BIN $ENV{MML_ARTISYNTH_BIN} CACHE FILE "Where to find artisynth binary")
set(MML_ARTISYNTH_WORKING_DIR $ENV{MML_ARTISYNTH_WORKING_DIR} CACHE PATH "Specify a folder for artisynth working files")
if((EXISTS ${MML_ARTISYNTH_BIN}) AND (EXISTS ${MML_ARTISYNTH_WORKING_DIR}))
    # Compile ARTISYNTH simulator files (ON or OFF)
    option(MML_ARTISYNTH_SUPPORT "Compile Artisynth simulator?" ON)

    # ARTISYNTH settings
    if(MML_ARTISYNTH_SUPPORT)
        # compilation flag
        add_definitions(-DARTISYNTH_SUPPORT)
        add_definitions(-DARTISYNTH_BIN="${MML_ARTISYNTH_BIN}" -DARTISYNTH_WORKING_DIR="${MML_ARTISYNTH_WORKING_DIR}")
        set(MML_ARTISYNTH_HEADERS   ArtiSynthSimulator.h)
        set(MML_ARTISYNTH_SRC       ArtiSynthSimulator.cpp)
    endif(MML_ARTISYNTH_SUPPORT)
endif()