-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make paths msys2
friendly
#2
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ name = "libdtrace_rs" | |
path = "src/lib.rs" | ||
|
||
[build-dependencies] | ||
anyhow = "1.0.79" | ||
bindgen = "0.69.1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,15 @@ use std::env; | |
use std::path::PathBuf; | ||
use std::process::Command; | ||
|
||
const DTRACE_SRC_DIR: &str = "_dtrace"; | ||
|
||
// Set-ExecutionPolicy RemoteSigned –Scope Process | ||
// 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe' opendtrace.sln /t:dtrace_dll:Rebuild /p:Configuration=Release /p:Platform=x64 | ||
fn get_dtrace_libpath() -> PathBuf { | ||
let dir = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
std::path::Path::new(&dir).join("target\\dtrace\\build\\x64\\Release\\lib\\") | ||
std::path::Path::new(&dir) | ||
.join(DTRACE_SRC_DIR) | ||
.join("dtrace/build/x64/Release/lib") | ||
} | ||
|
||
fn main() { | ||
|
@@ -20,7 +24,10 @@ fn main() { | |
get_dtrace_libpath().display() | ||
); | ||
|
||
build_dtrace(); | ||
print!("Trying to buidld dtrace library... "); | ||
build_dtrace().unwrap(); | ||
println!("\t....[DONE]"); | ||
|
||
let outdir = std::path::Path::new(&env::var("OUT_DIR").unwrap()).join("dtrace.dll"); | ||
std::fs::copy(get_dtrace_libpath().join("dtrace.dll"), outdir).expect("Failed to copy dll"); | ||
|
||
|
@@ -54,18 +61,33 @@ fn main() { | |
.expect("Couldn't write bindings!"); | ||
} | ||
|
||
fn build_dtrace() { | ||
Command::new("git") | ||
.args(&[ | ||
"clone", | ||
"https://github.com/microsoft/DTrace-on-Windows.git", | ||
"target\\dtrace", | ||
]) | ||
.output() | ||
.expect("Failed to clone dtrace"); | ||
fn build_dtrace() -> anyhow::Result<()> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there's no |
||
let output = if !PathBuf::from(DTRACE_SRC_DIR).is_dir() { | ||
Command::new("git") | ||
.args(&[ | ||
"clone", | ||
"https://github.com/microsoft/DTrace-on-Windows.git", | ||
DTRACE_SRC_DIR, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't clone anything inside root directory, use the |
||
]) | ||
.output() | ||
.expect("Failed to clone dtrace"); | ||
} else { | ||
Command::new("git") | ||
.arg("udpate") | ||
.current_dir(DTRACE_SRC_DIR) | ||
.output() | ||
.expect("Failed to update dtrace"); | ||
Comment on lines
+75
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}; | ||
|
||
let _ = Command::new("powershell") | ||
.args(&[".\\build-dtrace.ps1"]) | ||
println!("> git update/clone {output:?}"); | ||
|
||
let output = Command::new("powershell.exe") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this output, build logs get generated inside dtrace directory not in |
||
.arg("-F") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
.arg("./build-dtrace.ps1") | ||
.output() | ||
.expect("failed to get external tools"); | ||
|
||
println!("> git clone {output:?}"); | ||
|
||
Ok(()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong path, evaluates to
libdtrace-rs\_dtrace\dtrace/build/x64/Release/lib
Should be
libdtrace-rs\target\_dtrace/build/x64/Release/lib