-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sarlinpe/repr
- Loading branch information
Showing
5 changed files
with
145 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,21 @@ jobs: | |
{os: macos-13, arch: arm64}, | ||
{os: windows-latest}, | ||
] | ||
env: | ||
COMPILER_CACHE_VERSION: 1 | ||
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache | ||
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache | ||
CCACHE_BASEDIR: ${{ github.workspace }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set macOS env | ||
if: ${{ startsWith(matrix.config.os, 'macos') }} | ||
- uses: actions/cache@v3 | ||
id: cache-builds | ||
with: | ||
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.run_id }}-${{ github.run_number }} | ||
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }} | ||
path: ${{ env.COMPILER_CACHE_DIR }} | ||
- name: Set env (macOS) | ||
if: runner.os == 'macOS' | ||
run: | | ||
if [[ ${{ matrix.config.arch }} == "x86_64" ]]; then | ||
VCPKG_TARGET_TRIPLET="x64-osx" | ||
|
@@ -48,19 +59,61 @@ jobs: | |
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}" | ||
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}" | ||
echo "CIBW_CONFIG_SETTINGS_MACOS=${CONFIG_SETTINGS}" >> "$GITHUB_ENV" | ||
- name: Set Windows env | ||
if: ${{ startsWith(matrix.config.os, 'windows') }} | ||
# vcpkg binary caching | ||
VCPKG_CACHE_DIR="${COMPILER_CACHE_DIR}/vcpkg" | ||
VCPKG_BINARY_SOURCES="clear;files,${VCPKG_CACHE_DIR},readwrite" | ||
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" >> "$GITHUB_ENV" | ||
- name: Set env (Windows) | ||
if: runner.os == 'Windows' | ||
shell: pwsh | ||
run: | | ||
$CMAKE_TOOLCHAIN_FILE = "${env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" | ||
echo "CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" >> "${env:GITHUB_ENV}" | ||
$VCPKG_TARGET_TRIPLET = "x64-windows" | ||
echo "VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}" >> "${env:GITHUB_ENV}" | ||
# Fix: cibuildhweel cannot interpolate env variables. | ||
$CMAKE_TOOLCHAIN_FILE = $CMAKE_TOOLCHAIN_FILE.replace('\', '/') | ||
$CONFIG_SETTINGS = "cmake.define.CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" | ||
$CONFIG_SETTINGS = "${CONFIG_SETTINGS} cmake.define.VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}" | ||
echo "CIBW_CONFIG_SETTINGS_WINDOWS=${CONFIG_SETTINGS}" >> "${env:GITHUB_ENV}" | ||
# vcpkg binary caching | ||
$VCPKG_CACHE_DIR = "${env:COMPILER_CACHE_DIR}/vcpkg" | ||
$VCPKG_BINARY_SOURCES = "clear;files,${VCPKG_CACHE_DIR},readwrite" | ||
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" >> "${env:GITHUB_ENV}" | ||
- name: Set env (Ubuntu) | ||
if: runner.os == 'Linux' | ||
run: | | ||
VCPKG_TARGET_TRIPLET="x64-linux-release" | ||
echo "VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}" >> "$GITHUB_ENV" | ||
VCPKG_INSTALLATION_ROOT="${{ github.workspace }}/vcpkg" | ||
CMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" | ||
echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" >> "$GITHUB_ENV" | ||
echo "CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" >> "$GITHUB_ENV" | ||
# 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}" | ||
echo "CIBW_CONFIG_SETTINGS_LINUX=${CONFIG_SETTINGS}" >> "$GITHUB_ENV" | ||
# Remap caching paths to the container | ||
CONTAINER_COMPILER_CACHE_DIR="/compiler-cache" | ||
CIBW_CONTAINER_ENGINE="docker; create_args: -v ${COMPILER_CACHE_DIR}:${CONTAINER_COMPILER_CACHE_DIR}" | ||
echo "CIBW_CONTAINER_ENGINE=${CIBW_CONTAINER_ENGINE}" >> "$GITHUB_ENV" | ||
echo "COMPILER_CACHE_DIR=${CONTAINER_COMPILER_CACHE_DIR}" >> "$GITHUB_ENV" | ||
echo "CCACHE_DIR=${CONTAINER_COMPILER_CACHE_DIR}/ccache" >> "$GITHUB_ENV" | ||
echo "CCACHE_BASEDIR=/project" >> "$GITHUB_ENV" | ||
# vcpkg binary caching | ||
VCPKG_CACHE_DIR="${CONTAINER_COMPILER_CACHE_DIR}/vcpkg" | ||
VCPKG_BINARY_SOURCES="clear;files,${VCPKG_CACHE_DIR},readwrite" | ||
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" >> "$GITHUB_ENV" | ||
CIBW_ENVIRONMENT_PASS_LINUX="VCPKG_TARGET_TRIPLET VCPKG_INSTALLATION_ROOT CMAKE_TOOLCHAIN_FILE VCPKG_BINARY_SOURCES COMPILER_CACHE_DIR CCACHE_DIR CCACHE_BASEDIR" | ||
echo "CIBW_ENVIRONMENT_PASS_LINUX=${CIBW_ENVIRONMENT_PASS_LINUX}" >> "$GITHUB_ENV" | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,64 @@ | ||
#!/bin/bash | ||
set -e -x | ||
uname -a | ||
|
||
CURRDIR=$(pwd) | ||
echo "${CURRDIR}" | ||
|
||
# ------ Install dependencies from the default repositories ------ | ||
cd ${CURRDIR} | ||
yum install -y \ | ||
wget \ | ||
git \ | ||
gcc gcc-c++ make \ | ||
freeimage-devel \ | ||
metis-devel \ | ||
glew-devel \ | ||
suitesparse-devel \ | ||
atlas-devel \ | ||
lapack-devel \ | ||
blas-devel \ | ||
flann \ | ||
flann-devel \ | ||
lz4 \ | ||
lz4-devel | ||
yum install -y gcc gcc-c++ ninja-build curl zip unzip tar | ||
|
||
# ------ Install boost ------ | ||
cd ${CURRDIR} | ||
export BOOST_FILENAME=boost_1_71_0 | ||
wget -nv https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/${BOOST_FILENAME}.tar.gz | ||
tar xzf ${BOOST_FILENAME}.tar.gz | ||
cd ${BOOST_FILENAME} | ||
./bootstrap.sh --with-libraries=filesystem,system,program_options,graph,test --without-icu | ||
./b2 -j$(nproc) cxxflags="-fPIC" variant=release link=shared --disable-icu install | ||
# ccache shipped by CentOS is too old so we download and cache it. | ||
COMPILER_TOOLS_DIR="${COMPILER_CACHE_DIR}/bin" | ||
mkdir -p ${COMPILER_TOOLS_DIR} | ||
if [ ! -f "${COMPILER_TOOLS_DIR}/ccache" ]; then | ||
FILE="ccache-4.9-linux-x86_64" | ||
curl -sSLO https://github.com/ccache/ccache/releases/download/v4.9/${FILE}.tar.xz | ||
tar -xf ${FILE}.tar.xz | ||
cp ${FILE}/ccache ${COMPILER_TOOLS_DIR} | ||
fi | ||
export PATH="${COMPILER_TOOLS_DIR}:${PATH}" | ||
ccache --version | ||
ccache --help | ||
|
||
# ------ Install gflags ------ | ||
cd ${CURRDIR} | ||
git clone --branch v2.2.2 --depth 1 https://github.com/gflags/gflags.git | ||
cd gflags | ||
mkdir build && cd build | ||
cmake .. -DBUILD_SHARED_LIBS=ON | ||
make -j$(nproc) install | ||
|
||
# ------ Install glog ------ | ||
cd ${CURRDIR} | ||
git clone --branch v0.6.0 --depth 1 https://github.com/google/glog.git | ||
cd glog | ||
mkdir build && cd build | ||
cmake .. | ||
make -j$(nproc) install | ||
|
||
# ------ Install Eigen ------ | ||
cd ${CURRDIR} | ||
EIGEN_VERSION="3.3.9" | ||
export EIGEN_DIR="${CURRDIR}/eigen" | ||
wget https://gitlab.com/libeigen/eigen/-/archive/${EIGEN_VERSION}/eigen-${EIGEN_VERSION}.tar.gz | ||
tar -xvzf eigen-${EIGEN_VERSION}.tar.gz | ||
mv eigen-${EIGEN_VERSION} ${EIGEN_DIR} | ||
cd ${EIGEN_DIR} | ||
mkdir build && cd build | ||
cmake .. | ||
|
||
# ------ Install CERES solver ------ | ||
cd ${CURRDIR} | ||
git clone https://ceres-solver.googlesource.com/ceres-solver | ||
cd ceres-solver | ||
git checkout $(git describe --tags) # Checkout the latest release | ||
mkdir build && cd build | ||
cmake .. -DBUILD_TESTING=OFF \ | ||
-DBUILD_EXAMPLES=OFF \ | ||
-DEigen3_DIR="${EIGEN_DIR}/cmake/" | ||
make -j$(nproc) install | ||
git clone --branch sarlinpe/libraw-jaspter-nodefaults https://github.com/sarlinpe/vcpkg ${VCPKG_INSTALLATION_ROOT} | ||
cd ${VCPKG_INSTALLATION_ROOT} | ||
./bootstrap-vcpkg.sh | ||
./vcpkg install --recurse --clean-after-build --triplet=${VCPKG_TARGET_TRIPLET} \ | ||
boost-algorithm \ | ||
boost-filesystem \ | ||
boost-graph \ | ||
boost-heap \ | ||
boost-program-options \ | ||
boost-property-map \ | ||
boost-property-tree \ | ||
boost-regex \ | ||
boost-system \ | ||
ceres[lapack,suitesparse] \ | ||
eigen3 \ | ||
flann \ | ||
jasper[core] \ | ||
freeimage \ | ||
metis \ | ||
gflags \ | ||
glog \ | ||
gtest \ | ||
sqlite3 | ||
# We force the core option of jasper to disable the unwanted opengl option. | ||
./vcpkg integrate install | ||
|
||
# ------ Build COLMAP ------ | ||
cd ${CURRDIR} | ||
git clone https://github.com/colmap/colmap.git | ||
cd colmap | ||
git checkout ${COLMAP_COMMIT_ID} | ||
mkdir build && cd build | ||
CXXFLAGS="-fPIC" CFLAGS="-fPIC" cmake .. -DCMAKE_BUILD_TYPE=Release \ | ||
-DBoost_USE_STATIC_LIBS=OFF \ | ||
-DBOOST_ROOT=/usr/local \ | ||
-DCUDA_ENABLED=OFF \ | ||
-DCGAL_ENABLED=OFF \ | ||
-DGUI_ENABLED=OFF \ | ||
-DEIGEN3_INCLUDE_DIRS=$EIGEN_DIR | ||
make -j$(nproc) install | ||
CXXFLAGS="-fPIC" CFLAGS="-fPIC" cmake .. -GNinja \ | ||
-DCUDA_ENABLED=OFF \ | ||
-DCGAL_ENABLED=OFF \ | ||
-DGUI_ENABLED=OFF \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_TOOLCHAIN_FILE="${CMAKE_TOOLCHAIN_FILE}" \ | ||
-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} \ | ||
-DCMAKE_EXE_LINKER_FLAGS_INIT="-ldl" | ||
ninja install | ||
|
||
ccache --show-stats --verbose | ||
ccache --evict-older-than 1d | ||
ccache --show-stats --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters