From 6fc2c37d9a4c408331db1b33deb3b46e74d2a7d2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 12 Aug 2019 15:41:41 -0400 Subject: Callable CPU code support (#1014) * First pass support for compiling to a loaded shared library. * Improve documentation for cpu target. * Removed the SLANG_COMPILE_FLAG_LOAD_SHARED_LIBRARY flag. Use the SLANG_HOST_CALLABLE code target Document mechanism. * Fix typo in cpp-resource.slang In test code if the target is 'callable' we don't need to compile (indeed there is no source file). * Small refactor using CommandLineCPPCompiler as base class to implement VisualStudioCPPCompiler and GCCCPPCompiler. * Improvements around CPPCompiler. Mechanism to know products produced. Cleaning up products after execution. * Fix multiple definition of 'SourceType' --- source/core/slang-cpp-compiler.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source/core/slang-cpp-compiler.cpp') diff --git a/source/core/slang-cpp-compiler.cpp b/source/core/slang-cpp-compiler.cpp index 54138ab27..7ac4e96b4 100644 --- a/source/core/slang-cpp-compiler.cpp +++ b/source/core/slang-cpp-compiler.cpp @@ -160,9 +160,9 @@ void CPPCompiler::Output::removeByType(OutputMessage::Type type) } } -/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GenericCPPCompiler !!!!!!!!!!!!!!!!!!!!!!*/ +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CommandLineCPPCompiler !!!!!!!!!!!!!!!!!!!!!!*/ -SlangResult GenericCPPCompiler::compile(const CompileOptions& options, Output& outOutput) +SlangResult CommandLineCPPCompiler::compile(const CompileOptions& options, Output& outOutput) { outOutput.reset(); @@ -170,7 +170,7 @@ SlangResult GenericCPPCompiler::compile(const CompileOptions& options, Output& o CommandLine cmdLine(m_cmdLine); // Append command line args to the end of cmdLine using the target specific function for the specified options - m_calcArgsFunc(options, cmdLine); + SLANG_RETURN_ON_FAIL(calcArgs(options, cmdLine)); ExecuteResult exeRes; @@ -190,12 +190,7 @@ SlangResult GenericCPPCompiler::compile(const CompileOptions& options, Output& o } #endif - return m_parseOutputFunc(exeRes, outOutput); -} - -SlangResult GenericCPPCompiler::calcModuleFilePath(const CompileOptions& options, StringBuilder& outPath) -{ - return m_calcModuleFilePathFunc(options, outPath); + return parseOutput(exeRes, outOutput); } /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CPPCompilerUtil !!!!!!!!!!!!!!!!!!!!!!*/ @@ -339,7 +334,8 @@ static void _addGCCFamilyCompiler(const String& exeName, CPPCompilerSet* compile CPPCompiler::Desc desc; if (SLANG_SUCCEEDED(GCCCompilerUtil::calcVersion(exeName, desc))) { - RefPtr compiler(new GenericCPPCompiler(desc, exeName, &GCCCompilerUtil::calcArgs, &GCCCompilerUtil::parseOutput, GCCCompilerUtil::calcModuleFilePath)); + RefPtr compiler(new GCCCPPCompiler(desc)); + compiler->m_cmdLine.setExecutableFilename(exeName); compilerSet->addCompiler(compiler); } } -- cgit v1.2.3