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 OFF
ECHO Project files will be written to ./build ECHO Project files will be written to ./build
.\third-party\premake5\premake5.exe vs2022 ..\third-party\premake5\premake5.exe vs2022
PAUSE 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 #! /bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR"
if [ -z "$1" ] || [ $# -eq 0 ] if [ -z "$1" ] || [ $# -eq 0 ]
then then
./third-party/premake5/premake5 --config=Debug ecc ./third-party/premake5/premake5 --config=Debug ecc

View File

@ -1,7 +1,7 @@
require "ecc/ecc" require "ecc/ecc"
require "ninja/ninja" 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 ogg = require("build-ogg")
local sfml = require("build-sfml") local sfml = require("build-sfml")
@ -13,11 +13,13 @@ local imguisfml = require("build-imgui-sfml")
local snake = require("project") local snake = require("project")
local rootdir = "../"
workspace "snake" workspace "snake"
architecture "x64" architecture "x64"
startproject"snake" startproject"snake"
configurations{"Debug", "Release"} configurations{"Debug", "Release"}
location "build" location (rootdir .. "build")
filter"system:linux" filter"system:linux"
staticruntime"Off" staticruntime"Off"
@ -32,9 +34,9 @@ workspace "snake"
output_dir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" output_dir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
intdir = "intermediate-files/" intdir = rootdir .. "intermediate-files/"
bindir = "bin/" .. output_dir bindir = rootdir .. "bin/" .. output_dir
liboutdir = "lib/" .. output_dir liboutdir = rootdir.. "lib/" .. output_dir
externalwarnings "Off" externalwarnings "Off"

View File

@ -1,8 +1,8 @@
local m = {} 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 sfml = require("build-sfml")
local imgui = require("build-imgui") local imgui = require("build-imgui")
@ -17,7 +17,7 @@ project "snake"
kind "WindowedApp" kind "WindowedApp"
targetname "snake" targetname "snake"
targetdir (bindir) targetdir (bindir)
debugdir (scriptdir) debugdir (rootdir)
objdir (intdir) objdir (intdir)
-- link order matters on GCC/Clang -- link order matters on GCC/Clang
@ -27,15 +27,15 @@ project "snake"
includedirs includedirs
{ {
path.join(scriptdir, "src"), path.join(rootdir, "src"),
path.join(scriptdir, "include"), path.join(rootdir, "include"),
} }
files files
{ {
path.join(scriptdir, "src/**.cpp"), path.join(rootdir, "src/**.cpp"),
path.join(scriptdir, "include/**.h"), path.join(rootdir, "include/**.h"),
path.join(scriptdir, "include/**.hpp"), path.join(rootdir, "include/**.hpp"),
} }
--windows specific settings-- --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