~starkingdoms/starkingdoms

36673180617584e2efc720ab3a4408b9ab169661 — c0repwn3r 2 years ago 04e724c
remove justfile, add documentation on how to build
2 files changed, 26 insertions(+), 50 deletions(-)

A BUILDING.md
D justfile
A BUILDING.md => BUILDING.md +26 -0
@@ 0,0 1,26 @@
# Building StarKingdoms

StarKingdoms uses a small script called Spacetime as a build tool. Internally, it regenerates and runs a build.ninja file for compilation.

## Dependencies

For compilation, you will need the following tools installed:
- rust/cargo
- ninja
- inkscape
- sheep (see below)
- wasm-pack (see below - must be installed in a specific way)

`sheep` and `wasm-pack` can be installed with the build-command `install_tooling`. Other tools will need to be installed with your distribution's package manager.
`wasm-pack` *must* be installed with `install_tooling`, otherwise the build will crash.

If you get a `sheep: command not found` error, or the same with wasm-pack, add `$HOME/.cargo/bin/` to your `PATH`. 

## Running build commands

Build commands are ran with the `st` shell script. Run `./st <build-command>` to run a build.
`st` can be run from any directory - you could run `../../st run-server` from `server/src/`, and it would still properly build and run the server.

## Available build commands

Run the build-command `help` to view a list of all build-commands.
\ No newline at end of file

D justfile => justfile +0 -50
@@ 1,50 0,0 @@
run_server:
    cargo run --bin starkingdoms-server

run_http: build_client_bundle
    cd web && python3 -m http.server

run_http_prod: build_client_bundle_prod
    cd web && python3 -m http.server

build_client_bundle: build_assets
    rm -rf web/dist
    RUST_BACKTRACE=1 wasm-pack build --target web client
    cp -r client/pkg web/dist

build_client_bundle_prod: build_assets
    rm -rf web/dist
    RUST_BACKTRACE=1 wasm-pack build --target web client --no-default-features --features textures-fast
    cp -r client/pkg web/dist

install_tooling:
    cargo install wasm-pack --no-default-features
    cargo install sheep_cli

clean:
    rm -rf target
    rm -rf client/pkg
    rm -rf web/dist

build_assets: build_assets_full build_assets_375 build_assets_125

build_assets_full:
    mkdir -p assets/final/full
    inkscape -w 512 -h 512 assets/svg/*.svg --export-type "png"
    inkscape -w 2048 -h 2048 assets/svg/earth.svg --export-type "png" # Earth is a different size than all other sprites
    mv assets/svg/*.png assets/final/full/
    sheep pack assets/final/full/*.png -f amethyst_named -o assets/dist/spritesheet-full

build_assets_375:
    mkdir -p assets/final/375
    inkscape -w 192 -h 192 assets/svg/*.svg --export-type "png"
    inkscape -w 768 -h 768 assets/svg/earth.svg --export-type "png" # Earth is a different size than all other sprites
    mv assets/svg/*.png assets/final/375
    sheep pack assets/final/375/*.png -f amethyst_named -o assets/dist/spritesheet-375

build_assets_125:
    mkdir -p assets/final/125
    inkscape -w 64 -h 64 assets/svg/*.svg --export-type "png"
    inkscape -w 256 -h 256 assets/svg/earth.svg --export-type "png" # Earth is a different size than all other sprites
    mv assets/svg/*.png assets/final/125
    sheep pack assets/final/125/*.png -f amethyst_named -o assets/dist/spritesheet-125
\ No newline at end of file