From 1fe24d3a74a9cd51c4a025cd0e78642f3e29df79 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 14 Jun 2019 18:05:12 -0400 Subject: 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. --- source/core/slang-platform.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'source/core/slang-platform.cpp') 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 -- cgit v1.2.3