Skip to content

Commit

Permalink
Use the source version of drake's install_prereqs for external examples
Browse files Browse the repository at this point in the history
Previously, the binary version of the script was called in addition to
replicating much of the source version. With this change, the
copy-and-paste is removed.
  • Loading branch information
BetsyMcPhail committed Nov 14, 2024
1 parent b01ab48 commit 351f4eb
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 310 deletions.
10 changes: 10 additions & 0 deletions drake_bazel_external/.github/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@
set -euxo pipefail

cd $(dirname "${BASH_SOURCE}")

sudo ./ubuntu_setup

# Download the drake source
wget -O drake.tar.gz \
https://github.com/RobotLocomotion/drake/archive/master.tar.gz
trap 'rm -f drake.tar.gz' EXIT
tar -xf drake.tar.gz

# Install the source prereqs
sudo ./drake-master/setup/ubuntu/install_prereqs.sh

cat > "${HOME}/.bazelrc" << EOF
startup --output_user_root=${WORKSPACE}/_bazel_${USER}
test --color=yes
Expand Down
19 changes: 17 additions & 2 deletions drake_bazel_external/.github/ubuntu_setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,25 @@

set -euxo pipefail

if [[ "${EUID:-}" -ne 0 ]]; then
echo 'This script must be run as root' >&2
exit 2
fi

echo 'APT::Acquire::Retries "4";' > /etc/apt/apt.conf.d/80-acquire-retries
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90-get-assume-yes

export DEBIAN_FRONTEND='noninteractive'

cd $(dirname "${BASH_SOURCE}")/..
setup/install_prereqs
apt-get update
apt-get install --no-install-recommends lsb-release

if [[ "$(lsb_release -sc)" != 'jammy' ]]; then
echo 'This script requires Ubuntu 22.04 (Jammy)' >&2
exit 3
fi

apt-get install --no-install-recommends $(cat <<EOF
wget
EOF
)
8 changes: 6 additions & 2 deletions drake_bazel_external/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ For an introduction to Bazel, refer to

## Instructions

First, install the required Ubuntu packages:
First, download the drake source and run the source setup script to install
the required Ubuntu packages:

```
sudo setup/install_prereqs
wget -O drake.tar.gz \
https://github.com/RobotLocomotion/drake/archive/master.tar.gz
tar -xf drake.tar.gz
sudo ./drake-master/setup/ubuntu/install_prereqs.sh
```

Then, to build and test all apps:
Expand Down
149 changes: 0 additions & 149 deletions drake_bazel_external/setup/install_prereqs

This file was deleted.

2 changes: 1 addition & 1 deletion drake_cmake_external/.github/ci_build_test
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pushd build
export LD_LIBRARY_PATH="${PWD}/install/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"

cmake ..
make
cmake --build .

cd drake_external_examples
ctest -V .
Expand Down
10 changes: 10 additions & 0 deletions drake_cmake_external/.github/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@
set -euxo pipefail

cd $(dirname "${BASH_SOURCE}")

sudo ./ubuntu_setup

# Download the drake source
wget -O drake.tar.gz \
https://github.com/RobotLocomotion/drake/archive/master.tar.gz
trap 'rm -f drake.tar.gz' EXIT
tar -xf drake.tar.gz

# Install the source prereqs
sudo ./drake-master/setup/ubuntu/install_prereqs.sh

cat > "${HOME}/.bazelrc" << EOF
startup --output_user_root=${WORKSPACE}/_bazel_${USER}
test --color=yes
Expand Down
28 changes: 23 additions & 5 deletions drake_cmake_external/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,32 @@

This pulls in Drake using the CMake `ExternalProject_Add(drake)` mechanism.

To build all apps using CMake and Make:
## Instructions

First, download the drake source and run the source setup script to install
the required Ubuntu packages:

```
wget -O drake.tar.gz \
https://github.com/RobotLocomotion/drake/archive/master.tar.gz
tar -xf drake.tar.gz
sudo ./drake-master/setup/ubuntu/install_prereqs.sh
```

Keep in mind that within the top-level CMakeLists, the drake source is once
again downloaded as an external project. If the CMakeLists is modified to use
a specific version of drake other than master, and any dependencies have
changed within that version, then the same version must also be used above.

Once all necessary dependencies have been installed, build and run tests
using CMake:

```
mkdir build
cd build
cmake ..
make
```

**Under Construction**
cmake --build .
cd drake_external_examples
ctest -V .
```
Loading

0 comments on commit 351f4eb

Please sign in to comment.