diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..2c3793e --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.wasm32-unknown-emscripten] +# rustflags = ["-C", "link-args=-sUSE_GLFW=3"] +linker = "bundle/wasm/emcc.sh" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 62d9551..9435421 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,5 @@ description = "" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -raylib = "3.5" \ No newline at end of file +raylib = { version = "3.5", git = "https://github.com/ewpratten/raylib-rs", branch = "cross_compile_fixes" } + diff --git a/Cross.toml b/Cross.toml index f9f9eae..16cab71 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,2 +1,5 @@ [target.x86_64-unknown-linux-gnu] -image = "ldjam_48_x86_64_unknown_linux_gnu_build_env" \ No newline at end of file +image = "ldjam_48_x86_64_unknown_linux_gnu_build_env" + +[target.wasm32-unknown-emscripten] +image = "ldjam_48_wasm32_unknown_emscripten_build_env" \ No newline at end of file diff --git a/Web.toml b/Web.toml new file mode 100644 index 0000000..b4c357c --- /dev/null +++ b/Web.toml @@ -0,0 +1,7 @@ +default-target = "wasm32-unknown-emscripten" + +[cargo-web] +minimum-version = "0.6.0" + +[target.emscripten] +link-args = ["-s", "USE_GLFW=3", "-s", "ASSERTIONS=1", "-s", "ASYNCIFY=1", "--profiling"] \ No newline at end of file diff --git a/bundle/linux/create-release.sh b/bundle/linux/create-release.sh index 000b3c3..d3c2cbc 100755 --- a/bundle/linux/create-release.sh +++ b/bundle/linux/create-release.sh @@ -17,4 +17,5 @@ echo "Copying assets" cp -r ./assets ./bundle/linux/release echo "Packing assets" -zip -r ./bundle/linux/release-x86_64-unknown-linux-gnu.zip ./bundle/linux/release \ No newline at end of file +cd ./bundle/linux/release +zip -r ../release-x86_64-unknown-linux-gnu.zip ./ \ No newline at end of file diff --git a/bundle/wasm/Dockerfile b/bundle/wasm/Dockerfile new file mode 100644 index 0000000..c491a55 --- /dev/null +++ b/bundle/wasm/Dockerfile @@ -0,0 +1,13 @@ +FROM rustembedded/cross:wasm32-unknown-emscripten-0.2.1 + +# System deps +RUN apt-get update -y +RUN apt-get install emscripten -y +RUN apt-get install gcc-multilib -y +RUN apt-get install curl -y + +# Emscripten +# RUN emsdk update-tags +# RUN emsdk install sdk-incoming-64bit +# RUN emsdk activate sdk-incoming-64bit + diff --git a/bundle/wasm/create-release.sh b/bundle/wasm/create-release.sh new file mode 100755 index 0000000..02b2244 --- /dev/null +++ b/bundle/wasm/create-release.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +set -e + +echo "Building for 32-bit emscripten" +# docker build -t ldjam_48_wasm32_unknown_emscripten_build_env ./bundle/wasm +cross build --target wasm32-unknown-emscripten --release --verbose + +echo "Creating bundle output" +rm -rf ./bundle/wasm/release +mkdir -p ./bundle/wasm/release + +echo "Copying binary" +cp ./target/wasm32-unknown-emscripten/release/ludum-dare-48.exe ./bundle/wasm/release + +echo "Copying assets" +cp -r ./assets ./bundle/wasm/release + +echo "Packing assets" +zip -r ./bundle/wasm/release-wasm32-unknown-emscripten.zip ./bundle/wasm/release \ No newline at end of file diff --git a/bundle/wasm/emcc.sh b/bundle/wasm/emcc.sh new file mode 100755 index 0000000..706d279 --- /dev/null +++ b/bundle/wasm/emcc.sh @@ -0,0 +1,5 @@ +#! /bin/bash + +set -e + +emcc "-s" "USE_GLFW=3" "-s" "ASSERTIONS=1" "-s" "ASYNCIFY=1" $@ \ No newline at end of file diff --git a/bundle/windows/create-release.sh b/bundle/windows/create-release.sh index f5ab480..f7421f9 100755 --- a/bundle/windows/create-release.sh +++ b/bundle/windows/create-release.sh @@ -16,4 +16,5 @@ echo "Copying assets" cp -r ./assets ./bundle/windows/release echo "Packing assets" -zip -r ./bundle/windows/release-x86_64-pc-windows-gnu.zip ./bundle/windows/release \ No newline at end of file +cd ./bundle/windows/release +zip -r ../release-x86_64-pc-windows-gnu.zip ./ \ No newline at end of file