From 9e4da6e467d4376ea239f22a108ac773823d35d0 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 13 Mar 2025 12:54:13 +0800 Subject: [PATCH 1/2] Simplify text writing for core module headers --- source/slang/slang-options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 72756d3603..977cf322cc 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -2260,7 +2260,7 @@ SlangResult OptionsParser::_parse(int argc, char const* const* argv) 16, &writer)); - File::writeAllText(fileName.value, builder); + File::writeNativeText(fileName.value, builder.getBuffer(), builder.getLength()); break; } case OptionKind::DumpIrIds: From 05f563232fed239ca48f5b9a13a2401cb311987b Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 13 Mar 2025 12:54:13 +0800 Subject: [PATCH 2/2] Use an explicit dependency for generated headers instead of source file dependency From the CMake Docs > Do not list the output in more than one independent target that may build in parallel or the instances of the rule may conflict. Instead, use the add_custom_target() command to drive the command and make the other targets depend on that one. See the Example: Generating Files for Multiple Targets below. --- source/slang-core-module/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/slang-core-module/CMakeLists.txt b/source/slang-core-module/CMakeLists.txt index 67b0e9af26..50b45c90c9 100644 --- a/source/slang-core-module/CMakeLists.txt +++ b/source/slang-core-module/CMakeLists.txt @@ -152,7 +152,7 @@ set(core_module_common_args slang_add_target( ${core_module_common_args} TARGET_NAME slang-embedded-core-module - EXPLICIT_SOURCE ${core_module_generated_header} + REQUIRES generate_core_module_headers EXTRA_COMPILE_DEFINITIONS_PRIVATE SLANG_EMBED_CORE_MODULE INCLUDE_DIRECTORIES_PRIVATE ${core_module_generated_header_dir} )