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.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) -------------------- diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1b8a2a4 --- /dev/null +++ b/build.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Function to display usage instructions +usage() { + echo "Usage: $0 [platform] [shipping]" + echo "platform: linux" + 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_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 +} + +case "$PLATFORM" in + windows) + build_windows + ;; + linux) + build_linux + ;; + quest) + build_quest + ;; + *) + usage + ;; +esac + +echo "Build script complete."