From fd72d63f653a806a9af1089d57dbdb3376a06a84 Mon Sep 17 00:00:00 2001 From: Shady Gmira Date: Wed, 22 Jan 2025 20:56:55 +0100 Subject: [PATCH 1/3] Feat: Created build script --- build.sh | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..5e5d24a --- /dev/null +++ b/build.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# Function to display usage instructions +usage() { + echo "Usage: $0 [platform] [shipping]" + echo "platform: windows | linux | quest" + echo "shipping: optional, use 'shipping' to create a shipping build" + exit 1 +} + +# Check for platform argument +if [ -z "$1" ]; then + usage +fi + +PLATFORM="$1" +SHIPPING="" +if [ "$2" == "shipping" ]; then + SHIPPING="-DSHIPPING=ON" +fi + +# General steps +init_vcpkg() { + echo "Initializing vcpkg submodule..." + git submodule init && git submodule update +} + +build_windows() { + echo "Building for Windows..." + init_vcpkg + cd vcpkg || exit + ./bootstrap-vcpkg.bat + cd .. || exit + mkdir -p build && cd build || exit + cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake $SHIPPING + cmake --build . --config=Release +} + +build_linux() { + echo "Building for Linux..." + echo "Installing dependencies..." + sudo apt-get install -y clang cmake freeglut3-dev libopenxr-dev meson python3-jinja2 + init_vcpkg + cd vcpkg || exit + ./bootstrap-vcpkg.sh + cd .. || exit + mkdir -p build && cd build || exit + cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake $SHIPPING + cmake --build . --config=Release +} + +build_quest() { + echo "Building for Meta Quest..." + echo "Installing required packages with vcpkg..." + vcpkg install glm:arm64-android + vcpkg install libpng:arm64-android + vcpkg install nlohmann-json:arm64-android + + echo "Set ANDROID_VCPKG_DIR to point to vcpkg/installed/arm64-android." + echo "Download and setup Meta OpenXR Mobile SDK 59.0." + echo "Copy the ovr_openxr_mobile_sdk_59.0 dir into the meta-quest directory." + echo "Copy the meta-quest/splatapult dir to ovr_openxr_mobile_sdk_59.0/XrSamples/splatapult." + echo "Open the project in Android Studio and sync/build." +} + +case "$PLATFORM" in + windows) + build_windows + ;; + linux) + build_linux + ;; + quest) + build_quest + ;; + *) + usage + ;; +esac + +echo "Build script complete." From 6a90cf331470df3473936ec969e43b910cd074c8 Mon Sep 17 00:00:00 2001 From: Shady Gmira Date: Wed, 22 Jan 2025 21:06:50 +0100 Subject: [PATCH 2/3] Feat: Updated workflow --- .github/workflows/build.yaml | 16 +++++----------- build.sh | 27 +-------------------------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe43fce..1baccd9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,16 +13,10 @@ jobs: uses: ConorMacBride/install-package@v1 with: apt: libxmu-dev libxi-dev libgl-dev libxcb-glx0-dev libglu1-mesa-dev libxxf86vm-dev libxrandr-dev - - name: Install CMake - uses: lukka/get-cmake@v3.29.0 - - name: Create Build Dir - run: mkdir build - - name: CMake Configure - working-directory: build - run: cmake -DSHIPPING=ON -DCMAKE_TOOLCHAIN_FILE="../vcpkg/scripts/buildsystems/vcpkg.cmake" .. - - name: CMake Build - working-directory: build - run: cmake --build . --config=Release + - name: Project Build + run: | + chmod +x build.sh + ./build.sh linux build-windows: runs-on: windows-latest steps: @@ -46,4 +40,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: windows-build - path: build/Release + path: build/Release \ No newline at end of file diff --git a/build.sh b/build.sh index 5e5d24a..1b8a2a4 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ # Function to display usage instructions usage() { echo "Usage: $0 [platform] [shipping]" - echo "platform: windows | linux | quest" + echo "platform: linux" echo "shipping: optional, use 'shipping' to create a shipping build" exit 1 } @@ -25,17 +25,6 @@ init_vcpkg() { git submodule init && git submodule update } -build_windows() { - echo "Building for Windows..." - init_vcpkg - cd vcpkg || exit - ./bootstrap-vcpkg.bat - cd .. || exit - mkdir -p build && cd build || exit - cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake $SHIPPING - cmake --build . --config=Release -} - build_linux() { echo "Building for Linux..." echo "Installing dependencies..." @@ -49,20 +38,6 @@ build_linux() { cmake --build . --config=Release } -build_quest() { - echo "Building for Meta Quest..." - echo "Installing required packages with vcpkg..." - vcpkg install glm:arm64-android - vcpkg install libpng:arm64-android - vcpkg install nlohmann-json:arm64-android - - echo "Set ANDROID_VCPKG_DIR to point to vcpkg/installed/arm64-android." - echo "Download and setup Meta OpenXR Mobile SDK 59.0." - echo "Copy the ovr_openxr_mobile_sdk_59.0 dir into the meta-quest directory." - echo "Copy the meta-quest/splatapult dir to ovr_openxr_mobile_sdk_59.0/XrSamples/splatapult." - echo "Open the project in Android Studio and sync/build." -} - case "$PLATFORM" in windows) build_windows From 8dc3a6475bee53c3a0131e6facd789823c18368d Mon Sep 17 00:00:00 2001 From: Shady Gmira Date: Wed, 22 Jan 2025 21:11:07 +0100 Subject: [PATCH 3/3] Feat: Updated BUILD.md --- BUILD.md | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/BUILD.md b/BUILD.md index 755f3f4..828f9db 100644 --- a/BUILD.md +++ b/BUILD.md @@ -29,23 +29,10 @@ And the resulting exe will use that copy. You can then zip up the folder and di Linux Build (vcpkg submodule) -------------------- -* Install dependencies - - `sudo apt-get install clang` - - `sudo apt-get install cmake` - - `sudo apt-get install freeglut3-dev` - - `sudo apt-get install libopenxr-dev` -* Ensure splatapult has the vcpkg submodule. - Either clone with the --recursive flag so that the vcpkg submodule is added - or execute `git submodule init` and `git submodule update` after a regular clone. -* Bootstrap vcpkg - - `cd vcpkg` - - `bootstrap-vcpg.sh` -* Execute cmake to create a Makefile - - `mkdir build` - - `cd build` - - `cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake` -* build executable - - `cmake --build . --config=Release` +* The project and its dependencies can be installed using the following command: +```bash +./build.sh linux +``` *EXPERIMENTAL* Meta Quest Build (OUT OF DATE) --------------------