Skip to content

Commit

Permalink
Reworked build scripts for all platforms; Removed platform prefix fro…
Browse files Browse the repository at this point in the history
…m script names
  • Loading branch information
dbeef committed Jun 12, 2024
1 parent cfd8b99 commit 01d8d95
Show file tree
Hide file tree
Showing 29 changed files with 141 additions and 117 deletions.
14 changes: 8 additions & 6 deletions scripts/android/build-android.sh → scripts/android/build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/usr/bin/env bash
# This script is meant to be run from the root of the project.

source scripts/variables-android.sh
source variables.sh

# Following variables must be present in the environment:
#
# ANDROID_NDK_HOME - Root of directory with unpacked Android NDK, i.e - /opt/android/android-ndk-r15c
# ANDROID_DEPS_ARMEABI_V7A - Root of directory with armeabi-v7a dependency artifacts, i.e - /opt/android/deps-armeabi-v7a,
# will be forwarded to CMake through CMAKE_PREFIX_PATH.
# ANDROID_DEPS_ARM64_V8A - Root of directory with arm64-v8a dependency artifacts, i.e - /opt/android/deps-arm64-v8a,
# will be forwarded to CMake through CMAKE_PREFIX_PATH.
# will be forwarded to CMake through CMAKE_PREFIX_PATH.

rm -rf $INSTALL_PATH
mkdir -p $INSTALL_PATH
echo ANDROID_NDK_HOME: $ANDROID_NDK_HOME
echo ANDROID_DEPS_ARMEABI_V7A: $ANDROID_DEPS_ARMEABI_V7A
echo ANDROID_DEPS_ARM64_V8A: $ANDROID_DEPS_ARM64_V8A

cd $ROOT_PATH/platforms/android
# FIXME: This should be building under TMP_PATH, just like every other artifact:
cd $PLATFORMS_PATH/android
./gradlew assemble
cp build/android-app/outputs/apk/debug/Spelunky_PSP-debug.apk $INSTALL_PATH/Spelunky_PSP.apk
5 changes: 3 additions & 2 deletions scripts/android/clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# This script is meant to be run from the root of the project.

rm -rf tmp
source variables.sh

yes | rm -r $TMP_PATH
8 changes: 0 additions & 8 deletions scripts/android/variables-android.sh

This file was deleted.

14 changes: 14 additions & 0 deletions scripts/android/variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# Stop on error:
set -e
# Referencing unset variables are errors:
set -u

ROOT_PATH=$(realpath ../../)
TMP_PATH=$ROOT_PATH/tmp
INSTALL_PATH=$TMP_PATH/install-android
BUILD_PATH=$TMP_PATH/build-android
# TODO: Think about moving this directory somewhere else or more specific naming;
# "platform-specific/android", "platform-files/android", "extras/android"?
PLATFORMS_PATH=$ROOT_PATH/platforms
4 changes: 0 additions & 4 deletions scripts/darwin/build-darwin.sh

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/darwin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

source variables.sh

cmake \
--build $BUILD_PATH \
--target install \
--config Release \
-j $NUM_THREADS
5 changes: 3 additions & 2 deletions scripts/darwin/clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# This script is meant to be run from the root of the project.

rm -rf tmp
source variables.sh

yes | rm -r $TMP_PATH
13 changes: 0 additions & 13 deletions scripts/darwin/config-darwin.sh

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/darwin/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

source variables.sh

cmake \
-B $BUILD_PATH \
-S $ROOT_PATH \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH
12 changes: 12 additions & 0 deletions scripts/darwin/variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Stop on error:
set -e
# Referencing unset variables are errors:
set -u

ROOT_PATH=$(realpath ../../)
TMP_PATH=$ROOT_PATH/tmp
INSTALL_PATH=$TMP_PATH/install-darwin
BUILD_PATH=$TMP_PATH/build-darwin
NUM_THREADS=$(nproc)
7 changes: 0 additions & 7 deletions scripts/linux/build-linux.sh

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/linux/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

