]> uap-core.de Git - note.git/commitdiff
add cargo build system
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 28 Mar 2026 13:17:43 +0000 (14:17 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Sat, 28 Mar 2026 13:17:43 +0000 (14:17 +0100)
.gitignore
Cargo.lock [new file with mode: 0644]
Cargo.toml [new file with mode: 0644]
application/Cargo.toml [new file with mode: 0644]
application/build.rs [new file with mode: 0644]
application/src/main.rs [new file with mode: 0644]
ui-rs/Cargo.toml [new file with mode: 0644]
ui-rs/build.rs [new file with mode: 0644]
ui-rs/src/lib.rs [new file with mode: 0644]

index 6a501356393beb8e54ff760608b531268c0ea9da..0f391ad43b64b042930932dd435301636b9538d4 100644 (file)
@@ -7,4 +7,10 @@ make/vs/vcpkg_installed
 ui/winui/winui.vcxproj.user
 ui/winui/Generated Files
 gmon.out
+.idea
 
+
+
+# Added by cargo
+
+/target
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644 (file)
index 0000000..3697568
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "note"
+version = "0.1.0"
+dependencies = [
+ "ui-rs",
+]
+
+[[package]]
+name = "ui-rs"
+version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644 (file)
index 0000000..e4cdb20
--- /dev/null
@@ -0,0 +1,7 @@
+[workspace]
+members = [
+    "ui-rs",
+    "application"
+]
+
+resolver = "2"
diff --git a/application/Cargo.toml b/application/Cargo.toml
new file mode 100644 (file)
index 0000000..75d4ac4
--- /dev/null
@@ -0,0 +1,7 @@
+[package]
+name = "note"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+ui-rs = { path = "../ui-rs" }
diff --git a/application/build.rs b/application/build.rs
new file mode 100644 (file)
index 0000000..55af0b4
--- /dev/null
@@ -0,0 +1,33 @@
+use std::path::Path;
+use std::fs;
+
+fn main() {
+    let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
+    let lib_dir = Path::new(&manifest_dir).join("../build/lib");
+    let config_mk = Path::new(&manifest_dir).join("../config.mk");
+
+    println!("cargo:rustc-link-search=native={}", lib_dir.display());
+    println!("cargo:rustc-link-lib=static=uitk");
+    println!("cargo:rustc-link-lib=static=ucx");
+
+    let content = fs::read_to_string(&config_mk)
+        .expect(&format!("Failed to read {}", config_mk.display()));
+    for line in content.lines() {
+        if line.starts_with("TK_LDFLAGS") {
+            let parts: Vec<&str> = line.split_whitespace().collect();
+            for token in &parts[2..] {
+                if let Some(lib) = token.strip_prefix("-l") {
+                    println!("cargo:rustc-link-lib={}", lib);
+                } else if token.starts_with("-L") {
+                    let path = &token[2..];
+                    println!("cargo:rustc-link-search=native={}", path);
+                } else if token.starts_with("-R") {
+                    let path = &token[2..];
+                    println!("cargo:rustc-link-arg=-Wl,-rpath,{}", path);
+                } else {
+                    println!("cargo:rustc-link-arg={}", token);
+                }
+            }
+        }
+    }
+}
diff --git a/application/src/main.rs b/application/src/main.rs
new file mode 100644 (file)
index 0000000..3033f62
--- /dev/null
@@ -0,0 +1,4 @@
+
+fn main() {
+
+}
diff --git a/ui-rs/Cargo.toml b/ui-rs/Cargo.toml
new file mode 100644 (file)
index 0000000..ab578f0
--- /dev/null
@@ -0,0 +1,7 @@
+[package]
+name = "ui-rs"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+
diff --git a/ui-rs/build.rs b/ui-rs/build.rs
new file mode 100644 (file)
index 0000000..cf74f49
--- /dev/null
@@ -0,0 +1,3 @@
+fn main() {
+
+}
\ No newline at end of file
diff --git a/ui-rs/src/lib.rs b/ui-rs/src/lib.rs
new file mode 100644 (file)
index 0000000..e69de29