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 /source/slang/slang-compiler.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 'source/slang/slang-compiler.h')
| -rw-r--r-- | source/slang/slang-compiler.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index ce01e5ea3..a6be59c76 100644 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h @@ -62,6 +62,7 @@ namespace Slang Executable = SLANG_EXECUTABLE, SharedLibrary = SLANG_SHARED_LIBRARY, HostCallable = SLANG_HOST_CALLABLE, + CountOf = SLANG_TARGET_COUNT_OF, }; CodeGenTarget calcCodeGenTargetFromName(const UnownedStringSlice& name); @@ -1057,6 +1058,13 @@ namespace Slang /// ComPtr<ISlangBlob> createRawBlob(void const* data, size_t size); + + /// Given a target returns the required downstream compiler + PassThroughMode getDownstreamCompilerRequiredForTarget(CodeGenTarget target); + + PassThroughMode getPassThroughModeForCPPCompiler(CPPCompiler::CompilerType type); + + /// A context for loading and re-using code modules. class Linkage : public RefObject, public slang::ISession { @@ -1791,10 +1799,13 @@ namespace Slang SLANG_NO_THROW SlangProfileID SLANG_MCALL findProfile( char const* name) override; - SLANG_NO_THROW void SLANG_MCALL setPassThroughPath( + SLANG_NO_THROW void SLANG_MCALL setDownstreamCompilerPath( SlangPassThrough passThrough, char const* path) override; + SLANG_NO_THROW void SLANG_MCALL setDownstreamCompilerPrelude( + SlangPassThrough inPassThrough, + char const* prelude) override; enum class SharedLibraryFuncType { @@ -1928,6 +1939,9 @@ namespace Slang SlangFuncPtr getSharedLibraryFunc(SharedLibraryFuncType type, DiagnosticSink* sink); + /// Get the downstream compiler prelude + const String& getDownstreamCompilerPrelude(PassThroughMode mode) { return m_downstreamCompilerPreludes[int(mode)]; } + /// Finds out what compilers are present and caches the result CPPCompilerSet* requireCPPCompilerSet(); @@ -1943,7 +1957,8 @@ namespace Slang /// Linkage used for all built-in (stdlib) code. RefPtr<Linkage> m_builtinLinkage; - String m_passThroughPaths[int(PassThroughMode::CountOf)]; ///< Paths for each pass through + String m_downstreamCompilerPaths[int(PassThroughMode::CountOf)]; ///< Paths for each pass through + String m_downstreamCompilerPreludes[int(PassThroughMode::CountOf)]; ///< Prelude for each type of target }; |
