From dfcd0a21d7a80607795e8b5b9c5a2446d77d06b7 Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Fri, 6 Oct 2023 09:41:27 -0600 Subject: [PATCH] clean up build process (#9) * clean up build process * more * more * add mac * more * more * Update build.rs --- .cargo/config.toml | 8 ++++++++ .github/workflows/build.yml | 26 ++++++++++++++++++++------ README.md | 2 +- build.rs | 3 ++- build_debug.sh | 3 --- build_release.sh | 3 --- rust-toolchain.toml | 2 ++ 7 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 .cargo/config.toml delete mode 100755 build_debug.sh delete mode 100755 build_release.sh create mode 100644 rust-toolchain.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..2786085 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,8 @@ +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "target-cpu=x86-64-v3"] + +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-cpu=x86-64-v3"] + +[target.x86_64-apple-darwin] +rustflags = ["-C", "target-cpu=x86-64-v2"] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee590f6..5830f3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,10 +19,9 @@ jobs: - name: Update rust run: | rustup update - rustup install nightly - name: Build run: | - ./build_release.sh + cargo build --release -v - name: Upload file uses: actions/upload-artifact@v3 with: @@ -36,16 +35,31 @@ jobs: with: submodules: recursive - name: Update rust - shell: bash run: | rustup update - rustup install nightly - name: Build - shell: bash run: | - ./build_release.sh + cargo build --release -v - name: Upload file uses: actions/upload-artifact@v3 with: name: gopher64-windows path: target/release/gopher64.exe + + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Update rust + run: | + rustup update + - name: Build + run: | + cargo build --release -v + - name: Upload file + uses: actions/upload-artifact@v3 + with: + name: gopher64-mac + path: target/release/gopher64 diff --git a/README.md b/README.md index 68fc9da..a265b0e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ 2. `rustup install nightly` 3. `git clone --recursive https://github.com/gopher64/gopher64.git` 4. `cd gopher64` -5. `./build_release.sh` +5. `cargo build --release` 6. `./target/release/gopher64 /path/to/rom.z64` ## controls diff --git a/build.rs b/build.rs index 2e3e002..e0272b7 100644 --- a/build.rs +++ b/build.rs @@ -2,6 +2,7 @@ fn main() { let mut build = cc::Build::new(); build .cpp(true) + .std("c++17") .file("parallel-rdp/parallel-rdp-standalone/parallel-rdp/command_ring.cpp") .file("parallel-rdp/parallel-rdp-standalone/parallel-rdp/rdp_device.cpp") .file("parallel-rdp/parallel-rdp-standalone/parallel-rdp/rdp_dump_write.cpp") @@ -51,7 +52,7 @@ fn main() { { build.flag("-DVK_USE_PLATFORM_WIN32_KHR"); } - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_os = "macos"))] { build .flag("-Wno-missing-field-initializers") diff --git a/build_debug.sh b/build_debug.sh deleted file mode 100755 index a56659e..0000000 --- a/build_debug.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -RUSTFLAGS='-C target-cpu=x86-64-v3' cargo +nightly build diff --git a/build_release.sh b/build_release.sh deleted file mode 100755 index 08f5cb5..0000000 --- a/build_release.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -RUSTFLAGS='-C target-cpu=x86-64-v3' cargo +nightly build --release diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..5d56faf --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly"