From 972a931452c3f06a23a4f67ccfb655851df53fa4 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 22 May 2023 17:22:22 -0400 Subject: Source embedding for output (#2889) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix typo. * Add options for source embedding. * Small improvements. * Working with tests. * Add check for supported language types for embedding. * Try and remove assume warning. * Fix warning on MacOSX. * Some extra checking around Style::Text. * Some small improvements to docs/handling for headers extensions. * Fix md issue. * Small fixes around zeroing partial last element. * Another small fix.... * Small improvement in hex conversion. * Add an assert for unsignedness. --- docs/command-line-slangc-reference.md | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'docs/command-line-slangc-reference.md') diff --git a/docs/command-line-slangc-reference.md b/docs/command-line-slangc-reference.md index 777d586d1..16d5b52a2 100644 --- a/docs/command-line-slangc-reference.md +++ b/docs/command-line-slangc-reference.md @@ -29,6 +29,7 @@ slangc -help-style markdown -h * [optimization-level](#optimization-level) * [debug-level](#debug-level) * [file-system-type](#file-system-type) +* [source-embed-style](#source-embed-style) * [target](#target) * [stage](#stage) * [vulkan-shift](#vulkan-shift) @@ -237,6 +238,36 @@ Treat the rest of the command line as input files. Reports the time spent in the downstream compiler. + +## -source-embed-style + +**-source-embed-style <[source-embed-style](#source-embed-style)>** + +If source embedding is enabled, defines the style used. When enabled (with any style other than `none`), will write compile results into embeddable source for the target language. If no output file is specified, the output is written to stdout. If an output file is specified it is written either to that file directly (if it is appropriate for the target language), or it will be output to the filename with an appropriate extension. + + + +Note for C/C++ with u16/u32/u64 types it is necessary to have "#include <stdint.h>" before the generated file. + + + + + +## -source-embed-name + +**-source-embed-name <name>** + +The name used as the basis for variables output for source embedding. + + + +## -source-embed-language + +**-source-embed-language <[language](#language)>** + +The language to be used for source embedding. Defaults to C/C++. Currently only C/C++ are supported + + # Target @@ -719,6 +750,20 @@ File System Type * `load-file` : Just implements loadFile interface, so will be wrapped with CacheFileSystem internally. * `os` : Use the OS based file system directly (without file system caching) + +# source-embed-style + +Source Embed Style + +* `none` : No source level embedding +* `default` : The default embedding for the type to be embedded +* `text` : Embed as text. May change line endings. If output isn't text will use 'default'. Size will *not* contain terminating 0. +* `binary-text` : Embed as text assuming contents is binary. +* `u8` : Embed as unsigned bytes. +* `u16` : Embed as uint16_t. +* `u32` : Embed as uint32_t. +* `u64` : Embed as uint64_t. + # target -- cgit v1.2.3