mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-04 06:53:06 +00:00
Use different binary depending os family
This commit is contained in:
parent
6d3d085a38
commit
a94ee694a3
@ -1,3 +1,5 @@
|
|||||||
|
extern crate core;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::env::set_current_dir;
|
use std::env::set_current_dir;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -5,12 +7,21 @@ use std::process::Command;
|
|||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// TODO: well, there are a lot of things to consider here, including architechture target. A better aware system should be used.
|
||||||
|
// For now this will have to do
|
||||||
|
let go_bin = if cfg!(target_family = "unix") {
|
||||||
|
"/usr/local/go/bin/go"
|
||||||
|
} else if cfg!(target_family = "windows") {
|
||||||
|
"go"
|
||||||
|
} else {
|
||||||
|
panic!("OS not supported!");
|
||||||
|
};
|
||||||
// Build go-waku static lib
|
// Build go-waku static lib
|
||||||
// build command taken from waku make file:
|
// build command taken from waku make file:
|
||||||
// https://github.com/status-im/go-waku/blob/eafbc4c01f94f3096c3201fb1e44f17f907b3068/Makefile#L115
|
// https://github.com/status-im/go-waku/blob/eafbc4c01f94f3096c3201fb1e44f17f907b3068/Makefile#L115
|
||||||
let output_lib = "libgowaku.a";
|
let output_lib = "libgowaku.a";
|
||||||
set_current_dir("./vendor").unwrap();
|
set_current_dir("./vendor").unwrap();
|
||||||
Command::new("/usr/local/go/bin/go")
|
Command::new(go_bin)
|
||||||
.env("CGO_ENABLED","1")
|
.env("CGO_ENABLED","1")
|
||||||
.arg("build")
|
.arg("build")
|
||||||
.arg("-buildmode=c-archive")
|
.arg("-buildmode=c-archive")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user