#------------------------------------------------------------------- # This file is part of the CMake build system for Scol # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. #------------------------------------------------------------------- ############################################################ # OpenCV plugin CMakeList ############################################################ PROJECT(bitmaptoolkit) #set (CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE) find_package(Freetype) find_package(Harfbuzz) #find_package(ORB_SLAM2) find_package(Eigen3) find_package(DSO) #find_package(SD_SLAM) #find_package(VINSMobile) if (ANDROID) find_package(LibUVC) if (libuvc_FOUND) message (STATUS "Use LibUVC for usb cameras !") set (BITMAP_TOOLKIT_LIBUVC True) else() set (BITMAP_TOOLKIT_LIBUVC False) message (FATAL_ERROR "LibUVC not found !") endif() endif(ANDROID) if(NOT FREETYPE_FOUND) message(STATUS "freetype2: NO") else() message(STATUS "freetype2: YES") endif() if(NOT HARFBUZZ_FOUND) message(STATUS "harfbuzz: NO") else() message(STATUS "harfbuzz: YES") endif() if(FREETYPE_FOUND AND HARFBUZZ_FOUND) set (BITMAP_TOOLKIT_FREETYPE True) endif() # define header and source files for the library set (BITMAP_TOOLKIT_HEADER_FILES include/sService.h include/ArCameraParam.h include/ArDetector.h include/ArFeaturedMarker.h include/ArFeaturedDetector.h include/ArBlobDetector.h include/ArFaceMarker.h include/ArFaceDetector.h include/ArTkDetector.h include/ArTkMarker.h include/ArManager.h include/ArMarker.h include/ICameraInput.h include/CameraInputOpenCV.h include/Smoothers.h include/Prerequisites.h include/ScolConvert.h include/BitmapToolkitThread.h include/BitmapToolkitText.h include/NeuralNetwork.h include/MediaPlayer.h # include/emotime/AdaBoostClassifier.h # include/emotime/BoostEmoDetector.h # include/emotime/Classifier.h # include/emotime/EmoDetector.h # include/emotime/FacePreProcessor.h # include/emotime/GaborBank.h # include/emotime/GaborKernel.h # include/emotime/matrix_io.h # include/emotime/string_utils.h # include/emotime/SVMClassifier.h # include/emotime/SVMEmoDetector.h # include/emotime/TrainingParameters.h ) if (NOT Scol_STATIC) set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/tinyxml2.h) else() set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/loadScolBitmapToolkit.h) endif() #if (RPI) # file (GLOB RPI_TOOLKIT_HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/raspicam/*.h) # set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} ${RPI_TOOLKIT_HEADER_FILES}) #endif() if(TARGET ORB_SLAM2::ORB_SLAM2) set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/sSlam_orb.h) elseif(TARGET ucoslam::ucoslam) set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/sSlam_ucoslam.h) elseif(TARGET DSO::DSO) set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/sSlam.h) elseif(TARGET SD_SLAM::SD_SLAM) set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/sSlam_sd.h) elseif(TARGET VINSMobile::VINSMobile) set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/sSlam_vins.h) endif() if (BITMAP_TOOLKIT_FREETYPE) set (BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} include/freetypeFont.h) endif (BITMAP_TOOLKIT_FREETYPE) set (BITMAP_TOOLKIT_SOURCE_FILES src/sService.cpp src/ArCameraParam.cpp src/ArDetector.cpp src/ArFeaturedMarker.cpp src/ArFeaturedDetector.cpp src/ArBlobDetector.cpp src/ArFaceMarker.cpp src/ArFaceDetector.cpp src/ArTkDetector.cpp src/ArTkMarker.cpp src/ArManager.cpp src/ArMarker.cpp src/Smoothers.cpp src/MathToolkit.cpp src/ArToolkit.cpp src/BitmapToolkit.cpp src/ICameraInput.cpp src/CameraInputOpenCV.cpp src/CaptureToolkit.cpp src/PluginBT.cpp src/ScolConvert.cpp src/BitmapToolkitThread.cpp src/BitmapToolkitText.cpp src/MlToolkit.cpp src/NeuralNetwork.cpp src/MediaPlayer.cpp src/MediaPlayerToolkit.cpp # src/emotime/AdaBoostClassifier.cpp # src/emotime/BoostEmoDetector.cpp # src/emotime/Classifier.cpp # src/emotime/EmoDetector.cpp # src/emotime/FacePreProcessor.cpp # src/emotime/GaborBank.cpp # src/emotime/matrix_io.cpp # src/emotime/string_utils.cpp # src/emotime/SVMClassifier.cpp # src/emotime/SVMEmoDetector.cpp ) if (NOT Scol_STATIC) set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} src/tinyxml2.cpp) endif() #if (RPI) # file (GLOB RPI_TOOLKIT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/raspicam/*.cpp) # set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} ${RPI_TOOLKIT_SRC_FILES}) #endif() if(TARGET ORB_SLAM2::ORB_SLAM2) set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} src/sSlam_orb.cpp) elseif(TARGET ucoslam::ucoslam) set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} src/sSlam_ucoslam.cpp) elseif(TARGET DSO::DSO) set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} src/sSlam.cpp) elseif(TARGET SD_SLAM::SD_SLAM) set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} src/sSlam_sd.cpp) elseif(TARGET VINSMobile::VINSMobile) set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} src/sSlam_vins.cpp) endif() if (BITMAP_TOOLKIT_FREETYPE) set (BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} src/freetypeFont.cpp) endif (BITMAP_TOOLKIT_FREETYPE) if (APPLE_IOS) set(BITMAP_TOOLKIT_HEADER_FILES include/CameraPermissionIOS.h ${BITMAP_TOOLKIT_HEADER_FILES}) set(BITMAP_TOOLKIT_SOURCE_FILES src/CameraPermissionIOS.mm ${BITMAP_TOOLKIT_SOURCE_FILES}) set(BITMAP_TOOLKIT_HEADER_FILES include/CameraTorchIOS.h ${BITMAP_TOOLKIT_HEADER_FILES}) set(BITMAP_TOOLKIT_SOURCE_FILES src/CameraTorchIOS.mm ${BITMAP_TOOLKIT_SOURCE_FILES}) endif() if(WIN32) option(SCOL_CAMERA_OPENCV "Use OpenCV native wrapper for camera handling" TRUE) if (NOT SCOL_CAMERA_OPENCV) set(BITMAP_TOOLKIT_HEADER_FILES_WINDOWS include/CameraInputWindows.h) set(BITMAP_TOOLKIT_SOURCE_FILES_WINDOWS src/CameraInputWindows.cpp) endif() elseif(ANDROID) if(ANDROID_OLD) set(BITMAP_TOOLKIT_HEADER_FILES_ANDROID include/CameraInputAndroid-old.h) set(BITMAP_TOOLKIT_SOURCE_FILES_ANDROID src/CameraInputAndroid-old.cpp) else() set(BITMAP_TOOLKIT_HEADER_FILES_ANDROID include/CameraInputAndroid.h) set(BITMAP_TOOLKIT_SOURCE_FILES_ANDROID src/CameraInputAndroid.cpp) endif() else() set(SCOL_CAMERA_OPENCV ON CACHE BOOL "" FORCE) endif() scol_include_plugin("BITMAP_TOOLKIT" "${PROJECT_SOURCE_DIR}/include" "loadScolBitmapToolkit.h") # Add directories includes set(BITMAP_TOOLKIT_INCLUDES_DIR include ${Aruco_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${FFMPEG_INCLUDE_DIRS} ${ARToolKit_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR}) if(WIN32) set(BITMAP_TOOLKIT_INCLUDES_DIR ${BITMAP_TOOLKIT_INCLUDES_DIR} ${VIDEOINPUT_INCLUDE_DIRS}) endif() #if(RPI) # find_host_package(MMAL) # # if(NOT MMAL_FOUND) # MESSAGE(FATAL_ERROR "Could not find mmal libraries") # endif() # # set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DUSE_RASPICAM) # set(BITMAP_TOOLKIT_INCLUDES_DIR ${BITMAP_TOOLKIT_INCLUDES_DIR} ${MMAL_INCLUDE_DIRS}) #endif() if (BITMAP_TOOLKIT_FREETYPE) set(BITMAP_TOOLKIT_INCLUDES_DIR ${BITMAP_TOOLKIT_INCLUDES_DIR} ${FREETYPE_INCLUDE_DIRS} ${HARFBUZZ_INCLUDE_DIRS}) endif (BITMAP_TOOLKIT_FREETYPE) # Add definition for P4 optimizations, warnings removal. set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DCAPTURE_EXPORTS -DREMOVE_VIDEO_SRC -DHAVE_NFT) if(NOT WIN32) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -D__STDC_CONSTANT_MACROS) endif() # Add windows version if(WIN32) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0601) endif(WIN32) if(TARGET ORB_SLAM2::ORB_SLAM2) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DHAVE_BTSLAM) elseif(TARGET ucoslam::ucoslam) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DHAVE_BTSLAM) elseif(TARGET DSO::DSO) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DHAVE_BTSLAM) elseif(TARGET SD_SLAM::SD_SLAM) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DHAVE_BTSLAM) elseif(TARGET VINSMobile::VINSMobile) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DHAVE_BTSLAM) endif() set(BTLIBRARIES ${BTLIBRARIES} ${Aruco_LIBRARIES} ${OpenCV_LIBS} ${FFMPEG_LIBRARIES} ${ARToolKit_LIBRARIES}) if(WIN32) set(BTLIBRARIES ${BTLIBRARIES} Bcrypt.lib) endif(WIN32) if(LINUX AND NOT ANDROID) set(BTLIBRARIES ${BTLIBRARIES} -llzma) endif() #if(RPI) # set(BTLIBRARIES ${BTLIBRARIES} ${MMAL_LIBRARIES}) #endif() if (SCOL_CAMERA_OPENCV) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DSCOL_CAMERA_OPENCV) else() if (WIN32) set(BTLIBRARIES ${BTLIBRARIES} ${VIDEOINPUT_LIBRARIES}) endif() endif() #if (NOT APPLE_IOS) set(BTLIBRARIES ${BTLIBRARIES} ${OPENSSL_LIBRARIES}) #endif() if (APPLE_IOS OR OSX) set(BTLIBRARIES ${BTLIBRARIES} ${SECURITY_FWK}) endif() if (BITMAP_TOOLKIT_FREETYPE) set(BTLIBRARIES ${BTLIBRARIES} ${HARFBUZZ_LIBRARIES} ${FREETYPE_LIBRARIES}) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DBT_USE_FREETYPE) endif (BITMAP_TOOLKIT_FREETYPE) if (BITMAP_TOOLKIT_LIBUVC) set(BTLIBRARIES ${BTLIBRARIES} ${HARFBUZZ_LIBRARIES} ${FREETYPE_LIBRARIES} LibUVC::UVCStatic) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DBT_USE_LIBUVC) endif (BITMAP_TOOLKIT_LIBUVC) #link_directories("${Scol_DEPENDENCIES_DIR}/lib") if(TARGET ORB_SLAM2::ORB_SLAM2) set (BTLIBRARIES ${BTLIBRARIES} ORB_SLAM2::ORB_SLAM2) elseif(TARGET ucoslam::ucoslam) set (BTLIBRARIES ${BTLIBRARIES} ucoslam::ucoslam) elseif(TARGET DSO::DSO) set (BTLIBRARIES ${BTLIBRARIES} DSO::DSO) elseif(TARGET SD_SLAM::SD_SLAM) set (BTLIBRARIES ${BTLIBRARIES} SD_SLAM::SD_SLAM) elseif(TARGET VINSMobile::VINSMobile) set (BTLIBRARIES ${BTLIBRARIES} VINSMobile::VINSMobile) endif() # setup Scol bitmaptoolkit plugin target if (ANDROID) set(BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} ${BITMAP_TOOLKIT_HEADER_FILES_ANDROID}) set(BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} ${BITMAP_TOOLKIT_SOURCE_FILES_ANDROID}) else() set(BITMAP_TOOLKIT_HEADER_FILES ${BITMAP_TOOLKIT_HEADER_FILES} ${BITMAP_TOOLKIT_HEADER_FILES_WINDOWS}) set(BITMAP_TOOLKIT_SOURCE_FILES ${BITMAP_TOOLKIT_SOURCE_FILES} ${BITMAP_TOOLKIT_SOURCE_FILES_WINDOWS}) endif() add_library(bitmaptoolkit ${Scol_LIB_TYPE} ${BITMAP_TOOLKIT_HEADER_FILES} ${BITMAP_TOOLKIT_SOURCE_FILES} ) add_dependencies(bitmaptoolkit kernel) target_include_directories(bitmaptoolkit PUBLIC $ ) find_package(OpenMP QUIET) if(OPENMP_FOUND) #Hack for NDK 21 if (ANDROID) SET(OpenMP_C_FLAGS "-fopenmp -static-openmp" CACHE STRING "" FORCE) SET(OpenMP_CXX_FLAGS "-fopenmp -static-openmp" CACHE STRING "" FORCE) set_target_properties(bitmaptoolkit PROPERTIES COMPILE_OPTIONS -fopenmp) SET(BTLIBRARIES ${BTLIBRARIES} "-fopenmp -static-openmp") else (ANDROID) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") if (OpenMP_CXX_LIB_NAMES) set(BTLIBRARIES ${BTLIBRARIES} ${OpenMP_CXX_LIB_NAMES}) else(OpenMP_CXX_LIB_NAMES) if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") set(BTLIBRARIES ${BTLIBRARIES} omp) elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") set(BTLIBRARIES ${BTLIBRARIES} gomp) endif() endif() endif(ANDROID) set(BTCOMPILE_FLAGS ${BTCOMPILE_FLAGS} -DUSE_OMP) endif() if (APPLE_IOS) set(BTLIBRARIES ${BTLIBRARIES} ${VIDEOTOOLBOX_FWK}) if (NOT Qt5Widgets_FOUND) #find_host_package(Qt5 COMPONENTS Widgets REQUIRED) set(QtModule "Widgets") find_host_package(Qt5 REQUIRED) endif() set(BTLIBRARIES ${BTLIBRARIES} Qt5::Widgets ${Qt5Widgets_STATIC_DEPS}) set_target_properties(bitmaptoolkit PROPERTIES AUTOMOC ON) endif() if (ANDROID) set(BTLIBRARIES ${BTLIBRARIES} ndk_helper log android cpufeatures native_app_glue) set(Scol_ANDROID_SHARED_LIBS ${Scol_ANDROID_SHARED_LIBS} CACHE INTERNAL "" FORCE) set(Scol_ANDROID_DEPENDENCIES ${Scol_ANDROID_DEPENDENCIES} bitmaptoolkit CACHE INTERNAL "" FORCE) message(STATUS "[${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}] Scol_ANDROID_DEPENDENCIES: ${Scol_ANDROID_DEPENDENCIES} -- added bitmaptoolkit to android project deps") endif() # set preprocessors for this project only target_compile_options(bitmaptoolkit PUBLIC ${BTCOMPILE_FLAGS}) target_link_libraries(bitmaptoolkit ${Boost_LIBRARIES} ${BTLIBRARIES}) # install Scol bitmaptoolkit scol_config_plugin(bitmaptoolkit) #install(FILES ${BITMAP_TOOLKIT_HEADER_FILES} DESTINATION include/SCOL/plugins/bitmaptoolkit)