From b72353ec3fe529237828cacbe710233d31eb4837 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 24 Sep 2020 14:30:12 -0700 Subject: Enable default cpp prelude. (#1560) * Enable default cpp prelude. * Print the "#include" line as a normal source if the file does not exist. * Bug fix * Fix. * Fix c++ prelude header. * Remove unnecessary fopen call. --- source/slang/run-generators.vcxproj | 30 ++++------------------------- source/slang/run-generators.vcxproj.filters | 14 ++++++++------ source/slang/slang.cpp | 10 ++++++---- source/slang/slang.vcxproj | 1 + source/slang/slang.vcxproj.filters | 3 +++ 5 files changed, 22 insertions(+), 36 deletions(-) (limited to 'source') diff --git a/source/slang/run-generators.vcxproj b/source/slang/run-generators.vcxproj index 41f61f01d..82b993466 100644 --- a/source/slang/run-generators.vcxproj +++ b/source/slang/run-generators.vcxproj @@ -153,6 +153,10 @@ true + + + + @@ -170,32 +174,6 @@ ../../bin/windows-x86/release/slang-embed.exe ../../bin/windows-x64/release/slang-embed.exe - - Document - "../../bin/windows-x86/debug/slang-embed" %(Identity) - "../../bin/windows-x64/debug/slang-embed" %(Identity) - "../../bin/windows-x86/release/slang-embed" %(Identity) - "../../bin/windows-x64/release/slang-embed" %(Identity) - ../../prelude/slang-cpp-scalar-intrinsics.h.cpp - slang-embed %(Identity) - ../../bin/windows-x86/debug/slang-embed.exe - ../../bin/windows-x64/debug/slang-embed.exe - ../../bin/windows-x86/release/slang-embed.exe - ../../bin/windows-x64/release/slang-embed.exe - - - Document - "../../bin/windows-x86/debug/slang-embed" %(Identity) - "../../bin/windows-x64/debug/slang-embed" %(Identity) - "../../bin/windows-x86/release/slang-embed" %(Identity) - "../../bin/windows-x64/release/slang-embed" %(Identity) - ../../prelude/slang-cpp-types.h.cpp - slang-embed %(Identity) - ../../bin/windows-x86/debug/slang-embed.exe - ../../bin/windows-x64/debug/slang-embed.exe - ../../bin/windows-x86/release/slang-embed.exe - ../../bin/windows-x64/release/slang-embed.exe - Document "../../bin/windows-x86/debug/slang-embed" %(Identity) diff --git a/source/slang/run-generators.vcxproj.filters b/source/slang/run-generators.vcxproj.filters index 6a51d5ba7..e8ec8394a 100644 --- a/source/slang/run-generators.vcxproj.filters +++ b/source/slang/run-generators.vcxproj.filters @@ -8,6 +8,14 @@ {E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6} + + + Header Files + + + Header Files + + Source Files @@ -17,12 +25,6 @@ Header Files - - Header Files - - - Header Files - Header Files diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 1086338f4..572c9c3a3 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -41,8 +41,9 @@ #undef NOMINMAX #endif -extern char const* slang_cuda_prelude; -extern char const* slang_hlsl_prelude; +extern Slang::String get_slang_cuda_prelude(); +extern Slang::String get_slang_cpp_prelude(); +extern Slang::String get_slang_hlsl_prelude(); namespace Slang { @@ -189,8 +190,9 @@ void Session::init() } // Set up default prelude code for target languages that need a prelude - m_languagePreludes[Index(SourceLanguage::CUDA)] = slang_cuda_prelude; - m_languagePreludes[Index(SourceLanguage::HLSL)] = slang_hlsl_prelude; + m_languagePreludes[Index(SourceLanguage::CUDA)] = get_slang_cuda_prelude(); + m_languagePreludes[Index(SourceLanguage::CPP)] = get_slang_cpp_prelude(); + m_languagePreludes[Index(SourceLanguage::HLSL)] = get_slang_hlsl_prelude(); } ISlangUnknown* Session::getInterface(const Guid& guid) diff --git a/source/slang/slang.vcxproj b/source/slang/slang.vcxproj index a5d51e36b..d98a29118 100644 --- a/source/slang/slang.vcxproj +++ b/source/slang/slang.vcxproj @@ -298,6 +298,7 @@ + diff --git a/source/slang/slang.vcxproj.filters b/source/slang/slang.vcxproj.filters index fec82a8f5..b9f9d69c0 100644 --- a/source/slang/slang.vcxproj.filters +++ b/source/slang/slang.vcxproj.filters @@ -341,6 +341,9 @@ + + Header Files + Header Files -- cgit v1.2.3