Skip to content

Commit

Permalink
Merge pull request #280 from gergondet/set-conan-build-type
Browse files Browse the repository at this point in the history
[conan] Use the closes build type that is compatible
  • Loading branch information
felixmaisonneuve authored Apr 6, 2023
2 parents c7b943b + 24da986 commit 14cb703
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 18 additions & 4 deletions kortex_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,38 +62,52 @@ generate_messages(DEPENDENCIES std_msgs actionlib_msgs)
## declare a catkin package
catkin_package(CATKIN_DEPENDS actionlib_msgs)

function(get_closest_build_type VAR_OUT)
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(${VAR_OUT} "Debug" PARENT_SCOPE)
return()
endif()
string(TOUPPER ${CMAKE_BUILD_TYPE} BTYPE)
if("${BTYPE}" STREQUAL "DEBUG")
set(${VAR_OUT} "Debug" PARENT_SCOPE)
else()
set(${VAR_OUT} "Release" PARENT_SCOPE)
endif()
endfunction()

if(USE_CONAN)
# Include conan.cmake module and download Kortex API from artifactory
include(${PROJECT_SOURCE_DIR}/cmake/conan.cmake)
conan_check(REQUIRED)
conan_add_remote(NAME kinova_public
URL https://artifactory.kinovaapps.com/artifactory/api/conan/conan-public)
get_closest_build_type(CONAN_BUILD_TYPE)
if("${CONAN_TARGET_PLATFORM}" STREQUAL "x86")
conan_cmake_run(CONANFILE conanfile.py
UPDATE
BASIC_SETUP CMAKE_TARGETS
NO_OUTPUT_DIRS
SETTINGS kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=5 kortex_api_cpp:compiler.libcxx=libstdc++11)
SETTINGS kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=5 kortex_api_cpp:compiler.libcxx=libstdc++11 kortex_api_cpp:build_type=${CONAN_BUILD_TYPE})
elseif("${CONAN_TARGET_PLATFORM}" STREQUAL "artik710")
conan_cmake_run(CONANFILE conanfile.py
UPDATE
BASIC_SETUP CMAKE_TARGETS
NO_OUTPUT_DIRS
SETTINGS kortex_api_cpp:arch=armv7 kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=5 kortex_api_cpp:compiler.libcxx=libstdc++11
SETTINGS kortex_api_cpp:arch=armv7 kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=5 kortex_api_cpp:compiler.libcxx=libstdc++11 kortex_api_cpp:build_type=${CONAN_BUILD_TYPE}
ENV TARGET=artik710)
elseif("${CONAN_TARGET_PLATFORM}" STREQUAL "imx6")
conan_cmake_run(CONANFILE conanfile.py
UPDATE
BASIC_SETUP CMAKE_TARGETS
NO_OUTPUT_DIRS
SETTINGS kortex_api_cpp:arch=armv7 kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=6.4 kortex_api_cpp:compiler.libcxx=libstdc++11
SETTINGS kortex_api_cpp:arch=armv7 kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=6.4 kortex_api_cpp:compiler.libcxx=libstdc++11 kortex_api_cpp:build_type=${CONAN_BUILD_TYPE}
ENV TARGET=imx6)
elseif("${CONAN_TARGET_PLATFORM}" STREQUAL "jetson")
conan_cmake_run(CONANFILE conanfile.py
UPDATE
BASIC_SETUP CMAKE_TARGETS
NO_OUTPUT_DIRS
SETTINGS kortex_api_cpp:arch=armv7 kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=7 kortex_api_cpp:compiler.libcxx=libstdc++11
SETTINGS kortex_api_cpp:arch=armv7 kortex_api_cpp:compiler=gcc kortex_api_cpp:compiler.version=7 kortex_api_cpp:compiler.libcxx=libstdc++11 kortex_api_cpp:build_type=${CONAN_BUILD_TYPE}
ENV TARGET=jetson)
endif()
endif()
Expand Down
2 changes: 2 additions & 0 deletions kortex_driver/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ Many things have been changed in the ros_kortex repository between versions 1.1.

From release 2.2.0 onwards, the Kortex API is automatically downloaded from our Artifactory Conan server. The steps to install and setup Conan have been added to the root readme file. Conan downloads the binaries and header files in the Conan cache, by default situated in the `~/.conan/` directory.

Note that we only provide packages for the Release and Debug configurations. CMake will pick the most appropriate one given the `CMAKE_BUILD_TYPE` of your catkin workspace.

If you want to learn more about Conan, you can read about it [on their website](https://conan.io/).

If you still want to download the ZIP files for the API, you can find the link in the [Kortex repository](https://github.com/Kinovarobotics/kortex).
Expand Down

0 comments on commit 14cb703

Please sign in to comment.