You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# 获取编译时间
|
|
|
|
string(TIMESTAMP COMPILE_TIME 20%y_%m_%d-%H.%M.%S)
|
|
|
|
set(build_time ${COMPILE_TIME})
|
|
|
|
|
|
|
|
# 获取当前版本信息
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
add_compile_options(/wd4996)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_package(OpenMP REQUIRED)
|
|
|
|
|
|
|
|
find_package(Ceres REQUIRED)
|
|
|
|
include_directories(${CERES_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 公共头文件(放置在最前面,所有后面定义的模块才都能找到)
|
|
|
|
SET(ArithTrkPubInc ${CMAKE_SOURCE_DIR}/public_include)
|
|
|
|
include_directories(${ArithTrkPubInc}) # 引入算法公共头文件
|
|
|
|
|
|
|
|
# 全局包含opencv
|
|
|
|
link_directories(${OpenCV_LIBS_DIR})
|
|
|
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set(ArithSrcDIR_MAIN "src") # 库源文件路径
|
|
|
|
|
|
|
|
# 使用当前目录、Common目录源码构建
|
|
|
|
file(GLOB libsrcs ${ArithSrcDIR_MAIN}/*.cpp ${ArithSrcDIR_MAIN}/*.c ${ArithSrcDIR_MAIN}/*.h ${ArithSrcDIR_MAIN}/*.hpp)
|
|
|
|
file(GLOB CommonSrc ${ArithSrcDIR_MAIN}/utils/*.cpp ${ArithSrcDIR_MAIN}/utils/*.c ${ArithSrcDIR_MAIN}/utils/*.h ${ArithSrcDIR_MAIN}/utils/*.hpp)
|
|
|
|
|
|
|
|
add_library(${LIB_STITCH} SHARED ${libsrcs} ${CommonSrc}) # 构建算法库
|
|
|
|
|
|
|
|
# 设置包含路径
|
|
|
|
target_include_directories(${LIB_STITCH} PUBLIC
|
|
|
|
${ArithTrkPubInc}
|
|
|
|
${ArithSrcDIR_MAIN}
|
|
|
|
${ArithSrcDIR_MAIN}/utils
|
|
|
|
)
|
|
|
|
|
|
|
|
# 算法库链接
|
|
|
|
target_link_libraries(${LIB_STITCH}
|
|
|
|
OpenMP::OpenMP_CXX
|
|
|
|
${OpenCV_LIBS}
|
|
|
|
${CERES_LIBRARIES})
|
|
|
|
|
|
|
|
# # gcc编译器要求0警告
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
# 只导出指明的符号
|
|
|
|
add_definitions(-fvisibility=hidden)
|
|
|
|
|
|
|
|
# 警告:必须在如下编译器配置下编译通过
|
|
|
|
target_compile_options(${LIB_STITCH} PRIVATE -Werror -Wreturn-type)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Bin) # 输出算法库路径
|
|
|
|
|