ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
After some months, I am revisiting this question, and I found a solution to my question from last September. For completeness sake, I post my solution here. It turned out that using ExternalProject_Add
was still the easiest solution, after all.
The package contains only CMakeLists.txt, package.xml, readme, and license files.
Relevant parts of package.xml:
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>autoconf</depend>
<depend>libtool</depend>
The CMakeLists looks like this:
cmake_minimum_required(VERSION 3.5)
project(igh_eml)
find_package(ament_cmake REQUIRED)
include(ExternalProject)
ExternalProject_Add(upstream_igh_eml # Name for custom target
#--Download step--------------
GIT_REPOSITORY https://github.com/ribalda/ethercat.git
#The following TAG should correspond to the same version as your installed kernel modules
GIT_TAG 7d73d5b2b372b37b95ce5d7bf16aa5b032190004
TIMEOUT 30 # Time allowed for file download operations
#--Update/Patch step----------
UPDATE_COMMAND touch <SOURCE_DIR>/config.h COMMAND mkdir -p <SOURCE_DIR>/include <SOURCE_DIR>/lib # Source work-tree update command
#--Configure step-------------
CONFIGURE_COMMAND touch <SOURCE_DIR>/ChangeLog COMMAND autoreconf -i <SOURCE_DIR> COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-kernel --enable-hrtimer --enable-tool # Build tree configuration command
#--Build step-----------------
BUILD_IN_SOURCE 1 # Use source dir for build dir
#--Install step---------------
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}" # Installation prefix
BUILD_COMMAND cd <SOURCE_DIR> COMMAND make -j8
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include DESTINATION ${CMAKE_INSTALL_PREFIX})
ament_export_include_directories(include)
ament_export_libraries(ethercat)
ament_package()
For understanding: ethercat
is a library built by that project and it resides in ${CMAKE_CURRENT_BINARY_DIR}/lib
after ExternalProject_Add
completed. Headers are in ${CMAKE_CURRENT_BINARY_DIR}/include
after the macro. I was surprised that ament_export_include_directories(include)
actually did the right thing even though I neither specified an absolute path nor is there such a directory in the source repository.
2 | No.2 Revision |
After some months, I am revisiting this question, and I found a solution to my question from last September. solution. For completeness sake, I post my solution here. It turned out that using ExternalProject_Add
was still the easiest solution, after all.
The package contains only CMakeLists.txt, package.xml, readme, and license files.
Relevant parts of package.xml:
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>autoconf</depend>
<depend>libtool</depend>
The CMakeLists looks like this:
cmake_minimum_required(VERSION 3.5)
project(igh_eml)
find_package(ament_cmake REQUIRED)
include(ExternalProject)
ExternalProject_Add(upstream_igh_eml # Name for custom target
#--Download step--------------
GIT_REPOSITORY https://github.com/ribalda/ethercat.git
#The following TAG should correspond to the same version as your installed kernel modules
GIT_TAG 7d73d5b2b372b37b95ce5d7bf16aa5b032190004
TIMEOUT 30 # Time allowed for file download operations
#--Update/Patch step----------
UPDATE_COMMAND touch <SOURCE_DIR>/config.h COMMAND mkdir -p <SOURCE_DIR>/include <SOURCE_DIR>/lib # Source work-tree update command
#--Configure step-------------
CONFIGURE_COMMAND touch <SOURCE_DIR>/ChangeLog COMMAND autoreconf -i <SOURCE_DIR> COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-kernel --enable-hrtimer --enable-tool # Build tree configuration command
#--Build step-----------------
BUILD_IN_SOURCE 1 # Use source dir for build dir
#--Install step---------------
INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}" # Installation prefix
BUILD_COMMAND cd <SOURCE_DIR> COMMAND make -j8
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include DESTINATION ${CMAKE_INSTALL_PREFIX})
ament_export_include_directories(include)
ament_export_libraries(ethercat)
ament_package()
For understanding: ethercat
is a library built by that project and it resides in ${CMAKE_CURRENT_BINARY_DIR}/lib
after ExternalProject_Add
completed. Headers are in ${CMAKE_CURRENT_BINARY_DIR}/include
after the macro. I was surprised that ament_export_include_directories(include)
actually did the right thing even though I neither specified an absolute path nor is there such a directory in the source repository.