summaryrefslogtreecommitdiffstats
path: root/source/slang/CMakeLists.txt
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-01-18 16:46:00 -0800
committerGitHub <noreply@github.com>2024-01-18 16:46:00 -0800
commitc5c1a25ab6d0e509e893d737a679ac47949df2f6 (patch)
treee60d4f96ae5105ef19c6b238a4d98467ff58975d /source/slang/CMakeLists.txt
parent1a13842f7ece9f3c492a7017509b75eafa903bbf (diff)
Capability def parsing & codegen + disjoint sets (#3451)
* Capability def parsing & codegen + disjoint sets This change adds a capability definition file, and a code generator to produce C++ code that defines the capability enums and necessary data structures around the capabilities. Extends the existing CapabilitySet class to support expressing disjoint sets of capabilities. This sets up for the next change that will enhance our type checking with reasoning of capability requirements. * Fix cmake. * Fix warning. * Fix. * Fix isBetterForTarget to prefer less specialized option. * Fix. * Fix premake. * Fix intrinsic. * Fix vs sln file. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/CMakeLists.txt')
-rw-r--r--source/slang/CMakeLists.txt52
1 files changed, 52 insertions, 0 deletions
diff --git a/source/slang/CMakeLists.txt b/source/slang/CMakeLists.txt
index c3ea18433..44785559f 100644
--- a/source/slang/CMakeLists.txt
+++ b/source/slang/CMakeLists.txt
@@ -47,6 +47,54 @@ target_include_directories(
)
#
+# generate capability files
+#
+glob_append(SLANG_CAPABILITY_SOURCE "*.capdef")
+
+set(SLANG_CAPABILITY_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/capability")
+
+# Generate the output file list
+set(SLANG_CAPABILITY_GENERATED_FILES
+ "${SLANG_CAPABILITY_OUTPUT_DIR}/slang-generated-capability-defs.h"
+ "${SLANG_CAPABILITY_OUTPUT_DIR}/slang-generated-capability-defs-impl.h"
+ "${SLANG_CAPABILITY_OUTPUT_DIR}/slang-lookup-capability-defs.cpp"
+)
+add_custom_command(
+ OUTPUT ${SLANG_CAPABILITY_GENERATED_FILES}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${SLANG_CAPABILITY_OUTPUT_DIR}
+ COMMAND
+ slang-capability-generator ${SLANG_CAPABILITY_SOURCE} --target-directory ${SLANG_CAPABILITY_OUTPUT_DIR}
+ DEPENDS ${SLANG_CAPABILITY_SOURCE}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+ VERBATIM
+)
+add_library(
+ slang-capability-defs
+ INTERFACE
+ EXCLUDE_FROM_ALL
+ ${SLANG_CAPABILITY_GENERATED_FILES}
+)
+set_target_properties(slang-capability-defs PROPERTIES FOLDER generated)
+target_include_directories(
+ slang-capability-defs
+ INTERFACE ${SLANG_CAPABILITY_OUTPUT_DIR}
+ INTERFACE ${slang_SOURCE_DIR}/source/slang
+)
+
+add_library(
+ slang-capability-lookup
+ INTERFACE
+ EXCLUDE_FROM_ALL
+ ${SLANG_CAPABILITY_GENERATED_FILES}
+)
+set_target_properties(slang-capability-lookup PROPERTIES FOLDER generated)
+target_sources(
+ slang-capability-lookup
+ INTERFACE
+ "${SLANG_CAPABILITY_OUTPUT_DIR}/slang-lookup-capability-defs.cpp"
+)
+
+#
# generated headers for reflection
#
@@ -118,6 +166,8 @@ slang_add_target(
core
compiler-core
# Bundle the source unconditionally
+ slang-capability-defs
+ slang-capability-lookup
slang-meta-headers
slang-reflect-headers
SPIRV-Headers
@@ -164,6 +214,8 @@ slang_add_target(
core
compiler-core
prelude
+ slang-capability-defs
+ slang-capability-lookup
slang-reflect-headers
SPIRV-Headers
# slang.h is in the project root, so include that directory in the interface