def haveDragonegg(): if not hasattr(SulongTestSuite, '_haveDragonegg'): SulongTestSuite._haveDragonegg = mx_sulong.dragonEggPath( ) is not None and os.path.exists( mx_sulong.dragonEggPath()) and mx_sulong.getGCC( optional=True) is not None return SulongTestSuite._haveDragonegg
def getBuildEnv(self, replaceVar=mx_subst.path_substitutions): env = super(SulongTestSuite, self).getBuildEnv(replaceVar=replaceVar) env['VPATH'] = os.path.join(self.dir, self.name) env['PROJECT'] = self.name env['TESTS'] = ' '.join(self.getTests()) env['VARIANTS'] = ' '.join(self.getVariants()) env['BUILD_REF'] = '1' if self.buildRef else '0' env['BUILD_SO'] = '1' if self.buildSharedObject else '0' env['SO_EXT'] = mx.add_lib_suffix("") env['CLANG'] = mx_sulong.findBundledLLVMProgram('clang') env['CLANGXX'] = mx_sulong.findBundledLLVMProgram('clang++') env['LLVM_OPT'] = mx_sulong.findBundledLLVMProgram('opt') env['LLVM_AS'] = mx_sulong.findBundledLLVMProgram('llvm-as') env['LLVM_LINK'] = mx_sulong.findBundledLLVMProgram('llvm-link') env['LLVM_OBJCOPY'] = mx_sulong.findBundledLLVMProgram('llvm-objcopy') env['GRAALVM_LLVM_HOME'] = mx_subst.path_substitutions.substitute("<path:SULONG_HOME>") if SulongTestSuite.haveDragonegg(): env['DRAGONEGG'] = mx_sulong.dragonEggPath() env['DRAGONEGG_GCC'] = mx_sulong.getGCC() env['DRAGONEGG_LLVMAS'] = mx_sulong.findLLVMProgramForDragonegg("llvm-as") env['DRAGONEGG_FC'] = mx_sulong.getGFortran() env['FC'] = mx_sulong.getGFortran() elif not self._is_needs_rebuild_call and getattr(self, 'requireDragonegg', False): mx.abort('Could not find dragonegg, cannot build "{}" (requireDragonegg = True).'.format(self.name)) return env
def getBuildEnv(self, replaceVar=mx_subst.path_substitutions): env = super(SulongTestSuite, self).getBuildEnv(replaceVar=replaceVar) env['VPATH'] = os.path.join(self.dir, self.name) env['PROJECT'] = self.name env['TESTS'] = ' '.join(self.getTests()) env['VARIANTS'] = ' '.join(self.getVariants()) if SulongTestSuite.haveDragonegg(): env['DRAGONEGG'] = mx_sulong.dragonEggPath() env['DRAGONEGG_GCC'] = mx_sulong.getGCC() env['DRAGONEGG_LLVMAS'] = mx_sulong.findLLVMProgramForDragonegg( "llvm-as") return env
def getBuildEnv(self, replaceVar=mx_subst.path_substitutions): env = super(SulongTestSuite, self).getBuildEnv(replaceVar=replaceVar) env['VPATH'] = os.path.join(self.dir, self.name) env['PROJECT'] = self.name env['TESTS'] = ' '.join(self.getTests()) env['VARIANTS'] = ' '.join(self.getVariants()) env['BUILD_REF'] = '1' if self.buildRef else '0' env['SULONG_MAKE_CLANG_IMPLICIT_ARGS'] = mx_sulong.getClangImplicitArgs() if SulongTestSuite.haveDragonegg(): env['DRAGONEGG'] = mx_sulong.dragonEggPath() env['DRAGONEGG_GCC'] = mx_sulong.getGCC() env['DRAGONEGG_LLVMAS'] = mx_sulong.findLLVMProgramForDragonegg("llvm-as") return env
def run(self, inputFile, outputFile, flags): inputLanguage = ProgrammingLanguage.lookupFile(inputFile) if inputLanguage == ProgrammingLanguage.C: tool = mx_sulong.getGCC() flags.append('-std=gnu99') elif inputLanguage == ProgrammingLanguage.C_PLUS_PLUS: tool = mx_sulong.getGPP() elif inputLanguage == ProgrammingLanguage.FORTRAN: tool = mx_sulong.getGFortran() else: raise Exception('Unsupported input language') return self.runTool([tool, '-S', '-fplugin=' + mx_sulong._dragonEggPath, '-fplugin-arg-dragonegg-emit-ir', '-o', outputFile] + flags + [inputFile], errorMsg='Cannot compile %s with %s' % (inputFile, os.path.basename(tool)))
def getBuildEnv(self, replaceVar=mx_subst.path_substitutions): env = super(SulongTestSuite, self).getBuildEnv(replaceVar=replaceVar) env['VPATH'] = os.path.join(self.dir, self.name) env['PROJECT'] = self.name env['TESTS'] = ' '.join(self.getTests()) env['VARIANTS'] = ' '.join(self.getVariants()) env['BUILD_REF'] = '1' if self.buildRef else '0' env['SULONG_MAKE_CLANG_IMPLICIT_ARGS'] = mx_sulong.getClangImplicitArgs( ) if SulongTestSuite.haveDragonegg(): env['DRAGONEGG'] = mx_sulong.dragonEggPath() env['DRAGONEGG_GCC'] = mx_sulong.getGCC() env['DRAGONEGG_LLVMAS'] = mx_sulong.findLLVMProgramForDragonegg( "llvm-as") return env
def getTool(self, inputFile, outputFile): inputLanguage = ProgrammingLanguage.lookupFile(inputFile) if inputLanguage == ProgrammingLanguage.C: if self.gcc is None: self.gcc = mx_sulong.getGCC() return self.gcc, ['-std=gnu99'] elif inputLanguage == ProgrammingLanguage.C_PLUS_PLUS: if self.gpp is None: self.gpp = mx_sulong.getGPP() return self.gpp, [] elif inputLanguage == ProgrammingLanguage.FORTRAN: if self.gfortran is None: self.gfortran = mx_sulong.getGFortran() return self.gfortran, ['-J%s' % os.path.dirname(outputFile)] else: raise Exception('Unsupported input language')
def getBuildEnv(self, replaceVar=mx_subst.path_substitutions): env = super(SulongTestSuite, self).getBuildEnv(replaceVar=replaceVar) env['VPATH'] = os.path.join(self.dir, self.name) env['PROJECT'] = self.name env['TESTS'] = ' '.join(self.getTests()) env['VARIANTS'] = ' '.join(self.getVariants()) env['BUILD_REF'] = '1' if self.buildRef else '0' env['SULONG_MAKE_CLANG_IMPLICIT_ARGS'] = mx_sulong.getClangImplicitArgs() if SulongTestSuite.haveDragonegg(): env['DRAGONEGG'] = mx_sulong.dragonEggPath() env['DRAGONEGG_GCC'] = mx_sulong.getGCC() env['DRAGONEGG_LLVMAS'] = mx_sulong.findLLVMProgramForDragonegg("llvm-as") env['DRAGONEGG_FC'] = mx_sulong.getGFortran() env['FC'] = mx_sulong.getGFortran() elif not self._is_needs_rebuild_call and getattr(self, 'requireDragonegg', False): mx.abort('Could not find dragonegg, cannot build "{}" (requireDragonegg = True).'.format(self.name)) return env
def haveDragonegg(): if not hasattr(SulongTestSuite, '_haveDragonegg'): SulongTestSuite._haveDragonegg = mx_sulong.dragonEggPath() is not None and os.path.exists(mx_sulong.dragonEggPath()) and mx_sulong.getGCC(optional=True) is not None return SulongTestSuite._haveDragonegg