8000 Define vcpkg manifest by ahojnnes · Pull Request #2426 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Define vcpkg manifest #2426

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

Merged
merged 29 commits into from
Feb 21, 2024
Merged
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
9 changes: 7 additions & 2 deletions .github/workflows/build-pycolmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
# Fix: cibuildhweel cannot interpolate env variables.
CONFIG_SETTINGS="cmake.define.CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}"
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.VCPKG_INSTALLED_DIR=${{ github.workspace }}/build/vcpkg_installed"
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
echo "CIBW_CONFIG_SETTINGS_MACOS=${CONFIG_SETTINGS}" >> "$GITHUB_ENV"

Expand All @@ -67,7 +68,7 @@ jobs:
if: runner.os == 'Windows'
shell: pwsh
run: |
$VCPKG_INSTALLATION_ROOT="${{ github.workspace }}/vcpkg"
$VCPKG_INSTALLATION_ROOT = "${{ github.workspace }}/vcpkg"
echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" >> "${env:GITHUB_ENV}"
$CMAKE_TOOLCHAIN_FILE = "${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
echo "CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" >> "${env:GITHUB_ENV}"
Expand All @@ -76,10 +77,13 @@ jobs:

# Fix: cibuildhweel cannot interpolate env variables.
$CMAKE_TOOLCHAIN_FILE = $CMAKE_TOOLCHAIN_FILE.replace('\', '/')
$VCPKG_INSTALLED_DIR = "${{ github.workspace }}/build/vcpkg_installed"
$VCPKG_INSTALLED_DIR = $VCPKG_INSTALLED_DIR.replace('\', '/')
$CONFIG_SETTINGS = "cmake.define.CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
$CONFIG_SETTINGS = "${CONFIG_SETTINGS} cmake.define.VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}"
$CONFIG_SETTINGS = "${CONFIG_SETTINGS} cmake.define.VCPKG_INSTALLED_DIR=${VCPKG_INSTALLED_DIR}"
echo "CIBW_CONFIG_SETTINGS_WINDOWS=${CONFIG_SETTINGS}" >> "${env:GITHUB_ENV}"
$CIBW_REPAIR_WHEEL_COMMAND = "delvewheel repair -v --add-path ${VCPKG_INSTALLATION_ROOT}/installed/${VCPKG_TARGET_TRIPLET}/bin -w {dest_dir} {wheel}"
$CIBW_REPAIR_WHEEL_COMMAND = "delvewheel repair -v --add-path ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin -w {dest_dir} {wheel}"
echo "CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=${CIBW_REPAIR_WHEEL_COMMAND}" >> "${env:GITHUB_ENV}"

# vcpkg binary caching
Expand All @@ -100,6 +104,7 @@ jobs:
# Fix: cibuildhweel cannot interpolate env variables.
CONFIG_SETTINGS="cmake.define.CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}"
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.VCPKG_INSTALLED_DIR=/project/build/vcpkg_installed"
echo "CIBW_CONFIG_SETTINGS_LINUX=${CONFIG_SETTINGS}" >> "$GITHUB_ENV"

# Remap caching paths to the container
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ jobs:
cd ../doc/sample-project
mkdir build
cd build
colmap_DIR=${{ github.workspace }}/build/install/share/colmap cmake .. \
export colmap_DIR=${{ github.workspace }}/build/install/share/colmap
cmake .. \
-GNinja \
-DCMAKE_CUDA_ARCHITECTURES=50
ninja
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/build-windows-vcpkg.txt

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
VCPKG_COMMIT_ID: fa6e6a6ec3224f1d3697d544edef6272a59cd834
VCPKG_COMMIT_ID: 13bde2ff13192e1b2fdd37bd9b475c7665ae6ae5
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

steps:
Expand Down Expand Up @@ -78,7 +78,6 @@ jobs:
cd vcpkg
git reset --hard ${{ env.VCPKG_COMMIT_ID }}
./bootstrap-vcpkg.bat
./vcpkg.exe install --recurse @${{ github.workspace }}/.github/workflows/build-windows-vcpkg.txt --clean-after-build

- name: Configure and build
shell: pwsh
Expand All @@ -93,8 +92,10 @@ jobs:
-DCMAKE_MAKE_PROGRAM=ninja `
-DCMAKE_BUILD_TYPE=Release `
-DTESTS_ENABLED=ON `
-DGUI_ENABLED=ON `
-DCUDA_ENABLED=OFF `
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=x64-windows
-DVCPKG_TARGET_TRIPLET=x64-windows-release
ninja

- name: Run tests
Expand Down
51 changes: 31 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@

cmake_minimum_required(VERSION 3.10)

################################################################################
# Options
################################################################################

option(SIMD_ENABLED "Whether to enable SIMD optimizations" ON)
option(OPENMP_ENABLED "Whether to enable OpenMP parallelization" ON)
option(IPO_ENABLED "Whether to enable interprocedural optimization" ON)
option(CUDA_ENABLED "Whether to enable CUDA, if available" ON)
option(GUI_ENABLED "Whether to enable the graphical UI" ON)
option(OPENGL_ENABLED "Whether to enable OpenGL, if available" ON)
option(TESTS_ENABLED "Whether to build test binaries" OFF)
option(ASAN_ENABLED "Whether to enable AddressSanitizer flags" OFF)
option(PROFILING_ENABLED "Whether to enable google-perftools linker flags" OFF)
option(CCACHE_ENABLED "Whether to enable co 6D40 mpiler caching, if available" ON)
option(CGAL_ENABLED "Whether to enable the CGAL library" ON)

# Propagate options to vcpkg manifest.
if(TESTS_ENABLED)
enable_testing()
list(APPEND VCPKG_MANIFEST_FEATURES "tests")
endif()
if(CUDA_ENABLED)
list(APPEND VCPKG_MANIFEST_FEATURES "cuda")
endif()
if(GUI_ENABLED)
list(APPEND VCPKG_MANIFEST_FEATURES "gui")
endif()
if(CGAL_ENABLED)
list(APPEND VCPKG_MANIFEST_FEATURES "cgal")
endif()

project(COLMAP LANGUAGES C CXX)

set(COLMAP_VERSION "3.10-dev")
Expand Down Expand Up @@ -57,26 +88,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeHelper.cmake NO_POLICY_SCOPE)
# COLMAP's static libraries.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

################################################################################
# Options
################################################################################

option(SIMD_ENABLED "Whether to enable SIMD optimizations" ON)
option(OPENMP_ENABLED "Whether to enable OpenMP parallelization" ON)
option(IPO_ENABLED "Whether to enable interprocedural optimization" ON)
option(CUDA_ENABLED "Whether to enable CUDA, if available" ON)
option(GUI_ENABLED "Whether to enable the graphical UI" ON)
option(OPENGL_ENABLED "Whether to enable OpenGL, if available" ON)
option(TESTS_ENABLED "Whether to build test binaries" OFF)
option(ASAN_ENABLED "Whether to enable AddressSanitizer flags" OFF)
option(PROFILING_ENABLED "Whether to enable google-perftools linker flags" OFF)
option(CCACHE_ENABLED "Whether to enable compiler caching, if available" ON)
option(CGAL_ENABLED "Whether to enable the CGAL library" ON)

if(TESTS_ENABLED)
enable_testing()
endif()

################################################################################
# Dependency configuration
################################################################################
Expand Down
10 changes: 2 additions & 8 deletions pycolmap/ci/install-colmap-centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,18 @@ if [ ! -f "${COMPILER_TOOLS_DIR}/ccache" ]; then
cp ${FILE}/ccache ${COMPILER_TOOLS_DIR}
fi
export PATH="${COMPILER_TOOLS_DIR}:${PATH}"
ccache --version
ccache --help

# Build the dependencies
DEPENDENCIES=$(cat ${CURRDIR}/pycolmap/ci/vcpkg-dependencies.txt)
# Setup vcpkg
git clone https://github.com/microsoft/vcpkg ${VCPKG_INSTALLATION_ROOT}
cd ${VCPKG_INSTALLATION_ROOT}
git checkout ${VCPKG_COMMIT_ID}
./bootstrap-vcpkg.sh
./vcpkg install --recurse --clean-after-build \
--triplet=${VCPKG_TARGET_TRIPLET} \
${DEPENDENCIES}
./vcpkg integrate install

# Build COLMAP
cd ${CURRDIR}
mkdir build && cd build
CXXFLAGS="-fPIC" CFLAGS="-fPIC" cmake .. -GNinja \
cmake .. -GNinja \
-DCUDA_ENABLED=OFF \
-DCGAL_ENABLED=OFF \
-DGUI_ENABLED=OFF \
Expand Down
6 changes: 1 addition & 5 deletions pycolmap/ci/install-colmap-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ brew install git cmake ninja llvm ccache
# When building lapack-reference, vcpkg/cmake looks for gfortran.
ln -s $(which gfortran-13) "$(dirname $(which gfortran-13))/gfortran"

# Build the dependencies
DEPENDENCIES=$(cat ${CURRDIR}/pycolmap/ci/vcpkg-dependencies.txt)
# Setup vcpkg
git clone https://github.com/microsoft/vcpkg ${VCPKG_INSTALLATION_ROOT}
cd ${VCPKG_INSTALLATION_ROOT}
git checkout ${VCPKG_COMMIT_ID}
./bootstrap-vcpkg.sh
./vcpkg install --recurse --clean-after-build \
--triplet=${VCPKG_TARGET_TRIPLET} \
${DEPENDENCIES}
./vcpkg integrate install

# Build COLMAP
Expand Down
6 changes: 1 addition & 5 deletions pycolmap/ci/install-colmap-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If (!(Test-Path -path "${COMPILER_TOOLS_DIR}/ccache.exe" -PathType Leaf)) {
Remove-Item -Recurse ${folder_path}
}

# Build the dependencies
# Setup vcpkg
cd ${CURRDIR}
git clone https://github.com/microsoft/vcpkg ${env:VCPKG_INSTALLATION_ROOT}
cd ${env:VCPKG_INSTALLATION_ROOT}
Expand All @@ -35,10 +35,6 @@ git checkout "${env:VCPKG_COMMIT_ID}"

cd ${CURRDIR}
& "./scripts/shell/enter_vs_dev_shell.ps1"

[System.Collections.ArrayList]$DEPS = Get-Content -Path "./pycolmap/ci/vcpkg-dependencies.txt"
& "${env:VCPKG_INSTALLATION_ROOT}/vcpkg.exe" install --recurse --clean-after-build `
--triplet="${env:VCPKG_TARGET_TRIPLET}" @DEPS
& "${env:VCPKG_INSTALLATION_ROOT}/vcpkg.exe" integrate install

# Build COLMAP
Expand Down
19 changes: 0 additions & 19 deletions pycolmap/ci/vcpkg-dependencies.txt

This file was deleted.

2 changes: 1 addition & 1 deletion pycolmap/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ archs = ["auto64"]
test-command = "python -c \"import pycolmap; print(pycolmap.__version__)\""

[tool.cibuildwheel.environment]
VCPKG_COMMIT_ID = "fa6e6a6ec3224f1d3697d544edef6272a59cd834"
VCPKG_COMMIT_ID = "13bde2ff13192e1b2fdd37bd9b475c7665ae6ae5"

[tool.cibuildwheel.linux]
before-all = "{package}/ci/install-colmap-centos.sh"
Expand Down
70 changes: 70 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "colmap",
"description": "COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline with a graphical and command-line interface. It offers a wide range of features for reconstruction of ordered and unordered image collections. The software is licensed under the new BSD license.",
"homepage": "https://colmap.github.io/",
"license": "BSD-3-Clause",
"supports": "(linux | (windows & !static) | osx) & (x86 | x64 | arm64)",
"dependencies": [
"boost-algorithm",
"boost-filesystem",
"boost-graph",
"boost-heap",
"boost-program-options",
"boost-property-map",
"boost-property-tree",
{
"name": "ceres",
"features": [
"lapack",
"suitesparse"
]
},
"eigen3",
"flann",
"freeimage",
"gflags",
"glog",
{
"name": "jasper",
"default-features": false
},
"metis",
"sqlite3",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"tests": {
"description": "Build all tests.",
"dependencies": [
"gtest"
]
},
"cuda": {
"description": "Build with CUDA.",
"dependencies": [
"glew",
"cuda"
]
},
"gui": {
"description": "Build the GUI.",
"dependencies": [
"glew",
"qt5-base"
]
},
"cgal": {
"description": "Build with CGAL.",
"dependencies": [
"cgal"
]
}
}
}
0