summaryrefslogtreecommitdiffstats
path: root/source/core/slang-platform.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-06-14 18:05:12 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-06-14 15:05:12 -0700
commit1fe24d3a74a9cd51c4a025cd0e78642f3e29df79 (patch)
treea52d2b1e05f0d22accbb70eb4bea69d7c67455a4 /source/core/slang-platform.cpp
parent8c56d83506ef92b15b15bdb5969008dd69c8d2a6 (diff)
Runtime Shared Library compilation and testing (#985)
* Removed the need for VisualStudio specific CPPCompiler Improved the version parsing for gcc/clang Removed need for slang-unix-cpp-compiler-util.cpp/.h Remove binary before compiling in the compile c tests * Moved VisualStudio calcArgs into CPPCompilerUtil - as code is not windows specific. * Set up compile time version for gcc and clang * Fix compilation on OSX - use remove instead of unlink for file deletion. * On OSX - clang uses different string format. * Removed /bin/sh invoking as not required for OSX. * First pass working testing with shared libraries.
Diffstat (limited to 'source/core/slang-platform.cpp')
-rw-r--r--source/core/slang-platform.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp
index 1cb2bc56e..82f914f7d 100644
--- a/source/core/slang-platform.cpp
+++ b/source/core/slang-platform.cpp
@@ -2,6 +2,7 @@
#include "slang-platform.h"
#include "slang-common.h"
+#include "slang-io.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
@@ -25,6 +26,25 @@ namespace Slang
return loadWithPlatformFilename(builder.begin(), handleOut);
}
+/* static */String SharedLibrary::calcPlatformPath(const UnownedStringSlice& path)
+{
+ // Work out the shared library name
+ String parent = Path::getParentDirectory(path);
+ String filename = Path::getFileName(path);
+
+ StringBuilder builder;
+ SharedLibrary::appendPlatformFileName(filename.getUnownedSlice(), builder);
+
+ if (parent.getLength() > 0)
+ {
+ return Path::combine(parent, builder);
+ }
+ else
+ {
+ return builder;
+ }
+}
+
#ifdef _WIN32
// Make sure SlangResult match for common standard window HRESULT
@@ -105,8 +125,8 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
/* static */void SharedLibrary::appendPlatformFileName(const UnownedStringSlice& name, StringBuilder& dst)
{
- // Windows doesn't need the extension or any prefix to work
dst.Append(name);
+ dst.Append(".dll");
}
#else // _WIN32