File indexing completed on 2024-05-12 04:17:32

0001 #!/bin/bash
0002 
0003 # SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier, <caulier dot gilles at gmail dot com>
0004 #
0005 # SPDX-License-Identifier: BSD-3-Clause
0006 #
0007 # Arguments : $1 : VCPKG install path (default ./project/mxe/build.win32).
0008 #             $2 : build type : 'debugfull' to hack (default), 'release' for production, relwithdebinfo for packaging.
0009 #             $3 : Cmake extra configure options.
0010 
0011 # Halt and catch errors
0012 set -eE
0013 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
0014 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
0015 
0016 INSTALL_DIR=$1
0017 
0018 if [[ $INSTALL_DIR == "" ]]; then
0019 
0020     INSTALL_DIR="/e/dk/"
0021 
0022 fi
0023 
0024 VCPKG_DIR="/c/vcpkg"
0025 VCPKG_TRIPLET="x64-windows"
0026 VCPKG_INSTALL_PREFIX=$INSTALL_DIR/$VCPKG_TRIPLET
0027 
0028 BUILD_TYPE=$2
0029 
0030 if [[ $BUILD_TYPE == "" ]]; then
0031     BUILD_TYPE=RelWithDebInfo
0032 fi
0033 
0034 OPTIONS=$3
0035 
0036 echo "Installing to $INSTALL_DIR for target $VCPKG_TRIPLET with build mode $BUILD_TYPE and configure options $OPTIONS"
0037 
0038 # Paths rules
0039 ORIG_PATH="$PATH"
0040 
0041 export PATH="\
0042 $PATH:\
0043 /c/bison:/c/icoutils/bin:\
0044 $VCPKG_INSTALL_PREFIX/tools/gperf:\
0045 $VCPKG_INSTALL_PREFIX/tools/curl:\
0046 $VCPKG_INSTALL_PREFIX/tools/python3:\
0047 $VCPKG_INSTALL_PREFIX/tools/pkgconf:\
0048 $VCPKG_INSTALL_PREFIX/tools/ninja:\
0049 $VCPKG_INSTALL_PREFIX/bin:\
0050 $VCPKG_INSTALL_PREFIX/tools/Qt6/bin\
0051 "
0052 
0053 echo "PATH=$PATH"
0054 
0055 export PKG_CONFIG_PATH=$VCPKG_INSTALL_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH
0056 
0057 if [ ! -d "build" ]; then
0058     mkdir build
0059 fi
0060 
0061 cd build
0062 
0063 cmake .. \
0064       -DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake \
0065       -DVCPKG_TARGET_TRIPLET=$VCPKG_TRIPLET \
0066       -DCMAKE_COLOR_MAKEFILE=ON \
0067       -DCMAKE_INSTALL_PREFIX=$VCPKG_INSTALL_PREFIX \
0068       -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
0069       -DBUILD_TESTING=OFF \
0070       -DQT_VERSION_MAJOR=6 \
0071       -DGAMMARAY_BUILD_DOCS=OFF \
0072       ${OPTIONS} \
0073       -Wno-dev
0074 
0075 CMAKE_VAL_RET=$?
0076 
0077 export PATH=$ORIG_PATH
0078 
0079 exit $CMAKE_VAL_RET