From a021ebce3b374e872096c05331f76fc1daa735ed Mon Sep 17 00:00:00 2001 From: OLEGSHA Date: Fri, 31 Mar 2023 22:02:12 +0200 Subject: [PATCH] TMP / Removed old build tools --- tools/bashlib.sh | 66 -------- tools/build.sh | 199 ------------------------- tools/clang-format/use-clang-format.sh | 102 ------------- tools/cppcheck/options.txt | 28 ---- tools/cppcheck/suppressions.txt | 21 --- tools/cppcheck/use-cppcheck.sh | 65 -------- tools/git/hook_pre_commit.sh | 51 ------- tools/setup.sh | 146 ------------------ 8 files changed, 678 deletions(-) delete mode 100644 tools/bashlib.sh delete mode 100755 tools/build.sh delete mode 100755 tools/clang-format/use-clang-format.sh delete mode 100644 tools/cppcheck/options.txt delete mode 100644 tools/cppcheck/suppressions.txt delete mode 100755 tools/cppcheck/use-cppcheck.sh delete mode 100755 tools/git/hook_pre_commit.sh delete mode 100755 tools/setup.sh diff --git a/tools/bashlib.sh b/tools/bashlib.sh deleted file mode 100644 index 2c75f2e..0000000 --- a/tools/bashlib.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/false - -# Writes a message to stderr. -# Parameters: -# $@ - the message to display -function error() { - echo >&2 "`basename "$0"`: $@" -} - -# Writes a message to stderr and exits with code 1. -# Parameters: -# $@ - the message to display -function fail() { - error "$@" - exit 1; -} - -# Ensures that a variable with name $1 has a valid executable. If it does not, -# this function attempts to find an executable with a name suggested in $2...$n. -# In either way, if the variable does not end up naming an executable, fail() is -# called. -# Parameters: -# $1 - name of the variable to check and modify -# $2...$n - suggested executables (at least one) -# $FAIL_SILENTLY - if set, don't call exit and don't print anything on failure -function find_cmd() { - declare -n target="$1" - - if [ -z "${target+x}" ]; then - for candidate in "${@:2}"; do - if command -v "$candidate" >/dev/null; then - target="$candidate" - break - fi - done - fi - - if ! command -v "$target" >/dev/null; then - [ -n "${FAIL_SILENTLY+x}" ] && return 1 - fail "Command $2 is not available. Check \$PATH or set \$$1." - fi - - unset -n target - return 0 -} - -# Displays the command and then runs it. -# Parameters: -# $@ - the command to run -function echo_and_run() { - echo " > $*" - command "$@" -} - -root_dir="$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")" -source_dir="$root_dir" -build_dir="$root_dir/build" -tools_dir="$root_dir/tools" - -# Load private.sh -private_sh="$tools_dir/private.sh" -if [ -f "$private_sh" ]; then - [ -x "$private_sh" ] \ - || fail 'tools/private.sh exists but it is not executable' - source "$private_sh" -fi diff --git a/tools/build.sh b/tools/build.sh deleted file mode 100755 index a8466b3..0000000 --- a/tools/build.sh +++ /dev/null @@ -1,199 +0,0 @@ -#!/bin/bash - -usage=\ -"Usage: build.sh [OPTIONS...] -Build and run the game. - -Options: - --debug make a debug build (default) - --release make a release build - --build-id=ID set the build ID. Default is dev. - --cmake-gen=ARGS pass additional arguments to pass to cmake when - generating build files. ARGS is the ;-separated list. - --dont-generate don't generate build instructions; use existing - configuration if building - --dont-build don't build; run existing binaries or generate build - instructions only - --debug-vulkan enable Vulkan validation layers from LunarG - -R, --run run the game after building - --memcheck[=ARGS] run the game using valgrind's memcheck dynamic memory - analysis tool. Implies -R. ARGS is the ;-separated - list of arguments to pass to valgrind/memcheck. - - -h, --help display this help and exit - -Environment variables: - PARALLELISM threads to use, default is 1 - - CMAKE cmake executable - VALGRIND valgrind executable - -private.sh variables: - private_cmake_gen_args array of additional arguments to pass to cmake when - generating build files - -See also: tools/cppcheck/use-cppcheck.sh --help - tools/clang-format/use-clang-format.sh --help - tools/setup.sh --help" - -rsrc="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" -source "$rsrc/bashlib.sh" - - - -# Parse arguments - -build_type=Debug -do_generate=true -cmake_gen_args=() -do_build=true - -run_type=Normal -do_run='' - -debug_vulkan='' -memcheck_args=() - -for arg in "$@"; do - case "$arg" in - -h | --help ) - echo "$usage" - exit - ;; - --debug ) - build_type=Debug - ;; - --release ) - build_type=Release - ;; - --build-id ) - fail "Option --build-id=ID requires a parameter" - ;; - --build-id=* ) - build_id="${arg#*=}" - ;; - --cmake-gen ) - fail "Option --cmake-gen=ARGS requires a parameter" - ;; - --cmake-gen=* ) - readarray -t -d ';' new_cmake_gen_args <<<"${arg#*=};" - unset new_cmake_gen_args[-1] - cmake_gen_args+=("${new_cmake_gen_args[@]}") - unset new_cmake_gen_args - ;; - --debug-vulkan ) - debug_vulkan=true - ;; - -R | --run ) - do_run=true - ;; - --memcheck ) - do_run=true - run_type=memcheck - ;; - --memcheck=* ) - do_run=true - run_type=memcheck - readarray -t -d ';' new_memcheck_args <<<"${arg#*=};" - unset new_memcheck_args[-1] - memcheck_args+=("${new_memcheck_args[@]}") - unset new_memcheck_args - ;; - --dont-generate ) - do_generate='' - ;; - --dont-build ) - do_build='' - ;; - * ) - fail "Unknown option '$arg'" - ;; - esac -done - -if [ -z "$do_build" -a -z "$do_generate" -a ${#cmake_gen_args[@]} != 0 ]; then - fail "CMake arguments are set, but no build is requested. Aborting" -fi - -if [ -z "$do_build" -a -z "$do_generate" -a -z "$do_run" ]; then - fail "Nothing to do" -fi - - - -# Generate build files - -find_cmd CMAKE cmake -if [ $do_generate ]; then - - cmake_gen_managed_args=( - -DCMAKE_BUILD_TYPE=$build_type - -DVULKAN_ERROR_CHECKING=`[ $debug_vulkan ] && echo ON || echo OFF` - -UBUILD_ID - ) - - [ -n "${build_id+x}" ] && cmake_gen_managed_args+=( - -DBUILD_ID="$build_id" - ) - - echo_and_run "$CMAKE" \ - -B "$build_dir" \ - -S "$source_dir" \ - "${cmake_gen_managed_args[@]}" \ - "${private_cmake_gen_args[@]}" \ - "${cmake_gen_args[@]}" \ - || fail "Could not generate build files" -fi - - - -# Build - -find_cmd CMAKE cmake -if [ $do_build ]; then - options=() - - [ -n "${PARALLELISM+x}" ] && options+=(-j "$PARALLELISM") - - echo_and_run "$CMAKE" \ - --build "$build_dir" \ - "${options[@]}" \ - || fail "Build failed" - - unset options -fi - - - -# Run - -if [ $do_run ]; then - - run_command=() - - if [ $run_type == memcheck ]; then - find_cmd VALGRIND valgrind - - run_command+=( - "$VALGRIND" - --tool=memcheck - --suppressions="$tools_dir"/memcheck/suppressions.supp - "${memcheck_args[@]}" - -- - ) - fi - - run_command+=( - "$build_dir/progressia" - ) - - run_dir="$root_dir/run" - mkdir -p "$run_dir" - - ( - cd "$run_dir" - echo_and_run "${run_command[@]}" - echo "Process exited with code $?" - ) - -fi diff --git a/tools/clang-format/use-clang-format.sh b/tools/clang-format/use-clang-format.sh deleted file mode 100755 index 24bdbe9..0000000 --- a/tools/clang-format/use-clang-format.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash - -usage=\ -"Usage: use-clang-format.sh git - or: use-clang-format.sh files FILES... - or: use-clang-format.sh raw ARGUMENTS... -In the 1st form, format all files that have changed since last git commit. -In the 2nd form, format all FILES, treating directories recursively. -In the 3rd form, run \`clang-format --style=