Initial commit

Includes build files for windows, linux, mac, and web.
Stubbed out directory structure for packaging, assets, everything
I expect I'll need.
main
Elijah C. Voigt 1 year ago
commit b2ca08ce3f

@ -0,0 +1,34 @@
# Pulled from https://github.com/bevyengine/bevy/blob/latest/.cargo/config_fast_builds.toml
# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the "-Zshare-generics=y" below.
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
"-Clink-arg=-fuse-ld=lld", # Use LLD Linker
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]
[target.x86_64-apple-darwin]
rustflags = [
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]
[target.aarch64-apple-darwin]
rustflags = [
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe" # Use LLD Linker
rustflags = [
"-Zshare-generics=n",
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]
[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"

5
.gitignore vendored

@ -0,0 +1,5 @@
/target
# Web build artifacts
/platforms/web/*.js
/platforms/web/*.wasm

3966
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
[package]
name = "game-jam-casino"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = "0.13"

@ -0,0 +1,3 @@
# Game Jam Casino
Game Jam Casino is a toy app used to discover whacky new ideas through playing cards, rolling dice, or pulling slot machines.

@ -0,0 +1,6 @@
[Desktop Entry]
Name=GameJamCasino
Exec=GameJamCasino
Icon=GameJamCasino
Type=Application
Categories=Game;

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Game Jam Casino</string>
<key>CFBundleExecutable</key>
<string>GameJamCasino</string>
<key>CFBundleIconFile</key>
<string>GameJamCasino.icns</string>
<key>CFBundleIdentifier</key>
<string>your.domain.bevy-game</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>GameJamCasino</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>10.9</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
</dict>
</plist>

@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<body style="margin: 0px;">
<script type="module">
import init from './game-jam-casino.js'
init().catch((error) => {
if (!error.message.startsWith("Using exceptions for control flow, don't mind me. This isn't actually an error!")) {
throw error;
}
});
</script>
</body>
</html>

@ -0,0 +1,18 @@
[toolchain]
channel = "nightly"
components = [
"clippy",
"llvm-tools-preview",
"rls",
"rustc-dev",
"rustfmt",
"wasm-bindgen-cli",
"wasm-server-runner",
]
targets = [
"aarch64-apple-darwin",
"wasm32-unknown-unknown",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
]

@ -0,0 +1,5 @@
#!/usr/bin/env bash
TARGET="x86_64-unknown-linux-gnu"
cargo build --release --target $TARGET

@ -0,0 +1,8 @@
#!/bin/bash
AARCH_TARGET="aarch64-apple-darwin"
X64_TARGET="x86_64-apple-darwin"
# Generate x86 and arm builds
cargo build --release --target $AARCH_TARGET
cargo build --release --target $X64_TARGET

@ -0,0 +1,13 @@
#!/usr/bin/env sh
BUILD_FILE="./target/$TARGET/release/$NAME.wasm"
OUT_DIR="./platforms/web/"
NAME="game-jam-casino"
TARGET="wasm32-unknown-unknown"
cargo build --release --target $TARGET
wasm-bindgen --target web \
--out-dir $OUT_DIR \
--out-name $NAME \
$BUILD_FILE

@ -0,0 +1,3 @@
# Build x86_64 release
cargo build --release --target x86_64-pc-windows-msvc

@ -0,0 +1,3 @@
#!/usr/bin/env bash
cp media/GameJamCasino.png platforms/linux/GameJamCasino.AppDir/GameJamCasino.png

@ -0,0 +1,34 @@
#!/bin/bash
# https://gist.github.com/ansarizafar/6fa64f44aa933794c4d6638eec32b9aa
BASE="media/GameJamCasino.png"
OUT_DIR="media/GameJamCasino.iconset"
mkdir -p $OUT_DIR
# 1024x1024
sips "$BASE" -Z 1024 -o $OUT_DIR/icon_512x512@2.png
# 512x512
sips "$BASE" -Z 512 -o $OUT_DIR/icon_512x512.png
sips "$BASE" -Z 512 -o $OUT_DIR/icon_256x256@2.png
# 256x256
sips "$BASE" -Z 256 -o $OUT_DIR/icon_256x256.png
sips "$BASE" -Z 256 -o $OUT_DIR/icon_128x128@2.png
# 128x128
sips "$BASE" -Z 128 -o $OUT_DIR/icon_128x128.png
sips "$BASE" -Z 128 -o $OUT_DIR/icon_64x64@2.png
# 64x64
sips "$BASE" -Z 64 -o $OUT_DIR/icon_64x64.png
sips "$BASE" -Z 64 -o $OUT_DIR/icon_32x32@2.png
# 32x32
sips "$BASE" -Z 32 -o $OUT_DIR/icon_32x32.png
sips "$BASE" -Z 32 -o $OUT_DIR/icon_16x16@2.png
# 16x16
sips "$BASE" -Z 16 -o $OUT_DIR/icon_16x16.png
iconutil -c icns $OUT_DIR

@ -0,0 +1,37 @@
#!/usr/bin/env bash
NAME="game-jam-casino"
PACKAGE_NAME="GameJamCasino-alpha-linux"
# Variables for copying binary file
TARGET="x86_64-unknown-linux-gnu"
APP_DIR="platforms/linux/GameJamCasino.AppDir/"
TARGET_DIR="target/$TARGET/release/"
BUILD_BIN="$TARGET_DIR/$NAME"
PACKAGE_BIN="$APP_DIR/AppRun"
# Vars for dynamic libraries
PACKAGE_LIB_DIR="$APP_DIR/usr/lib/"
LIB_DIR="lib/linux/"
# Assets
ASSETS_DIR="assets"
# Package variables
PACKAGE_FILE="$PACKAGE_NAME.AppImage"
DEST_FILE="packages/$PACKAGE_FILE"
########################################
# Copy binary to build dir
cp -f $BUILD_BIN $PACKAGE_BIN
# Copy dynamic libraries
mkdir -p $PACKAGE_LIB_DIR
cp -f $LIB_DIR/* $PACKAGE_LIB_DIR/
# Copy assets
cp -rf $ASSET_DIR $APP_DIR/
# Build AppImage file
appimagetool $APP_DIR $DEST_FILE

@ -0,0 +1,52 @@
#!/bin/bash
# https://github.com/create-dmg/create-dmg/tree/master?tab=readme-ov-file#create-dmg
NAME='Game Jam Casino.app'
APP="platforms/macos/$NAME"
CONTENTS="$APP/Contents"
GAME="$CONTENTS/MacOS"
RESOURCES="$CONTENTS/Resources"
FRAMEWORKS="$CONTENTS/Frameworks"
mkdir -p "$APP"
mkdir -p "$GAME"
mkdir -p "$RESOURCES"
mkdir -p "$FRAMEWORKS"
# Copy icons to package
cp -f media/GameJamCasino.icns "$RESOURCES"
# Generate cross-architecture binary
rm -f "$GAME/GameJamCasino"
lipo "target/x86_64-apple-darwin/release/game-jam-casino" \
"target/aarch64-apple-darwin/release/game-jam-casino" \
-create -output "$GAME/GameJamCasino"
# Copy assets
rm -rf "$GAME/assets"
cp -r assets "$GAME/"
# Copy fmod libraries
cp -f lib/macos/libfmod.dylib "$FRAMEWORKS/"
cp -f lib/macos/libfmodstudio.dylib "$FRAMEWORKS/"
# Update dynamic linking search paths
install_name_tool -change @rpath/libfmod.dylib "@loader_path/../Frameworks/libfmod.dylib" "$GAME/GameJamCasno"
install_name_tool -change @rpath/libfmodstudio.dylib "@loader_path/../Frameworks/libfmodstudio.dylib" "$GAME/GameJamCasino"
# Build dmg file
PACKAGE_FILE="packages/GameJamCasino-alpha-macos.dmg"
rm -f $PACKAGE_FILE
create-dmg \
--volname "Game Jam Casino" \
--volicon "media/GameJamCasino.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--app-drop-link 600 200 \
--icon-size 100 \
--icon "$NAME" 200 190 \
--hide-extension "$NAME" \
--app-drop-link 600 185 \
$PACKAGE_FILE \
./platforms/macos/

@ -0,0 +1,3 @@
#!/usr/bin/env bash
# Just zip platforms/web

@ -0,0 +1,11 @@
Copy-Item -Force "./target/x86_64-pc-windows-msvc/release/game-jam-casino.exe" "./platforms/windows/GameJamCasino.exe"
Copy-Item -Force "./lib/windows/*" "./platforms/windows/"
Copy-Item -Force -Recurse "./assets" "./platforms/windows"
$compress = @{
Path = "./platforms/windows/*"
CompressionLevel = "Optimal"
DestinationPath = "./packages/GameJamCasino-alpha-windows.zip"
}
Compress-Archive -Force @compress

@ -0,0 +1,30 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell rec {
nativeBuildInputs = [
pkg-config
];
buildInputs = [
alsa-lib # Audio
blender # Modeling
clang # C/C++ Compiler
gcc # Another C/C++ Compiler
gcc-unwrapped # GCC Libs
git-lfs # Git LFS
rustup # Rust
udev # Audio?
vulkan-loader # Rendering
xorg.libXcursor xorg.libXi xorg.libXrandr # To use the x11 feature
libxkbcommon wayland # To use the wayland feature
gimp
ffmpeg
appimagekit # Building appimages
];
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
shellHook = ''
export LD_LIBRARY_PATH=lib/linux:$LD_LIBRARY_PATH
'';
}

@ -0,0 +1,7 @@
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.run();
}
Loading…
Cancel
Save