From 3ef08b6b3779d627b15bd4a4572907fdff5d59cf Mon Sep 17 00:00:00 2001 From: tyler-yankee Date: Wed, 29 Jan 2025 08:57:44 -0500 Subject: [PATCH 1/3] [cmake_installed] README: remove only Ubuntu support and match style to other examples --- drake_cmake_installed/README.md | 72 +++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/drake_cmake_installed/README.md b/drake_cmake_installed/README.md index 68f6712e..786665ca 100644 --- a/drake_cmake_installed/README.md +++ b/drake_cmake_installed/README.md @@ -4,51 +4,61 @@ This uses the CMake `find_package(drake)` mechanism to find an installed instanc # Instructions -These instructions are only supported for Ubuntu 22.04 (Jammy). +## Download and Install Prerequisites + +First, run the `install_prereqs` script to download the +Drake source to `$HOME/drake/`. This also run's Drake's +setup script to install the required packages depending +on your operating system: + +```bash +setup/install_prereqs +``` + +See [below](#alternative-versions) for alternative versions of +Drake to download. + +## Build Everything + +Then, after cloning this repository, run the following to +build using CMake from the current directory +(`drake-external-examples/drake_cmake_installed`): ```bash -############################################################### -# Download Drake and Install Prerequisites -############################################################### +mkdir build && cd build +cmake -DCMAKE_PREFIX_PATH=$HOME/drake .. +make +``` -# Download Drake source to $HOME/drake/ and -# install various system dependencies -sudo setup/install_prereqs +You can also optionally run the tests by calling `make test`. -############################################################### -# Alternative Drake Versions -############################################################### +## Alternative Versions -# The script above gets the latest version of Drake (usually -# last night's build). Ignore this step if that version is desired. -# Otherwise, the following are alternative options for which -# version of Drake to download: +By default, `install_prereqs` script gets the latest version +of Drake (usually last night's build). Ignore this if that +version is desired. Otherwise, the following are alternative +options for which version of Drake to download. -# 1) A specific version (date-stamped) +1. A specific version (date-stamped) + +```bash curl -O https://drake-packages.csail.mit.edu/drake/nightly/drake-20240214-jammy.tar.gz tar -xvzf drake-20240214-jammy.tar.gz -C $HOME +``` -# 2) Manual Installation +2. Manual installation + +```bash git clone https://github.com/RobotLocomotion/drake.git (cd drake && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/drake .. && make) +``` + +3. Manual installation w/ licensed Gurobi +Install & setup gurobi (http://drake.mit.edu/bazel.html?highlight=gurobi#install-on-ubuntu) -# 3) Manual Installation w/ Licensed Gurobi -# Install & setup gurobi (http://drake.mit.edu/bazel.html?highlight=gurobi#install-on-ubuntu) +```bash git clone https://github.com/RobotLocomotion/drake.git (cd drake && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/drake -DWITH_GUROBI=ON .. && make) - -############################################################### -# Build Everything -############################################################### - -git clone https://github.com/RobotLocomotion/drake-external-examples.git -cd drake-external-examples/drake_cmake_installed -mkdir build && cd build -cmake -DCMAKE_PREFIX_PATH=$HOME/drake .. -make - -# (Optionally) Run Tests -make test ``` # Examples From faa5577c5850891db129549fc682f6210b5cb27b Mon Sep 17 00:00:00 2001 From: tyler-yankee Date: Thu, 30 Jan 2025 08:59:43 -0500 Subject: [PATCH 2/3] add clarifications to README --- drake_cmake_installed/README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drake_cmake_installed/README.md b/drake_cmake_installed/README.md index 786665ca..91f156a9 100644 --- a/drake_cmake_installed/README.md +++ b/drake_cmake_installed/README.md @@ -20,8 +20,7 @@ Drake to download. ## Build Everything -Then, after cloning this repository, run the following to -build using CMake from the current directory +Then run the following to build using CMake from the current directory (`drake-external-examples/drake_cmake_installed`): ```bash @@ -39,6 +38,10 @@ of Drake (usually last night's build). Ignore this if that version is desired. Otherwise, the following are alternative options for which version of Drake to download. +To use any of these options, instead of running `install_prereqs`, +first run the code for whichever option you prefer below. Each option +downloads Drake to the `$HOME` directory. + 1. A specific version (date-stamped) ```bash @@ -61,6 +64,15 @@ git clone https://github.com/RobotLocomotion/drake.git (cd drake && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/drake -DWITH_GUROBI=ON .. && make) ``` +Then ensure you have Python installed; specifically, +install `python3-all-dev` if on Ubuntu, and use Homebrew Python +(not Apple's system Python) if on macOS. Finally, run *Drake's* +`install_prereqs` script to install the remaining system packages: + +```bash +$HOME/drake/share/drake/setup/install_prereqs +``` + # Examples Drake-specific examples: From dd2e219a3470d384538d5a683174734c499f82c5 Mon Sep 17 00:00:00 2001 From: tyler-yankee Date: Fri, 31 Jan 2025 10:45:26 -0500 Subject: [PATCH 3/3] overhaul 'alternative versions' in README --- drake_cmake_installed/README.md | 37 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/drake_cmake_installed/README.md b/drake_cmake_installed/README.md index 91f156a9..22c5fd50 100644 --- a/drake_cmake_installed/README.md +++ b/drake_cmake_installed/README.md @@ -39,39 +39,50 @@ version is desired. Otherwise, the following are alternative options for which version of Drake to download. To use any of these options, instead of running `install_prereqs`, -first run the code for whichever option you prefer below. Each option +run the code for whichever option you prefer below. Each option downloads Drake to the `$HOME` directory. 1. A specific version (date-stamped) +Replace `jammy` (for Ubuntu 22.04) with `noble` or `mac-arm64` +to download the version needed for your operating system. + ```bash -curl -O https://drake-packages.csail.mit.edu/drake/nightly/drake-20240214-jammy.tar.gz -tar -xvzf drake-20240214-jammy.tar.gz -C $HOME +curl -O https://drake-packages.csail.mit.edu/drake/nightly/drake-0.0.20250131-jammy.tar.gz +tar -xvzf drake-0.0.20250131-jammy.tar.gz -C $HOME +$HOME/drake/share/drake/setup/install_prereqs # install prereqs ``` +See [Installation via Direct Download](https://drake.mit.edu/from_binary.html) +for more information. + 2. Manual installation +If on Mac, adjust the call to install prereqs to replace `ubuntu` with `mac` +and remove the use of `sudo`. + ```bash git clone https://github.com/RobotLocomotion/drake.git -(cd drake && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/drake .. && make) +cd drake +sudo setup/ubuntu/source_distribution/install_prereqs.sh # install prereqs +(mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/drake .. && make) ``` 3. Manual installation w/ licensed Gurobi Install & setup gurobi (http://drake.mit.edu/bazel.html?highlight=gurobi#install-on-ubuntu) +If on Mac, adjust the call to install prereqs to replace `ubuntu` with `mac` +and remove the use of `sudo`. + ```bash git clone https://github.com/RobotLocomotion/drake.git -(cd drake && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/drake -DWITH_GUROBI=ON .. && make) +cd drake +sudo setup/ubuntu/source_distribution/install_prereqs.sh # install prereqs +(mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/drake -DWITH_GUROBI=ON .. && make) ``` -Then ensure you have Python installed; specifically, -install `python3-all-dev` if on Ubuntu, and use Homebrew Python -(not Apple's system Python) if on macOS. Finally, run *Drake's* -`install_prereqs` script to install the remaining system packages: - -```bash -$HOME/drake/share/drake/setup/install_prereqs -``` +Finally, for the code in this example, ensure you have `python3-all-dev` +installed if on Ubuntu. # Examples