Desktop: Enable GPU nodes (#3364)

* desktop simple nix ci

* make workflow manual

* fixup

* fix nix shell

* nix fmt

* fix shell
This commit is contained in:
Timon
2025-11-16 22:37:02 +00:00
committed by GitHub
parent 94414adaf8
commit ebb434692a
18 changed files with 509 additions and 254 deletions
+4
View File
@@ -8,6 +8,10 @@ repository = ""
edition = "2024"
rust-version = "1.87"
[[bin]]
name = "graphite"
path = "src/main.rs"
[features]
default = ["recommended", "embedded_resources"]
recommended = ["gpu", "accelerated_paint"]
@@ -2,7 +2,7 @@
Name=Graphite
GenericName=Vector & Raster Graphics Editor
Comment=Open-source vector & raster graphics editor. Featuring node based procedural nondestructive editing workflow.
Exec=graphite-editor
Exec=graphite
Terminal=false
Type=Application
Icon=graphite-icon-color
+23 -8
View File
@@ -1,16 +1,31 @@
const RESOURCES: &str = "../../frontend/dist";
const EMBEDDED_RESOURCES_ENV: &str = "EMBEDDED_RESOURCES";
const DEFAULT_RESOURCES_DIR: &str = "../../frontend/dist";
// Check if the directory `RESOURCES` exists and sets the embedded_resources cfg accordingly
// Absolute path of `RESOURCES` available via the `EMBEDDED_RESOURCES` environment variable
fn main() {
let crate_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
let mut embedded_resources: Option<String> = None;
println!("cargo:rerun-if-changed={RESOURCES}");
if let Ok(resources) = crate_dir.join(RESOURCES).canonicalize()
&& resources.exists()
println!("cargo:rerun-if-env-changed={EMBEDDED_RESOURCES_ENV}");
if let Ok(embedded_resources_env) = std::env::var(EMBEDDED_RESOURCES_ENV)
&& std::path::PathBuf::from(&embedded_resources_env).exists()
{
embedded_resources = Some(embedded_resources_env);
}
if embedded_resources.is_none() {
// Check if the directory `DEFAULT_RESOURCES_DIR` exists and sets the embedded_resources cfg accordingly
// Absolute path of `DEFAULT_RESOURCES_DIR` available via the `EMBEDDED_RESOURCES` environment variable
let crate_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
println!("cargo:rerun-if-changed={DEFAULT_RESOURCES_DIR}");
if let Ok(resources) = crate_dir.join(DEFAULT_RESOURCES_DIR).canonicalize()
&& resources.exists()
{
embedded_resources = Some(resources.to_string_lossy().to_string());
}
}
if let Some(embedded_resources) = embedded_resources {
println!("cargo:rustc-cfg=embedded_resources");
println!("cargo:rustc-env=EMBEDDED_RESOURCES={}", resources.to_string_lossy());
println!("cargo:rustc-env={EMBEDDED_RESOURCES_ENV}={embedded_resources}");
} else {
println!("cargo:warning=Resource directory does not exist. Resources will not be embedded. Did you forget to build the frontend?");
}
+1 -2
View File
@@ -9,8 +9,7 @@ edition = "2024"
rust-version = "1.87"
[features]
default = ["gpu"]
gpu = ["graphite-editor/gpu"]
gpu = ["graphite-editor/gpu", "graphene-std/shader-nodes"]
[dependencies]
# Local dependencies