cmake_minimum_required(VERSION 3.10.2)
project(faceRecognize LANGUAGES CXX)
find_package(OpenCV REQUIRED)
find_package(Threads REQUIRED)
find_package(CUDA REQUIRED)
find_package(OpenMP REQUIRED)
set(faceRecognize VERSION 1.0.0)
add_definitions(-std=c++14)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
#set(CMAKE_HAVE_THREADS_LIBRARY 1)
#set(CMAKE_USE_PTHREADS_INIT 1)
#set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
set(FACE_RECOGNITION_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
file(GLOB FACE_RECOGNITION_SRC "${FACE_RECOGNITION_PATH}/*.cpp")
set(NCNN_LIB_PATH /usr/local/lib/ncnn/)
file(GLOB NCNN_LIB_FILES "${NCNN_LIB_PATH}/*.a")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(/usr/local/include/ncnn/)
include_directories(/usr/lib/aarch64-linux-gnu/)
cuda_add_executable(faceRecognitionV1 faceRecognitionMain.cpp ${FACE_RECOGNITION_SRC})
target_link_libraries(faceRecognitionV1 pthread dl gomp Threads::Threads)
target_link_libraries(faceRecognitionV1 ${OpenCV_LIBS} ${NCNN_LIB_FILES})
target_link_libraries(faceRecognitionV1 /usr/lib/aarch64-linux-gnu/libvulkan.so)
を使用してプロジェクトをビルドするとCMakeLists.txt
、次のエラーが発生しました。
/usr/local/lib/ncnn//libMachineIndependent.a(ShaderLang.cpp.o): In function `ShConstructCompiler':
ShaderLang.cpp:(.text+0x1b90): undefined reference to `ConstructCompiler(EShLanguage, int)'
/usr/local/lib/ncnn//libMachineIndependent.a(ShaderLang.cpp.o): In function `ShConstructLinker':
ShaderLang.cpp:(.text+0x1bd8): undefined reference to `ConstructLinker(EShExecutable, int)'
/usr/local/lib/ncnn//libMachineIndependent.a(ShaderLang.cpp.o): In function `ShConstructUniformMap':
ShaderLang.cpp:(.text+0x1c08): undefined reference to `ConstructUniformMap()'
/usr/local/lib/ncnn//libMachineIndependent.a(ShaderLang.cpp.o): In function `ShDestruct':
ShaderLang.cpp:(.text+0x1c54): undefined reference to `DeleteCompiler(TCompiler*)'
ShaderLang.cpp:(.text+0x1c80): undefined reference to `DeleteLinker(TShHandleBase*)'
ShaderLang.cpp:(.text+0x1cac): undefined reference to `DeleteUniformMap(TUniformMap*)'
collect2: error: ld returned 1 exit status
CMakeFiles/faceRecognitionV1.dir/build.make:329: recipe for target 'faceRecognitionV1' failed
make[2]: *** [faceRecognitionV1] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/faceRecognitionV1.dir/all' failed
make[1]: *** [CMakeFiles/faceRecognitionV1.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
他に何を追加する必要がありCMakeLists.txt
ますか?