From 4da0f2632b1a66da03dbcc08d2d0dc257e3978cc Mon Sep 17 00:00:00 2001 From: Marino von Wattenwyl Date: Thu, 26 Oct 2023 11:25:22 +0200 Subject: [PATCH] [Android] Fix release build --- cmake/DownloadPrebuilts.cmake | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cmake/DownloadPrebuilts.cmake b/cmake/DownloadPrebuilts.cmake index 17b51b6b..8858fcb8 100644 --- a/cmake/DownloadPrebuilts.cmake +++ b/cmake/DownloadPrebuilts.cmake @@ -1019,9 +1019,14 @@ elseif ("${SYSTEM_NAME_UPPER}" STREQUAL "ANDROID") #---------------------------- #set(OpenCV_VERSION "3.4.1") set(OpenCV_PREBUILT_DIR "andV8_opencv_${OpenCV_VERSION}") set(OpenCV_DIR "${PREBUILT_PATH}/${OpenCV_PREBUILT_DIR}") - set(OpenCV_LINK_DIR "${OpenCV_DIR}/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}") set(OpenCV_INCLUDE_DIR "${OpenCV_DIR}/include") + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(OpenCV_LINK_DIR "${OpenCV_DIR}/Debug/${ANDROID_ABI}") + else () + set(OpenCV_LINK_DIR "${OpenCV_DIR}/Release/${ANDROID_ABI}") + endif () + set(OpenCV_LINK_LIBS ${OpenCV_LINK_LIBS} cpufeatures @@ -1075,7 +1080,12 @@ elseif ("${SYSTEM_NAME_UPPER}" STREQUAL "ANDROID") #---------------------------- set(g2o_PREBUILT_DIR "andV8_g2o") set(g2o_DIR "${PREBUILT_PATH}/${g2o_PREBUILT_DIR}") set(g2o_INCLUDE_DIR "${g2o_DIR}/include") - set(g2o_LINK_DIR "${g2o_DIR}/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}") + + if (CMAKE_BUILD_TYPE MATCHES "Debug") + set(g2o_LINK_DIR "${g2o_DIR}/Debug/${ANDROID_ABI}") + else () + set(g2o_LINK_DIR "${g2o_DIR}/Release/${ANDROID_ABI}") + endif () foreach (lib ${g2o_LINK_LIBS}) add_library(${lib} SHARED IMPORTED) @@ -1160,7 +1170,7 @@ elseif ("${SYSTEM_NAME_UPPER}" STREQUAL "ANDROID") #---------------------------- add_library(MediaPipe::MediaPipe SHARED IMPORTED) set_target_properties(MediaPipe::MediaPipe PROPERTIES - IMPORTED_LOCATION_RELEASE "${MediaPipe_DIR}/release/libmediapipe.so" + IMPORTED_LOCATION "${MediaPipe_DIR}/release/libmediapipe.so" IMPORTED_LOCATION_DEBUG "${MediaPipe_DIR}/debug/libmediapipe.so" INTERFACE_INCLUDE_DIRECTORIES "${MediaPipe_DIR}/include" ) @@ -1168,7 +1178,7 @@ elseif ("${SYSTEM_NAME_UPPER}" STREQUAL "ANDROID") #---------------------------- add_library(MediaPipe::OpenCV_Java4 SHARED IMPORTED) set_target_properties(MediaPipe::OpenCV_Java4 PROPERTIES - IMPORTED_LOCATION_RELEASE "${MediaPipe_DIR}/release/libopencv_java4.so" + IMPORTED_LOCATION "${MediaPipe_DIR}/release/libopencv_java4.so" IMPORTED_LOCATION_DEBUG "${MediaPipe_DIR}/debug/libopencv_java4.so" )