From f7a586a1e0bafc0fef56056019a5843d71425e9d Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:52:58 -0600 Subject: [PATCH] add build workflow (#2) * add build workflow * more * more * more * more * more * more * more * more * more * more * more * fix * more * more * more * more * more * remove pkg-config * remove * more * fix * last --- .github/workflows/build.yml | 51 +++++++++++++++++++++++++++++++++++++ Cargo.toml | 10 +++++--- build.rs | 11 +++++--- 3 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..b178deef --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,51 @@ +name: Rust + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +env: + CARGO_TERM_COLOR: always + +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Update rust + run: | + rustup default nightly + rustup update + - name: Build + run: | + ./build_release.sh + - name: Upload file + uses: actions/upload-artifact@v3 + with: + name: gopher64-linux + path: target/release/gopher64 + + build-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Update rust + shell: bash + run: | + rustup default nightly + rustup update + - name: Build + shell: bash + run: | + ./build_release.sh + - name: Upload file + uses: actions/upload-artifact@v3 + with: + name: gopher64-windows + path: target/release/gopher64.exe diff --git a/Cargo.toml b/Cargo.toml index 36d93931..c434382c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,20 @@ [package] -name = "rust64" +name = "gopher64" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sdl2 = "0.35" +sdl2-sys = { git = "https://github.com/Rust-SDL2/rust-sdl2.git" } + +[dependencies.sdl2] +git = "https://github.com/Rust-SDL2/rust-sdl2.git" +default-features = false +features = ["static-link","bundled"] [build-dependencies] cc = { version = "1.0", features = ["parallel"] } -pkg-config = "0.3" [profile.release] lto = true diff --git a/build.rs b/build.rs index 448bc870..2e3e0022 100644 --- a/build.rs +++ b/build.rs @@ -1,10 +1,7 @@ fn main() { - let sdl = pkg_config::Config::new().probe("sdl2").unwrap(); let mut build = cc::Build::new(); build .cpp(true) - .flag("-Wno-missing-field-initializers") - .flag("-Wno-unused-parameter") .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") @@ -48,11 +45,17 @@ fn main() { .include("parallel-rdp/parallel-rdp-standalone/vulkan") .include("parallel-rdp/parallel-rdp-standalone/vulkan-headers/include") .include("parallel-rdp/parallel-rdp-standalone/util") - .includes(sdl.include_paths); + .includes(std::env::var("DEP_SDL2_INCLUDE")); #[cfg(target_os = "windows")] { build.flag("-DVK_USE_PLATFORM_WIN32_KHR"); } + #[cfg(target_os = "linux")] + { + build + .flag("-Wno-missing-field-initializers") + .flag("-Wno-unused-parameter"); + } build.compile("parallel-rdp"); }