summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTobias Frisch <jacki@thejackimonster.de>2024-10-04 10:34:12 +0200
committerGitHub <noreply@github.com>2024-10-04 16:34:12 +0800
commit25c17b9fcbf7a21e9fa19c4a8f08b0406437be24 (patch)
treea85a734b32ea4f27a9cd594586a328858965893b /source
parent9f246a43667b4893040669873400e2e3813328ff (diff)
Allow building using external dependencies (#5076)
* Add options to prevent usage of own submodules Signed-off-by: Jacki <jacki@thejackimonster.de> * Allow using external unordered dense headers Signed-off-by: Jacki <jacki@thejackimonster.de> * Link system wide installed unordered dense Signed-off-by: Jacki <jacki@thejackimonster.de> * Allow external header usage for lz4 and spirv Signed-off-by: Jacki <jacki@thejackimonster.de> * Add more options to disable targets Signed-off-by: Jacki <jacki@thejackimonster.de> * Add option to provide explizit path for spirv headers and remove earlier options that break the build process Signed-off-by: Jacki <jacki@thejackimonster.de> * Rename options to use common prefix Signed-off-by: Jacki <jacki@thejackimonster.de> * Fix indentation for the cmake changes Signed-off-by: Jacki <jacki@thejackimonster.de> * Add advanced_option function for cmake * Normalize includes between system and submodule dependencies Fix any before-accidentally-working problems * Add option for enabling/disabling slang-rhi Signed-off-by: Jacki <jacki@thejackimonster.de> * Pass correct include path for cpu tests * Correct include path --------- Signed-off-by: Jacki <jacki@thejackimonster.de> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'source')
-rw-r--r--source/compiler-core/slang-spirv-core-grammar.h4
-rw-r--r--source/core/slang-dictionary.h4
-rw-r--r--source/core/slang-hash.h4
-rw-r--r--source/core/slang-lz4-compression-system.cpp2
-rw-r--r--source/slang/CMakeLists.txt8
-rw-r--r--source/slang/slang-ir-glsl-legalize.cpp5
6 files changed, 21 insertions, 6 deletions
diff --git a/source/compiler-core/slang-spirv-core-grammar.h b/source/compiler-core/slang-spirv-core-grammar.h
index 958aaaef2..d78a339f1 100644
--- a/source/compiler-core/slang-spirv-core-grammar.h
+++ b/source/compiler-core/slang-spirv-core-grammar.h
@@ -4,7 +4,9 @@
#include "../core/slang-string.h"
#include "../core/slang-string-slice-pool.h"
#include "../core/slang-dictionary.h"
-#include "../../external/spirv-headers/include/spirv/unified1/spirv.h"
+
+#include <spirv/unified1/spirv.h>
+
#include <optional>
namespace Slang
diff --git a/source/core/slang-dictionary.h b/source/core/slang-dictionary.h
index ba4672740..9c445c3c9 100644
--- a/source/core/slang-dictionary.h
+++ b/source/core/slang-dictionary.h
@@ -8,7 +8,9 @@
#include "slang-exception.h"
#include "slang-math.h"
#include "slang-hash.h"
-#include "../../external/unordered_dense/include/ankerl/unordered_dense.h"
+
+#include <ankerl/unordered_dense.h>
+
#include <initializer_list>
namespace Slang
diff --git a/source/core/slang-hash.h b/source/core/slang-hash.h
index 784f7fd23..3e255f7db 100644
--- a/source/core/slang-hash.h
+++ b/source/core/slang-hash.h
@@ -3,7 +3,9 @@
#include "../../include/slang.h"
#include "slang-math.h"
-#include "../../external/unordered_dense/include/ankerl/unordered_dense.h"
+
+#include <ankerl/unordered_dense.h>
+
#include <cstring>
#include <type_traits>
diff --git a/source/core/slang-lz4-compression-system.cpp b/source/core/slang-lz4-compression-system.cpp
index c20b457df..1e2ab9558 100644
--- a/source/core/slang-lz4-compression-system.cpp
+++ b/source/core/slang-lz4-compression-system.cpp
@@ -5,7 +5,7 @@
#include "slang-blob.h"
-#include "../../external/lz4/lib/lz4.h"
+#include <lz4.h>
namespace Slang
{
diff --git a/source/slang/CMakeLists.txt b/source/slang/CMakeLists.txt
index fd20bbe22..78d2376a7 100644
--- a/source/slang/CMakeLists.txt
+++ b/source/slang/CMakeLists.txt
@@ -152,8 +152,12 @@ target_include_directories(
# generated lookup tables
#
+if (NOT SLANG_USE_SYSTEM_SPIRV_HEADERS)
+ set(SLANG_SPIRV_HEADERS_INCLUDE_DIR "${slang_SOURCE_DIR}/external/spirv-headers/include")
+endif()
+
set(SLANG_LOOKUP_GENERATOR_INPUT_JSON
- "${slang_SOURCE_DIR}/external/spirv-headers/include/spirv/unified1/extinst.glsl.std.450.grammar.json"
+ "${SLANG_SPIRV_HEADERS_INCLUDE_DIR}/spirv/unified1/extinst.glsl.std.450.grammar.json"
)
set(SLANG_LOOKUP_GENERATOR_OUTPUT_DIR
"${CMAKE_CURRENT_BINARY_DIR}/slang-lookup-tables/"
@@ -179,7 +183,7 @@ add_custom_command(
)
set(SLANG_SPIRV_CORE_SOURCE_JSON
- "${slang_SOURCE_DIR}/external/spirv-headers/include/spirv/unified1/spirv.core.grammar.json"
+ "${SLANG_SPIRV_HEADERS_INCLUDE_DIR}/spirv/unified1/spirv.core.grammar.json"
)
set(SLANG_SPIRV_CORE_GRAMMAR_SOURCE
"${SLANG_LOOKUP_GENERATOR_OUTPUT_DIR}/slang-spirv-core-grammar-embed.cpp"
diff --git a/source/slang/slang-ir-glsl-legalize.cpp b/source/slang/slang-ir-glsl-legalize.cpp
index 2d7e0c804..4f19d45a2 100644
--- a/source/slang/slang-ir-glsl-legalize.cpp
+++ b/source/slang/slang-ir-glsl-legalize.cpp
@@ -11,7 +11,12 @@
#include "slang-ir-clone.h"
#include "slang-ir-single-return.h"
#include "slang-glsl-extension-tracker.h"
+
+#ifdef SLANG_USE_SYSTEM_SPIRV_HEADER
+#include <spirv/unified1/spirv.h>
+#else
#include "../../external/spirv-headers/include/spirv/unified1/spirv.h"
+#endif
namespace Slang
{