Skip to content

Commit

Permalink
Makes MSCL version configurable and autodetects architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiefish committed Aug 5, 2021
1 parent 910d856 commit c44eebc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ group_id := $(shell id -g)
# Set up some variables for the docker build
dev_dockerfile := $(docker_dir)/Dockerfile.dev
deploy_dockerfile := $(docker_dir)/Dockerfile.deploy
build_args := --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy --build-arg USER_ID=$(user_id) --build-arg GROUP_ID=$(group_id)
build_args := --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy --build-arg ARCH=$(arch) --build-arg USER_ID=$(user_id) --build-arg GROUP_ID=$(group_id)
run_args := -e http_proxy -e https_proxy -e no_proxy
run_mounts := -v "$(project_dir):/tmp/$(project_name)_release_workspace" -v "$(project_dir)/ros_mscl:$(docker_catkin_src_dir)/ros_mscl" -v "$(project_dir)/mscl_msgs:$(docker_catkin_src_dir)/mscl_msgs" -v "$(project_dir)/Examples:$(docker_catkin_src_dir)/Examples" -v "$(build_dir):$(docker_catkin_build_dir)" -v "$(devel_dir):$(docker_catkin_devel_dir)"
dev_image_name := $(arch)/$(project_name)-dev:$(ros_version)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ can be used to build docker images, run a shell inside the docker images and pro
1. Install the following dependencies:
1. [Make](https://www.gnu.org/software/make/)
1. [Docker](https://docs.docker.com/get-docker/)
1. [qemu-user-static](https://packages.ubuntu.com/bionic/qemu-user-static) (for multiarch builds)
1. Run the following command to register the qemu binaries with docker: `docker run --rm --privileged multiarch/qemu-user-static:register`

The `Makefile` exposes the following tasks. They can all be run from the `.devcontainer` directory:
* `make build-shell` - Builds the docker image and starts a shell session in the image allowing the user to develop and build the ROS project using common commands such as `catkin_make`
Expand Down
18 changes: 16 additions & 2 deletions ros_mscl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,25 @@ find_package(catkin REQUIRED COMPONENTS
mscl_msgs
)

# Allow the MSCL version to be overridden
set(MSCL_VERSION "62.0.0" CACHE STRING "Version of MSCL to download and build with")

# Convert the CMake architecture to the format that MSCL uses
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64")
set(MSCL_ARCH "amd64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(MSCL_ARCH "arm64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armhf")
set(MSCL_ARCH "armhf")
else()
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()

# Install MSCL from github
set(MSCL_GITHUB_ORG "LORD-MicroStrain")
set(MSCL_GITHUB_REPO "MSCL")
set(MSCL_GITHUB_TAG "v62.0.0")
set(MSCL_GITHUB_ARTIFACT "c++-mscl_62.0.0_amd64.deb")
set(MSCL_GITHUB_TAG "v${MSCL_VERSION}")
set(MSCL_GITHUB_ARTIFACT "c++-mscl_${MSCL_VERSION}_${MSCL_ARCH}.deb")

# Get the release ID for the version we are trying to download
set(MSCL_LIST_REPO_URL "https://api.github.com/repos/${MSCL_GITHUB_ORG}/${MSCL_GITHUB_REPO}/releases/tags/${MSCL_GITHUB_TAG}")
Expand Down

0 comments on commit c44eebc

Please sign in to comment.