fix
This commit is contained in:
parent
52c0fa5ce9
commit
3978bba5a7
1 changed files with 6 additions and 6 deletions
|
@ -244,6 +244,7 @@ mod macos {
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod windows {
|
mod windows {
|
||||||
use std::{
|
use std::{
|
||||||
|
fs,
|
||||||
io::Write,
|
io::Write,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::{self, Command},
|
process::{self, Command},
|
||||||
|
@ -270,6 +271,7 @@ mod windows {
|
||||||
let lib_name = "amd_ags_x64_2022_MT";
|
let lib_name = "amd_ags_x64_2022_MT";
|
||||||
#[cfg(target_pointer_width = "32")]
|
#[cfg(target_pointer_width = "32")]
|
||||||
let lib_name = "amd_ags_x86_2022_MT";
|
let lib_name = "amd_ags_x86_2022_MT";
|
||||||
|
|
||||||
println!("cargo:rustc-link-lib=static={}", lib_name);
|
println!("cargo:rustc-link-lib=static={}", lib_name);
|
||||||
println!("cargo:rustc-link-search=native={}", lib_dir.display());
|
println!("cargo:rustc-link-search=native={}", lib_dir.display());
|
||||||
println!(
|
println!(
|
||||||
|
@ -292,8 +294,6 @@ mod windows {
|
||||||
|
|
||||||
/// You can set the `GPUI_FXC_PATH` environment variable to specify the path to the fxc.exe compiler.
|
/// You can set the `GPUI_FXC_PATH` environment variable to specify the path to the fxc.exe compiler.
|
||||||
fn compile_shaders() {
|
fn compile_shaders() {
|
||||||
use std::fs;
|
|
||||||
|
|
||||||
let shader_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap())
|
let shader_path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap())
|
||||||
.join("src/platform/windows/shaders.hlsl");
|
.join("src/platform/windows/shaders.hlsl");
|
||||||
let out_dir = std::env::var("OUT_DIR").unwrap();
|
let out_dir = std::env::var("OUT_DIR").unwrap();
|
||||||
|
@ -318,7 +318,7 @@ mod windows {
|
||||||
fs::remove_file(&rust_binding_path)
|
fs::remove_file(&rust_binding_path)
|
||||||
.expect("Failed to remove existing Rust binding file");
|
.expect("Failed to remove existing Rust binding file");
|
||||||
}
|
}
|
||||||
for module in &modules {
|
for module in modules {
|
||||||
compile_shader_for_module(
|
compile_shader_for_module(
|
||||||
module,
|
module,
|
||||||
&out_dir,
|
&out_dir,
|
||||||
|
@ -329,6 +329,7 @@ mod windows {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// You can set the `GPUI_FXC_PATH` environment variable to specify the path to the fxc.exe compiler.
|
||||||
fn find_fxc_compiler() -> String {
|
fn find_fxc_compiler() -> String {
|
||||||
// Try to find in PATH
|
// Try to find in PATH
|
||||||
if let Ok(output) = std::process::Command::new("where").arg("fxc.exe").output() {
|
if let Ok(output) = std::process::Command::new("where").arg("fxc.exe").output() {
|
||||||
|
@ -433,8 +434,7 @@ mod windows {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_rust_binding(const_name: &str, head_file: &str, output_path: &str) {
|
fn generate_rust_binding(const_name: &str, head_file: &str, output_path: &str) {
|
||||||
let header_content =
|
let header_content = fs::read_to_string(head_file).expect("Failed to read header file");
|
||||||
std::fs::read_to_string(head_file).expect("Failed to read header file");
|
|
||||||
let const_definition = {
|
let const_definition = {
|
||||||
let global_var_start = header_content.find("const BYTE").unwrap();
|
let global_var_start = header_content.find("const BYTE").unwrap();
|
||||||
let global_var = &header_content[global_var_start..];
|
let global_var = &header_content[global_var_start..];
|
||||||
|
@ -446,7 +446,7 @@ mod windows {
|
||||||
const_name,
|
const_name,
|
||||||
const_definition.replace('{', "[").replace('}', "]")
|
const_definition.replace('{', "[").replace('}', "]")
|
||||||
);
|
);
|
||||||
let mut options = std::fs::OpenOptions::new()
|
let mut options = fs::OpenOptions::new()
|
||||||
.write(true)
|
.write(true)
|
||||||
.create(true)
|
.create(true)
|
||||||
.append(true)
|
.append(true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue