Skip to content

🎥 Make videos programmatically with React

smart turborepo cache?

Jonny Burger0fe5c47d88c4
diff --git a/.gitignore b/.gitignore
index a74e9a7aeb..3a27325834 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,4 +12,3 @@ packages/example/out
.vscode/taskmarks.json
.turbo
.vercel
-packages/compositor/target
diff --git a/packages/.cargo/config.toml b/packages/.cargo/config.toml
index 3b3b6f469a..7c5f1305ee 100644
--- a/packages/.cargo/config.toml
+++ b/packages/.cargo/config.toml
@@ -1,21 +1,6 @@
-[build]
-target-dir = "rust/target"
-target = [
- # Linux ARM
- "aarch64-unknown-linux-gnu",
- # Linux x64
- "x86_64-unknown-linux-gnu",
- # macOS ARM
- "aarch64-apple-darwin",
- # macOS ARM
- "x86_64-apple-darwin",
- # Windows x64
- "x86_64-pc-windows-gnu",
-]
-
+# Putting this file into packages/ because VSCode Rust extension
+# only searches 1 level for Cargofiles
-[target.x86_64-unknown-linux-gnu]
-linker = "x86_64-unknown-linux-gnu-gcc"
-
-[target.aarch64-unknown-linux-gnu]
-linker = "aarch64-unknown-linux-gnu-gcc"
+[build]
+# Calling the directory "dist" so it gets cached by turborepo
+target-dir = "compositor/dist"
diff --git a/packages/Cargo.toml b/packages/Cargo.toml
index 344c23ff55..b34453256e 100644
--- a/packages/Cargo.toml
+++ b/packages/Cargo.toml
@@ -12,5 +12,5 @@ serde_json = "1.0.89"
[[bin]]
-name = "transformer"
-path = "rust/main.rs"
+name = "compositor"
+path = "compositor/main.rs"
diff --git a/packages/compositor/cross_compile.sh b/packages/compositor/cross_compile.sh
new file mode 100644
index 0000000000..3aeb3e3444
--- /dev/null
+++ b/packages/compositor/cross_compile.sh
@@ -0,0 +1,14 @@
+echo "Linux ARM"
+CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-unknown-linux-gnu-gcc cargo build --release --target=aarch64-unknown-linux-gnu
+
+echo "Linux x64"
+CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc cargo build --release --target=x86_64-unknown-linux-gnu
+
+echo "macOS ARM"
+cargo build --release --target=aarch64-apple-darwin
+
+echo "macOS x64"
+cargo build --release --target=x86_64-apple-darwin
+
+echo "Windows x64"
+cargo build --release --target=x86_64-pc-windows-gnu
diff --git a/packages/compositor/package.json b/packages/compositor/package.json
index 37a459a1a7..2ab9d0d692 100644
--- a/packages/compositor/package.json
+++ b/packages/compositor/package.json
@@ -6,6 +6,10 @@
"files": [
"dist"
],
+ "scripts": {
+ "build": "cargo build --release",
+ "build-all": "sh cross_compile.sh"
+ },
"author": "",
"license": "SEE LICENSE IN LICENSE.md",
"repository": {