From f1c987a0cefd183efe93f9521ee0656440126918 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sun, 4 Sep 2022 14:29:59 -0400 Subject: [PATCH] Fixed android build (res tool not found) --- utilite/resource_generator/CMakeLists.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/utilite/resource_generator/CMakeLists.txt b/utilite/resource_generator/CMakeLists.txt index a41de3bfbf..82f1253516 100644 --- a/utilite/resource_generator/CMakeLists.txt +++ b/utilite/resource_generator/CMakeLists.txt @@ -7,11 +7,22 @@ if (CMAKE_CROSSCOMPILING OR ANDROID OR IOS) # The target named 'res_tool' can be used elsewhere in all cases, when cross compiling or not. IF(NOT RTABMAP_RES_TOOL) - FIND_PROGRAM(RTABMAP_RES_TOOL ${PROJECT_PREFIX}-res_tool) + IF (COMMAND find_host_program) + # On android docker build + MESSAGE(STATUS "Looking for ${PROJECT_PREFIX}-res tool in ${PROJECT_BINARY_DIR}/../bin") + FIND_HOST_PROGRAM( RTABMAP_RES_TOOL ${PROJECT_PREFIX}-res_tool PATHS ${PROJECT_BINARY_DIR}/../bin NO_DEFAULT_PATH) IF(NOT RTABMAP_RES_TOOL) - MESSAGE( FATAL_ERROR "RTABMAP_RES_TOOL is not defined (it is the path to \"rtabmap-res_tool\" application created by a non-Android build)." ) + MESSAGE(STATUS "Looking for ${PROJECT_PREFIX}-res tool on host system") + FIND_HOST_PROGRAM( RTABMAP_RES_TOOL ${PROJECT_PREFIX}-res_tool) ENDIF(NOT RTABMAP_RES_TOOL) - ENDIF() + ELSE() + MESSAGE(STATUS "Looking for ${PROJECT_PREFIX}-res tool on host system") + FIND_PROGRAM( RTABMAP_RES_TOOL ${PROJECT_PREFIX}-res_tool ) + ENDIF() + IF(NOT RTABMAP_RES_TOOL) + MESSAGE( FATAL_ERROR "RTABMAP_RES_TOOL is not defined (it is the path to \"${PROJECT_PREFIX}-res_tool\" application created by a non-Android build)." ) + ENDIF(NOT RTABMAP_RES_TOOL) + ENDIF(NOT RTABMAP_RES_TOOL) MESSAGE(STATUS "Using res_tool at ${RTABMAP_RES_TOOL}")