From 2db15080085856ed9b5f20642dbb354aac59a888 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:53:19 -0500 Subject: Move the file public header files to `include` dir (#4636) * Move the file public header files to `include` dir Close the issue (#4635). Move the following headers files to a `include` dir located at root dir of slang repo: slang-com-helper.h -> include/slang-com-helper.h slang-com-ptr.h -> include/slang-com-ptr.h slang-gfx.h -> include/slang-gfx.h slang.h -> include/slang.h Change cmake/SlangTarget.cmake to add include path to every target, and change the source file to use "#include " to include the public headers. The source code update is by the script like follow: ``` fileNames_slang=$(grep -r "\".*slang\.h\"" source/ -l) for fileName in "${fileNames_slang[@]}" do echo "$fileName" sed -i "s/\".*slang\.h\"/\"slang\.h\"/" $fileName done ``` * Fix the test issues * Fix cpu test issues by adding include seach path * Update cmake to not add include path for every target Also change "#include " to "include "slang.h" " to make the coding style consistent with other slang code. * Change public include to private include for unit-test and slang-glslang --- tools/gfx-unit-test/gfx-test-texture-util.cpp | 2 +- tools/gfx-unit-test/gfx-test-util.cpp | 2 +- tools/gfx/renderer-shared.cpp | 2 +- tools/render-test/diagnostics.h | 2 +- tools/render-test/options.h | 4 ++-- tools/render-test/slang-support.h | 2 +- tools/slang-cpp-extractor/cpp-extractor-main.cpp | 2 +- tools/slang-cpp-extractor/macro-writer.cpp | 2 +- tools/slang-profile/slang-profile-main.cpp | 2 +- .../slang-reflection-test/slang-reflection-test-main.cpp | 4 ++-- tools/slang-test/parse-diagnostic-util.cpp | 2 +- tools/slang-test/parse-diagnostic-util.h | 2 +- tools/slang-test/slang-test-main.cpp | 15 ++++++++++++++- tools/slang-test/test-context.h | 2 +- tools/slang-unit-test/unit-test-com-host-callable.cpp | 6 +++--- tools/slang-unit-test/unit-test-default-matrix-layout.cpp | 6 +++--- tools/slang-unit-test/unit-test-find-check-entrypoint.cpp | 4 ++-- tools/slang-unit-test/unit-test-find-type-by-name.cpp | 2 +- tools/slang-unit-test/unit-test-function-reflection.cpp | 4 ++-- tools/slang-unit-test/unit-test-get-target-code.cpp | 4 ++-- .../slang-unit-test/unit-test-translation-unit-import.cpp | 4 ++-- tools/test-process/test-process-main.cpp | 2 +- tools/test-server/test-server-main.cpp | 2 +- tools/vk-pipeline-create/main.cpp | 4 ++-- 24 files changed, 48 insertions(+), 35 deletions(-) (limited to 'tools') diff --git a/tools/gfx-unit-test/gfx-test-texture-util.cpp b/tools/gfx-unit-test/gfx-test-texture-util.cpp index 3b3a1a760..21e82ab22 100644 --- a/tools/gfx-unit-test/gfx-test-texture-util.cpp +++ b/tools/gfx-unit-test/gfx-test-texture-util.cpp @@ -2,7 +2,7 @@ #include "gfx-test-util.h" #include "tools/unit-test/slang-unit-test.h" -#include +#include "slang-com-ptr.h" #include #include diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp index fe06a1745..3ca67e67b 100644 --- a/tools/gfx-unit-test/gfx-test-util.cpp +++ b/tools/gfx-unit-test/gfx-test-util.cpp @@ -1,7 +1,7 @@ #include "gfx-test-util.h" #include "tools/unit-test/slang-unit-test.h" -#include +#include "slang-com-ptr.h" #define GFX_ENABLE_RENDERDOC_INTEGRATION 0 #define GFX_ENABLE_SPIRV_DEBUG 0 diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index d4fda3183..65a14c8cb 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -6,7 +6,7 @@ #include "../../source/core/slang-stable-hash.h" #include "../../source/core/slang-file-system.h" -#include "../../slang.h" +#include "slang.h" using namespace Slang; diff --git a/tools/render-test/diagnostics.h b/tools/render-test/diagnostics.h index 08ba28e27..fa4c8a389 100644 --- a/tools/render-test/diagnostics.h +++ b/tools/render-test/diagnostics.h @@ -7,7 +7,7 @@ #include "../../source/compiler-core/slang-source-loc.h" #include "../../source/compiler-core/slang-diagnostic-sink.h" -#include "../../slang.h" +#include "slang.h" namespace Slang { diff --git a/tools/render-test/options.h b/tools/render-test/options.h index 6ea166833..1400f0129 100644 --- a/tools/render-test/options.h +++ b/tools/render-test/options.h @@ -7,14 +7,14 @@ #define SLANG_HANDLE_RESULT_FAIL(x) assert(!"failure") #endif -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-writer.h" #include "../../source/core/slang-process-util.h" #include "../../source/compiler-core/slang-command-line-args.h" -#include "../../slang-gfx.h" +#include "slang-gfx.h" namespace renderer_test { diff --git a/tools/render-test/slang-support.h b/tools/render-test/slang-support.h index 6eef93edc..0ed6216a9 100644 --- a/tools/render-test/slang-support.h +++ b/tools/render-test/slang-support.h @@ -3,7 +3,7 @@ #include "slang-gfx.h" -#include +#include "slang.h" #include "shader-input-layout.h" #include "options.h" diff --git a/tools/slang-cpp-extractor/cpp-extractor-main.cpp b/tools/slang-cpp-extractor/cpp-extractor-main.cpp index 2bc0596e1..e3bb041be 100644 --- a/tools/slang-cpp-extractor/cpp-extractor-main.cpp +++ b/tools/slang-cpp-extractor/cpp-extractor-main.cpp @@ -5,7 +5,7 @@ #include #include "../../source/core/slang-secure-crt.h" -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-list.h" #include "../../source/core/slang-string.h" diff --git a/tools/slang-cpp-extractor/macro-writer.cpp b/tools/slang-cpp-extractor/macro-writer.cpp index 24d95850a..285a91851 100644 --- a/tools/slang-cpp-extractor/macro-writer.cpp +++ b/tools/slang-cpp-extractor/macro-writer.cpp @@ -1,6 +1,6 @@ #include "macro-writer.h" -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-list.h" #include "../../source/core/slang-string.h" diff --git a/tools/slang-profile/slang-profile-main.cpp b/tools/slang-profile/slang-profile-main.cpp index 7cf6cb6f8..d23a7ba10 100644 --- a/tools/slang-profile/slang-profile-main.cpp +++ b/tools/slang-profile/slang-profile-main.cpp @@ -5,7 +5,7 @@ #include "../../source/core/slang-process-util.h" -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-string-util.h" diff --git a/tools/slang-reflection-test/slang-reflection-test-main.cpp b/tools/slang-reflection-test/slang-reflection-test-main.cpp index 4b5faae6b..be48d8e92 100644 --- a/tools/slang-reflection-test/slang-reflection-test-main.cpp +++ b/tools/slang-reflection-test/slang-reflection-test-main.cpp @@ -5,8 +5,8 @@ #include #include -#include -#include +#include "slang.h" +#include "slang-com-helper.h" #include "../../source/core/slang-string-escape-util.h" #include "../../source/core/slang-char-util.h" diff --git a/tools/slang-test/parse-diagnostic-util.cpp b/tools/slang-test/parse-diagnostic-util.cpp index 1141f81c4..b0f13b4ee 100644 --- a/tools/slang-test/parse-diagnostic-util.cpp +++ b/tools/slang-test/parse-diagnostic-util.cpp @@ -5,7 +5,7 @@ #include "../../source/core/slang-hex-dump-util.h" #include "../../source/core/slang-type-text-util.h" -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-string-util.h" #include "../../source/core/slang-byte-encode-util.h" diff --git a/tools/slang-test/parse-diagnostic-util.h b/tools/slang-test/parse-diagnostic-util.h index 2ad7a7911..44707b9ff 100644 --- a/tools/slang-test/parse-diagnostic-util.h +++ b/tools/slang-test/parse-diagnostic-util.h @@ -10,7 +10,7 @@ #include "../../source/compiler-core/slang-artifact-diagnostic-util.h" -#include "../../slang-com-ptr.h" +#include "slang-com-ptr.h" struct ParseDiagnosticUtil { diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 9463cbc23..f9e07bdc9 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -11,7 +11,7 @@ #include "../../source/compiler-core/slang-artifact-desc-util.h" #include "../../source/compiler-core/slang-artifact-helper.h" -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-string-util.h" #include "../../source/core/slang-string-escape-util.h" @@ -1629,6 +1629,17 @@ TestResult runExecutableTest(TestContext* context, TestInput& input) String modulePath = Path::combine( Path::getParentDirectory(Path::getExecutablePath()), Path::getFileNameWithoutExt(filePath)); + // String testRoot + // for(;;) + // { + // String testRoot = Path::getParentDirectory(filePath); + // if (testRoot == "") + // { + // break; + // } + // } + // printf("test folder = %s\n", testRoot.begin()); + String moduleExePath; { StringBuilder buf; @@ -1651,6 +1662,8 @@ TestResult runExecutableTest(TestContext* context, TestInput& input) args.add(moduleExePath); args.add("-target"); args.add("exe"); + args.add("-Xgenericcpp"); + args.add("-I./include"); for (auto arg : args) { // If unescaping is needed, do it diff --git a/tools/slang-test/test-context.h b/tools/slang-test/test-context.h index 7006ec905..b42ac1ec9 100644 --- a/tools/slang-test/test-context.h +++ b/tools/slang-test/test-context.h @@ -15,7 +15,7 @@ #include "../../source/compiler-core/slang-json-rpc-connection.h" -#include "../../slang-com-ptr.h" +#include "slang-com-ptr.h" #include "filecheck.h" diff --git a/tools/slang-unit-test/unit-test-com-host-callable.cpp b/tools/slang-unit-test/unit-test-com-host-callable.cpp index 57209fbde..82aa14aa4 100644 --- a/tools/slang-unit-test/unit-test-com-host-callable.cpp +++ b/tools/slang-unit-test/unit-test-com-host-callable.cpp @@ -7,9 +7,9 @@ #include "tools/unit-test/slang-unit-test.h" -#include "../../slang.h" -#include "../../slang-com-helper.h" -#include "../../slang-com-ptr.h" +#include "slang.h" +#include "slang-com-helper.h" +#include "slang-com-ptr.h" #include "../../source/core/slang-list.h" diff --git a/tools/slang-unit-test/unit-test-default-matrix-layout.cpp b/tools/slang-unit-test/unit-test-default-matrix-layout.cpp index 468b7d986..540036650 100644 --- a/tools/slang-unit-test/unit-test-default-matrix-layout.cpp +++ b/tools/slang-unit-test/unit-test-default-matrix-layout.cpp @@ -5,9 +5,9 @@ #include "tools/unit-test/slang-unit-test.h" -#include "../../slang.h" -#include "../../slang-com-helper.h" -#include "../../slang-com-ptr.h" +#include "slang.h" +#include "slang-com-helper.h" +#include "slang-com-ptr.h" #include "../../source/core/slang-list.h" diff --git a/tools/slang-unit-test/unit-test-find-check-entrypoint.cpp b/tools/slang-unit-test/unit-test-find-check-entrypoint.cpp index 371c8ae81..423b83b65 100644 --- a/tools/slang-unit-test/unit-test-find-check-entrypoint.cpp +++ b/tools/slang-unit-test/unit-test-find-check-entrypoint.cpp @@ -1,12 +1,12 @@ // unit-test-translation-unit-import.cpp -#include "../../slang.h" +#include "slang.h" #include #include #include "tools/unit-test/slang-unit-test.h" -#include "../../slang-com-ptr.h" +#include "slang-com-ptr.h" #include "../../source/core/slang-io.h" #include "../../source/core/slang-process.h" diff --git a/tools/slang-unit-test/unit-test-find-type-by-name.cpp b/tools/slang-unit-test/unit-test-find-type-by-name.cpp index 87be156db..ee6ba3516 100644 --- a/tools/slang-unit-test/unit-test-find-type-by-name.cpp +++ b/tools/slang-unit-test/unit-test-find-type-by-name.cpp @@ -1,6 +1,6 @@ // unit-test-find-type-by-name.cpp -#include "../../slang.h" +#include "slang.h" #include #include diff --git a/tools/slang-unit-test/unit-test-function-reflection.cpp b/tools/slang-unit-test/unit-test-function-reflection.cpp index ddbfa439b..ddcb81adc 100644 --- a/tools/slang-unit-test/unit-test-function-reflection.cpp +++ b/tools/slang-unit-test/unit-test-function-reflection.cpp @@ -1,12 +1,12 @@ // unit-test-translation-unit-import.cpp -#include "../../slang.h" +#include "slang.h" #include #include #include "tools/unit-test/slang-unit-test.h" -#include "../../slang-com-ptr.h" +#include "slang-com-ptr.h" #include "../../source/core/slang-io.h" #include "../../source/core/slang-process.h" diff --git a/tools/slang-unit-test/unit-test-get-target-code.cpp b/tools/slang-unit-test/unit-test-get-target-code.cpp index a98510fd5..7cb51c91b 100644 --- a/tools/slang-unit-test/unit-test-get-target-code.cpp +++ b/tools/slang-unit-test/unit-test-get-target-code.cpp @@ -1,12 +1,12 @@ // unit-test-translation-unit-import.cpp -#include "../../slang.h" +#include "slang.h" #include #include #include "tools/unit-test/slang-unit-test.h" -#include "../../slang-com-ptr.h" +#include "slang-com-ptr.h" #include "../../source/core/slang-io.h" #include "../../source/core/slang-process.h" diff --git a/tools/slang-unit-test/unit-test-translation-unit-import.cpp b/tools/slang-unit-test/unit-test-translation-unit-import.cpp index b8108644e..3b7f90c00 100644 --- a/tools/slang-unit-test/unit-test-translation-unit-import.cpp +++ b/tools/slang-unit-test/unit-test-translation-unit-import.cpp @@ -1,12 +1,12 @@ // unit-test-translation-unit-import.cpp -#include "../../slang.h" +#include "slang.h" #include #include #include "tools/unit-test/slang-unit-test.h" -#include "../../slang-com-ptr.h" +#include "slang-com-ptr.h" #include "../../source/core/slang-io.h" #include "../../source/core/slang-process.h" diff --git a/tools/test-process/test-process-main.cpp b/tools/test-process/test-process-main.cpp index 9729c24b7..ea8f30c11 100644 --- a/tools/test-process/test-process-main.cpp +++ b/tools/test-process/test-process-main.cpp @@ -5,7 +5,7 @@ #include -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-string.h" #include "../../source/core/slang-io.h" diff --git a/tools/test-server/test-server-main.cpp b/tools/test-server/test-server-main.cpp index dc6a7916d..750fb7faf 100644 --- a/tools/test-server/test-server-main.cpp +++ b/tools/test-server/test-server-main.cpp @@ -6,7 +6,7 @@ #include "../../source/core/slang-secure-crt.h" -#include "../../slang-com-helper.h" +#include "slang-com-helper.h" #include "../../source/core/slang-string.h" #include "../../source/core/slang-io.h" diff --git a/tools/vk-pipeline-create/main.cpp b/tools/vk-pipeline-create/main.cpp index 893eecfd1..f9acd69ac 100644 --- a/tools/vk-pipeline-create/main.cpp +++ b/tools/vk-pipeline-create/main.cpp @@ -3,8 +3,8 @@ // This tools reads a gfx pipeline dump file and replays the pipeline creation to trigger // shader compilation in the driver. // -#include -#include +#include "slang.h" +#include "slang-com-ptr.h" #include "examples/hello-world/vulkan-api.h" #include "../../source/core/slang-string-util.h" -- cgit v1.2.3