These instructions are for installing only Gazebo CMake. If you're interested in using all the Gazebo libraries, not only Gazebo CMake, check out this Gazebo installation.
We recommend following the binary install instructions to get up and running as quickly and painlessly as possible.
The source install instructions should be used if you need the very latest software improvements, if you need to modify the code, or if you plan to make a contribution.
Binary Install
Ubuntu
On Ubuntu, it's possible to install Gazebo CMake as follows:
Add OSRF packages:
Install Gazebo CMake:
Be sure to replace <#>
with a number value, such as 1 or 2, depending on which version you need.
macOS
On macOS, add OSRF packages:
Install Gazebo CMake:
Be sure to replace <#>
with a number value, such as 1 or 2, depending on which version you need.
Windows
Install Conda package management system. Miniconda suffices.
Open a Visual Studio Command Prompt (search for "x64 Native Tools Command Prompt for VS 2019" in the Windows search near the Start button). Optionally, right-click and pin to the task bar for quick access in the future.
If you did not add Conda to your PATH
environment variable during Conda installation, you may need to navigate to the location of condabin
in order to use the conda
command. To find condabin
, search for "Anaconda Prompt" in the Windows search near the Start button, open it, run where conda
, and look for a line containing the directory condabin
.
Navigate to your
condabin
if necessary, and then create and activate a Conda environment:conda create -n gz-wsconda activate gz-wsOnce you have activated an environment, a prefix like
(gz-ws)
will be prepended to your prompt, and you can use theconda
command outside ofcondabin
.You can use
conda info --envs
to see all your environments.To remove an environment, use
conda env remove --name <env_name>
.Install Gazebo CMake:
conda install libgz-cmake<#> --channel conda-forgeBe sure to replace
<#>
with a number value, such as 1 or 2, depending on which version you need.You can view all the versions with
conda search libgz-cmake* --channel conda-forgeand view their dependencies with
conda search libgz-cmake* --channel conda-forge --infoand install a specific minor version with
conda install libgz-cmake=2.6.1 --channel conda-forge
Source Install
Ubuntu Focal 20.04 or above
Prerequisites
Add OSRF packages:
Building from source
Clone source code:
Install dependencies
Build and install as follows:
Windows 10
Prerequisites
- Install Conda package management system. Miniconda suffices.
- Install Visual Studio 2019. The Community version is free for students, open-source contributors, and individuals. Check "Desktop development with C++" in the "Workloads" tab, and uncheck "C++ CMake Tools". We will install
cmake
via Conda.
Building from source
Open a Visual Studio Command Prompt (search for "x64 Native Tools Command Prompt for VS 2019" in the search field near the Windows button). Optionally, right-click and pin to the task bar for quick access in the future.
If you did not add Conda to your PATH
environment variable during Conda installation, you may need to navigate to the location of condabin
in order to use the conda
command. To find condabin
, search for "Anaconda Prompt" in the search field near the Windows button, open it, run where conda
, and look for a line containing the directory condabin
.
Navigate to your
condabin
if necessary, and then create and activate a Conda environment:conda create -n gz-wsconda activate gz-wsOnce you have activated an environment, a prefix like
(gz-ws)
will be prepended to your prompt, and you can use theconda
command outside ofcondabin
.You can use
conda info --envs
to see all your environments.To remove an environment, use
conda env remove --name <env_name>
.- Install dependencies conda install git cmake pkg-config --channel conda-forge
- Navigate to where you would like to build the library, and then clone the repository. # Optionally, append `-b gz-cmake#` (replace # with a number) to check out a specific versiongit clone https://github.com/gazebosim/gz-cmake.git
- Build. cd gz-cmakemkdir buildcd buildcmake .. # Optionally, -DCMAKE_INSTALL_PREFIX=path\to\installcmake --build . --config Releasecmake --install . --config Release
Note If you find that the build is failing due to failures in the test
directory, then you may need to disable tests by adding -DBUILD_TESTING=OFF
to the cmake ..
command.
Documentation
API documentation and tutorials can be accessed at https://gazebosim.org/libs/cmake
You can also generate the documentation from a clone of this repository by following these steps.
- You will need Doxygen. On Ubuntu Doxygen can be installed using sudo apt-get install doxygen
Clone the repository
git clone https://github.com/gazebosim/gz-cmake- Configure and build the documentation. cd gz-cmakemkdir buildcd buildcmake ..make doc
- View the documentation by running the following command from the
build
directory.firefox doxygen/html/index.html
Note Alternatively, documentation for gz-cmake
can be found within the source code, and also in the MIGRATION.md guide.
Testing
Follow these steps to run tests and static code analysis in your clone of this repository.
- Follow the source install instruction.
- Run tests. make test
- Static code checker. make codecheck
Additionally, a fuller suite of tests in the examples
directory can be enabled by building with BUILDSYSTEM_TESTING
enabled. Tests can be run by building the test
target. From your build directory you can run:
See the Writing Tests section of the gz-cmake contributor documentation for help creating or modifying tests.