Skip to content

Advanced use of vcpkg through manifest mode #1858

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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 10 additions & 26 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,34 +182,14 @@ jobs:
# Uses a specific version of vcpkg
run: |
cd ..
git clone https://github.com/alicevision/vcpkg.git
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
cd ${{ github.workspace }}

- name: vcpkg - Bootstrap
run: |
${{ env.vcpkgDir }}\bootstrap-vcpkg.bat

- name: vcpkg - Download zip file with prebuilt binaries
uses: suisei-cn/actions-download-file@v1.3.0
id: vcpkgDownload
with:
url: "https://github.com/alicevision/vcpkg/releases/download/2025.03.11/aliceVisionDeps-2025.03.11.zip"
target: "${{ env.vcpkgDir }}"
filename: installed.zip

- name: vcpkg - Unzip prebuilt binaries
run: |
tar -xvzf "${{ env.vcpkgArchive }}" -C "${{ env.vcpkgDir }}"

- name: vcpkg - Display installed packages
run: |
${{ env.vcpkgDir }}\vcpkg list

- name: vcpkg - Remove zip file with prebuilt binaries
run: |
rm ${{ env.vcpkgArchive }}

- name: Get CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.21
id: cuda-toolkit
Expand All @@ -223,13 +203,14 @@ jobs:
nvcc -V
echo ${{ env.CUDA_PATH }}

# Install latest CMake.
- uses: lukka/get-cmake@latest

- name: Display remaining disk space (16 Go max)
run: |
Get-CimInstance -Class Win32_logicaldisk

- name: vcpkg install
run: |
${{ env.VCPKG_ROOT }}\vcpkg install --triplet x64-windows-release

- name: Build
uses: lukka/run-cmake@v3
with:
Expand All @@ -238,7 +219,7 @@ jobs:
buildDirectory: ${{ env.buildDir }}
buildWithCMakeArgs: '--config Release --target install'
cmakeAppendedArgs: -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=x64-windows
-DVCPKG_TARGET_TRIPLET=x64-windows-release
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-A x64 -T host=x64
-DBUILD_SHARED_LIBS=ON
Expand Down Expand Up @@ -273,7 +254,10 @@ jobs:

- name: Python Binding - Unit Tests
run: |
${{ env.VCPKG_ROOT }}\installed\x64-windows\tools\python3\python -m pytest ./pyTests
set PYTHONPATH=${{ env.ALICEVISION_ROOT }}/install/bundle/bin
set PATH=${{ env.ALICEVISION_ROOT }}/install/bundle/bin;${{ env.PATH }}
pip install pytest
pytest ./pyTests

- name: Unit Tests
uses: lukka/run-cmake@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ Production

**/.vscode
**/.vs

#vcpkg
vcpkg_installed
65 changes: 15 additions & 50 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,68 +70,33 @@ In the scope of AliceVision, vcpkg has only been tested on Windows.

1. Install vcpkg

