Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
Reduce the wheel size by disabling GUI and Qt
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe committed Jan 2, 2022
1 parent 0ca8edf commit aad4be7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
11 changes: 2 additions & 9 deletions package/build-wheels-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ yum -y install wget

ls -ltrh /io/

yum -y install qt5-qtbase-devel

# we cannot simply use `pip` or `python`, since points to old 2.7 version
PYBIN="/opt/python/$PYTHON_VERSION/bin"
PYVER_NUM=$($PYBIN/python -c "import sys;print(sys.version.split(\" \")[0])")
Expand Down Expand Up @@ -72,10 +70,7 @@ yum install \
libgoogle-glog-dev \
libgflags-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev
yum install libcgal-qt5-dev


# Note: `yum install gflags` will not work, since the version is too old (2.1)
Expand Down Expand Up @@ -137,10 +132,7 @@ yum install libsuitesparse-dev
yum install libgoogle-glog-dev
yum install libgflags-dev
yum install libglew-dev
yum install qtbase5-dev
yum install libqt5opengl5-dev
yum install libcgal-dev
yum install libcgal-qt5-dev

yum -y install freeimage

Expand All @@ -162,9 +154,10 @@ cd colmap
git checkout dev
mkdir build/
cd build/
cmake .. -DCMAKE_BUILD_TYPE=Release \
CXXFLAGS="-fPIC" CFLAGS="-fPIC" cmake .. -DCMAKE_BUILD_TYPE=Release \
-DBoost_USE_STATIC_LIBS=ON \
-DBOOST_ROOT=/usr/local \
-DGUI_ENABLED=OFF \
-DEIGEN3_INCLUDE_DIRS=$EIGEN_DIR

if [ $ec -ne 0 ]; then
Expand Down
11 changes: 3 additions & 8 deletions package/build-wheels-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@ brew update
brew upgrade
brew install wget python cmake || true
# TODO: try without brew install of boost, but use version below
brew install git cmake boost eigen freeimage glog gflags suite-sparse ceres-solver glew cgal qt5
brew install git cmake boost eigen freeimage glog gflags suite-sparse ceres-solver glew cgal

brew install llvm libomp

brew info gcc
brew upgrade gcc
brew info gcc

echo 'export PATH="/usr/local/opt/qt@5/bin:$PATH"' >> /Users/runner/.bash_profile
export Qt5_CMAKE_DIR="/usr/local/opt/qt@5/lib/cmake/Qt5"

CURRDIR=$(pwd)
ls -ltrh $CURRDIR

Expand All @@ -61,8 +58,6 @@ declare -a PYTHON_VERS=( $1 )

git clone https://github.com/colmap/colmap.git

sed -i -e 's/Qt5 5.4/Qt5 5.15.2/g' colmap/CMakeLists.txt

for compiler in cc c++ gcc g++ clang clang++
do
which $compiler
Expand All @@ -89,7 +84,7 @@ cd colmap
git checkout dev
mkdir build
cd build
cmake .. -DQt5_DIR=$Qt5_CMAKE_DIR
cmake .. -DGUI_ENABLED=OFF

# examine exit code of last command
ec=$?
Expand All @@ -109,7 +104,7 @@ cd $CURRDIR
cat setup.py
# flags must be passed, to avoid the issue: `Unsupported compiler -- pybind11 requires C++11 support!`
# see https://github.com/quantumlib/qsim/issues/242 for more details
Qt5_DIR="$Qt5_CMAKE_DIR" CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ LDFLAGS=-L/usr/local/opt/libomp/lib "${PYBIN}/python3" setup.py bdist_wheel
CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ LDFLAGS=-L/usr/local/opt/libomp/lib "${PYBIN}/python3" setup.py bdist_wheel
cp ./dist/*.whl $CURRDIR/wheelhouse_unrepaired

# Bundle external shared libraries into the wheels
Expand Down

0 comments on commit aad4be7

Please sign in to comment.