diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-08-20 09:43:59 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-20 09:43:59 -0400 |
| commit | 7258ef4ddebd021208a019f6ee73edcda57a88f7 (patch) | |
| tree | 30cccf48c8f03e59e48a2d265e05494238fe758d /slang.h | |
| parent | 3e78e4654cdf9556869325f2ed2da517f252d879 (diff) | |
User defined downstream compiler prelude (#1028)
* Added setDownstreamCompilerPrelude
Renamed setPassThroughPath to setDownstreamCompilerPath.
Fixed tests.
Added prelude directory & code to TestToolUtil to setup default preludes for testing/command line apis.
* Fix merge problem
* Remove hacks to make prelude work by adding a search path as no longer needed with 'user prelude'.
* Split up prelude into scalar intrinsics, and types.
Use slang.h for main header.
slang-cpp-prelude.h can now just include what it needs (relative to prelude directory) and define the few remaining things/work arounds.
* Fix typo.
Diffstat (limited to 'slang.h')
| -rw-r--r-- | slang.h | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -517,6 +517,7 @@ extern "C" SLANG_EXECUTABLE, ///< Executable (for hosting CPU/OS) SLANG_SHARED_LIBRARY, ///< A shared library/Dll (for hosting CPU/OS) SLANG_HOST_CALLABLE, ///< A CPU target that makes the compiled code available to be run immediately + SLANG_TARGET_COUNT_OF, }; /* A "container format" describes the way that the outputs @@ -2647,13 +2648,27 @@ namespace slang virtual SLANG_NO_THROW SlangProfileID SLANG_MCALL findProfile( char const* name) = 0; - /** Set the path that pass through (aka back end compilers) will - be looked from. For back ends that are dlls/shared libraries, it will mean the path will + /** Set the path that downstream compilers (aka back end compilers) will + be looked from. + @param passThrough Identifies the downstream compiler + @param path The path to find the downstream compiler (shared library/dll/executable) + + For back ends that are dlls/shared libraries, it will mean the path will be prefixed with the path when calls are made out to ISlangSharedLibraryLoader. For executables - it will look for executables along the path */ - virtual void SLANG_MCALL setPassThroughPath( + virtual SLANG_NO_THROW void SLANG_MCALL setDownstreamCompilerPath( SlangPassThrough passThrough, char const* path) = 0; + + /** Set the 'prelude' for generated code for a 'downstream compiler'. + @param passThrough The downstream compiler for generated code that will have the prelude applied to it. + @param preludeText The text added pre-pended verbatim before the generated source + + That for pass-through usage, prelude is not pre-pended, preludes are for code generation only. + */ + virtual SLANG_NO_THROW void SLANG_MCALL setDownstreamCompilerPrelude( + SlangPassThrough passThrough, + const char* preludeText) = 0; }; #define SLANG_UUID_IGlobalSession { 0xc140b5fd, 0xc78, 0x452e, { 0xba, 0x7c, 0x1a, 0x1e, 0x70, 0xc7, 0xf7, 0x1c } }; |
