Skip to content

Commit

Permalink
restructure project
Browse files Browse the repository at this point in the history
  • Loading branch information
theMackabu committed Nov 28, 2023
1 parent c97fae0 commit 8ae1590
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 13 deletions.
58 changes: 58 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ lazy_static = "1.4.0"
prometheus = "0.13.3"
serde_json = "1.0.108"
simple-logging = "2.0.2"
utoipa-rapidoc = "1.0.0"
pretty_env_logger = "0.5.0"
clap-verbosity-flag = "2.1.0"
global_placeholders = "0.1.0"
Expand All @@ -36,6 +37,7 @@ psutil = { version = "3.2.2", features = ["serde"] }
tabled = { version = "0.14.0", features = ["color"] }
chrono = { version = "0.4.23", features = ["serde"] }
serde = { version = "1.0.192", features = ["derive"] }
utoipa = { version = "4.1.0", features = ["serde_yaml"] }

[build-dependencies]
chrono = "0.4.23"
Expand Down
2 changes: 1 addition & 1 deletion Maidfile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ script = [
"killall pmc",
"maid build -q",
"sudo cp bin/pmc /usr/local/bin",
"echo Copied binary!"
"echo Copied binary!"
]
18 changes: 13 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@ fn main() {

/* cc linking */
cxx_build::bridge("src/lib.rs")
.file("src/cc/bridge.cc")
.file("src/cc/process.cc")
.file("src/cc/fork.cc")
.file("lib/bridge.cc")
.file("lib/process.cc")
.file("lib/fork.cc")
.flag_if_supported("-std=c++17")
.compile("bridge");

let watched = vec!["lib.rs", "cc/bridge.cc", "cc/process.cc", "cc/fork.cc", "include/bridge.h", "include/process.h", "include/fork.h"];
watched.iter().for_each(|file| println!("cargo:rerun-if-changed=src/{}", file));
let watched = vec![
"src/lib.rs",
"lib/bridge.cc",
"lib/process.cc",
"lib/fork.cc",
"lib/include/bridge.h",
"lib/include/process.h",
"lib/include/fork.h",
];
watched.iter().for_each(|file| println!("cargo:rerun-if-changed={file}"));
}
4 changes: 2 additions & 2 deletions src/cc/bridge.cc → lib/bridge.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../include/bridge.h"
#include "../include/process.h"
#include "include/bridge.h"
#include "include/process.h"

#include <iostream>
#include <signal.h>
Expand Down
2 changes: 1 addition & 1 deletion src/cc/fork.cc → lib/fork.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../include/fork.h"
#include "include/fork.h"
#include <cstring>
#include <stdexcept>
#include <cstdlib>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cc/process.cc → lib/process.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../include/process.h"
#include "include/process.h"
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ pub mod service {
}

unsafe extern "C++" {
include!("pmc/src/include/process.h");
include!("pmc/src/include/bridge.h");
include!("pmc/src/include/fork.h");
include!("pmc/lib/include/process.h");
include!("pmc/lib/include/bridge.h");
include!("pmc/lib/include/fork.h");
type Callback = crate::Callback;

pub fn stop(pid: i64) -> i64;
Expand Down

0 comments on commit 8ae1590

Please sign in to comment.