summaryrefslogtreecommitdiff
path: root/source/core/slang-gcc-compiler-util.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-08-12 16:28:18 -0400
committerGitHub <noreply@github.com>2019-08-12 16:28:18 -0400
commitea200663ffe33d7b4c739c0d84e9c21a3ae2ffa6 (patch)
tree73fae6929c3114be15e84875e4e798ef5a3e563c /source/core/slang-gcc-compiler-util.cpp
parent6fc2c37d9a4c408331db1b33deb3b46e74d2a7d2 (diff)
Ability to set Paths on Pass Through/Back End Compilers (#1010)
* Expanded prelude for some other resource types. Disable C++ output for ParameterGroup. * WIP: Layout for CPU. * Fixes to CPU layout. * WIP: The uniform is output, but the variable definition is not. * WIP: Entry point parameters to global scope in C++. Handling of resource types (in so far as outputting) * Some discussion of ABI and different input types. * WIP: More C++ support around resource types. * WIP: Split up variables into different structures on emit. * WIP: Emitting C++ with wrapping up of 'Context' * WIP: C++ code has access to semantic values. Wrap in struct so can use method calls to pass shared state. Disable legalizeResourceTypes and legalizeExistentialTypeLayout * Fix structured buffer layout for CPU. * Remove testing/handling of global uniforms on CPU path. Typo fix. Changed CPU tests to use new CPU calling convention. * Check globals are working. Initalize context to zero globals. * Order the global parameters for C++ ouput by their layout. Note - that layout isn't quite working correctly because the StructuredBuffer<int> the int seems to be consuming uniform space. * Work around for reflection not having all data needed for layout ordering for C++ code. * Output constant buffers as pointers. * Entry point parameters accessed through pointer to struct. * WIP: Layout for CPU is reasonable for test case. * Only output 'f' after float literal if type marks as a float. * Cast construction works on C++. * Made IntrinsicOp::ConvertConstruct to make intent clearer. * C++ handling construction from scalar. Handle access of a scalar with .x. Check default initialization. * Comment about need for split of kIROp_construct. Release build works. * Added support from constructVectorFromScalar to C/C++ target. * Handling of in/out in C/C++. * First pass documentation CPU support. * Improvements to C++/C slang code generation documentation. * Small doc change to include need for mechansim to specify cpp compiler path. * WIP: Being able to set path for backends. * Better handling of swizzling - allow swizzling a scalar into a vector. * Fix missing/broken headers for path setting on session. * Fix for compiling using clang on Windows. * Remove Clang test code. * * Removed spSessionGetGlobalSession - no longer needed because SlangSession is slang::IGlobalSession alias. * Gave Session a ref count on spCreateSession, and have it checked on spDestroySession, so behaves correctly as ISlangUnknown Note that spDestroySession does a release (and checks the ref count on debug builds). It's behaviour could be the same as just release, but this seems closer to the original intention.
Diffstat (limited to 'source/core/slang-gcc-compiler-util.cpp')
-rw-r--r--source/core/slang-gcc-compiler-util.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/source/core/slang-gcc-compiler-util.cpp b/source/core/slang-gcc-compiler-util.cpp
index d42076039..c48e779d1 100644
--- a/source/core/slang-gcc-compiler-util.cpp
+++ b/source/core/slang-gcc-compiler-util.cpp
@@ -279,10 +279,13 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
LineParseResult prevLineResult = LineParseResult::Ignore;
outOutput.reset();
+ outOutput.rawMessages = exeRes.standardError;
for (auto line : LineParser(exeRes.standardError.getUnownedSlice()))
{
CPPCompiler::OutputMessage msg;
+ msg.reset();
+
LineParseResult lineRes;
SLANG_RETURN_ON_FAIL(_parseGCCFamilyLine(line, lineRes, msg));
@@ -383,6 +386,8 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
/* static */SlangResult GCCCompilerUtil::calcArgs(const CompileOptions& options, CommandLine& cmdLine)
{
+ PlatformKind platformKind = (options.platform == PlatformKind::Unknown) ? PlatformUtil::getPlatformKind() : options.platform;
+
cmdLine.addArg("-fvisibility=hidden");
if (options.sourceType == SourceType::CPP)
@@ -391,9 +396,6 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
cmdLine.addArg("-std=c++14");
}
- // Use shared libraries
- //cmdLine.addArg("-shared");
-
switch (options.optimizationLevel)
{
case OptimizationLevel::None:
@@ -425,6 +427,11 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
cmdLine.addArg("-g");
}
+ if (options.flags & CompileOptions::Flag::Verbose)
+ {
+ cmdLine.addArg("-v");
+ }
+
switch (options.floatingPointMode)
{
case FloatingPointMode::Default: break;
@@ -454,8 +461,12 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
{
// Shared library
cmdLine.addArg("-shared");
- // Position independent
- cmdLine.addArg("-fPIC");
+
+ if (PlatformUtil::isFamily(PlatformFamily::Unix, platformKind))
+ {
+ // Position independent
+ cmdLine.addArg("-fPIC");
+ }
break;
}
case TargetType::Executable:
@@ -500,13 +511,14 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
if (options.targetType == TargetType::SharedLibrary)
{
-#if !SLANG_APPLE_FAMILY
- // On MacOS, this linker option is not supported. That's ok though in
- // so far as on MacOS it does report any unfound symbols without the option.
+ if (!PlatformUtil::isFamily(PlatformFamily::Apple, platformKind))
+ {
+ // On MacOS, this linker option is not supported. That's ok though in
+ // so far as on MacOS it does report any unfound symbols without the option.
- // Linker flag to report any undefined symbols as a link error
- cmdLine.addArg("-Wl,--no-undefined");
-#endif
+ // Linker flag to report any undefined symbols as a link error
+ cmdLine.addArg("-Wl,--no-undefined");
+ }
}
// Files to compile
@@ -524,11 +536,11 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
cmdLine.addArg(libPath);
}
- if (options.sourceType == SourceType::CPP)
+ if (options.sourceType == SourceType::CPP && !PlatformUtil::isFamily(PlatformFamily::Windows, platformKind))
{
// Make STD libs available
cmdLine.addArg("-lstdc++");
- // Make maths lib available
+ // Make maths lib available
cmdLine.addArg("-lm");
}