Skip to content

Commit

Permalink
chore: update build system
Browse files Browse the repository at this point in the history
  • Loading branch information
domire8 committed May 1, 2024
1 parent 247315d commit 33ad390
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions apt-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ libboost-all-dev
libeigen3-dev
liburdfdom-dev
libassimp-dev
libzmq3-dev
10 changes: 9 additions & 1 deletion dependencies/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
14 changes: 13 additions & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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__,
Expand Down
7 changes: 7 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions source/control_librariesConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 33ad390

Please sign in to comment.