cmake_minimum_required(VERSION 3.3)
project(CatalystDummyCompile)

set(USE_CATALYST_FLAG ON CACHE BOOL "Link the simulator with Catalyst")
if(USE_CATALYST_FLAG)
  find_package(ParaView 4.1 REQUIRED COMPONENTS vtkPVPythonCatalyst)
  include("${PARAVIEW_USE_FILE}")
  set(Adaptor_SRCS
    ../catalyst_adaptor.cpp
    )
  add_library(CatalystAdaptor ${Adaptor_SRCS})
  target_link_libraries(CatalystAdaptor vtkPVPythonCatalyst vtkParallelMPI)
  add_definitions("-DUSE_CATALYST_FLAG -DCATALYST_COMPILE_DUMMY")
  if(NOT PARAVIEW_USE_MPI)
    message(SEND_ERROR "ParaView must be built with MPI enabled")
  endif()
else()
  find_package(MPI REQUIRED)
  include_directories(${MPI_C_INCLUDE_PATH})
endif()

add_executable(CatalystDummy ../catalyst_dummy.cpp)
if(USE_CATALYST_FLAG)
  target_link_libraries(CatalystDummy LINK_PRIVATE CatalystAdaptor)
  include(vtkModuleMacros)
  include(vtkMPI)
  vtk_mpi_link(CatalystDummy)
else()
  target_link_libraries(CatalystDummy LINK_PRIVATE ${MPI_LIBRARIES})
endif()
