summaryrefslogtreecommitdiffstats
path: root/tools/slang-embed/slang-embed.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-03-28 22:14:33 -0700
committerGitHub <noreply@github.com>2022-03-28 22:14:33 -0700
commit255fd5873f65a6b01d5385c277d55612dc3cc587 (patch)
tree54eda0ae98bc9c1b30ca75e534ca203d8e03f241 /tools/slang-embed/slang-embed.cpp
parent79b81083b75dc0abdbb8184568dbe36d082e04f3 (diff)
Allow slangc to generate exe from .slang file. (#2170)
Diffstat (limited to 'tools/slang-embed/slang-embed.cpp')
-rw-r--r--tools/slang-embed/slang-embed.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/slang-embed/slang-embed.cpp b/tools/slang-embed/slang-embed.cpp
index 4a81c1b95..7fb865eee 100644
--- a/tools/slang-embed/slang-embed.cpp
+++ b/tools/slang-embed/slang-embed.cpp
@@ -18,7 +18,7 @@
#include "../../source/core/slang-string.h"
#include "../../source/core/slang-string-util.h"
#include "../../source/core/slang-io.h"
-
+#include "../../source/core/slang-dictionary.h"
// Utility to free pointers on scope exit
struct ScopedMemory
@@ -59,6 +59,7 @@ struct App
{
char const* appName = "slang-embed";
char const* inputPath = nullptr;
+ Slang::HashSet<Slang::String> includedFiles;
void parseOptions(int argc, char** argv)
{
@@ -89,6 +90,13 @@ struct App
{
using namespace Slang;
+ String canonicalPath;
+ if (SLANG_SUCCEEDED(Slang::Path::getCanonical(inputPath, canonicalPath)))
+ {
+ if (!includedFiles.Add(canonicalPath))
+ return;
+ }
+
// We open the input file in text mode because we are currently
// embedding textual source files. If/when this utility gets
// used for binary files another mode could be called for.