forked from introlab/rtabmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use imported target for res_tool during cross compilation. (introlab#865
- Loading branch information
1 parent
8cd4a6f
commit 8826f13
Showing
3 changed files
with
57 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
|
||
SET(SRC_FILES | ||
main.cpp | ||
) | ||
|
||
SET(INCLUDE_DIRS | ||
../include | ||
) | ||
|
||
# Make sure the compiler can find include files from our library. | ||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) | ||
|
||
# Add binary called "resource_tool" that is built from the source file "main.cpp". | ||
# The extension is automatically found. | ||
ADD_EXECUTABLE(res_tool ${SRC_FILES}) | ||
TARGET_LINK_LIBRARIES(res_tool rtabmap_utilite) | ||
|
||
SET_TARGET_PROPERTIES( | ||
res_tool | ||
PROPERTIES | ||
VERSION ${UTILITE_VERSION} | ||
SOVERSION ${UTILITE_VERSION} | ||
OUTPUT_NAME ${PROJECT_PREFIX}-res_tool | ||
) | ||
|
||
INSTALL(TARGETS res_tool | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime | ||
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) | ||
if (CMAKE_CROSSCOMPILING OR ANDROID OR IOS) | ||
# See this page about tools being required in the build: | ||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/CrossCompiling#using-executables-in-the-build-created-during-the-build | ||
|
||
# Some ideas there were used, not all. | ||
# 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(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)." ) | ||
ENDIF(NOT RTABMAP_RES_TOOL) | ||
ENDIF() | ||
|
||
MESSAGE(STATUS "Using res_tool at ${RTABMAP_RES_TOOL}") | ||
|
||
ADD_EXECUTABLE(res_tool IMPORTED GLOBAL) | ||
SET_TARGET_PROPERTIES(res_tool PROPERTIES IMPORTED_LOCATION "${RTABMAP_RES_TOOL}") | ||
|
||
else() | ||
|
||
SET(SRC_FILES | ||
main.cpp | ||
) | ||
|
||
SET(INCLUDE_DIRS | ||
../include | ||
) | ||
|
||
# Make sure the compiler can find include files from our library. | ||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) | ||
|
||
# Add binary called "resource_tool" that is built from the source file "main.cpp". | ||
# The extension is automatically found. | ||
ADD_EXECUTABLE(res_tool ${SRC_FILES}) | ||
TARGET_LINK_LIBRARIES(res_tool rtabmap_utilite) | ||
|
||
SET_TARGET_PROPERTIES( | ||
res_tool | ||
PROPERTIES | ||
VERSION ${UTILITE_VERSION} | ||
SOVERSION ${UTILITE_VERSION} | ||
OUTPUT_NAME ${PROJECT_PREFIX}-res_tool | ||
) | ||
|
||
INSTALL(TARGETS res_tool | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime | ||
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) | ||
|
||
endif() |