This repository has been archived by the owner on Aug 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Parse args and run in a separate thread * Native helper struct for static FFI invocation * Wait until node starts when run as daemon * Flags for success, daemon and displaying help * Graceful shutdown on interrupt signal
- Loading branch information
1 parent
b592186
commit 0060779
Showing
10 changed files
with
332 additions
and
20 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CARGO ?= cargo | ||
TARGET ?= | ||
|
||
build-native-pkg: | ||
CRATE_CC_NO_DEFAULTS=1 $(CARGO) build --package meta-node --release $(if $(TARGET),--target $(TARGET),) | ||
mkdir -p pkg/metachain/include pkg/metachain/lib | ||
cp target/$(if $(TARGET),$(TARGET)/,)release/libmeta_node.a pkg/metachain/lib/libmetachain.a | ||
cp target/libmc.hpp pkg/metachain/include/ | ||
cp target/libmc.cpp pkg/metachain/ |
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,7 +1,39 @@ | ||
use proc_macro2::TokenStream; | ||
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; | ||
|
||
use std::env; | ||
use std::fs::File; | ||
use std::io::{Read, Write}; | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
generate_cargo_keys(); | ||
|
||
rerun_if_git_head_changed(); | ||
|
||
let mut root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); | ||
let parent = root.clone(); | ||
root.pop(); | ||
root.pop(); | ||
let lib_path = &parent.join("src").join("lib.rs"); | ||
println!("cargo:rerun-if-changed={}", lib_path.display()); | ||
let target_dir = &root.join("target"); | ||
|
||
let mut content = String::new(); | ||
File::open(lib_path) | ||
.unwrap() | ||
.read_to_string(&mut content) | ||
.unwrap(); | ||
let tt: TokenStream = content.parse().unwrap(); | ||
let codegen = cxx_gen::generate_header_and_cc(tt, &cxx_gen::Opt::default()).unwrap(); | ||
|
||
let cpp_stuff = String::from_utf8(codegen.implementation).unwrap(); | ||
File::create(target_dir.join("libmc.hpp")) | ||
.unwrap() | ||
.write_all(&codegen.header) | ||
.unwrap(); | ||
File::create(target_dir.join("libmc.cpp")) | ||
.unwrap() | ||
.write_all(cpp_stuff.as_bytes()) | ||
.unwrap(); | ||
} |
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
Oops, something went wrong.