Skip to content

Commit

Permalink
Update to recent vcpkg version (#14)
Browse files Browse the repository at this point in the history
* Update to recent vcpkg version

In particular: 
* Use a recent commit of vcpkg, microsoft/vcpkg@28ab0b1 that contains microsoft/vcpkg#10644 
* Update qt5 to build with the `latest` feature, that install qt 5.14 that should be the first version of qt completely relocatable ( https://www.qt.io/blog/qt-is-relocatable )  
* Substitute opencv3 with opencv, that install opencv4 
* Install also `asio`, `boost-asio`, `boost-process`, `boost-dll`,  `boost-filesystem` and `boost-system`, to fix #7 
* As the newer version of vcpkg are affected by the bug microsoft/vcpkg#10119, clone the `robotology-vcpkg-binary-ports` repo in `C:/robotology`, so that it will be contained in the same archive  used to distribute the vcpkg dependencies .
  • Loading branch information
traversaro authored Apr 29, 2020
1 parent 98baac8 commit 961e421
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 11 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,35 @@ jobs:
wget https://github.com/robotology/robotology-vcpkg-binary-ports/releases/download/storage/robotology-vcpkg-2019.10-ace.zip
7z x robotology-vcpkg-2019.10-ace.zip
rm robotology-vcpkg-2019.10-ace.zip
cd C:/robotology/vcpkg
# Update vcpkg to a newer commit
git fetch
git checkout 5852144908b2c714be6f0d343f1de01ca2ec7758
C:/robotology/vcpkg/bootstrap-vcpkg.sh
git clone https://github.com/robotology-dependencies/robotology-vcpkg-binary-ports C:/robotology-vcpkg-binary-ports
cd C:/robotology-vcpkg-binary-ports
git clone https://github.com/robotology-dependencies/robotology-vcpkg-binary-ports C:/robotology/robotology-vcpkg-binary-ports
cd C:/robotology/robotology-vcpkg-binary-ports
git checkout v0.1.0
- name: Install vcpkg ports
shell: bash
run: |
# TinyXML is not installed as a workaround for https://github.com/robotology/ycm/pull/296
C:/robotology/vcpkg/vcpkg.exe --overlay-ports=C:/robotology-vcpkg-binary-ports install --triplet x64-windows ace freeglut gsl eigen3 esdcan-binary ode openssl libxml2 eigen3 opencv3 matio sdl1 sdl2 qt5-base ipopt-binary qt5-declarative qt5-multimedia qt5-quickcontrols2 sqlite3[core,tool]
# Remove temporary files https://github.com/Microsoft/vcpkg/blob/master/docs/about/faq.md#how-can-i-remove-temporary-files
rm -rf C:/robotology/vcpkg/buildtrees
rm -rf C:/robotology/vcpkg/packages
rm -rf C:/robotology/vcpkg/downloads
C:/robotology/vcpkg/vcpkg.exe --overlay-ports=C:/robotology/robotology-vcpkg-binary-ports install --triplet x64-windows ace asio boost-asio boost-process boost-dll boost-filesystem boost-system freeglut gsl eigen3 esdcan-binary ode openssl libxml2 eigen3 opencv matio sdl1 sdl2 qt5-base[latest] ipopt-binary qt5-declarative qt5-multimedia qt5-quickcontrols qt5-quickcontrols2 sqlite3[core,tool]
# Remove temporary files https://github.com/Microsoft/vcpkg/blob/master/docs/about/faq.md#how-can-i-remove-temporary-files
# For some reason doing using git bash to do rm -rf fails for icu's port buildtrees, probably for the use of msys2
# See https://github.com/microsoft/vcpkg/issues/10365
- name: Cleanup vcpkg temporary directories
shell: cmd
run: |
RMDIR /Q/S C:\robotology\vcpkg\buildtrees
RMDIR /Q/S C:\robotology\vcpkg\packages
RMDIR /Q/S C:\robotology\vcpkg\downloads
- uses: actions/upload-artifact@master
with:
name: vcpkg-robotology
path: C:/robotology/vcpkg
path: C:/robotology

- name: Prepare release file
if: github.event_name == 'release'
Expand Down
53 changes: 50 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,72 @@ Windows binaries for the dependencies of robotology-superbuild .

The following libraries (and their dependencies) are built using `vcpkg`:
* `ace`
* `asio`
* `boost-asio`
* `boost-process`
* `boost-dll`
* `boost-filesystem`
* `boost-system`
* `freeglut`
* `gsl`
* `eigen3`
* `ode`
* `libxml2`
* `eigen3`
* `opencv3`
* `opencv`
* `matio`
* `sdl1`
* `sdl2`
* `qt5-base`
* `qt5-base[latest]`
* `qt5-declarative`
* `qt5-multimedia`
* `qt5-quickcontrols`
* `qt5-quickcontrols2`
* `sqlite3[core,tool]`

furthermore, the `ipopt-binary` and the `esdcan-binary` from [`robotology-vcpkg-binary-ports`](https://github.com/robotology-dependencies/robotology-vcpkg-binary-ports) is also installed.

The binaries are generated by installing vcpkg in `C:/robotology/vcpkg`, installing the selected ports, and compressing the vcpkg-robotology directory in a `.zip` archive.
The binaries are generated by installing vcpkg in `C:/robotology/vcpkg`, installing the selected ports, and compressing the `C:/robotology` directory in a `.zip` archive.

See [releases](https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/releases) to download the archives.

## Usage
To use the archive, you just need to donwload it and extract it in the `C:/` directory.

To use then vcpkg libraries, you need to configure your CMake projects to use the vcpkg's
toolchain as `CMAKE_TOOLCHAIN_FILE`, for example by configuring the projects as:
~~~
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=C:/robotology/vcpkg/scripts/buildsystems/vcpkg.cmake ..
~~~
See [vcpkg's documentation](https://github.com/microsoft/vcpkg/blob/master/docs/users/integration.md#cmake-toolchain-file-recommended-for-open-source-cmake-projects) for more info on how to use vcpkg-installed libraries.

### Install or remove ports
You can install or remove ports from the vcpkg installation in `C:/robotology/vcpkg` as you do for any other vcpkg installation.

However, as this vcpkg installation contains some ports installed from the custom port repo contained in `C:/robotology/vcpkg`,
due to a regression in vcpkg (see https://github.com/microsoft/vcpkg/issues/10119) you need to pass the `--overlay-ports=C:/robotology/vcpkg/robotology-vcpkg-binary-ports` argument whenever you use vcpkg.

For example, to install a new port called `<portname>` the correct command is:
~~~
./vcpkg.exe install --overlay-ports=C:/robotology/vcpkg/robotology-vcpkg-binary-ports <portname>:x64-windows
~~~


### GitHub Actions
To use the script in a GitHub Action script, you can use the following snippet:
~~~~
- name: Dependencies [Windows]
if: matrix.os == 'windows-latest'
run: |
# To avoid spending a huge time compiling vcpkg dependencies, we download an archive
# that comes precompiled with all the ports that we need
choco install -y wget unzip
# To avoid problems with non-relocatable packages, we unzip the archive exactly in the same directory
# that has been used to create the pre-compiled archive
cd C:/
wget https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/releases/download/<INSERT_HERE_THE_USED_VERSION>/vcpkg-robotology.zip
unzip vcpkg-robotology.zip -d C:/
rm vcpkg-robotology.zip
~~~~


0 comments on commit 961e421

Please sign in to comment.