See the reference [installation guide](https://github.com/alicevision/vcpkg/blob/alicevision_master/README.md#quick-start-windows) to setup vcpkg.
We recommend to use our vcpkg fork, where dependencies have been validated by the AliceVision development team and where some ports may have some custom changes.
```bash
git clone https://github.com/alicevision/vcpkg --branch alicevision_master
git clone https://github.com/microsoft/vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat
```

2. Build the required dependencies
```bash
cd <VCPKG_INSTALL_DIR>
set VCPKG_ROOT=%cd%

vcpkg install ^
boost-algorithm boost-accumulators boost-atomic boost-container boost-date-time boost-exception ^
boost-geometry boost-graph boost-json boost-log boost-program-options boost-property-tree ^
boost-ptr-container boost-regex boost-serialization boost-system boost-test boost-thread boost-timer ^
boost-format ^
lz4 ^
liblemon ^
openexr ^
alembic ^
geogram ^
eigen3 ^
expat ^
flann nanoflann ^
onnxruntime-gpu ^
opencv[eigen,ffmpeg,webp,contrib,nonfree,cuda] ^
openimageio[opencolorio,pybind11,libraw,ffmpeg,freetype,opencv,gif,openjpeg,webp] ^
openmesh ^
ceres[suitesparse,cxsparse] ^
cuda ^
tbb ^
assimp ^
pcl ^
clp ^
libe57format ^
vcpkg-tool-swig ^
--triplet x64-windows

%VCPKG_ROOT%/installed/x64-windows/tools/python3/python -m ensurepip --upgrade
%VCPKG_ROOT%/installed/x64-windows/tools/python3/python -m pip install numpy
```
2. Build

3. Build AliceVision
```bash
# With VCPKG_ROOT being the path to the root of vcpkg installation
cd /path/to/aliceVision/
mkdir build && cd build
* Open "x64 Native Tools command Prompt for VS 2022" shipped with Visual studio 2022
* Move to the aliceVision root directory
* Build the dependencies and generate the solution for building (This command may take a long time the first time as it is building and installing all the required dependencies from sources.)

# Windows: Visual 2022 + Powershell
cmake .. -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT"\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -G "Visual Studio 17 2022" -A x64 -T host=x64
```bash
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=c:\path_to_vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=c:\path_to_install -DVCPKG_TARGET_TRIPLET=x64-windows-release -G "Visual Studio 17 2022" -A x64 -T host=x64 -DALICEVISION_BUILD_SWIG_BINDING=ON -DALICEVISION_USE_OPENCV=OFF -DPython3_EXECUTABLE=c:\path_to_python\python.exe
```

# Windows: Visual 2022
cmake .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -G "Visual Studio 17 2022" -A x64 -T host=x64
* Effectively build AliceVision and install it to `c:\path_to_install`

# Windows: Visual 2017
cmake .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -G "Visual Studio 15 2017" -A x64 -T host=x64
```bash
cmake --build build --config Release -t INSTALL
```

This generates a "aliceVision.sln" solution inside the build folder that you can open in Visual Studio to launch the build. Do not forget to switch the build type to "Release".
* Generate the bundle with all the dependencies in the same directory

```bash
cmake --build build --config Release -t bundle
```

Building the project with embedded dependencies (recommended on linux)
-----------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
message(SEND_ERROR "Failed to find SWIG.")
endif()

find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module NumPy) # Python dependencies
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) # Python dependencies
endif()


Expand Down
1 change: 0 additions & 1 deletion src/aliceVision/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()

Expand Down
1 change: 0 additions & 1 deletion src/aliceVision/camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
1 change: 0 additions & 1 deletion src/aliceVision/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
1 change: 0 additions & 1 deletion src/aliceVision/hdr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
1 change: 0 additions & 1 deletion src/aliceVision/numeric/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
1 change: 0 additions & 1 deletion src/aliceVision/sensorDB/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
1 change: 0 additions & 1 deletion src/aliceVision/sfmData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
1 change: 0 additions & 1 deletion src/aliceVision/sfmDataIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
1 change: 0 additions & 1 deletion src/aliceVision/stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING)
../include
${ALICEVISION_ROOT}/include
${Python3_INCLUDE_DIRS}
${Python3_NumPy_INCLUDE_DIRS}
)
endif()
22 changes: 22 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"default-registry": {
"kind": "git",
"baseline": "d5182f703b51d7b258f83f94d936ac03488dcdbe",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
},
{
"kind": "filesystem",
"path": "./vcpkg",
"packages": ["vcpkg-tool-swig"]
}
],
"overlay-ports": [
"vcpkg/overlay_ports"
]
}
90 changes: 90 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"dependencies": [
"boost-algorithm",
"boost-accumulators",
"boost-atomic",
"boost-container",
"boost-date-time",
"boost-exception",
"boost-geometry",
"boost-graph",
"boost-json",
"boost-log",
"boost-program-options",
"boost-property-tree",
"boost-ptr-container",
"boost-regex",
"boost-serialization",
"boost-system",
"boost-test",
"boost-thread",
"boost-timer",
"boost-format",
"libe57format",
"assimp",
"openexr",
"alembic",
"geogram",
"eigen3",
"expat",
"flann",
"nanoflann",
"onnxruntime-gpu",
"openmesh",
"tbb",
"cuda",
"liblemon",
"clp",
"coinutils",
"osi",
"vcpkg-tool-swig",
{
"name":"openimageio",
"features": ["opencolorio","libraw","gif","openjpeg"],
"default-features": false
},
{
"name":"ceres",
"features": ["suitesparse"]
},
{
"name": "opencv",
"features": ["eigen", "contrib", "nonfree", "cuda"],
"default-features": false
}
],
"overrides": [
{
"name": "openimageio",
"version": "2.5.16.0"
},
{
"name": "suitesparse",
"version": "5.8.0"
},
{
"name": "opencv",
"version": "4.10.0#0"
},
{
"name": "liblemon",
"version": "2019-06-13#10"
},
{
"name": "clp",
"version": "1.17.6#1"
},
{
"name": "osi",
"version": "0.108.6#1"
},
{
"name": "coinutils",
"version": "2.11.4#1"
},
{
"name": "ceres",
"version": "2.2.0#0"
}
]
}
13 changes: 13 additions & 0 deletions vcpkg/overlay_ports/liblemon/cpp-20-adaptors.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/lemon/adaptors.h b/lemon/adaptors.h
index 1a40f8e..ffeb12d 100644
--- a/lemon/adaptors.h
+++ b/lemon/adaptors.h
@@ -37,7 +37,7 @@

namespace lemon {

-#ifdef _MSC_VER
+#if defined _MSC_VER and __cplusplus < 202002L
#define LEMON_SCOPE_FIX(OUTER, NESTED) OUTER::NESTED
#else
#define LEMON_SCOPE_FIX(OUTER, NESTED) typename OUTER::template NESTED
Loading
Loading