Hi everyone,
I'm trying to implement Hunter as my dependencies manager as it is in the depthai-core project, so before I started the configuration with Hunter my project was working fine with the local dependencies, which in my case are Boost and OpenCV.
I'm getting an error when Hunter tries to parse the Hunter configuration of depthai-core
project.
I have depthai-core
lib implemented in my project using git submodule
and my configuration is
file .gitmodules
[submodule "3rdparty/depthai-core"]
path = 3rdparty/depthai-core
url = https://github.com/luxonis/depthai-core.git
tag = v2.26.0
The error I got
cmake] Call Stack (most recent call first):
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_make_directory.cmake:7 (include)
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_save_to_cache.cmake:8 (include)
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_download.cmake:26 (include)
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_add_package.cmake:49 (include)
[cmake] 3rdparty/depthai-core/cmake/depthaiDependencies.cmake:14 (hunter_add_package)
[cmake] 3rdparty/depthai-core/CMakeLists.txt:170 (include)
[cmake]
[cmake]
[cmake]
[cmake] [hunter ** INTERNAL **] Unexpected empty string
[cmake] [hunter ** INTERNAL **] [Directory:/Users/christian/git/github.com/christiangda/FaceDetector/3rdparty/depthai-core/cmake]
[cmake]
[cmake] ------------------------------ ERROR -----------------------------
[cmake] https://hunter.readthedocs.io/en/latest/reference/errors/error.internal.html
[cmake] ------------------------------------------------------------------
[cmake]
[cmake] CMake Error at /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message):
[cmake] Call Stack (most recent call first):
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_error_page)
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_assert_not_empty_string.cmake:9 (hunter_internal_error)
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_get_package_sha1.cmake:26 (hunter_assert_not_empty_string)
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_download.cmake:83 (hunter_get_package_sha1)
[cmake] /Users/christian/.hunter/_Base/Download/Hunter/0.23.322/cb0ea1f/Unpacked/cmake/modules/hunter_add_package.cmake:53 (hunter_download)
[cmake] 3rdparty/depthai-core/cmake/depthaiDependencies.cmake:14 (hunter_add_package)
[cmake] 3rdparty/depthai-core/CMakeLists.txt:170 (include)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
My hunter configuration is:
file cmake/Hunter/config.cmake
hunter_config(
Boost
VERSION ${HUNTER_Boost_VERSION}
)
hunter_config(
OpenCV
VERSION ${HUNTER_OpenCV_VERSION}
CMAKE_ARGS
WITH_FFMPEG=ON
OPENCV_FFMPEG_USE_FIND_PACKAGE=YES
)
file CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
if(CUSTOM_HUNTER_ENABLED)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.322.tar.gz"
SHA1 "cb0ea1f74f4a2c49a807de34885743495fccccbe"
LOCAL # Local config for dependencies
)
endif()
# specify the C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# set(CMAKE_CXX_COMPILE_FEATURES cxx_std_23)
# set(CMAKE_CXX_FLAGS_INIT "-Wall -std=c++23")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
# set(CMAKE_CXX_FLAGS "-pedantic -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wunused-but-set-variable -Wno-unused-function -Wno-unused-private-field")
set(CMAKE_CXX_FLAGS "-Wextra -Wno-unused-parameter -Wno-unused-variable -Wunused-but-set-variable -Wno-unused-function -Wno-unused-private-field")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
# this dependency implement hunter package manager
# and hunter declaration must be before project declaration
# Add depthai-core dependency
add_subdirectory(./3rdparty/depthai-core EXCLUDE_FROM_ALL)
project(FaceDetector
VERSION 0.0.0
DESCRIPTION "FaceDeterctor is a simple application that uses depthai-core to detect faces in a video stream"
LANGUAGES C CXX
)
# add version number to the source code
configure_file(src/Config.h.in Config.h)
include_directories("${PROJECT_BINARY_DIR}")
# target_include_directories("${PROJECT_NAME}" PUBLIC
# "${CMAKE_CURRENT_BINARY_DIR}"
# )
# Add OpenCV (brew install opencv first)
if(CUSTOM_HUNTER_ENABLED)
hunter_add_package(OpenCV)
endif()
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# Add Boost (brew install boost first)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
if(CUSTOM_HUNTER_ENABLED)
hunter_add_package(Boost COMPONENTS program_options log system log_setup filesystem)
endif()
find_package(Boost 1.74.0 CONFIG REQUIRED
COMPONENTS
program_options
log
system
log_setup
filesystem
REQUIRED
)
include_directories(${Boost_INCLUDE_DIRS})
# Add the executable
add_executable("${PROJECT_NAME}"
src/main.cpp
src/FaceDetector.h
src/FaceDetector.cpp
src/FaceAgeGenderDetector.h
src/FaceAgeGenderDetector.cpp
src/MetricSender.h
src/MetricSender.cpp
src/CmdOptions.h
src/CmdOptions.cpp
)
# Link the executable to the depthai-core library
target_link_libraries("${PROJECT_NAME}"
PUBLIC
depthai::opencv
"${OpenCV_LIBS}"
"${Boost_LIBRARIES}"
)