summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-visual-studio-compiler-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core/slang-visual-studio-compiler-util.cpp')
-rw-r--r--source/compiler-core/slang-visual-studio-compiler-util.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/source/compiler-core/slang-visual-studio-compiler-util.cpp b/source/compiler-core/slang-visual-studio-compiler-util.cpp
index df64ed821..0552657f8 100644
--- a/source/compiler-core/slang-visual-studio-compiler-util.cpp
+++ b/source/compiler-core/slang-visual-studio-compiler-util.cpp
@@ -4,6 +4,7 @@
#include "../core/slang-common.h"
#include "../../slang-com-helper.h"
#include "../core/slang-string-util.h"
+#include "../core/slang-string-slice-pool.h"
// if Visual Studio import the visual studio platform specific header
#if SLANG_VC
@@ -250,28 +251,36 @@ namespace Slang
// Link options (parameters past /link go to linker)
cmdLine.addArg("/link");
+ StringSlicePool libPathPool(StringSlicePool::Style::Default);
+
for (const auto& libPath : options.libraryPaths)
{
- // Note that any escaping of the path is handled in the ProcessUtil::
- cmdLine.addPrefixPathArg("/LIBPATH:", libPath);
+ libPathPool.add(libPath);
}
// Link libraries.
for (Artifact* artifact : options.libraries)
{
- if (artifact->getDesc().isCpuBinary())
+ auto desc = artifact->getDesc();
+
+ if (desc.isCpuBinary() && desc.kind == ArtifactKind::Library)
{
- String path;
- SLANG_RETURN_ON_FAIL(artifact->requireFilePath(ArtifactKeep::No, path));
+ // Get the libray name and path
+ SLANG_RETURN_ON_FAIL(artifact->requireFileLike(ArtifactKeep::No));
- if (Path::getPathExt(path).getLength() == 0)
- {
- path.append(".lib");
- }
- cmdLine.addArg(path);
+ libPathPool.add(artifact->getParentPath());
+ // We need the extension for windows
+ cmdLine.addArg(artifact->getBaseName() + ".lib");
}
}
+ // Add all the library paths
+ for (const auto& libPath : libPathPool.getAdded())
+ {
+ // Note that any escaping of the path is handled in the ProcessUtil::
+ cmdLine.addPrefixPathArg("/LIBPATH:", libPath);
+ }
+
return SLANG_OK;
}