#-----------------------------------------------------------------------------
# OpenFOAM blockMeshDict reader plugin for ParaView GUI (pre-5.7)

# Predefined values from CMakeLists-library.txt
link_directories(${OPENFOAM_LINK_DIRS} ${SUPPORTING_LIBBIN})
include_directories(${OPENFOAM_INCLUDE_DIRS})

# NOTE: do not use CMAKE_INSTALL_LIBDIR here
# OpenFOAM uses lib (not lib64, or lib/multi-arch)


qt5_wrap_cpp(MOC_SRCS plugin/pqFoamBlockMeshControls.h)

add_paraview_property_group_widget(IFACES0 IFACES0_SRCS
    TYPE "openfoam_blockMesh_general_controls"
    CLASS_NAME pqFoamBlockMeshControls
)

add_paraview_plugin(
    ${CMAKE_PROJECT_NAME} "${foam_api}"
    SERVER_MANAGER_XML
        plugin/ParaFoamBlockReader.xml
    SERVER_MANAGER_SOURCES
        plugin/reader/vtkPVblockMeshReader.cxx
    GUI_INTERFACES
        ${IFACES0}
    SOURCES
        ${IFACES0_SRCS}
        ${MOC_SRCS}
        plugin/pqFoamBlockMeshControls.cxx
)

target_link_libraries(
    ${CMAKE_PROJECT_NAME}
    LINK_PUBLIC
    ${OPENFOAM_LIBNAMES}
    ${SUPPORTING_LIBNAMES}
)

# Compile directly into plugin directories
## # Set output library destination to plugin directory
## set(
##     LIBRARY_OUTPUT_DIRECTORY ${SUPPORTING_LIBBIN}
##     CACHE INTERNAL
##     "Single output directory for building all libraries."
## )
##
## set_target_properties(
##     ${CMAKE_PROJECT_NAME}
##     PROPERTIES
##     LIBRARY_OUTPUT_DIRECTORY ${SUPPORTING_LIBBIN}
## )

# Use install target
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION "lib/${PLUGIN_DIRNAME}")

#-----------------------------------------------------------------------------
