Revert "build: remove stale build scripts"

This commit is contained in:
Povilas Kanapickas
2024-10-04 02:27:48 +03:00
committed by GitHub
parent 20c5c04b37
commit 7bae4ea6d3
3 changed files with 137 additions and 0 deletions

93
clean_build.bat Normal file
View File

@@ -0,0 +1,93 @@
@echo off
REM defaults - override them by creating a build_env.bat file
set B_BUILD_TYPE=Debug
set B_QT_ROOT=C:\Qt
set B_QT_VER=5.11.1
set B_QT_MSVC=msvc2017_64
set B_BONJOUR=C:\Program Files\Bonjour SDK
set savedir=%cd%
cd /d %~dp0
REM cmake generator name for the target build system
if "%VisualStudioVersion%"=="15.0" (
set cmake_gen=Visual Studio 15 2017
) else if "%VisualStudioVersion%"=="16.0" (
set cmake_gen=Visual Studio 16 2019
) else if "%VisualStudioVersion%"=="17.0" (
set cmake_gen=Visual Studio 17 2022
) else (
echo Visual Studio version was not detected.
echo Did you forget to run inside a VS developer prompt?
echo Using the default cmake generator.
set cmake_gen=Visual Studio 16 2019
)
if exist build_env.bat call build_env.bat
REM needed by cmake to set bonjour include dir
set BONJOUR_SDK_HOME=%B_BONJOUR%
REM full path to Qt stuff we need
set B_QT_FULLPATH=%B_QT_ROOT%\%B_QT_VER%\%B_QT_MSVC%
echo Bonjour: %BONJOUR_SDK_HOME%
echo Qt: %B_QT_FULLPATH%
git submodule update --init --recursive
rmdir /q /s build
mkdir build
if ERRORLEVEL 1 goto failed
cd build
cmake -G "%cmake_gen%" -A x64 -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% -D CMAKE_PREFIX_PATH="%B_QT_FULLPATH%" -D DNSSD_LIB="%B_BONJOUR%\Lib\x64\dnssd.lib" -D QT_VERSION=%B_QT_VER% ..
if ERRORLEVEL 1 goto failed
cmake --build . --config %B_BUILD_TYPE%
if ERRORLEVEL 1 goto failed
if exist bin\Debug (
copy %B_QT_FULLPATH%\bin\Qt5Cored.dll bin\Debug\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Guid.dll bin\Debug\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Networkd.dll bin\Debug\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Widgetsd.dll bin\Debug\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Cored.dll bin\Debug\ > NUL
copy ..\ext\openssl\windows\x64\bin\* bin\Debug\ > NUL
copy ..\res\openssl\input-leap.conf bin\Debug\ > NUL
mkdir bin\Debug\platforms
copy %B_QT_FULLPATH%\plugins\platforms\qwindowsd.dll bin\Debug\platforms\ > NUL
) else if exist bin\Release (
copy %B_QT_FULLPATH%\bin\Qt5Core.dll bin\Release\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Gui.dll bin\Release\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Network.dll bin\Release\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Widgets.dll bin\Release\ > NUL
copy %B_QT_FULLPATH%\bin\Qt5Core.dll bin\Release\ > NUL
copy ..\ext\openssl\windows\x64\bin\* bin\Release\ > NUL
copy ..\res\openssl\input-leap.conf bin\Release\ > NUL
mkdir bin\Release\platforms
copy %B_QT_FULLPATH%\plugins\platforms\qwindows.dll bin\Release\platforms\ > NUL
) else (
echo Remember to copy supporting binaries and configuration files!
)
echo Build completed successfully
set BUILD_FAILED=0
goto done
:failed
set BUILD_FAILED=%ERRORLEVEL%
echo Build failed
:done
cd /d %savedir%
set B_BUILD_TYPE=
set B_QT_ROOT=
set B_QT_VER=
set B_QT_MSVC=
set B_BONJOUR=
set BONJOUR_SDK_HOME=
set B_QT_FULLPATH=
set savedir=
set cmake_gen=
EXIT /B %BUILD_FAILED%

43
clean_build.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/sh
cd "$(dirname "$0")" || exit 1
# some environments have cmake v2 as 'cmake' and v3 as 'cmake3'
# check for cmake3 first then fallback to just cmake
[ -n "$B_CMAKE" ] || B_CMAKE=$(command -v cmake3)
[ -n "$B_CMAKE" ] || B_CMAKE=$(command -v cmake)
if [ -z "$B_CMAKE" ]; then
echo "ERROR: CMake not in $PATH, cannot build! Please install CMake, or if this persists, file a bug report."
exit 1
fi
B_BUILD_DIR="${B_BUILD_DIR:-build}"
B_BUILD_TYPE="${B_BUILD_TYPE:-Debug}"
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=${B_BUILD_TYPE} ${B_CMAKE_FLAGS:-}"
if [ "$(uname)" = "Darwin" ]; then
# macOS needs a little help, so we source this environment script to fix paths.
[ -e ./macos_environment.sh ] && . ./macos_environment.sh
B_CMAKE_FLAGS="${B_CMAKE_FLAGS} -DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path) -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
fi
# Prefer ninja if available
if command -v ninja 2>/dev/null; then
B_CMAKE_FLAGS="-GNinja ${B_CMAKE_FLAGS}"
fi
# allow local customizations to build environment
[ -r ./build_env.sh ] && . ./build_env.sh
set -e
# Initialise Git submodules
git submodule update --init --recursive
rm -rf ${B_BUILD_DIR}
mkdir ${B_BUILD_DIR}
cd ${B_BUILD_DIR}
echo "Starting Input Leap $B_BUILD_TYPE build in '${B_BUILD_DIR}'..."
"$B_CMAKE" $B_CMAKE_FLAGS ..
"$B_CMAKE" --build . --parallel
echo "Build completed successfully"

1
pre-build.bat Normal file
View File

@@ -0,0 +1 @@
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"