]> git.nega.tv - josh/narcissus/commitdiff
Add debug info generation to stb build scripts
authorJoshua Simmons <josh@nega.tv>
Sat, 25 Feb 2023 19:11:07 +0000 (20:11 +0100)
committerJoshua Simmons <josh@nega.tv>
Sat, 25 Feb 2023 19:11:07 +0000 (20:11 +0100)
libs/ffi/stb_image-sys/build.rs
libs/ffi/stb_truetype-sys/build.rs

index 40312a423de82af03957b6924b2619a8e489ef73..7a8dddfac5137da3787e60ba4499a2744f43524d 100644 (file)
@@ -3,12 +3,18 @@ use std::{path::Path, process::Command};
 fn main() {
     let out_dir = std::env::var("OUT_DIR").unwrap();
     let opt_level = std::env::var("OPT_LEVEL").unwrap();
+    let debug = match std::env::var("DEBUG").unwrap().as_str() {
+        "true" | "2" => "",
+        "1" => "line-tables-only",
+        _ => "0",
+    };
 
     Command::new("clang")
         .args([
             "src/stb_image.c",
             "-c",
             &format!("-O{opt_level}"),
+            &format!("-g{debug}"),
             "-fPIC",
             "-o",
         ])
index 03efe3b2fb40afed3ac3866e074a9814a962c118..b4b8cabbd03186250072db45641a59fd08b1b90f 100644 (file)
@@ -3,12 +3,18 @@ use std::{path::Path, process::Command};
 fn main() {
     let out_dir = std::env::var("OUT_DIR").unwrap();
     let opt_level = std::env::var("OPT_LEVEL").unwrap();
+    let debug = match std::env::var("DEBUG").unwrap().as_str() {
+        "true" | "2" => "",
+        "1" => "line-tables-only",
+        _ => "0",
+    };
 
     Command::new("clang")
         .args([
             "src/stb_truetype.c",
             "-c",
             &format!("-O{opt_level}"),
+            &format!("-g{debug}"),
             "-fPIC",
             "-o",
         ])
@@ -26,5 +32,6 @@ fn main() {
     println!("cargo:rustc-link-lib=static=stb_truetype");
     println!("cargo:rerun-if-changed=src/stb_truetype.c");
     println!("cargo:rerun-if-changed=src/stb_truetype.h");
+    println!("cargo:rerun-if-changed=src/stb_rect_pack.h");
     println!("cargo:rerun-if-changed=build.rs");
 }