summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-07-09 13:59:30 -0400
committerGitHub <noreply@github.com>2019-07-09 13:59:30 -0400
commitf52f5cd4a7b5b71617b949fc62a78abe8c4822b3 (patch)
tree48f636f33e199b3508d779941c034f7be91debc4 /source/core
parent691ebae763e29327249735d67fbb231c75b17840 (diff)
WIP: slang to C++ code generation (#997)
* WIP: Emitting Cpp * Added HLSLType instead of using IRInst - because they don't seem to be deduped. * Removed need for lexer to take a String. Added mechansim to lookup intrinsic functions on C++. * A c/c++ cross compilation test. * WIP Cpp output using cloning and slang types. * More work to generate mul funcs. * WIP: Outputting some simple C++. * Expose findOrEmitHoistableInst to IRBuilder to aid cloning, * Simplification for checking for BasicTypes. Test infrastructure compiles output C++ code. * Dot and mat/vec multiplication output. * First pass at swizzling. * First support for binary ops. * Builtin binary and unary functions. * Any and all. * WIP adding support for other functions. Added code to generate function signature. * Add scalar functions to slang-cpp-prelude.h * Support for most built in operations. * Tested first ternary. * Checking the emitting of corner cases functions - normalize, length, any, all, normalize, reflect. * Check asfloat etc work. * Fmod support. * WIP Array handling in C++. * First stage in being able to handl arbitrary type output for CLikeSourceEmitter * Removed Handler/Emitter split - so can implement more easily complex type naming. * Array passing by value first pass. * Rename Array -> FixedArray * Outputs structs in C++. * Emit the thread config. * Dimension -> TypeDimension * SpecializedOperation -> SpecializedIntrinsic Operation -> IntrinsicOp Use shared impl of isNominalOp Commented use of m_uniqueModule etc. * Add code to test slang->cpp when compiled doesn't have errors. Does so by building shared library and exporting the entry point. * Fix linux clang/gcc compile error about override not being specified. * Make sure c-cross-compile is run on linux targets/smoke. * Remove c-cross-compile.slang from smoke. * Fix running tests/cross-compile/c-cross-compile.slang on Ubuntu 16.04 * Only add -std=c++11 for C++ source.
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-gcc-compiler-util.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/core/slang-gcc-compiler-util.cpp b/source/core/slang-gcc-compiler-util.cpp
index 9f22526a1..d210fa829 100644
--- a/source/core/slang-gcc-compiler-util.cpp
+++ b/source/core/slang-gcc-compiler-util.cpp
@@ -338,6 +338,12 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
/* static */void GCCCompilerUtil::calcArgs(const CompileOptions& options, CommandLine& cmdLine)
{
cmdLine.addArg("-fvisibility=hidden");
+
+ if (options.sourceType == SourceType::CPP)
+ {
+ cmdLine.addArg("-std=c++11");
+ }
+
// Use shared libraries
//cmdLine.addArg("-shared");
@@ -454,6 +460,8 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse
{
// Make STD libs available
cmdLine.addArg("-lstdc++");
+ // Make maths lib available
+ cmdLine.addArg("-lm");
}
}