def load_compiler(conf, compiler, arch): # Note clang goes first otherwise 'g++' will be in 'clang++' # ¯¯¯ ¯¯¯ if "clang" in compiler: conf.mkspec_clang_configure(3, 6, minimum=True) elif "g++" in compiler: conf.mkspec_gxx_configure(4, 9, minimum=True) elif "msvc" in compiler or "CL.exe" in compiler or "cl.exe" in compiler: if arch == "x86": conf.env.MSVC_TARGETS = ["x86"] elif arch == "x64": conf.env.MSVC_TARGETS = ["x64", "x86_amd64"] conf.load("msvc") # Note: the waf msvc tool also loads msvc as a C compiler conf.mkspec_check_minimum_msvc_version(14.0) conf.mkspec_set_msvc_flags() else: raise Errors.WafError("Unknown compiler: %s" % compiler) if ("clang" in compiler or "g++" in compiler) and arch: if arch == "x86": conf.mkspec_add_common_flag("-m32") elif arch == "x64": conf.mkspec_add_common_flag("-m64")
def load_compiler(conf, compiler, arch): # Note clang goes first otherwise 'g++' will be in 'clang++' # ¯¯¯ ¯¯¯ if 'clang' in compiler: conf.mkspec_clang_configure(3, 6, minimum=True) elif 'g++' in compiler: conf.mkspec_gxx_configure(4, 9, minimum=True) elif 'msvc' in compiler or 'CL.exe' in compiler or 'cl.exe' in compiler: if arch == 'x86': conf.env.MSVC_TARGETS = ['x86'] elif arch == 'x64': conf.env.MSVC_TARGETS = ['x86_amd64'] conf.load('msvc') # Note: the waf msvc tool also loads msvc as a C compiler conf.mkspec_check_minimum_msvc_version(14.0) conf.mkspec_set_msvc_flags() else: raise Errors.WafError('Unknown compiler: %s' % compiler) if ('clang' in compiler or 'g++' in compiler) and arch: if arch == 'x86': conf.mkspec_add_common_flag('-m32') elif arch == 'x64': conf.mkspec_add_common_flag('-m64')
def load_compiler(conf, compiler, arch): # Note clang goes first otherwise 'g++' will be in 'clang++' # ¯¯¯ ¯¯¯ if 'clang' in compiler: conf.mkspec_clang_configure(3, 6, minimum=True) elif 'g++' in compiler: conf.mkspec_gxx_configure(4, 9, minimum=True) elif 'msvc' in compiler or 'CL.exe' in compiler or 'cl.exe' in compiler: if arch == 'x86': conf.env.MSVC_TARGETS = ['x86'] elif arch == 'x64': conf.env.MSVC_TARGETS = ['x64', 'x86_amd64'] conf.load('msvc') # Note: the waf msvc tool also loads msvc as a C compiler conf.mkspec_check_minimum_msvc_version(14.0) conf.mkspec_set_msvc_flags() else: raise Errors.WafError('Unknown compiler: %s' % compiler) if ('clang' in compiler or 'g++' in compiler) and arch: if arch == 'x86': conf.mkspec_add_common_flag('-m32') elif arch == 'x64': conf.mkspec_add_common_flag('-m64')
def mkspec_msvc_configure(conf, version): conf.env.MSVC_VERSIONS = ['msvc %s' % version] # Here we suppress all the "Checking for program CL" # messages printed by waf when loading the msvc tool conf.env.stash() conf.start_msg('Checking for msvc %s compiler' % version) try: conf.load('msvc') except conf.errors.ConfigurationError as e: conf.env.revert() conf.end_msg(False) debug('msvc_common: %r' % e) else: conf.end_msg(conf.env.get_flat('CXX')) conf.end_msg(False) conf.mkspec_set_msvc_flags()
def mkspec_msvc_configure(conf, version): conf.env.MSVC_VERSIONS = ["msvc %s" % version] # Here we suppress all the "Checking for program CL" # messages printed by waf when loading the msvc tool conf.env.stash() conf.start_msg("Checking for msvc %s compiler" % version) try: conf.load("msvc") except conf.errors.ConfigurationError as e: conf.env.revert() conf.end_msg(False) # The error should be raised again to make the configure step fail raise e else: conf.end_msg(conf.env.get_flat("CXX")) conf.mkspec_set_msvc_flags()