diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slang-test/slang-test-main.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index cd783bb05..ef5d16b2c 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -7,6 +7,9 @@ #include "../../source/core/slang-type-text-util.h" #include "../../source/core/slang-memory-arena.h" +#include "../../source/compiler-core/slang-artifact-desc-util.h" +#include "../../source/compiler-core/slang-artifact-helper.h" + #include "../../slang-com-helper.h" #include "../../source/core/slang-string-util.h" @@ -2232,13 +2235,17 @@ static TestResult runCPPCompilerSharedLibrary(TestContext* context, TestInput& i // Build a shared library options.targetType = SLANG_SHADER_SHARED_LIBRARY; + auto helper = DefaultArtifactHelper::getSingleton(); + // Compile this source - TerminatedCharSlice sourceFiles[] = { SliceCaster::asTerminatedCharSlice(filePath) }; + ComPtr<IArtifact> sourceArtifact; + helper->createFileArtifact(ArtifactDescUtil::makeDescForSourceLanguage(options.sourceLanguage), asCharSlice(filePath.getUnownedSlice()), sourceArtifact.writeRef()); + TerminatedCharSlice includePaths[] = { TerminatedCharSlice(".") }; - options.sourceFiles = makeSlice(sourceFiles, 1); + options.sourceArtifacts = makeSlice(sourceArtifact.readRef(), 1); options.includePaths = makeSlice(includePaths, 1); - options.modulePath = SliceCaster::asTerminatedCharSlice(modulePath); + options.modulePath = SliceUtil::asTerminatedCharSlice(modulePath); ComPtr<IArtifact> artifact; if (SLANG_FAILED(compiler->compile(options, artifact.writeRef()))) @@ -2353,11 +2360,16 @@ static TestResult runCPPCompilerExecute(TestContext* context, TestInput& input) options.sourceLanguage = (ext == "c") ? SLANG_SOURCE_LANGUAGE_C : SLANG_SOURCE_LANGUAGE_CPP; - TerminatedCharSlice filePaths[] = { SliceCaster::asTerminatedCharSlice(filePath) }; + TerminatedCharSlice filePaths[] = { SliceUtil::asTerminatedCharSlice(filePath) }; + + auto helper = DefaultArtifactHelper::getSingleton(); + + ComPtr<IArtifact> sourceArtifact; + helper->createFileArtifact(ArtifactDescUtil::makeDescForSourceLanguage(options.sourceLanguage), asCharSlice(filePath.getUnownedSlice()), sourceArtifact.writeRef()); // Compile this source - options.sourceFiles = makeSlice(filePaths, 1); - options.modulePath = SliceCaster::asTerminatedCharSlice(modulePath); + options.sourceArtifacts = makeSlice(sourceArtifact.readRef(), 1); + options.modulePath = SliceUtil::asTerminatedCharSlice(modulePath); ComPtr<IArtifact> artifact; if (SLANG_FAILED(compiler->compile(options, artifact.writeRef()))) |
