fix --no-clean

This commit is contained in:
Eve 2024-11-21 12:19:53 -05:00
parent 0ae6edb6db
commit feadeadf50
2 changed files with 4 additions and 4 deletions

View file

@ -65,7 +65,7 @@ if (Vulkan_FOUND)
--output-dir ${_ggml_vk_output_dir} --output-dir ${_ggml_vk_output_dir}
--target-hpp ${_ggml_vk_header} --target-hpp ${_ggml_vk_header}
--target-cpp ${_ggml_vk_source} --target-cpp ${_ggml_vk_source}
--no-clean --no-clean true
DEPENDS ${_ggml_vk_shader_deps} DEPENDS ${_ggml_vk_shader_deps}
COMMENT "Generate vulkan shaders" COMMENT "Generate vulkan shaders"

View file

@ -40,7 +40,7 @@ std::string input_dir = "vulkan-shaders";
std::string output_dir = "/tmp"; std::string output_dir = "/tmp";
std::string target_hpp = "ggml-vulkan-shaders.hpp"; std::string target_hpp = "ggml-vulkan-shaders.hpp";
std::string target_cpp = "ggml-vulkan-shaders.cpp"; std::string target_cpp = "ggml-vulkan-shaders.cpp";
bool no_clean = false; std::string no_clean = "FALSE";
const std::vector<std::string> type_names = { const std::vector<std::string> type_names = {
"f32", "f32",
@ -463,7 +463,7 @@ void write_output_files() {
} }
fprintf(src, "\n};\n\n"); fprintf(src, "\n};\n\n");
if (!no_clean) { if (no_clean != "TRUE") {
std::remove(path.c_str()); std::remove(path.c_str());
} }
} }
@ -496,7 +496,7 @@ int main(int argc, char** argv) {
target_cpp = args["--target-cpp"]; // Path to generated cpp file target_cpp = args["--target-cpp"]; // Path to generated cpp file
} }
if (args.find("--no-clean") != args.end()) { if (args.find("--no-clean") != args.end()) {
no_clean = true; // Keep temporary SPIR-V files in output-dir after build no_clean = to_uppercase(args["--no-clean"]); // Keep temporary SPIR-V files in output-dir after build
} }
if (!directory_exists(input_dir)) { if (!directory_exists(input_dir)) {