-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from getsentry/feature/help-cargo-fmt
Move pub mod out of cfg_if to support cargo fmt and run it
- Loading branch information
Showing
5 changed files
with
72 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,27 @@ | ||
#[macro_use] | ||
extern crate cfg_if; | ||
|
||
cfg_if! { | ||
if #[cfg(target_os = "macos")] { | ||
fn main() { | ||
#[cfg(target_os = "macos")] | ||
{ | ||
extern crate bindgen; | ||
|
||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
generate_macos_bindings(); | ||
} | ||
|
||
fn generate_macos_bindings() { | ||
let bindings = bindgen::Builder::default() | ||
.header("./src/macos/bindings.h") | ||
.whitelist_function("_dyld_.*") | ||
.whitelist_type("mach_header.*") | ||
.whitelist_type("load_command.*") | ||
.whitelist_type("uuid_command.*") | ||
.whitelist_type("segment_command.*") | ||
.whitelist_var("MH_MAGIC.*") | ||
.whitelist_var("LC_SEGMENT.*") | ||
.whitelist_var("LC_UUID.*") | ||
.generate() | ||
.expect("Should generate macOS FFI bindings OK"); | ||
let bindings = bindgen::Builder::default() | ||
.header("./src/macos/bindings.h") | ||
.whitelist_function("_dyld_.*") | ||
.whitelist_type("mach_header.*") | ||
.whitelist_type("load_command.*") | ||
.whitelist_type("uuid_command.*") | ||
.whitelist_type("segment_command.*") | ||
.whitelist_var("MH_MAGIC.*") | ||
.whitelist_var("LC_SEGMENT.*") | ||
.whitelist_var("LC_UUID.*") | ||
.generate() | ||
.expect("Should generate macOS FFI bindings OK"); | ||
|
||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); | ||
bindings | ||
.write_to_file(out_path.join("macos_bindings.rs")) | ||
.expect("Should write macos_bindings.rs OK"); | ||
} | ||
} else { | ||
fn main() {} | ||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); | ||
bindings | ||
.write_to_file(out_path.join("macos_bindings.rs")) | ||
.expect("Should write macos_bindings.rs OK"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters