diff --git a/tutorials/02_installation.md b/tutorials/02_installation.md index a8f68fa00..20ab10f78 100644 --- a/tutorials/02_installation.md +++ b/tutorials/02_installation.md @@ -1,15 +1,17 @@ \page installation Installation -This tutorial describes how to install Ignition Physics on Ubuntu Linux and macOS via either a binary distribution or from source. Support for Windows is coming soon. +This tutorial describes how to install Ignition Physics via either a binary distribution or from source. ## Ubuntu +### Prerequisites + Ignition Physics uses several c++17 features which are not available in the version of gcc supplied with Ubuntu Xenial, so Ubuntu Bionic or later is required. If you don't already have the `lsb-release` package installed, please do so now: -```{.sh} +``` sudo apt-get update sudo apt-get install lsb-release ``` @@ -17,64 +19,66 @@ sudo apt-get install lsb-release Setup your computer to accept software from [packages.osrfoundation.org](http://packages.osrfoundation.org): -```{.sh} +``` sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' ``` Setup keys: -```{.sh} +``` wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - ``` -**Install Ignition Physics binaries** +### Binary Install -```{.sh} +``` sudo apt-get update sudo apt-get install libignition-physics<#>-dev ``` Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. -**Build from source** +### Source Install 1. Run the following to install dependencies - ```{.sh} - sudo apt-add-repository -s "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -c -s) main" - sudo apt-get build-dep -y ignition-physics<#>-dev - ``` - Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. + ``` + sudo apt-add-repository -s "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -c -s) main" + sudo apt-get build-dep -y ignition-physics<#>-dev + ``` + Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. 2. Use gcc-8: - ``` - sudo apt update - sudo apt-get -y install g++-8 - sudo update-alternatives --install \ - /usr/bin/gcc gcc /usr/bin/gcc-8 800 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-8 \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-8 - ``` + ``` + sudo apt update + sudo apt-get -y install g++-8 + sudo update-alternatives --install \ + /usr/bin/gcc gcc /usr/bin/gcc-8 800 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-8 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-8 + ``` 3. Clone the repository - ``` - git clone https://github.com/ignitionrobotics/ign-physics -b ign-physics<#> - ``` - Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. + ``` + git clone https://github.com/ignitionrobotics/ign-physics -b ign-physics<#> + ``` + Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. 4. Configure and build - ``` - cd ign-physics; mkdir build; cd build; cmake ..; make - ``` + ``` + cd ign-physics; mkdir build; cd build; cmake ..; make + ``` 5. Optionally, install Ignition Physics - ``` - sudo make install - ``` + ``` + sudo make install + ``` ## macOS +### Prerequisites + Ignition Physics and several of its dependencies can be installed on macOS with [Homebrew](http://brew.sh/) using the [osrf/simulation tap](https://github.com/osrf/homebrew-simulation). Ignition Physics uses @@ -82,28 +86,28 @@ several c++17 features which are not available in macOS High Sierra (10.13) and earlier, so macOS Mojave (10.14) with XCode 10.1 are the minimum system requirements. -**Install Binaries using Homebrew** +### Install Binaries using Homebrew Install homebrew, which should also prompt you to install the XCode command-line tools: -```{.sh} +``` ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ``` Run the following commands: -```{.sh} +``` brew tap osrf/simulation brew install ignition-physics<#> ``` Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. -**Build from source using Homebrew** +### Build from source using Homebrew Run the following to install dependencies -```{.sh} +``` brew tap osrf/simulation brew install ignition-physics<#> --only-dependencies ``` @@ -111,13 +115,13 @@ brew install ignition-physics<#> --only-dependencies Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. Clone the ign-physics repository from GitHub -```{.sh} +``` git clone https://github.com/ignitionrobotics/ign-physics -b ign-physics<#> ``` Be sure to replace `<#>` with a number value, such as `1` or `2`, depending on which version you need. Then build using CMake -```{.sh} +``` cd ign-physics mkdir build cd build @@ -125,3 +129,66 @@ cmake .. make sudo make install ``` + +## Windows + +### Prerequisites + +First, follow the [ign-cmake](https://github.com/ignitionrobotics/ign-cmake) tutorial for installing Conda, Visual Studio, CMake, etc., prerequisites, and creating a Conda environment. + +Navigate to ``condabin`` if necessary to use the ``conda`` command (i.e., if Conda is not in your `PATH` environment variable. You can find the location of ``condabin`` in Anaconda Prompt, ``where conda``). + +Create if necessary, and activate a Conda environment: + +``` +conda create -n ign-ws +conda activate ign-ws +``` + +### Binary Install + +``` +conda install libignition-physics<#> --channel conda-forge +``` + +Be sure to replace `<#>` with a number value, such as 1 or 2, depending on +which version you need. + +### Source Install + +1. Install Ignition dependencies: + +You can view available versions and their dependencies: + +``` +conda search libignition-physics* --channel conda-forge --info +``` + +Install dependencies, replacing `<#>` with the desired versions: + +``` +conda install libignition-cmake<#> libignition-common<#> libignition-math<#> libignition-plugin<#> libsdformat<#> --channel conda-forge +``` + +1. Navigate to where you would like to build the library, and clone the repository. + + ``` + # Optionally, append `-b ign-physics#` (replace # with a number) to check out a specific version + git clone https://github.com/ignitionrobotics/ign-physics.git + ``` + +1. Configure and build + + ``` + cd ign-physics + mkdir build + cd build + cmake .. -DBUILD_TESTING=OFF # Optionally, -DCMAKE_INSTALL_PREFIX=path\to\install + cmake --build . --config Release + ``` + +1. Optionally, install + + ``` + cmake --install . --config Release + ```