修改ARM下的Cmake;基础算法依赖的绝对路径

This commit is contained in:
杰仔 2026-01-11 17:06:52 +08:00
parent 7204f3efca
commit d0b88daf80
2 changed files with 46 additions and 27 deletions

View File

@ -2,6 +2,11 @@
cmake_minimum_required(VERSION 3.5)
project(ZAlgo)
# OpenCV320 480
# 使cmake -DOPENCV_VERSION=320 .. cmake -DOPENCV_VERSION=480 ..
set(OPENCV_VERSION "320" CACHE STRING "OpenCV版本选择: 320 或 480")
set_property(CACHE OPENCV_VERSION PROPERTY STRINGS "320" "480")
set(DCMAKE_BUILD_SYSNAME Arm)
set(CMAKE_BUILD_ARCH aarch64)
@ -20,15 +25,28 @@ SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/arm/libs)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/arm/bin)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../thirdParty/VzNLSDK/Inc)
# INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../thirdParty/OpenCV320/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../thirdParty/opencv/build/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../thirdParty/eigen3)
# OPENCV_VERSIONOpenCV
if(OPENCV_VERSION STREQUAL "320")
message(STATUS "使用 OpenCV 3.2.0")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../thirdParty/OpenCV320/include)
add_definitions(-DOPENCV_VERSION_320)
elseif(OPENCV_VERSION STREQUAL "480")
message(STATUS "使用 OpenCV 4.8.0")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../thirdParty/opencv480/include)
add_definitions(-DOPENCV_VERSION_480)
else()
message(FATAL_ERROR "不支持的OpenCV版本: ${OPENCV_VERSION},请使用 320 或 480")
endif()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/sourceCode/inc)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/sourceCode)
ADD_DEFINITIONS(-DSG_API_LIBRARY)
ADD_LIBRARY(baseAlgorithm SHARED sourceCode/SG_baseFunc.cpp
if(OPENCV_VERSION STREQUAL "320")
ADD_LIBRARY(baseAlgorithm SHARED sourceCode/SG_baseFunc.cpp
sourceCode/SG_clustering.cpp
sourceCode/SG_featureGrow.cpp
sourceCode/SG_lineFeature.cpp
@ -37,24 +55,25 @@ ADD_LIBRARY(baseAlgorithm SHARED sourceCode/SG_baseFunc.cpp
sourceCode/WD_watershed.cpp
)
ADD_LIBRARY(bagPositioning SHARED sourceCode/SG_bagPositioning.cpp)
ADD_LIBRARY(bagPositioning SHARED sourceCode/SG_bagPositioning.cpp)
ADD_LIBRARY(lapWeldDetection SHARED sourceCode/SX_lapWeldDetection.cpp)
ADD_LIBRARY(lapWeldDetection SHARED sourceCode/SX_lapWeldDetection.cpp)
ADD_LIBRARY(beltTearingDetection SHARED sourceCode/beltTearingDetection.cpp)
ADD_LIBRARY(beltTearingDetection SHARED sourceCode/beltTearingDetection.cpp)
ADD_LIBRARY(workpieceCornerExtraction SHARED sourceCode/BQ_workpieceCornerExtraction.cpp)
ADD_LIBRARY(workpieceCornerExtraction SHARED sourceCode/BQ_workpieceCornerExtraction.cpp)
ADD_LIBRARY(particleSizeMeasurement SHARED sourceCode/WD_particleSizeMeasure.cpp)
ADD_LIBRARY(particleSizeMeasurement SHARED sourceCode/WD_particleSizeMeasure.cpp)
ADD_LIBRARY(binocularMarkCam SHARED sourceCode/binocularMarkCam.cpp
ADD_LIBRARY(wheelArchHeigthMeasure SHARED sourceCode/wheelArchHeigthMeasure.cpp)
ADD_LIBRARY(channelSpaceMeasure SHARED sourceCode/channelSpaceMeasure.cpp)
elseif(OPENCV_VERSION STREQUAL "480")
ADD_LIBRARY(binocularMarkCam SHARED sourceCode/binocularMarkCam.cpp
sourceCode/aruco/aruco.cpp
sourceCode/aruco/aruco_calib.cpp
)
#add executable file
# ADD_EXECUTABLE(bagPositioning_test bagPositioning_test/bagPositioning_test.cpp)
# TARGET_LINK_LIBRARIES(bagPositioning_test
# bagPositioning
# )
else()
message(FATAL_ERROR "不支持的OpenCV版本: ${OPENCV_VERSION},请使用 320 或 480")
endif()

View File

@ -78,12 +78,12 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;F:\ShangGu\ProductDev\AlgoDev\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;..\..\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;F:\ShangGu\ProductDev\AlgoDev\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
<IncludePath>..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;..\..\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)build\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">