diff options
| author | Flaise <[email protected]> | 2019-07-29 09:26:02 -0500 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2019-07-30 10:36:45 +0100 |
| commit | 37a33d1de0f95183faefe1645a1dc1b8117e7e93 (patch) | |
| tree | 3f226f39524469a020769963193cdb2bfcd010bc | |
| parent | Add PublishedFileId struct (diff) | |
| download | steamworks-rs-37a33d1de0f95183faefe1645a1dc1b8117e7e93.tar.xz steamworks-rs-37a33d1de0f95183faefe1645a1dc1b8117e7e93.zip | |
Updated to support SDK version 1.45 on Mac OS
| -rw-r--r-- | src/app.rs | 4 | ||||
| -rw-r--r-- | src/matchmaking.rs | 4 | ||||
| -rwxr-xr-x | steamworks-sys/build.rs | 26 |
3 files changed, 21 insertions, 13 deletions
@@ -78,7 +78,7 @@ impl <Manager> Apps<Manager> { } } - /// Returns the buildid of this app. + /// Returns the build id of this app. pub fn app_build_id(&self) -> i32 { unsafe { sys::SteamAPI_ISteamApps_GetAppBuildId(self.apps) as i32 @@ -146,4 +146,4 @@ impl <Manager> Apps<Manager> { } } } -}
\ No newline at end of file +} diff --git a/src/matchmaking.rs b/src/matchmaking.rs index 6788450..061c9ef 100644 --- a/src/matchmaking.rs +++ b/src/matchmaking.rs @@ -13,7 +13,7 @@ const CALLBACK_BASE_ID: i32 = 500; pub enum LobbyType { Private, FriendsOnly, - Public , + Public, Invisible, } @@ -179,4 +179,4 @@ fn test_lobby() { single.run_callbacks(); ::std::thread::sleep(::std::time::Duration::from_millis(100)); } -}
\ No newline at end of file +} diff --git a/steamworks-sys/build.rs b/steamworks-sys/build.rs index d48e409..ddf1063 100755 --- a/steamworks-sys/build.rs +++ b/steamworks-sys/build.rs @@ -22,7 +22,6 @@ struct SteamEnum { values: Vec<SteamEnumValue>, } - #[derive(Deserialize)] struct SteamEnumValue { name: String, @@ -61,7 +60,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { let triple = env::var("TARGET").unwrap(); let mut lib = "steam_api"; let mut packing = 8; - let path = if triple.contains("windows") { + let link_path = if triple.contains("windows") { if triple.contains("i686") { sdk_loc.join("redistributable_bin/") } else { @@ -77,16 +76,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { } } else if triple.contains("darwin") { packing = 4; - sdk_loc.join("redistributable_bin/osx64") + sdk_loc.join("redistributable_bin/osx") } else { panic!("Unsupported OS"); }; - println!("cargo:rustc-link-search={}", path.display()); + println!("cargo:rustc-link-search={}", link_path.display()); println!("cargo:rustc-link-lib=dylib={}", lib); // Steamworks uses packed structs making them hard to work // with normally - let steam_api: SteamApi = serde_json::from_reader(File::open(sdk_loc.join("public/steam/steam_api.json"))?)?; + let steam_api_json_loc = sdk_loc.join("public/steam/steam_api.json"); + let file = File::open(&steam_api_json_loc).expect(&format!("open {:?}", steam_api_json_loc)); + let steam_api: SteamApi = serde_json::from_reader(file)?; let mut bindings = r##" use libc::*; @@ -239,14 +240,21 @@ pub struct {} {{"#, packing, derive, s.struct_)?; bindings.push_str(&s_builder); } - // fs::write("/tmp/steam-bindings.rs", &bindings)?; fs::write(out_path.join("bindings.rs"), bindings)?; - cc::Build::new() + if triple.contains("darwin") { + fs::copy(link_path.join("libsteam_api.dylib"), out_path.join("libsteam_api.dylib"))?; + } + + let mut compiler = cc::Build::new(); + compiler .cpp(true) .include(sdk_loc.join("public/steam")) - .file("src/lib.cpp") - .compile("steamrust"); + .file("src/lib.cpp"); + if triple.contains("darwin") { + compiler.flag("-std=c++11"); + } + compiler.compile("steamrust"); Ok(()) } |