Comments (8)
-- xrepo: opencv_INCLUDE_DIR /home/XXX/.xmake/packages/o/opencv/4.5.4/e610c461a5844179809cd993282550cb/include
到这个目录,找下对应文件在哪里 ,tree 下
from xrepo-cmake.
...include/opencv4/opencv2
---aruco
---aruco.hpp
---barcode.hpp
...
from xrepo-cmake.
可以用 xrepo fetch opencv 命令看下,按理 includedirs 已经包含 opencv4 子目录了,但是你这检测到没有
你这个 cmakelists.txt 也没贴全,我也看不出什么,建议走 xrepo_target_packages 接口,而不是 cmake find_package。。
cmake 的 find_package 不一定能给你附带上 opencv4 子目录
from xrepo-cmake.
完整的CMakeLists.txt是这样的:
#指定cmake的最小版本
cmake_minimum_required(VERSION 3.4.1)
#[[
设置项目名称,它会引入两个变量 demo_BINARY_DIR 和 demo_SOURCE_DIR,
同时,cmake 自动定义了两个等价的变量 PROJECT_BINARY_DIR 和 PROJECT_SOURCE_DIR。
]]
project(demo)
#指定c++版本
#specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
#Download xrepo.cmake if not exists in build directory.
if(NOT EXISTS "${CMAKE_BINARY_DIR}/xrepo.cmake")
message(STATUS "Downloading xrepo.cmake from https://github.com/xmake-io/xrepo-cmake/")
# mirror https://cdn.jsdelivr.net/gh/xmake-io/xrepo-cmake@main/xrepo.cmake
file(DOWNLOAD "https://raw.githubusercontent.com/xmake-io/xrepo-cmake/main/xrepo.cmake"
"${CMAKE_BINARY_DIR}/xrepo.cmake"
TLS_VERIFY ON)
endif()
#Include xrepo.cmake so we can use xrepo_package function.
include(${CMAKE_BINARY_DIR}/xrepo.cmake)
xrepo_package("spdlog")
xrepo_package("opencv 4.5.4")
#头文件目录,将指定目录添加到编译器的头文件搜索路径之下,指定的目录被解释成当前源码路径的相对路径。
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src #自己写的头文件所在目录
)
#查找c++源文件
file(GLOB_RECURSE CPP_SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/src/.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/.h"
) #GLOB_RECURSE 查找包括子目录
add_executable(mainWorker ${CPP_SOURCE_FILES})
target_link_libraries(mainWorker spdlog opencv)
from xrepo-cmake.
CMakeLists.txt 我改成下面了:
add_executable(mainWorker ${CPP_SOURCE_FILES})
#target_link_libraries(mainWorker spdlog opencv)
xrepo_target_packages(
mainWorker
spdlog opencv
)
make的时候报的错误是:
.../.xmake/packages/o/opencv/4.5.4/e610c461a5844179809cd993282550cb/include/opencv4/opencv2/opencv.hpp:48:10: fatal error: opencv2/opencv_modules.hpp: 没有那个文件或目录
48 | #include "opencv2/opencv_modules.hpp"
from xrepo-cmake.
说明 opencv2/opencv.hpp 已经找到了,includedir 没问题,至于 opencv_modules.hpp 有没有,自己找下路径
from xrepo-cmake.
.../.xmake/packages/o/opencv/4.5.4/e610c461a5844179809cd993282550cb/include/opencv4/opencv2/ 这个目录下面opencv.hpp和opencv_modules.hpp是挨着的,opencv.hpp下面一个文件就是opencv_modules.hpp
from xrepo-cmake.
那我不知道,只要 includedirs 和路径没问题,那跟 xmake 没啥关系了
from xrepo-cmake.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xrepo-cmake.