diff --git a/Dockerfile b/Dockerfile index fbc09a471..cdf29561a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -129,7 +129,8 @@ COPY --from=apt-dependencies /tmp/apt / COPY --from=base-dependencies /tmp/deps /usr COPY dependencies/dependencies.cmake CMakeLists.txt RUN --mount=type=cache,target=/build,id=cmake-deps-${TARGETPLATFORM}-${CACHEID},uid=1000 \ - cmake -B build -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && cmake --build build && cmake --install build --prefix /tmp/deps + cmake -B build -Dprotobuf_BUILD_TESTS=OFF -DCPPZMQ_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ + && cmake --build build && cmake --install build --prefix /tmp/deps COPY --from=base-dependencies /tmp/deps /tmp/deps COPY --from=pinocchio-dependencies /tmp/deps /tmp/deps diff --git a/apt-packages.txt b/apt-packages.txt index 2988803ab..d080e8fe6 100644 --- a/apt-packages.txt +++ b/apt-packages.txt @@ -2,3 +2,4 @@ libboost-all-dev libeigen3-dev liburdfdom-dev libassimp-dev +libzmq3-dev diff --git a/dependencies/dependencies.cmake b/dependencies/dependencies.cmake index 38830257c..99093b885 100644 --- a/dependencies/dependencies.cmake +++ b/dependencies/dependencies.cmake @@ -18,4 +18,12 @@ FetchContent_Declare( SOURCE_SUBDIR cmake ) -FetchContent_MakeAvailable(OsqpEigen protobuf) +FetchContent_Declare( + cppzmq + GIT_REPOSITORY https://github.com/zeromq/cppzmq/ + GIT_TAG v4.7.1 +) +FetchContent_MakeAvailable(cppzmq) + + +FetchContent_MakeAvailable(OsqpEigen protobuf cppzmq) diff --git a/python/setup.py b/python/setup.py index bed40e169..1476e8f06 100644 --- a/python/setup.py +++ b/python/setup.py @@ -12,13 +12,14 @@ osqp_path_var = 'OSQP_INCLUDE_DIR' __version__ = "8.0.0" -__libraries__ = ['state_representation', 'clproto', 'controllers', 'dynamical_systems', 'robot_model'] +__libraries__ = ['state_representation', 'clproto', 'controllers', 'dynamical_systems', 'robot_model', 'communicatoin_interfaces'] __include_dirs__ = ['include'] __install_clproto_module__ = True __install_controllers_module__ = True __install_dynamical_systems_module__ = True __install_robot_model_module__ = True +__install_communication_interfaces_module__ = True # check that necessary libraries can be found try: @@ -122,6 +123,17 @@ ) ) +if __install_communication_interfaces_module__: + ext_modules.append( + Pybind11Extension('communication_interfaces', + sorted(glob('source/communication_interfaces/*.cpp')), + cxx_std=17, + include_dirs=__include_dirs__, + libraries=['communication_interfaces'], + define_macros=[('MODULE_VERSION_INFO', __version__)], + ) + ) + setup( name='control-libraries', version=__version__, diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c77afad44..7601102f2 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -7,6 +7,7 @@ option(BUILD_TESTING "Build all tests." OFF) option(BUILD_CONTROLLERS "Build and install controllers library" ON) option(BUILD_DYNAMICAL_SYSTEMS "Build and install dynamical systems library" ON) option(BUILD_ROBOT_MODEL "Build and install robot model library" ON) +option(BUILD_COMMUNICATION_INTERFACES "Build and install communication interfaces library" ON) option(EXPERIMENTAL_FEATURES "Include experimental features" OFF) # Default to C99 @@ -78,6 +79,12 @@ if(BUILD_CONTROLLERS) add_pkgconfig_library(controllers ${PROJECT_VERSION}) endif() +if(BUILD_COMMUNICATION_INTERFACES) + add_subdirectory(communication_interfaces) + list(APPEND INSTALL_SUPPORTED_COMPONENTS communication_interfaces) + add_pkgconfig_library(communication_interfaces ${PROJECT_VERSION}) +endif() + # generate the version file for the config file write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" diff --git a/source/control_librariesConfig.cmake.in b/source/control_librariesConfig.cmake.in index f244c2f63..4c580a77a 100644 --- a/source/control_librariesConfig.cmake.in +++ b/source/control_librariesConfig.cmake.in @@ -22,6 +22,12 @@ while(_control_libraries_to_find) set_and_check(control_libraries_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") endif() + # Find communication interfaces dependencies if the corresponding component is needed + # FIXME: this should be done automatically + if (${_comp} STREQUAL "communication_interfaces") + find_dependency(cppzmq) + endif() + # Find robot model dependencies if the corresponding component is needed # FIXME: this should be done automatically if (${_comp} STREQUAL "robot_model")