Skip to content

Commit

Permalink
Add Windows packaging script.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinking committed Jul 23, 2020
1 parent 34c7d14 commit eeb8290
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ src/.tags
src/.tags_sorted_by_file

/.vs
/out
/CMakeSettings.json
/venv/
/cmake-build-*/
28 changes: 18 additions & 10 deletions tools/package-linux.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
#!/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"
cmake --build "$DIR/build/$ty-$cfg"
done
done

(cd "$DIR/build"; cpack --config "$DIR/packaging/Linux.cmake")

(
cd "$DIR/build" || exit
cpack --config "$DIR/packaging/Linux.cmake"
)
26 changes: 26 additions & 0 deletions tools/package-windows.bat
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eeb8290

Please sign in to comment.