Я пытаюсь написать cmake. Я буду использовать OpenGL, SDL и OpenCV вместе. Дело в том, что операция cmake выполняется правильно, но если я ввожу команду make, она говорит, что «Нет такого файла или каталога» для SDL / SDL.h
мой cmake такой:
cmake_minimum_required (VERSION 3.2)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
project (VisionTest)
# compiler version checking does not work if CMAKE_CXX_COMPILER is not set
if (CMAKE_CXX_COMPILER)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
message("GCC version: ${GCC_VERSION}")
if (GCC_VERSION VERSION_GREATER "5.0.0" OR GCC_VERSION VERSION_EQUAL "5.0.0")
message(STATUS "GCC version >= 5.0, use CXX11_ABI=1")
else()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
endif()
endif()
find_package(OpenCV)
find_package(SDL2 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
include_directories(
${GLEW_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
${SDL2_INCLUDE_DIRS}
)
add_executable(
VisionTest
src/arucoDetect.cpp
)
target_link_libraries(VisionTest ${OpenCV_LIBS}
${SDL2_LIBRARY}
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES}
)
В исходном коде мои включения:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/core.hpp"
#include "opencv2/shape.hpp"
#include <opencv2/aruco.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
#include <sstream>
#include <vector>
#include <cmath>
#include <list>
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/freeglut.h>
#include <GL/glut.h>
#include <algorithm>
#include <math.h>
#include <iostream>
как последняя, моя структура каталогов для проекта:
CMakeCache.txt Makefile camera_calibration.cpp paths.cmake
CMakeLists.txt README.md cmake_install.cmake src
./src:
arucoDetect.cpp
и paths.cmake как руководство, я взял его у моего друга для того же проекта (но сложного):
# define platform specific paths in this file
SET(TOOLCHAIN_DIR "/opt" CACHE STRING "")
include(cmake/TargetArch.cmake)
target_architecture(ARCH)
MESSAGE("TOOLCHAIN_DIR is set to: ${TOOLCHAIN_DIR}")
MESSAGE("BUILDING FOR: ${ARCH}")
#include target specific linker and include_directories
IF(${ARCH} MATCHES "aarch64")
set(QT5_DIR ${TOOLCHAIN_DIR}/qt5-odroid)
set(ZEROMQ_INCLUDE_PATH ${TOOLCHAIN_DIR}/zeromq-odroid/include)
set(ZEROMQ_LIB_PATH ${TOOLCHAIN_DIR}/zeromq-odroid/lib)
set(PROTOBUF_INCLUDE_PATH ${TOOLCHAIN_DIR}/protobuf-odroid/include)
set(PROTOBUF_LIB_PATH ${TOOLCHAIN_DIR}/protobuf-odroid/lib)
set(PROTOBUF_PROTOC ${TOOLCHAIN_DIR}/protobuf-host/bin/protoc)
set(LIBSODIUM_LIB_PATH ${TOOLCHAIN_DIR}/libsodium-odroid/lib)
set(OpenCV_DIR ${TOOLCHAIN_DIR}/opencv-odroid/share/OpenCV/)
ELSEIF(${ARCH} MATCHES "x86_64")
set(QT5_DIR ${TOOLCHAIN_DIR}/qt5-host)
set(ZEROMQ_INCLUDE_PATH ${TOOLCHAIN_DIR}/zeromq-host/include)
set(ZEROMQ_LIB_PATH ${TOOLCHAIN_DIR}/zeromq-host/lib)
set(PROTOBUF_INCLUDE_PATH ${TOOLCHAIN_DIR}/protobuf-host/include)
set(PROTOBUF_LIB_PATH ${TOOLCHAIN_DIR}/protobuf-host/lib)
set(PROTOBUF_PROTOC ${TOOLCHAIN_DIR}/protobuf-host/bin/protoc)
set(LIBSODIUM_LIB_PATH ${TOOLCHAIN_DIR}/libsodium-host/lib)
set(OpenCV_DIR ${TOOLCHAIN_DIR}/opencv-host/share/OpenCV/)
ENDIF(${ARCH} MATCHES "aarch64")
# set Qt CMake paths
set(CMAKE_PREFIX_PATH ${QT5_DIR}/lib/cmake)
set(Qt5Core_DIR ${QT5_DIR}/lib/cmake/Qt5Core)
set(Qt5Scxml_DIR ${QT5_DIR}/lib/cmake/Qt5Scxml)
set(Qt5Qml_DIR ${QT5_DIR}/lib/cmake/Qt5Qml)
set(Qt5Network_DIR ${QT5_DIR}/lib/cmake/Qt5Network)
set(Qt5Test_DIR ${QT5_DIR}/lib/cmake/Qt5Test)
MESSAGE("CMAKE_PREFIX_PATH is set to: ${CMAKE_PREFIX_PATH}")
MESSAGE("Qt5Core_DIR is set to: ${Qt5Core_DIR}")
MESSAGE("Qt5Scxml_DIR is set to: ${Qt5Scxml_DIR}")
MESSAGE("Qt5Qml_DIR is set to: ${Qt5Qml_DIR}")
MESSAGE("Qt5Network_DIR is set to: ${Qt5Network_DIR}")
MESSAGE("Qt5Test_DIR is set to: ${Qt5Test_DIR}")
Я только начинаю использовать cmake, поэтому не могу найти что-то, что можно использовать правильно. Спасибо всем!