summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/core/slang-test-tool-util.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/core/slang-test-tool-util.cpp b/source/core/slang-test-tool-util.cpp
index 487ea89ac..74802e233 100644
--- a/source/core/slang-test-tool-util.cpp
+++ b/source/core/slang-test-tool-util.cpp
@@ -71,7 +71,12 @@ namespace Slang
static SlangResult _addCPPPrelude(const String& rootPath, slang::IGlobalSession* session)
{
String includePath;
- SLANG_RETURN_ON_FAIL(TestToolUtil::getIncludePath(rootPath, "prelude/slang-cpp-prelude.h", includePath));
+ SlangResult res = SLANG_FAIL;
+ if (SLANG_FAILED(res))
+ res = TestToolUtil::getIncludePath(Path::combine(rootPath, "include"), "slang-cpp-prelude.h", includePath);
+ if (SLANG_FAILED(res))
+ res = TestToolUtil::getIncludePath(rootPath, "prelude/slang-cpp-prelude.h", includePath);
+ SLANG_RETURN_ON_FAIL(res);
StringBuilder prelude;
prelude << "#include \"" << includePath << "\"\n\n";
session->setLanguagePrelude(SLANG_SOURCE_LANGUAGE_CPP, prelude.getBuffer());
@@ -81,7 +86,12 @@ static SlangResult _addCPPPrelude(const String& rootPath, slang::IGlobalSession*
static SlangResult _addCUDAPrelude(const String& rootPath, slang::IGlobalSession* session)
{
String includePath;
- SLANG_RETURN_ON_FAIL(TestToolUtil::getIncludePath(rootPath, "prelude/slang-cuda-prelude.h", includePath));
+ SlangResult res = SLANG_FAIL;
+ if (SLANG_FAILED(res))
+ res = TestToolUtil::getIncludePath(Path::combine(rootPath, "include"), "slang-cuda-prelude.h", includePath);
+ if (SLANG_FAILED(res))
+ res = TestToolUtil::getIncludePath(rootPath, "prelude/slang-cuda-prelude.h", includePath);
+ SLANG_RETURN_ON_FAIL(res);
StringBuilder prelude;
prelude << "#include \"" << includePath << "\"\n\n";
session->setLanguagePrelude(SLANG_SOURCE_LANGUAGE_CUDA, prelude.getBuffer());
@@ -109,6 +119,8 @@ static SlangResult _addCUDAPrelude(const String& rootPath, slang::IGlobalSession
SLANG_RETURN_ON_FAIL(Path::getCanonical(parentPath, rootRelPath));
do
{
+ if(File::exists(Path::combine(rootRelPath, "include/slang-cpp-prelude.h")))
+ break;
if(File::exists(Path::combine(rootRelPath, "prelude/slang-cpp-prelude.h")))
break;