source variables.sh

cmake \
--build $BUILD_PATH \
--target install \
--config Release \
-j $NUM_THREADS
5 changes: 3 additions & 2 deletions scripts/linux/clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# This script is meant to be run from the root of the project.

rm -rf tmp
source variables.sh

yes | rm -r $TMP_PATH
16 changes: 0 additions & 16 deletions scripts/linux/config-linux.sh

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/linux/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

source variables.sh

cmake \
-S $ROOT_PATH \
-B $BUILD_PATH \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH
12 changes: 12 additions & 0 deletions scripts/linux/variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Stop on error:
set -e
# Referencing unset variables are errors:
set -u

ROOT_PATH=$(realpath ../../)
TMP_PATH=$ROOT_PATH/tmp
INSTALL_PATH=$TMP_PATH/install-linux
BUILD_PATH=$TMP_PATH/build-linux
NUM_THREADS=$(nproc)
6 changes: 0 additions & 6 deletions scripts/psp/build-psp.sh

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/psp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

source variables.sh

cmake \
--build $BUILD_PATH \
--target install \
--config Release \
-j $NUM_THREADS
5 changes: 3 additions & 2 deletions scripts/psp/clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# This script is meant to be run from the root of the project.

rm -rf tmp
source variables.sh

yes | rm -r $TMP_PATH
20 changes: 0 additions & 20 deletions scripts/psp/config-psp.sh

This file was deleted.

13 changes: 13 additions & 0 deletions scripts/psp/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#/usr/bin/env bash

source variables.sh

# "psp-cmake" is guaranteed to be in PATH after successful pspdev/psptoolchain installation AND in the official PSP SDK Docker image;
# it's a shell script calling host's vanilla cmake with cmake toolchain file already passed:

psp-cmake \
-S $ROOT_PATH \
-B $BUILD_PATH \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
-DCMAKE_VERBOSE_MAKEFILE=ON
7 changes: 0 additions & 7 deletions scripts/psp/run-psp.sh

This file was deleted.

6 changes: 6 additions & 0 deletions scripts/psp/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

source variables.sh

# Run filtering everything except Spelunky-PSP output:
ppsspp $BUILD_PATH/EBOOT.PBP 2>&1 | grep -F SPELUNKY
8 changes: 0 additions & 8 deletions scripts/psp/variables-psp.sh

This file was deleted.

12 changes: 12 additions & 0 deletions scripts/psp/variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Stop on error:
set -e
# Referencing unset variables are errors:
set -u

ROOT_PATH=$(realpath ../../)
TMP_PATH=$ROOT_PATH/tmp
INSTALL_PATH=$TMP_PATH/install-psp
BUILD_PATH=$TMP_PATH/build-psp
NUM_THREADS=$(nproc)
1 change: 1 addition & 0 deletions scripts/windows/TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rework these scripts to be structured in the same way as for other platforms.
8 changes: 0 additions & 8 deletions scripts/windows/build-windows.ps1

This file was deleted.

3 changes: 3 additions & 0 deletions scripts/windows/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$ErrorActionPreference = "Stop"

cmake --build "../../tmp/build-windows" --target install --config Release -j $env:NUMBER_OF_PROCESSORS
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This script is meant to be run from the root of the project.

# Builds SpelunkyPSP natively on Windows, using following dependencies:
# * SDL as a vendor of creating window, retrieving OpenGL context, controls and sounds.

[CmdletBinding()]
param (
[Parameter()][String]
Expand All @@ -11,7 +6,7 @@ param (

$ErrorActionPreference = "Stop"

$ROOT = $(Get-Location)
$ROOT = $(Get-Location)/../../
$INSTALL_PATH = "$ROOT/tmp/install-windows"
$DEPS_PATH = "$ROOT/$DepsDirectory/SDL"

Expand Down

0 comments on commit 01d8d95

Please sign in to comment.