CMakeLists.txt 4.36 KB
Newer Older
Burlen Loring's avatar
Burlen Loring committed
1
2
if (ENABLE_SENSEI)
  message(STATUS "Enabled: sensei library")
3

Burlen Loring's avatar
Burlen Loring committed
4
5
  # senseiCore
  # everything but the Python and configurable analysis adaptors.
6
7
8
9
  set(senseiCore_sources AnalysisAdaptor.cxx Autocorrelation.cxx
    DataAdaptor.cxx DataRequirements.cxx Error.cxx Histogram.cxx
    ProgrammableDataAdaptor.cxx VTKHistogram.cxx VTKDataAdaptor.cxx
    VTKUtils.cxx)
10

Burlen Loring's avatar
Burlen Loring committed
11
  set(senseiCore_libs mpi pugixml vtk thread ArrayIO timer diy grid)
12

13
  if (ENABLE_CONDUIT)
14
15
16
17
    list(APPEND senseiCore_sources ConduitDataAdaptor.cxx)
    list(APPEND senseiCore_libs sconduit)
  endif()

18
19
  if (ENABLE_CATALYST)
    list(APPEND senseiCore_sources CatalystAnalysisAdaptor.cxx
20
      CatalystParticle.cxx CatalystSlice.cxx CatalystUtilities.cxx)
21
22
23
  endif()

  if (ENABLE_VTKM)
24
    list(APPEND senseiCore_sources VTKmVolumeReductionAnalysis.cxx
25
      VTKmCDFAnalysis.cxx CDFReducer.cxx CinemaHelper.cxx)
26
    list(APPEND senseiCore_libs vtkm_cont)
27
28
  endif()

Burlen Loring's avatar
Burlen Loring committed
29
  if(ENABLE_ADIOS)
30
31
    list(APPEND senseiCore_sources ADIOSSchema.cxx ADIOSAnalysisAdaptor.cxx
      ADIOSDataAdaptor.cxx)
Burlen Loring's avatar
Burlen Loring committed
32
    list(APPEND senseiCore_libs adios)
33
  endif()
Burlen Loring's avatar
Burlen Loring committed
34

35
  if(ENABLE_VTK_ACCELERATORS)
36
    list(APPEND senseiCore_sources VTKmContourAnalysis.cxx)
37
38
  endif()

Burlen Loring's avatar
Burlen Loring committed
39
  if(ENABLE_LIBSIM)
40
41
    list(APPEND senseiCore_sources LibsimAnalysisAdaptor.cxx
      LibsimImageProperties.cxx)
Burlen Loring's avatar
Burlen Loring committed
42
    list(APPEND senseiCore_libs libsim)
Burlen Loring's avatar
Burlen Loring committed
43
  endif()
Burlen Loring's avatar
Burlen Loring committed
44

45
  if(ENABLE_VTK_IO)
Burlen Loring's avatar
Burlen Loring committed
46
    list(APPEND senseiCore_sources VTKPosthocIO.cxx)
47
    if (ENABLE_VTK_MPI)
Burlen Loring's avatar
Burlen Loring committed
48
      list(APPEND senseiCore_sources VTKAmrWriter.cxx)
49
    endif()
50
51
  endif()

Burlen Loring's avatar
Burlen Loring committed
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
  add_library(senseiCore ${senseiCore_sources})

  target_include_directories(senseiCore PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    $<INSTALL_INTERFACE:include>)

  target_link_libraries(senseiCore PUBLIC ${senseiCore_libs})

  install(TARGETS senseiCore EXPORT senseiCore
    INCLUDES DESTINATION include ARCHIVE DESTINATION lib
    LIBRARY DESTINATION lib)

  install(EXPORT senseiCore DESTINATION lib/cmake
    EXPORT_LINK_INTERFACE_LIBRARIES)

  set(sensei_sources ConfigurableAnalysis.cxx)
  set(sensei_libs senseiCore)

  # PythonAnalysis
  # an analysis adaptor with a minimal set of Python bindings to enable an
  # embedded interpreter to execute run time provided Python code implementing
  # AnalysisAdaptor::Execute
  if (ENABLE_PYTHON)
    depend_swig(PythonAnalysis.i PythonAnalysis.dep)

    wrap_swig(PythonAnalysis.i _PythonAnalysis.cxx
      PythonAnalysis.dep _PythonAnalysis)

    include_directories(SYSTEM ${PYTHON_INCLUDE_PATH} ${NUMPY_INCLUDE_DIR})
    include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}
      ${CMAKE_CURRENT_BINARY_DIR})

    add_library(_PythonAnalysis SHARED
      ${CMAKE_CURRENT_BINARY_DIR}/_PythonAnalysis.cxx)

    set_target_properties(_PythonAnalysis PROPERTIES PREFIX "")
    target_link_libraries(_PythonAnalysis PUBLIC senseiCore python)

    add_custom_command(TARGET _PythonAnalysis POST_BUILD
      COMMAND ${CMAKE_COMMAND} -E copy
        ${CMAKE_CURRENT_BINARY_DIR}/PythonAnalysis.py
        ${CMAKE_CURRENT_BINARY_DIR}/../lib)

    install(TARGETS _PythonAnalysis EXPORT _PythonAnalysis
      LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)

    install(EXPORT _PythonAnalysis DESTINATION lib/cmake
      EXPORT_LINK_INTERFACE_LIBRARIES)

101
102
103
104
    install(
      FILES ${CMAKE_CURRENT_BINARY_DIR}/PythonAnalysis.py
      DESTINATION lib
    )
Burlen Loring's avatar
Burlen Loring committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

    set(python_analyses Histogram.py)
    foreach(python_analysis ${python_analyses})
      configure_file(${python_analysis}
        ${CMAKE_CURRENT_BINARY_DIR}/../lib/${python_analysis} COPYONLY)
    endforeach()

    install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
      DESTINATION lib FILES_MATCHING PATTERN "*.py")

    list(APPEND sensei_libs _PythonAnalysis)
  endif()

  # sensei
  # world facing library that users will link to
  # contains senseiCore classes, PythonAnalysis, and ConfigurableAnalysis
Burlen Loring's avatar
Burlen Loring committed
121
  add_library(sensei ${sensei_sources})
122

Burlen Loring's avatar
Burlen Loring committed
123
124
125
  target_include_directories(sensei PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    $<INSTALL_INTERFACE:include>)
126

Burlen Loring's avatar
Burlen Loring committed
127
  target_link_libraries(sensei PUBLIC ${sensei_libs})
128

129
130
  install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
    DESTINATION include FILES_MATCHING PATTERN "*.h")
Burlen Loring's avatar
Burlen Loring committed
131

Burlen Loring's avatar
Burlen Loring committed
132
133
134
  install(TARGETS sensei EXPORT sensei
    INCLUDES DESTINATION include ARCHIVE DESTINATION lib
    LIBRARY DESTINATION lib)
Burlen Loring's avatar
Burlen Loring committed
135

Burlen Loring's avatar
Burlen Loring committed
136
137
  install(EXPORT sensei DESTINATION lib/cmake
    EXPORT_LINK_INTERFACE_LIBRARIES)
138

139
  add_subdirectory(testing)
Burlen Loring's avatar
Burlen Loring committed
140
endif()