From 393ce4f746c6697442a3a61debd12101fbe4e9db Mon Sep 17 00:00:00 2001 From: Craig Kolb Date: Tue, 31 May 2022 12:04:08 -0700 Subject: Add Slang::String compatibility with std::ostream (#2256) * Work around MacOS compilation issue with embed stlib - The enable-stdlib-generator project is created with 'kind = StaticLib' to allow the build to work, even though the project doesn't actually create a library. - Unlike some other platforms, MacOs "ar" emits an error if no object files are listed to be added to an archive. This causes enable-stdlib-generator to fail on MacOS. - Changing the project's kind to "SharedLib" works around the issue. Other values for kind do not seem to work around the issue. - Add an optional flag to generatorProject to indicate that kind = "SharedLibrary" should be used, rather than "StaticLibrary" - Enable embed stdlib in github_macos_build.sh * Allow Strings to be used with std::ostream. Co-authored-by: jsmall-nvidia --- source/core/slang-string.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/core/slang-string.cpp') diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp index 1a6221cc8..5f2ba13ba 100644 --- a/source/core/slang-string.cpp +++ b/source/core/slang-string.cpp @@ -690,5 +690,10 @@ namespace Slang return true; } +} +std::ostream& operator<< (std::ostream& stream, const Slang::String& s) +{ + stream << s.getBuffer(); + return stream; } -- cgit v1.2.3