moved build scripts to /scripts, added SCRIPT_DIR variable to make sure it gets executed properly

This commit is contained in:
Joseph Aquino 2025-12-31 19:26:54 -05:00
parent 188afef5de
commit 498971e921
14 changed files with 65 additions and 43 deletions

View File

@ -1,6 +0,0 @@
#! /bin/bash
set -e
echo build files will be placed in ./build
./third-party/premake5/premake5 premake-ninja
ninja $1 -C build

View File

@ -1,6 +0,0 @@
#! /bin/bash
set -e
echo build files will be placed in ./build
./third-party/premake5/premake5 gmake2
make -C build config=$1

View File

@ -1,7 +0,0 @@
#! /bin/bash
if [ -z "$1" ] || [ $# -eq 0 ]
then
ninja -C build -t clean
else
ninja -C build -t clean $1
fi

View File

@ -1,7 +0,0 @@
#! /bin/bash
if [ -z "$1" ] || [ $# -eq 0 ]
then
make -C build config=Debug clean && make config=Release clean
else
make -C build config=$1 clean
fi

3
run.sh
View File

@ -1,3 +0,0 @@
#! /bin/bash
./bin/$1-linux-x86_64/snake

View File

@ -1,4 +1,4 @@
@ECHO OFF
ECHO Project files will be written to ./build
.\third-party\premake5\premake5.exe vs2022
..\third-party\premake5\premake5.exe vs2022
PAUSE

9
scripts/build-ninja.sh Executable file
View File

@ -0,0 +1,9 @@
#! /bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
echo build files will be placed in /build
../third-party/premake5/premake5 premake-ninja && ninja $1 -C ../build

8
scripts/build.sh Executable file
View File

@ -0,0 +1,8 @@
#! /bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
echo build files will be placed in ./build
./third-party/premake5/premake5 gmake2 && make -C ../build config=$1

11
scripts/clean-ninja.sh Executable file
View File

@ -0,0 +1,11 @@
#! /bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
if [ -z "$1" ] || [ $# -eq 0 ]
then
ninja -C ../build -t clean
else
ninja -C ../build -t clean $1
fi

11
scripts/clean.sh Executable file
View File

@ -0,0 +1,11 @@
#! /bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
if [ -z "$1" ] || [ $# -eq 0 ]
then
make -C ../build config=Debug clean && make -C ../build config=Release clean
else
make -C ../build config=$1 clean
fi

View File

@ -1,4 +1,8 @@
#! /bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
if [ -z "$1" ] || [ $# -eq 0 ]
then
./third-party/premake5/premake5 --config=Debug ecc

View File

@ -1,7 +1,7 @@
require "ecc/ecc"
require "ninja/ninja"
package.path = package.path .. ";third-party/premake-scripts/?.lua"
package.path = package.path .. ";../third-party/premake-scripts/?.lua"
local ogg = require("build-ogg")
local sfml = require("build-sfml")
@ -13,11 +13,13 @@ local imguisfml = require("build-imgui-sfml")
local snake = require("project")
local rootdir = "../"
workspace "snake"
architecture "x64"
startproject"snake"
configurations{"Debug", "Release"}
location "build"
location (rootdir .. "build")
filter"system:linux"
staticruntime"Off"
@ -32,9 +34,9 @@ workspace "snake"
output_dir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
intdir = "intermediate-files/"
bindir = "bin/" .. output_dir
liboutdir = "lib/" .. output_dir
intdir = rootdir .. "intermediate-files/"
bindir = rootdir .. "bin/" .. output_dir
liboutdir = rootdir.. "lib/" .. output_dir
externalwarnings "Off"

View File

@ -1,8 +1,8 @@
local m = {}
local scriptdir = path.getabsolute(path.getdirectory(_SCRIPT))
local rootdir = path.join(path.getabsolute(path.getdirectory(_SCRIPT)), "../")
package.path = package.path .. ";third-party/premake-scripts/?.lua"
package.path = package.path .. ";../third-party/premake-scripts/?.lua"
local sfml = require("build-sfml")
local imgui = require("build-imgui")
@ -17,7 +17,7 @@ project "snake"
kind "WindowedApp"
targetname "snake"
targetdir (bindir)
debugdir (scriptdir)
debugdir (rootdir)
objdir (intdir)
-- link order matters on GCC/Clang
@ -27,15 +27,15 @@ project "snake"
includedirs
{
path.join(scriptdir, "src"),
path.join(scriptdir, "include"),
path.join(rootdir, "src"),
path.join(rootdir, "include"),
}
files
{
path.join(scriptdir, "src/**.cpp"),
path.join(scriptdir, "include/**.h"),
path.join(scriptdir, "include/**.hpp"),
path.join(rootdir, "src/**.cpp"),
path.join(rootdir, "include/**.h"),
path.join(rootdir, "include/**.hpp"),
}
--windows specific settings--

6
scripts/run.sh Executable file
View File

@ -0,0 +1,6 @@
#! /bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
../bin/$1-linux-x86_64/snake