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 --- examples/autodiff-texture/main.cpp | 2 +- examples/cpu-com-example/main.cpp | 6 +++--- examples/cpu-hello-world/main.cpp | 6 +++--- examples/gpu-printing/gpu-printing.h | 2 +- examples/gpu-printing/main.cpp | 4 ++-- examples/hello-world/main.cpp | 4 ++-- examples/model-viewer/main.cpp | 2 +- examples/nv-aftermath-example/main.cpp | 2 +- examples/platform-test/main.cpp | 2 +- examples/ray-tracing-pipeline/main.cpp | 2 +- examples/ray-tracing/main.cpp | 2 +- examples/shader-object/main.cpp | 4 ++-- examples/shader-toy/main.cpp | 4 ++-- examples/triangle/main.cpp | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-) (limited to 'examples') diff --git a/examples/autodiff-texture/main.cpp b/examples/autodiff-texture/main.cpp index 5cd0a3523..01cad6fe4 100644 --- a/examples/autodiff-texture/main.cpp +++ b/examples/autodiff-texture/main.cpp @@ -5,7 +5,7 @@ #include "source/core/slang-basic.h" #include "tools/platform/vector-math.h" #include "tools/platform/window.h" -#include +#include "slang.h" using namespace gfx; using namespace Slang; diff --git a/examples/cpu-com-example/main.cpp b/examples/cpu-com-example/main.cpp index d75822e72..6da2aa0df 100644 --- a/examples/cpu-com-example/main.cpp +++ b/examples/cpu-com-example/main.cpp @@ -2,10 +2,10 @@ #include -#include +#include "slang.h" -#include -#include +#include "slang-com-ptr.h" +#include "slang-com-helper.h" // This includes a useful small function for setting up the prelude (described more further below). #include "../../source/core/slang-test-tool-util.h" diff --git a/examples/cpu-hello-world/main.cpp b/examples/cpu-hello-world/main.cpp index fedbf7ebe..7eb897cc2 100644 --- a/examples/cpu-hello-world/main.cpp +++ b/examples/cpu-hello-world/main.cpp @@ -16,12 +16,12 @@ // Of course, in order to use the Slang API, we need to include // its header. We have set up the build options for this project // so that it is as simple as: -#include +#include "slang.h" // Allows use of ComPtr - which we can use to scope any 'com-like' pointers easily -#include +#include "slang-com-ptr.h" // Provides macros for handling SlangResult values easily -#include +#include "slang-com-helper.h" // This includes a useful small function for setting up the prelude (described more further below). #include "../../source/core/slang-test-tool-util.h" diff --git a/examples/gpu-printing/gpu-printing.h b/examples/gpu-printing/gpu-printing.h index 81c2e615f..64eaf770a 100644 --- a/examples/gpu-printing/gpu-printing.h +++ b/examples/gpu-printing/gpu-printing.h @@ -9,7 +9,7 @@ // strings that were specified in Slang shader code, and // for that it will use the Slang reflection API. // -#include +#include "slang.h" // We also need a way to store the data for strings that // were used in shader code, and we will go ahead and diff --git a/examples/gpu-printing/main.cpp b/examples/gpu-printing/main.cpp index 39b97a889..aa5beea95 100644 --- a/examples/gpu-printing/main.cpp +++ b/examples/gpu-printing/main.cpp @@ -1,9 +1,9 @@ // main.cpp #include -#include +#include "slang.h" -#include +#include "slang-com-ptr.h" using Slang::ComPtr; #include "gpu-printing.h" diff --git a/examples/hello-world/main.cpp b/examples/hello-world/main.cpp index cdae6e92b..53285ae51 100644 --- a/examples/hello-world/main.cpp +++ b/examples/hello-world/main.cpp @@ -7,8 +7,8 @@ // The goal is to demonstrate how to use the Slang API to cross compile // shader code. // -#include -#include +#include "slang.h" +#include "slang-com-ptr.h" #include "vulkan-api.h" #include "examples/example-base/example-base.h" diff --git a/examples/model-viewer/main.cpp b/examples/model-viewer/main.cpp index 5f2a39441..8627fe2c4 100644 --- a/examples/model-viewer/main.cpp +++ b/examples/model-viewer/main.cpp @@ -16,7 +16,7 @@ // We still need to include the Slang header to use the Slang API // -#include +#include "slang.h" #include "slang-com-helper.h" // We will again make use of a graphics API abstraction diff --git a/examples/nv-aftermath-example/main.cpp b/examples/nv-aftermath-example/main.cpp index c4f40fda6..9850586c8 100644 --- a/examples/nv-aftermath-example/main.cpp +++ b/examples/nv-aftermath-example/main.cpp @@ -1,6 +1,6 @@ // main.cpp -#include +#include "slang.h" #include "slang-gfx.h" #include "gfx-util/shader-cursor.h" #include "tools/platform/window.h" diff --git a/examples/platform-test/main.cpp b/examples/platform-test/main.cpp index bfa00c5da..f20a5a716 100644 --- a/examples/platform-test/main.cpp +++ b/examples/platform-test/main.cpp @@ -1,4 +1,4 @@ -#include +#include "slang.h" #include "tools/platform/window.h" #include "examples/example-base/example-base.h" diff --git a/examples/ray-tracing-pipeline/main.cpp b/examples/ray-tracing-pipeline/main.cpp index a632761bc..c4da87756 100644 --- a/examples/ray-tracing-pipeline/main.cpp +++ b/examples/ray-tracing-pipeline/main.cpp @@ -3,7 +3,7 @@ // This file implements an example of hardware ray-tracing using // Slang shaders and the `gfx` graphics API. -#include +#include "slang.h" #include "slang-gfx.h" #include "gfx-util/shader-cursor.h" #include "tools/platform/window.h" diff --git a/examples/ray-tracing/main.cpp b/examples/ray-tracing/main.cpp index 6c1a6639d..2eb0a8481 100644 --- a/examples/ray-tracing/main.cpp +++ b/examples/ray-tracing/main.cpp @@ -3,7 +3,7 @@ // This file implements an example of hardware ray-tracing using // Slang shaders and the `gfx` graphics API. -#include +#include "slang.h" #include "slang-gfx.h" #include "gfx-util/shader-cursor.h" #include "tools/platform/window.h" diff --git a/examples/shader-object/main.cpp b/examples/shader-object/main.cpp index c4940e78f..15e2df54c 100644 --- a/examples/shader-object/main.cpp +++ b/examples/shader-object/main.cpp @@ -8,8 +8,8 @@ // simplifies shader specialization and parameter binding when using `interface` typed // shader parameters. // -#include -#include +#include "slang.h" +#include "slang-com-ptr.h" using Slang::ComPtr; #include "slang-gfx.h" diff --git a/examples/shader-toy/main.cpp b/examples/shader-toy/main.cpp index 105c74cc0..13a79c7ee 100644 --- a/examples/shader-toy/main.cpp +++ b/examples/shader-toy/main.cpp @@ -10,8 +10,8 @@ // This example uses the Slang C/C++ API, alonmg with its optional type // for managing COM-style reference-counted pointers. // -#include -#include +#include "slang.h" +#include "slang-com-ptr.h" using Slang::ComPtr; // This example uses a graphics API abstraction layer that is implemented inside diff --git a/examples/triangle/main.cpp b/examples/triangle/main.cpp index 90589c157..93ae1bd2e 100644 --- a/examples/triangle/main.cpp +++ b/examples/triangle/main.cpp @@ -14,7 +14,7 @@ // its header. We have set up the build options for this project // so that it is as simple as: // -#include +#include "slang.h" // // Other build setups are possible, and Slang doesn't assume that // its include directory must be added to your global include -- cgit v1.2.3