diff --git a/.gitignore b/.gitignore index 372a3c4e6553..faaf88b4d29b 100644 --- a/.gitignore +++ b/.gitignore @@ -88,6 +88,7 @@ src/.tags src/.tags_sorted_by_file /.vs +/out /CMakeSettings.json /venv/ /cmake-build-*/ diff --git a/tools/package-linux.sh b/tools/package-linux.sh index 4873ab92f7d8..fd5c69197b81 100755 --- a/tools/package-linux.sh +++ b/tools/package-linux.sh @@ -1,18 +1,24 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -DIR="$(readlink -f $DIR/..)" +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +DIR="$(readlink -f "$DIR/..")" +[ -z "$LLVM_DIR" ] && echo "Must set specific LLVM_DIR for packaging" && exit + +# shellcheck disable=SC2154 +[ -z "$Clang_DIR" ] && echo "Must set specific Clang_DIR for packaging" && exit + +# shellcheck disable=SC2034 flag_shared="-DBUILD_SHARED_LIBS=YES" + +# shellcheck disable=SC2034 flag_static="-DBUILD_SHARED_LIBS=NO" -for ty in shared static -do - for cfg in Debug Release - do +for ty in shared static; do + for cfg in Debug Release; do flag_name=flag_$ty - cmake -G Ninja -DCMAKE_BUILD_TYPE=$cfg ${!flag_name}\ - -DLLVM_DIR=$LLVM_DIR -DClang_DIR=$Clang_DIR \ + cmake -G Ninja -DCMAKE_BUILD_TYPE=$cfg ${!flag_name} \ + -DLLVM_DIR="$LLVM_DIR" -DClang_DIR="$Clang_DIR" \ -DWITH_TESTS=NO -DWITH_APPS=NO -DWITH_TUTORIALS=NO \ -DWITH_DOCS=YES -DWITH_UTILS=NO -DWITH_PYTHON_BINDINGS=NO \ -S "$DIR" -B "$DIR/build/$ty-$cfg" @@ -20,5 +26,7 @@ do done done -(cd "$DIR/build"; cpack --config "$DIR/packaging/Linux.cmake") - +( + cd "$DIR/build" || exit + cpack --config "$DIR/packaging/Linux.cmake" +) diff --git a/tools/package-windows.bat b/tools/package-windows.bat new file mode 100644 index 000000000000..b4c5e65b1663 --- /dev/null +++ b/tools/package-windows.bat @@ -0,0 +1,26 @@ +@echo off + +pushd %~dp0\.. + +if not exist "%VCPKG_ROOT%\.vcpkg-root" ( + echo Must define VCPKG_ROOT to be the root of the VCPKG install + goto return +) + +cmake -G "Ninja Multi-Config" -DBUILD_SHARED_LIBS=YES ^ + -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake ^ + -DWITH_TESTS=NO -DWITH_APPS=NO -DWITH_TUTORIALS=NO ^ + -DWITH_DOCS=YES -DWITH_UTILS=NO -DWITH_PYTHON_BINDINGS=NO ^ + -S . -B build/shared + +if %errorlevel% neq 0 goto return + +cmake --build build/shared --config Debug +cmake --build build/shared --config Release + +cd build\shared +cpack -B .. -C "Debug;Release" + +:return +popd +exit /b