feat:调整CMake
parent
6c3b52564b
commit
a9f462bcbd
|
@ -14,12 +14,12 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
|
||||||
|
|
||||||
# Check C++11 or C++0x support
|
# Check C++11 or C++0x support
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||||
if(COMPILER_SUPPORTS_CXX11)
|
if(COMPILER_SUPPORTS_CXX11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||||
add_definitions(-DCOMPILEDWITHC11)
|
add_definitions(-DCOMPILEDWITHC11)
|
||||||
message(STATUS "Using flag -std=c++11.")
|
message(STATUS "Using flag -std=c++14.")
|
||||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
elseif(COMPILER_SUPPORTS_CXX0X)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||||
add_definitions(-DCOMPILEDWITHC0X)
|
add_definitions(-DCOMPILEDWITHC0X)
|
||||||
|
@ -32,9 +32,9 @@ LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
|
||||||
|
|
||||||
# 要保证整个工程的opencv版本一致,包括dbow,源码以及ros相关的
|
# 要保证整个工程的opencv版本一致,包括dbow,源码以及ros相关的
|
||||||
# 3 4 都可以正常运行
|
# 3 4 都可以正常运行
|
||||||
find_package(OpenCV 3.2)
|
find_package(OpenCV 4.2)
|
||||||
if(NOT OpenCV_FOUND)
|
if(NOT OpenCV_FOUND)
|
||||||
message(FATAL_ERROR "OpenCV > 3.2 not found.")
|
message(FATAL_ERROR "OpenCV > 4.2 not found.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
MESSAGE("OPENCV VERSION:")
|
MESSAGE("OPENCV VERSION:")
|
||||||
|
|
|
@ -14,12 +14,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
|
||||||
|
|
||||||
# Check C++11 or C++0x support
|
# Check C++11 or C++0x support
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||||
if(COMPILER_SUPPORTS_CXX11)
|
if(COMPILER_SUPPORTS_CXX14)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||||
add_definitions(-DCOMPILEDWITHC11)
|
add_definitions(-DCOMPILEDWITHC11)
|
||||||
message(STATUS "Using flag -std=c++11.")
|
message(STATUS "Using flag -std=c++14.")
|
||||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
elseif(COMPILER_SUPPORTS_CXX0X)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||||
add_definitions(-DCOMPILEDWITHC0X)
|
add_definitions(-DCOMPILEDWITHC0X)
|
||||||
|
@ -32,9 +32,9 @@ LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake_modules)
|
||||||
|
|
||||||
# 要保证整个工程的opencv版本一致,包括dbow,源码以及ros相关的
|
# 要保证整个工程的opencv版本一致,包括dbow,源码以及ros相关的
|
||||||
# 3 4 都可以正常运行
|
# 3 4 都可以正常运行
|
||||||
find_package(OpenCV 3.2)
|
find_package(OpenCV 4.2)
|
||||||
if(NOT OpenCV_FOUND)
|
if(NOT OpenCV_FOUND)
|
||||||
message(FATAL_ERROR "OpenCV > 3.2 not found.")
|
message(FATAL_ERROR "OpenCV > 4.2 not found.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Eigen3 3.1.0 REQUIRED)
|
find_package(Eigen3 3.1.0 REQUIRED)
|
||||||
|
|
|
@ -30,12 +30,9 @@ set(SRCS_DUTILS
|
||||||
|
|
||||||
# 要保证整个工程的opencv版本一致,包括dbow,源码以及ros相关的
|
# 要保证整个工程的opencv版本一致,包括dbow,源码以及ros相关的
|
||||||
# 3 4 都可以正常运行
|
# 3 4 都可以正常运行
|
||||||
find_package(OpenCV 3.2 QUIET)
|
find_package(OpenCV 4.2 QUIET)
|
||||||
if(NOT OpenCV_FOUND)
|
if(NOT OpenCV_FOUND)
|
||||||
find_package(OpenCV 3.0 QUIET)
|
message(FATAL_ERROR "OpenCV > 3.0 not found.")
|
||||||
if(NOT OpenCV_FOUND)
|
|
||||||
message(FATAL_ERROR "OpenCV > 3.0 not found.")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
|
||||||
|
|
Loading…
Reference in New Issue