我正在尝试编译我的flandmark但它非常复杂。 C:\ flandmark \ libflandmark \ CMakeLists.txt我放在第一行:
set(OpenCV "C:/opencv248/sources/cmake")
这是对的吗?
关注我的完整文件CMakeList.txt:
set(OpenCV "C:/opencv248/sources/cmake")
find_package( OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_library(flandmark_static STATIC flandmark_detector.cpp flandmark_detector.h liblbp.cpp liblbp.h)
target_link_libraries(flandmark_static ${OpenCV_LIBS})
if(CMAKE_COMPILER_IS_GNUCC)
set_target_properties(flandmark_static PROPERTIES COMPILE_FLAGS -fPIC)
endif(CMAKE_COMPILER_IS_GNUCC)
set_property(TARGET flandmark_static PROPERTY COMPILE_DEFINITIONS FLANDMARK_STATIC)
add_library(flandmark_shared SHARED flandmark_detector.cpp flandmark_detector.h liblbp.cpp liblbp.h)
target_link_libraries(flandmark_shared ${OpenCV_LIBS})
#setup Config.cmake
SET(FLANDMARK_BASE_DIR "${PROJECT_SOURCE_DIR}/libflandmark")
set(FLANDMARK_BINARY_DIR "${PROJECT_BINARY_DIR}/libflandmark")
configure_file(flandmarkConfig.cmake.in
"${PROJECT_BINARY_DIR}/libflandmark/flandmarkConfig.cmake" @ONLY)
export(PACKAGE flandmark)
当我被CMake-gui执行时查看结果:
OpenCV ARCH: x86
OpenCV RUNTIME: mingw
OpenCV STATIC: OFF
CMake Warning at C:/opencv248/build/OpenCVConfig.cmake:161 (message):
Found OpenCV Windows Pack but it has not binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
libflandmark/CMakeLists.txt:2 (find_package)
CMake Error at libflandmark/CMakeLists.txt:2 (find_package):
Found package configuration file:
C:/opencv248/build/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
拜托,你能详细告诉我我该做什么吗? 我不知道为什么他们没有.dll已经为我们编译了! :(
由于
答案 0 :(得分:1)
您应该将cmake-gui中的OpenCV_DIR变量设置为OpenCV的构建目录。然后它应该没有问题。
答案 1 :(得分:0)
嗨,大家好,谢谢你帮助我完成这一步。我已经解决了这个问题 我跟随Uricamic的方向,让我详细了解解决方案:
在cmake-gui中设置变量OPENCV_DIR = C:/ opencv / build / x86 / vc12 / staticlib 我选择在哪里构建二进制文件:c:/ flandmark-bin 之后由Cmake-gui生成,结果生成:
C:\flandmark-bin
- CMakeCache.txt
- CMakeFiles
- examples
- libflandmark
- matlab_toolbox
C:\flandmark-bin\CMakeFiles
- cmake.check_cache
- CMakeGNUtoMS_lib.bat
- CMakeOutput.log
- CMakeTmp
C:\flandmark-bin\CMakeFiles\3.0.1
- CMakeCCompiler.cmake
- CMakeCXXCompiler.cmake
- CMakeDetermineCompilerABI_C.bin
- CMakeDetermineCompilerABI_CXX.bin
- CMakeRCCompiler.cmake
- CMakeSystem.cmake
- CompilerIdC
- CompilerIdCXX
C:\flandmark-bin\CMakeFiles\3.0.1\CompilerIdC
- a.exe
- CMakeCCompilerId.c
C:\flandmark-bin\CMakeFiles\3.0.1\CompilerIdCXX
- a.exe
- CMakeCXXCompilerId.cpp
C:\flandmark-bin\CMakeFiles\CMakeTmp
C:\flandmark-bin\examples
- CMakeFiles
- face.jpg
- flandmark_model.dat
- groupphoto.jpg
- haarcascade_frontalface_alt.xml
- seq_bruges04_300frames.avi
C:\flandmark-bin\examples\CMakeFiles
C:\flandmark-bin\libflandmark
- CMakeFiles
- flandmarkConfig.cmake
C:\flandmark-bin\libflandmark\CMakeFiles
C:\flandmark-bin\matlab_toolbox
- mex
C:\flandmark-bin\matlab_toolbox\mex
- CMakeFiles
这个疑问已经解决了!
我的另一个疑问是如何生成.dll文件,启动C:/ flandmark-bin生成(上图)?