Skip to content

Data Plugin Dependent

Baldur van Lew edited this page Jul 17, 2024 · 1 revision

Consuming a Data Plugin artifact

This description is based on the CellMorphologyViewer example Adjust the names CMD , CellMorphologyData etc. to suit your naming

  1. Add a requires statement to the conan file to pull in the Data Plugin e.g.

requires = ("CellMorphologyData/1.0@lkeb/stable")

  1. If needs be add other requirements to this tuple

3a. Pass the requirement install dir to CMake using the toolchain in the generate function e.g.

        MV_CMD_PATH = pathlib.Path(self.deps_cpp_info["CellMorphologyData"].rootpath).as_posix()
         tc.variables["MV_CMD_INSTALL_DIR"] = MV_CMD_PATH

3b. Always pass posix style paths for CMake

  1. In the CMake itself use this variable to locate the incoming include and library paths
    target_include_directories(${PROJECT_NAME} PRIVATE "${MV_CMD_INSTALL_DIR}/$<CONFIGURATION>/include/")
    set(CMDPLUGIN_LINK_PATH "${MV_CMD_INSTALL_DIR}/$<CONFIGURATION>/$<IF:$<CXX_COMPILER_ID:MSVC>,lib,Plugins>")
    set(CELL_MORPHOLOGY_DATA_LINK_LIBRARY "${CMDPLUGIN_LINK_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CellMorphologyData${MV_LINK_SUFFIX}")
    target_link_libraries(${PROJECT_NAME} PRIVATE "${CELL_MORPHOLOGY_DATA_LINK_LIBRARY}")