Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows installation via conda-forge #139

Merged
merged 16 commits into from
Jan 21, 2021
91 changes: 84 additions & 7 deletions tutorials/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,35 @@ Install Ignition 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](https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html).
Miniconda suffices.

Create if necessary, and activate a Conda environment:
mabelzhang marked this conversation as resolved.
Show resolved Hide resolved

conda create -n ign-ws
conda activate ign-ws

Install Ignition CMake:

conda install libignition-cmake<#> --channel conda-forge

Be 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 libignition-cmake* --channel conda-forge

and view their dependencies with

conda search libignition-cmake* --channel conda-forge --info

and install a specific minor version with

conda install libignition-cmake=2.6.1 --channel conda-forge

## Source Install

### Prerequisites
Expand All @@ -60,6 +89,23 @@ Add OSRF packages:
wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add -
sudo apt-add-repository -s "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -c -s) main"

Only on Bionic, update the GCC compiler version:

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

#### Windows 10
mabelzhang marked this conversation as resolved.
Show resolved Hide resolved

1. Install [Conda package management system](https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html).
Miniconda suffices.

1. Install [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/).
The Community version is free for students, open-source contributors, and individuals.
JShep1 marked this conversation as resolved.
Show resolved Hide resolved
Check "Desktop development with C++" in the Workloads tab, and uncheck C++ CMake Tools. We will install cmake via Conda.
mabelzhang marked this conversation as resolved.
Show resolved Hide resolved

### Building from source

#### Ubuntu

Clone source code:

# This checks out the `main` branch. You can append `-b ign-cmake#` (replace # with a number) to checkout a specific version
Expand All @@ -69,13 +115,6 @@ Install dependencies

sudo apt -y install $(sort -u $(find . -iname 'packages.apt') | tr '\n' ' ')

Only on Bionic, update the GCC compiler version:

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


### Building from source

Build and install as follows:

cd ign-cmake
Expand All @@ -85,6 +124,44 @@ Build and install as follows:
make -j4
sudo make install

#### Windows

Open a Visual Studio Command Prompt (search for "x64 Native Tools Command Prompt for VS 2019" in the Windows search near the Start button).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI PR conda-forge/vc-feedstock#19 added the package vs2019_win-64, that should source automatically the necessary variables of VS2019, but to be honest I tried it now and it is not working correctly for me, so probably sticking to this well known method is a good idea for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"feedstock" is a new word to me. Is the idea that with that package, Visual Studio can be installed via something like conda install vc vs2019_win-64, instead of from the Microsoft downloads? And then instead of using the VS Command Prompt, people can use the Anaconda prompt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the jargon. In conda, the "feedstock" is the repository that contains the metadata and the scripts to generate a conda package for a given library (see https://conda-forge.org/#about for more info).

The vs2019_win-64 conda package does not install Visual Studio 2019, but it just automatically invokes the script to set the environment variables set in the VS Command Prompt when a conda environment containg it is activated. However, as I was writing in the previous comment is not working correctly (at least for me). In any case if you use the Visual Studio 2019 16 Generator (as you are doing implicitly now in the docs), instead of the Ninja or NMake generator, it is not necessary to use it as CMake will handle all that configuration automatically.

Copy link
Contributor Author

@mabelzhang mabelzhang Dec 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! I understand half of that, but sounds good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ask for the point in which I was not clear. Re-reading it, I think it would be helpful to point out that the default CMake generator in Windows is the latest Visual Studio one if found, so following the instructions the build will default to use https://cmake.org/cmake/help/v3.19/generator/Visual%20Studio%2016%202019.html .

mabelzhang marked this conversation as resolved.
Show resolved Hide resolved
Right-click and run as Administrator.
mabelzhang marked this conversation as resolved.
Show resolved Hide resolved
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.
mabelzhang marked this conversation as resolved.
Show resolved Hide resolved
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``.

1. Navigate to your ``condabin`` if necessary, and then create and activate a Conda environment:

conda create -n ign-ws
conda activate ign-ws

Once you have activated an environment, a prefix like ``(ign-ws)`` will be prepended to your prompt, and you can use the ``conda`` command outside of ``condabin``.

You can use ``conda info --envs`` to see all your environments.

To remove an environment, use``conda env remove --name <env_name>``.
mabelzhang marked this conversation as resolved.
Show resolved Hide resolved

1. Install dependencies

conda install git cmake pkg-config --channel conda-forge

1. Navigate to where you would like to build the library, and then clone the repository.

# Optionally, append `-b ign-cmake#` (replace # with a number) to check out a specific version
git clone https://github.com/ignitionrobotics/ign-cmake.git

1. Build. Tests do not build at this time, so we turn tests off.
JShep1 marked this conversation as resolved.
Show resolved Hide resolved

cd ign-cmake
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF # Optionally, -DCMAKE_INSTALL_PREFIX=path\to\install
cmake --build . --config Release
cmake --install . --config Release

# Documentation

API documentation and tutorials can be accessed at
Expand Down