def find_clang(conf): """ Finds the program clang and executes it to ensure it really is clang """ import os cc = conf.find_program('clang', var='CC') if conf.options.clang_target_triple != None: conf.env.append_value('CC', ['-target', conf.options.clang_target_triple]) if conf.options.clang_sysroot != None: sysroot = str() if os.path.isabs(conf.options.clang_sysroot): sysroot = conf.options.clang_sysroot else: sysroot = os.path.normpath( os.path.join(os.getcwd(), conf.options.clang_sysroot)) conf.env.append_value('CC', ['--sysroot', sysroot]) conf.get_cc_version(cc, clang=True) conf.env.CC_NAME = 'clang'
def find_gxx(conf): names = ["g++", "c++"] if conf.env.TOOLCHAIN != "native": names = ["%s-%s" % (conf.env.TOOLCHAIN, n) for n in names] cxx = conf.find_program(names, var="CXX") conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = "gcc"
def find_gxx(conf): """ Finds the program g++, and if present, try to detect its version number """ cxx = conf.find_program(["g++", "c++"], var="CXX") conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = "gcc"
def find_clangxx(conf): """ Finds the program clang++, and executes it to ensure it really is clang++ """ cxx = conf.find_program("clang++", var="CXX") conf.get_cc_version(cxx, clang=True) conf.env.CXX_NAME = "clang"
def find_icpc(conf): """ Finds the program icpc, and execute it to ensure it really is icpc """ cxx = conf.find_program('icpc', var='CXX') conf.get_cc_version(cxx, icc=True) conf.env.CXX_NAME = 'icc'
def find_gcc(conf): names = ['gcc', 'cc'] if conf.env.TOOLCHAIN != 'native': names = ['%s-%s' % (conf.env.TOOLCHAIN, n) for n in names] cc = conf.find_program(names, var='CC') conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'gcc'
def find_gxx(conf): """ Find the program g++, and if present, try to detect its version number """ cxx = conf.find_program(['g++', 'c++'], var='CXX') conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = 'gcc'
def find_icc(conf): """ Finds the program icc and execute it to ensure it really is icc """ cc = conf.find_program(['icc', 'ICL'], var='CC') conf.get_cc_version(cc, icc=True) conf.env.CC_NAME = 'icc'
def find_gxx(conf): names = ['g++', 'c++'] if conf.env.TOOLCHAIN != 'native': names = ['%s-%s' % (conf.env.TOOLCHAIN, n) for n in names] cxx = conf.find_program(names, var='CXX') conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = 'gcc'
def find_gxx(conf): """ Finds the program g++, and if present, try to detect its version number """ cxx = conf.find_program(['g++', 'c++'], var='CXX') conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = 'gcc'
def find_mpiicpc(conf): if sys.platform == 'cygwin': conf.fatal('The Intel compiler does not work on Cygwin') cxx = conf.find_program('mpiicpc') conf.env.CXX = cxx conf.get_cc_version(cxx, icc=True) conf.env.CXX_NAME = 'icc'
def find_clangxx(conf): """ Finds the program clang++, and executes it to ensure it really is clang++ """ cxx = conf.find_program('clang++', var='CXX') conf.get_cc_version(cxx, clang=True) conf.env.CXX_NAME = 'clang'
def find_clangxx(conf): """ Find the program clang++, and execute it to ensure it really is clang++ """ cxx = conf.find_program('clang++', var='CXX') conf.get_cc_version(cxx, clang=True) conf.env.CXX_NAME = 'clang'
def find_android_gxx(conf): exeDir = os.path.join(conf.options.ndk, "toolchains", "arm-linux-androideabi-4.6", "prebuilt", "windows-x86_64", "bin") cxx=conf.find_program(['arm-linux-androideabi-g++'], var = "CXX", path_list=[exeDir]) cxx=conf.cmd_to_list(cxx) conf.get_cc_version(cxx,gcc=True) conf.env.CXX_NAME='gcc' conf.env.CXX=cxx
def find_clang(conf): """ Find the program clang and execute it to ensure it really is clang """ cc = conf.find_program('clang', var='CC') conf.get_cc_version(cc, clang=True) conf.env.CC_NAME = 'clang'
def find_gcc(conf): """ Find the program gcc, and if present, try to detect its version number """ cc = conf.find_program(['gcc', 'cc'], var='CC') conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'gcc'
def find_clang(conf): """ Finds the program clang and executes it to ensure it really is clang """ cc = conf.find_program('clang', var='CC') conf.get_cc_version(cc, clang=True) conf.env.CC_NAME = 'clang'
def find_gcc(conf): names = ["gcc", "cc"] if conf.env.TOOLCHAIN != "native": names = ["%s-%s" % (conf.env.TOOLCHAIN, n) for n in names] cc = conf.find_program(names, var="CC") conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = "gcc"
def find_clangxx(conf): """ Find the program g++, and if present, try to detect its version number """ cxx = conf.find_program(['clang++', 'c++'], var='CXX') cxx = conf.cmd_to_list(cxx) conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = 'clang' conf.env.CXX = cxx
def find_arm_gcc(conf): """ Find the program gcc, and if present, try to detect its version number """ cc = conf.find_program(['arm-none-eabi-gcc', 'arm-none-linux-gnueabi-gcc'], var='CC') cc = conf.cmd_to_list(cc) conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'arm-gcc' conf.env.CC = cc
def find_clang(conf): """ Find the program clang, and if present, try to detect its version number """ cc = conf.find_program(['clang', 'cc'], var='CC') cc = conf.cmd_to_list(cc) conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'clang' conf.env.CC = cc
def find_gcc(conf): """ Find the program gcc, and if present, try to detect its version number """ cross_gcc = '%sgcc' % conf.options.cross cross_cc = '%scc' % conf.options.cross cc = conf.find_program([cross_gcc, cross_cc], var='CC') conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'gcc'
def find_gxx(conf): """ Finds the program g++, and if present, try to detect its version number """ cross_gxx = '%sg++' % conf.options.cross cross_cxx = '%sc++' % conf.options.cross cxx = conf.find_program([cross_gxx, cross_cxx], var='CXX') conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = 'gcc'
def mkspec_check_gcc_version(conf, compiler, major, minor, minimum=False): """ Check the exact or minimum gcc version. :param major: The major version number, e.g. 4 :param minor: The minor version number, e.g. 6 :param minimum: Only check for a minimum compiler version, if true """ conf.get_cc_version(cc=compiler, gcc=True) conf.mkspec_validate_cc_version(major, minor, minimum)
def find_icc(conf): """ Find the program icc and execute it to ensure it really is icc """ if sys.platform == 'cygwin': conf.fatal('The Intel compiler does not work on Cygwin') cc = conf.find_program(['icc', 'ICL'], var='CC') conf.get_cc_version(cc, icc=True) conf.env.CC_NAME = 'icc'
def find_icpc(conf): """ Find the program icpc, and execute it to ensure it really is icpc """ if sys.platform == 'cygwin': conf.fatal('The Intel compiler does not work on Cygwin') cxx = conf.find_program('icpc', var='CXX') conf.get_cc_version(cxx, icc=True) conf.env.CXX_NAME = 'icc'
def find_avr_gxx(conf): """ Find the program g++, and if present, try to detect its version number """ cxx = conf.find_program(['avr-g++'], var='CXX') # Shortcut... cxx = "/Applications/Arduino.app//Contents/Resources/Java/hardware/tools/avr/bin/avr-g++" cxx = conf.cmd_to_list(cxx) conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = 'gcc' conf.env.CXX = cxx
def find_armgcc(conf): conf.find_program("arm-none-eabi-gcc", var="AS") conf.find_program("arm-none-eabi-ar", var="AR") conf.find_program("arm-none-eabi-gcc", var="LINK_CC") conf.find_program("arm-none-eabi-objcopy", var="OBJCOPY") conf.find_program("arm-none-eabi-gcc", var="CC") conf.find_program("arm-none-eabi-g++", var="CXX") conf.find_program("arm-none-eabi-c++", var="LINK_CXX") conf.env.CC_NAME = "armgcc" conf.get_cc_version(conf.env.CC, gcc=True)
def find_android_gxx(conf): exeDir = os.path.join(conf.options.ndk, "toolchains", "arm-linux-androideabi-4.6", "prebuilt", "windows-x86_64", "bin") cxx = conf.find_program(['arm-linux-androideabi-g++'], var="CXX", path_list=[exeDir]) cxx = conf.cmd_to_list(cxx) conf.get_cc_version(cxx, gcc=True) conf.env.CXX_NAME = 'gcc' conf.env.CXX = cxx
def mkspec_check_cc_version(conf, compiler, major, minor): """ :param major: The major version number of the g++ binary e.g. 4 :param minor: The minor version number of the g++ binary e.g. 6 """ conf.get_cc_version(compiler, gcc=True) if int(conf.env["CC_VERSION"][0]) != int(major) or int(conf.env["CC_VERSION"][1]) != int(minor): conf.fatal( "Wrong version number: {0}, " "expected major={1} and minor={2}.".format(conf.env["CC_VERSION"], major, minor) )
def mkspec_check_cc_version(conf, compiler, major, minor): """ :param major: The major version number of the g++ binary e.g. 4 :param minor: The minor version number of the g++ binary e.g. 6 """ conf.get_cc_version(compiler, gcc=True) if (int(conf.env['CC_VERSION'][0]) != int(major) or int(conf.env['CC_VERSION'][1]) != int(minor)): conf.fatal("Wrong version number: {0}, " "expected major={1} and minor={2}.".format( conf.env['CC_VERSION'], major, minor))
def find_icpc(conf): if sys.platform=='cygwin': conf.fatal('The Intel compiler does not work on Cygwin') v=conf.env cxx=None if v['CXX']:cxx=v['CXX'] elif'CXX'in conf.environ:cxx=conf.environ['CXX'] if not cxx:cxx=conf.find_program('icpc',var='CXX') if not cxx:conf.fatal('Intel C++ Compiler (icpc) was not found') cxx=conf.cmd_to_list(cxx) conf.get_cc_version(cxx,icc=True) v['CXX']=cxx v['CXX_NAME']='icc'
def find_icc(conf): if sys.platform == 'cygwin': conf.fatal('The Intel compiler does not work on Cygwin') v = conf.env cc = None if v['CC']: cc = v['CC'] elif 'CC' in conf.environ: cc = conf.environ['CC'] if not cc: cc = conf.find_program('icc', var='CC') if not cc: cc = conf.find_program('ICL', var='CC') if not cc: conf.fatal('Intel C Compiler (icc) was not found') cc = conf.cmd_to_list(cc) conf.get_cc_version(cc, icc=True) v['CC'] = cc v['CC_NAME'] = 'icc'
def find_icc(conf): if sys.platform=='cygwin': conf.fatal('The Intel compiler does not work on Cygwin') v=conf.env cc=None if v['CC']:cc=v['CC'] elif'CC'in conf.environ:cc=conf.environ['CC'] if not cc:cc=conf.find_program('icc',var='CC') if not cc:cc=conf.find_program('ICL',var='CC') if not cc:conf.fatal('Intel C Compiler (icc) was not found') cc=conf.cmd_to_list(cc) conf.get_cc_version(cc,icc=True) v['CC']=cc v['CC_NAME']='icc'
def mkspec_check_minimum_cc_version(conf, compiler, major, minor): """ :param major: The major version number, e.g. 4 :param minor: The minor version number, e.g. 6 """ conf.get_cc_version(compiler, gcc=True) cc_major = int(conf.env['CC_VERSION'][0]) cc_minor = int(conf.env['CC_VERSION'][1]) if ((cc_major < int(major)) or (cc_major == int(major) and cc_minor < int(minor))): conf.fatal("Compiler version: {0}, " "required minimum: major={1} and minor={2}.".format( conf.env['CC_VERSION'], major, minor))
def mkspec_check_minimum_cc_version(conf, compiler, major, minor): """ :param major: The major version number, e.g. 4 :param minor: The minor version number, e.g. 6 """ conf.get_cc_version(compiler, gcc=True) cc_major = int(conf.env["CC_VERSION"][0]) cc_minor = int(conf.env["CC_VERSION"][1]) if (cc_major < int(major)) or (cc_major == int(major) and cc_minor < int(minor)): conf.fatal( "Compiler version: {0}, " "required minimum: major={1} and minor={2}.".format(conf.env["CC_VERSION"], major, minor) )
def find_icpc(conf): if sys.platform == "cygwin": conf.fatal("The Intel compiler does not work on Cygwin") v = conf.env cxx = None if v["CXX"]: cxx = v["CXX"] elif "CXX" in conf.environ: cxx = conf.environ["CXX"] if not cxx: cxx = conf.find_program("icpc", var="CXX") if not cxx: conf.fatal("Intel C++ Compiler (icpc) was not found") cxx = conf.cmd_to_list(cxx) conf.get_cc_version(cxx, icc=True) v["CXX"] = cxx v["CXX_NAME"] = "icc"
def find_icc(conf): if sys.platform == "cygwin": conf.fatal("The Intel compiler does not work on Cygwin") v = conf.env cc = None if v["CC"]: cc = v["CC"] elif "CC" in conf.environ: cc = conf.environ["CC"] if not cc: cc = conf.find_program("icc", var="CC") if not cc: cc = conf.find_program("ICL", var="CC") if not cc: conf.fatal("Intel C Compiler (icc) was not found") cc = conf.cmd_to_list(cc) conf.get_cc_version(cc, icc=True) v["CC"] = cc v["CC_NAME"] = "icc"
def find_avr_gcc(conf): cc=conf.find_program(['avr-gcc'],var='CC') cc=conf.cmd_to_list(cc) conf.get_cc_version(cc,gcc=True) conf.env.CC_NAME='avr-gcc' conf.env.CC=cc ar=conf.find_program(['avr-ar']) conf.env.AR=ar conf.env.ARFLAGS='rcs' prog=conf.find_program(['avr-objcopy']) conf.env.OBJCOPY=prog prog=conf.find_program(['avr-objdump']) conf.env.OBJDUMP=prog prog=conf.find_program(['avr-size']) conf.env.SIZE=prog prog=conf.find_program(['avr-nm']) conf.env.SIZE=prog
def find_avr_gcc(conf): cc = conf.find_program(['avr-gcc'], var='CC') cc = conf.cmd_to_list(cc) conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'avr-gcc' conf.env.CC = cc ar = conf.find_program(['avr-ar']) conf.env.AR = ar conf.env.ARFLAGS = 'rcs' prog = conf.find_program(['avr-objcopy']) conf.env.OBJCOPY = prog print prog prog = conf.find_program(['avr-objdump']) conf.env.OBJDUMP = prog prog = conf.find_program(['avr-size']) conf.env.SIZE = prog prog = conf.find_program(['avr-nm']) conf.env.SIZE = prog
def find_clang(conf): cc = conf.find_program('clang', var='CC') conf.get_cc_version(cc, clang=True) conf.env.CC_NAME = 'clang'
def find_icpc(conf): if sys.platform=='cygwin': conf.fatal('The Intel compiler does not work on Cygwin') cxx=conf.find_program('icpc',var='CXX') conf.get_cc_version(cxx,icc=True) conf.env.CXX_NAME='icc'
def find_gcc(conf): cc = conf.find_program(['clang'], var='CC') cc = conf.cmd_to_list(cc) conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'clang' conf.env.CC = cc
def find_icpc(conf): cxx=conf.find_program('icpc',var='CXX') conf.get_cc_version(cxx,icc=True) conf.env.CXX_NAME='icc'
def find_gcc(conf): cc=conf.find_program(['gcc','cc'],var='CC') cc=conf.cmd_to_list(cc) conf.get_cc_version(cc,gcc=True) conf.env.CC_NAME='gcc' conf.env.CC=cc
def find_clangxx(conf): cxx=conf.find_program(['clang++'],var='CXX') cxx=conf.cmd_to_list(cxx) conf.get_cc_version(cxx,gcc=True) conf.env.CXX_NAME='clang' conf.env.CXX=cxx
def find_gcc(conf): cc = conf.find_program(['gcc', 'cc'], var='CC') conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'gcc'
def load_gcc_common_settings(conf): """ Setup all compiler/linker flags with are shared over all targets using the gcc compiler !!! But not the actual compiler, since the compiler depends on the target !!! """ v = conf.env # Figure out GCC compiler version try: conf.get_cc_version( [ v['CC'] ], gcc=True) except: # Can happen if we don't have an GCC installed (code drop stripped of GCC cross compiler) conf.env.CC_VERSION = (0,0,0) # AR Tools v['ARFLAGS'] = 'rcs' v['AR_TGT_F'] = '' # CC/CXX Compiler v['CC_NAME'] = v['CXX_NAME'] = 'gcc' v['CC_SRC_F'] = v['CXX_SRC_F'] = [] v['CC_TGT_F'] = v['CXX_TGT_F'] = ['-c', '-o'] v['CPPPATH_ST'] = '-I%s' v['DEFINES_ST'] = '-D%s' # Linker v['CCLNK_SRC_F'] = v['CXXLNK_SRC_F'] = [] v['CCLNK_TGT_F'] = v['CXXLNK_TGT_F'] = '-o' v['LIB_ST'] = '-l%s' v['LIBPATH_ST'] = '-L%s' v['STLIB_ST'] = '-l%s' v['STLIBPATH_ST'] = '-L%s' # shared library settings v['CFLAGS_cshlib'] = v['CFLAGS_cxxshlib'] = ['-fpic'] v['CXXFLAGS_cshlib'] = v['CXXFLAGS_cxxshlib'] = ['-fpic'] v['LINKFLAGS_cshlib'] = ['-shared'] v['LINKFLAGS_cxxshlib'] = ['-shared'] # static library settings v['CFLAGS_cstlib'] = v['CFLAGS_cxxstlib'] = ['-fpic'] v['CXXFLAGS_cstlib'] = v['CXXFLAGS_cxxstlib'] = ['-fpic'] v['LINKFLAGS_cxxstlib'] = ['-Wl,-Bstatic'] v['LINKFLAGS_cxxshtib'] = ['-Wl,-Bstatic'] # Set common compiler flags COMMON_COMPILER_FLAGS = [ '-Wall', # Generate more warnings '-Werror', # Tread Warnings as Errors '-ffast-math', # Enable fast math '-fvisibility=hidden', # Disable some warnings '-Wno-char-subscripts', '-Wno-unknown-pragmas', '-Wno-unused-variable', '-Wno-unused-value', '-Wno-parentheses', '-Wno-switch', '-Wno-unused-function', '-Wno-multichar', '-Wno-format-security', '-Wno-empty-body', '-Wno-comment', '-Wno-char-subscripts', '-Wno-sign-compare', '-Wno-narrowing', '-Wno-write-strings', '-Wno-format', '-Wno-strict-aliasing', '-Wno-unused-but-set-variable', '-Wno-maybe-uninitialized', '-Wno-strict-overflow', '-Wno-uninitialized', '-Wno-unused-local-typedefs', '-Wno-deprecated', ] if conf.env.CC_VERSION[0] >= '4' and conf.env.CC_VERSION[1] >= '8' and conf.env.CC_VERSION[2] >= '0': COMMON_COMPILER_FLAGS += [ '-Wno-unused-result', '-Wno-sizeof-pointer-memaccess', '-Wno-array-bounds', ] # Copy common flags to prevent modifing references v['CFLAGS'] += COMMON_COMPILER_FLAGS[:] v['CXXFLAGS'] += COMMON_COMPILER_FLAGS[:] + [ '-fno-rtti', # Disable RTTI '-fno-exceptions', # Disable Exceptions '-fvisibility-inlines-hidden', '-std=c++11', # Enable c++11 features # Disable some C++ specific warnings '-Wno-invalid-offsetof', '-Wno-reorder', '-Wno-conversion-null', '-Wno-overloaded-virtual', ] # Linker Flags v['LINKFLAGS'] += ['-Wl,--rpath=$ORIGIN'] v['SHLIB_MARKER'] = '-Wl,-Bdynamic' v['SONAME_ST'] = '-Wl,-h,%s' v['STLIB_MARKER'] = '-Wl,-Bstatic' # Compile options appended if compiler optimization is disabled v['COMPILER_FLAGS_DisableOptimization'] = [ '-O0', '-fno-inline' ] # Compile options appended if debug symbols are generated v['COMPILER_FLAGS_DebugSymbols'] = [ '-g2', '-gdwarf-2' ] # Linker flags when building with debug symbols v['LINKFLAGS_DebugSymbols'] = [] # Store settings for show includes option v['SHOWINCLUDES_cflags'] = ['-H'] v['SHOWINCLUDES_cxxflags'] = ['-H'] # Store settings for preprocess to file option v['PREPROCESS_cflags'] = ['-E', '-dD'] v['PREPROCESS_cxxflags'] = ['-E', '-dD'] v['PREPROCESS_cc_tgt_f'] = ['-o'] v['PREPROCESS_cxx_tgt_f'] = ['-o'] # Store settings for preprocess to file option v['DISASSEMBLY_cflags'] = ['-S', '-fverbose-asm'] v['DISASSEMBLY_cxxflags'] = ['-S', '-fverbose-asm'] v['DISASSEMBLY_cc_tgt_f'] = ['-o'] v['DISASSEMBLY_cxx_tgt_f'] = ['-o']