set(fw_name "capi-media-vision") project(${fw_name}) cmake_minimum_required(VERSION 2.6...3.13) option(BUILD_ML_ONLY "Build mv_machine_learning only" OFF) option(BUILD_VISUALIZER "Build visualizer for testing 2D/3D output" OFF) option(BUILD_CAMERA_PACKET "Build camera packet output test" OFF) if(BUILD_VISUALIZER) add_compile_definitions(BUILD_VISUALIZER) endif() if(MV_3D_POINTCLOUD_IS_AVAILABLE) add_compile_definitions(MV_3D_POINTCLOUD_IS_AVAILABLE) endif() set(MV_COMMON_LIB_NAME "mv_common") set(MV_BARCODE_DETECTOR_LIB_NAME "mv_barcode_detector" CACHE STRING "Name of the library will be built for barcode detecting module (without extension).") set(MV_BARCODE_GENERATOR_LIB_NAME "mv_barcode_generator" CACHE STRING "Name of the library will be built for barcode generating module (without extension).") set(MV_IMAGE_LIB_NAME "mv_image" CACHE STRING "Name of the library will be built for image module (without extension).") set(MV_FACE_LIB_NAME "mv_face" CACHE STRING "Name of the library will be built for barcode generating module (without extension).") set(MV_SURVEILLANCE_LIB_NAME "mv_surveillance" CACHE STRING "Name of the library will be built for surveillance module (without extension).") set(MV_INFERENCE_LIB_NAME "mv_inference" CACHE STRING "Name of the library will be built for inference module (without extension).") set(MV_TRAINING_LIB_NAME "mv_training" CACHE STRING "Name of the library will be built for training module (without extension).") set(MV_FACE_RECOG_LIB_NAME "mv_face_recognition" CACHE STRING "Name of the library will be built for face recognition module (without extension).") set(MV_3D_LIB_NAME "mv_3d" CACHE STRING "Name of the library will be built for 3d module (without extension).") set(MV_ROI_TRACKER_LIB_NAME "mv_roi_tracker" CACHE STRING "Name of the library will be built for tracker module (without extension).") set(MV_OBJECT_DETECTION_LIB_NAME "mv_object_detection" CACHE STRING "Name of the library will be built for object detection module (without extension).") set(MV_OBJECT_DETECTION_3D_LIB_NAME "mv_object_detection_3d" CACHE STRING "Name of the library will be built for object detection 3d module (without extension).") set(MV_IMAGE_CLASSIFICATION_LIB_NAME "mv_image_classification" CACHE STRING "Name of the library will be built for image classification module (without extension).") include(FindPkgConfig) include(GNUInstallDirs) add_subdirectory(mv_common) add_subdirectory(mv_machine_learning) if(NOT BUILD_ML_ONLY) add_subdirectory(mv_barcode) add_subdirectory(mv_image) add_subdirectory(mv_face) add_subdirectory(mv_surveillance) add_subdirectory(mv_3d) add_subdirectory(mv_roi_tracker) add_subdirectory(test) endif() set(TOTAL_REQUIRED "") set(TOTAL_LDFLAGS "") set(pc_dependents "capi-media-tool") set(PC_NAME ${fw_name}-common) set(PC_REQUIRED ${pc_dependents}) set(PC_LDFLAGS "-l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-common.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-common.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) # now all sub package dependent common set(PC_REQUIRED ${fw_name}-common) if(NOT BUILD_ML_ONLY) set(PC_NAME ${fw_name}-barcode) set(PC_LDFLAGS "-l${MV_BARCODE_DETECTOR_LIB_NAME} -l${MV_BARCODE_GENERATOR_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-barcode.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-barcode.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) set(PC_NAME ${fw_name}-face) set(PC_LDFLAGS "-l${MV_FACE_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-face.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-face.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) set(PC_NAME ${fw_name}-image) set(PC_LDFLAGS "-l${MV_IMAGE_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-image.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-image.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) set(PC_NAME ${fw_name}-surveillance) set(PC_LDFLAGS "-l${MV_SURVEILLANCE_LIB_NAME} -l${MV_FACE_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-surveillance.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-surveillance.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) set(PC_NAME ${fw_name}-3d) set(PC_LDFLAGS "-l${MV_3D_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-3d.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-3d.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) endif() set(PC_NAME ${fw_name}-inference) set(PC_LDFLAGS "-l${MV_INFERENCE_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-inference.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-inference.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) set(PC_NAME ${fw_name}-tracker) set(PC_LDFLAGS "-l${MV_ROI_TRACKER_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-tracker.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-tracker.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) if (${ENABLE_ML_FACE_RECOGNITION}) set(PC_NAME ${fw_name}-training) set(PC_LDFLAGS "-l${MV_TRAINING_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-training.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-training.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) set(PC_NAME ${fw_name}-face-recognition) set(PC_LDFLAGS "-l${MV_FACE_RECOG_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-face-recognition.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-face-recognition.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mv_machine_learning/face_recognition/meta/face_recognition.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${fw_name}) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) endif() if (${ENABLE_ML_IMAGE_CLASSIFICATION}) set(PC_NAME ${fw_name}-image-classification) set(PC_LDFLAGS "-l${MV_IMAGE_CLASSIFICATION_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-image-classification.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-image-classification.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mv_machine_learning/image_classification/meta/image_classification.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${fw_name}) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) endif() if (${ENABLE_ML_OBJECT_DETECTION}) set(PC_NAME ${fw_name}-object-detection) set(PC_LDFLAGS "-l${MV_OBJECT_DETECTION_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-object-detection.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-object-detection.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mv_machine_learning/object_detection/meta/object_detection.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${fw_name}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mv_machine_learning/object_detection/meta/face_detection.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${fw_name}) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) endif() if (${ENABLE_ML_OBJECT_DETECTION_3D}) set(PC_NAME ${fw_name}-object-detection-3d) set(PC_LDFLAGS "-l${MV_OBJECT_DETECTION_3D_LIB_NAME} -l${MV_COMMON_LIB_NAME}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-object-detection-3d.pc @ONLY ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-object-detection-3d.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mv_machine_learning/object_detection_3d/meta/object_detection_3d.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${fw_name}) list(APPEND TOTAL_REQUIRED ${PC_NAME}) list(APPEND TOTAL_LDFLAGS ${PC_LDFLAGS}) endif() string(REPLACE ";" " " TOTAL_LDFLAGS "${TOTAL_LDFLAGS}") string(REPLACE " " ";" TOTAL_LDFLAGS_LIST "${TOTAL_LDFLAGS}") list(REMOVE_DUPLICATES TOTAL_LDFLAGS_LIST) string(REPLACE ";" " " TOTAL_LDFLAGS "${TOTAL_LDFLAGS_LIST}") string(REPLACE ";" " " TOTAL_REQUIRED "${TOTAL_REQUIRED}") string(REPLACE " " ";" TOTAL_REQUIRED_LIST "${TOTAL_REQUIRED}") list(REMOVE_DUPLICATES TOTAL_REQUIRED_LIST) string(REPLACE ";" " " TOTAL_REQUIRED "${TOTAL_REQUIRED_LIST}") set(PC_NAME ${fw_name}) set(PC_REQUIRED "${TOTAL_REQUIRED}") set(PC_LDFLAGS "${TOTAL_LDFLAGS}") configure_file( ${fw_name}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc @ONLY ) if(NOT BUILD_ML_ONLY) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) endif() install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/media-vision-config.json DESTINATION ${CMAKE_INSTALL_DATADIR}/${fw_name})