def check_osx_framework_mm(conf, fw_name, **kw): conf.check_cxx( framework_name=fw_name, uselib_store='OSX_' + fw_name.upper(), fragment='#import <{0}/{0}.h>\nint main() {{}}'.format(fw_name), compile_filename='test.mm', **kw)
def configure(conf): conf.load('g++') conf.load('gcc') conf.find_program('ldd') conf.check_cxx(lib='z', errmsg=missing_pkg_msg(fedora='zlib-devel', ubuntu='zlib1g-dev')) no_mlx = conf.options.no_mlx conf.env.NO_MLX = no_mlx if not no_mlx: ofed_ok = conf.check_ofed(mandatory=False) if ofed_ok: conf.check_cxx( lib='ibverbs', errmsg= 'Could not find library ibverbs, will use internal version.', mandatory=False) else: Logs.pprint( 'YELLOW', 'Warning: will use internal version of ibverbs. If you need to use Mellanox NICs, install OFED:\n' + 'https://trex-tgn.cisco.com/trex/doc/trex_manual.html#_mellanox_connectx_4_support' )
def check_yaml_cpp(conf): conf.check_boost() conf.check_cxx( fragment = fragment, use = ['YAML-CPP','BOOST'], msg = 'Checking to link with yaml-cpp', )
def mkspec_try_flags(conf, flagtype, flaglist): """ Tries the given list of compiler/linker flags if they are supported by the current compiler, and returns the list of supported flags :param flagtype: The flag type, cflags, cxxflags or linkflags :param flaglist: The list of flags to be checked :return: The list of supported flags """ ret = [] for flag in flaglist: conf.start_msg('Checking for %s: %s' % (flagtype, flag)) try: if flagtype == 'cflags': conf.check_cc(cflags=flag) elif flagtype == 'cxxflags': conf.check_cxx(cxxflags=flag) elif flagtype == 'linkflags': conf.check_cxx(linkflags=flag) except conf.errors.ConfigurationError: conf.end_msg('no', color='YELLOW') else: conf.end_msg('yes') ret.append(flag) return ret
def mkspec_try_flags(conf, flagtype, flaglist): """ Check support of the given list of compiler/linker flags. :param flagtype: The flag type, cflags, cxxflags or linkflags :param flaglist: The list of flags to be checked :return: The list of supported flags """ ret = [] for flag in flaglist: conf.start_msg('Checking for %s: %s' % (flagtype, flag)) try: if flagtype == 'cflags': conf.check_cc(cflags=flag) elif flagtype == 'cxxflags': conf.check_cxx(cxxflags=flag) elif flagtype == 'linkflags': conf.check_cxx(linkflags=flag) except conf.errors.ConfigurationError: conf.end_msg('no', color='YELLOW') else: conf.end_msg('yes') ret.append(flag) return ret
def mkspec_try_flags(conf, flagtype, flaglist): """ Tries the given list of compiler/linker flags if they are supported by the current compiler, and returns the list of supported flags :param flagtype: The flag type, cflags, cxxflags or linkflags :param flaglist: The list of flags to be checked :return: The list of supported flags """ ret = [] for flag in flaglist: conf.start_msg("Checking for %s: %s" % (flagtype, flag)) try: if flagtype == "cflags": conf.check_cc(cflags=flag) elif flagtype == "cxxflags": conf.check_cxx(cxxflags=flag) elif flagtype == "linkflags": conf.check_cxx(linkflags=flag) except conf.errors.ConfigurationError: conf.end_msg("no", color="YELLOW") else: conf.end_msg("yes") ret.append(flag) return ret
def mkspec_try_flags(conf, flagtype, flaglist): """ Check support of the given list of compiler/linker flags. :param flagtype: The flag type, cflags, cxxflags or linkflags :param flaglist: The list of flags to be checked :return: The list of supported flags """ ret = [] for flag in flaglist: conf.start_msg("Checking for %s: %s" % (flagtype, flag)) try: if flagtype == "cflags": conf.check_cc(cflags=flag) elif flagtype == "cxxflags": conf.check_cxx(cxxflags=flag) elif flagtype == "linkflags": conf.check_cxx(linkflags=flag) except conf.errors.ConfigurationError: conf.end_msg("no", color="YELLOW") else: conf.end_msg("yes") ret.append(flag) return ret
def check_sparkle(**kwargs): conf.check_cxx( framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"], uselib_store='OSX_SPARKLE', define_name='HAVE_SPARKLE', mandatory=True, compile_filename='test.mm', use="OSX_FOUNDATION OSX_APPKIT", **kwargs)
def check_sparkle(**kwargs): conf.check_cxx( framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"], uselib_store="OSX_SPARKLE", define_name="HAVE_SPARKLE", mandatory=True, compile_filename="test.mm", use="OSX_FOUNDATION OSX_APPKIT", **kwargs )
def configure(conf): conf.load('g++') conf.load('gcc') conf.find_program('ldd') conf.check_cxx(lib = 'z', errmsg = missing_pkg_msg(fedora = 'zlib-devel', ubuntu = 'zlib1g-dev')) ofed_ok = conf.check_ofed(mandatory = False) if ofed_ok: conf.check_cxx(lib = 'ibverbs', errmsg = 'Could not find library ibverbs, will use internal version.', mandatory = False) else: Logs.pprint('YELLOW', 'Warning: will use internal version of ibverbs. If you need to use Mellanox NICs, install OFED:\n' + 'https://trex-tgn.cisco.com/trex/doc/trex_manual.html#_mellanox_connectx_4_support')
def check_cpp14(conf): conf.start_msg('Checking C++14 support') try: conf.check_cxx( fragment='\n'.join([ '#include <memory>', 'class test { test(test&&) = default; };', 'int main() { auto ptr = std::make_unique<int>(); }', ]), execute=False, ) conf.end_msg('ok') except: conf.fatal('failed')
def check_filesystem(conf): conf.start_msg('Checking filesystem support') try: conf.check_cxx( fragment='\n'.join([ '#include <filesystem>', 'int main() { std::tr2::sys::path path; }', ]), execute=False, ) conf.define('STL_FILESYSTEM_ENABLED', 1) conf.end_msg('<filesystem>') except: conf.end_msg('<boost/filesystem.hpp>')
def check_cpp14(conf): conf.start_msg('Checking C++14 support') try: conf.check_cxx( fragment=''' #include <memory> class test { test() = default; test(const test&) = delete; test(test&&) = delete; ~test() = default; }; int main() { auto ptr = std::make_unique<int>(); return 0; }''', execute=False, ) conf.end_msg('ok') except: conf.fatal('failed')
def check_osx_security(conf, *k, **kw): if Utils.unversioned_sys_platform() == "darwin": try: conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', mandatory=True) conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', mandatory=True) conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY', define_name='HAVE_SECURITY', use="OSX_COREFOUNDATION", fragment=OSX_SECURITY_CODE, mandatory=True) conf.define('HAVE_OSX_SECURITY', 1) conf.env['HAVE_OSX_SECURITY'] = True except: Logs.warn( "Compiling on OSX, but CoreFoundation, CoreServices, or Security framework is not functional." ) Logs.warn( "The frameworks are known to work only with Apple-specific compilers: llvm-gcc-4.2 or clang" )
def configure(conf): if Utils.unversioned_sys_platform () == "darwin": conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION', mandatory=False, compile_filename='test.mm') conf.check_cxx(framework_name='AppKit', uselib_store='OSX_APPKIT', mandatory=False, compile_filename='test.mm') conf.check_cxx(framework_name='CoreWLAN', uselib_store='OSX_COREWLAN', define_name='HAVE_COREWLAN', use="OSX_FOUNDATION", mandatory=False, compile_filename='test.mm') def check_sparkle(**kwargs): conf.check_cxx(framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"], uselib_store='OSX_SPARKLE', define_name='HAVE_SPARKLE', mandatory=True, compile_filename='test.mm', use="OSX_FOUNDATION OSX_APPKIT", **kwargs ) try: # Try standard paths first check_sparkle() except: try: # Try local path Logs.info ("Check local version of Sparkle framework") check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) conf.env.HAVE_LOCAL_SPARKLE = 1 except: import urllib, subprocess, os, shutil if not os.path.exists('osx/Frameworks/Sparkle.framework'): # Download to local path and retry Logs.info ("Sparkle framework not found, trying to download it to 'build/'") urllib.urlretrieve ("https://github.com/sparkle-project/Sparkle/releases/download/1.17.0/Sparkle-1.17.0.tar.bz2", "build/Sparkle.tar.bz2") if os.path.exists('build/Sparkle.tar.bz2'): try: subprocess.check_call(['mkdir', 'build/Sparkle']) subprocess.check_call(['tar', 'xjf', 'build/Sparkle.tar.bz2', '-C', 'build/Sparkle']) os.remove("build/Sparkle.tar.bz2") if not os.path.exists("osx/Frameworks"): os.mkdir ("osx/Frameworks") os.rename("build/Sparkle/Sparkle.framework", "osx/Frameworks/Sparkle.framework") check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) conf.env.HAVE_LOCAL_SPARKLE = 1 except subprocess.CalledProcessError as e: conf.fatal("Cannot find Sparkle framework. Auto download failed: '%s' returned %s" % (' '.join(e.cmd), e.returncode)) except: conf.fatal("Unknown Error happened when auto downloading Sparkle framework") conf.env['LDFLAGS_OSX_SPARKLE'] += ['-Wl,-rpath,@loader_path/../Frameworks'] if conf.is_defined('HAVE_SPARKLE'): conf.env.HAVE_SPARKLE = 1 # small cheat for wscript
def check_osx_security(conf, *k, **kw): if Utils.unversioned_sys_platform() == "darwin": try: conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', mandatory=True) conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', mandatory=True) conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY', define_name='HAVE_SECURITY', use="OSX_COREFOUNDATION", fragment=OSX_SECURITY_CODE, mandatory=True) conf.define('HAVE_OSX_SECURITY', 1) conf.env['HAVE_OSX_SECURITY'] = True except: Logs.warn("Compiling on OSX, but CoreFoundation, CoreServices, or Security framework is not functional.") Logs.warn("The frameworks are known to work only with Apple-specific compilers: llvm-gcc-4.2 or clang")
def check_osx_framework_cxx(conf, fw_name, **kw): conf.check_cxx( framework_name=fw_name, uselib_store='OSX_' + fw_name.upper(), fragment='#include <{0}/{0}.h>\nint main() {{}}'.format(fw_name), **kw)
def check_osx_frameworks(conf, *k, **kw): if Utils.unversioned_sys_platform() == "darwin": try: conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', mandatory=True) conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', mandatory=True) conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY', use='OSX_COREFOUNDATION', fragment=OSX_SECURITY_CODE, mandatory=True) conf.check_cxx(framework_name='SystemConfiguration', uselib_store='OSX_SYSTEMCONFIGURATION', use='OSX_COREFOUNDATION', fragment=OSX_SYSTEMCONFIGURATION_CODE, mandatory=True) conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION', mandatory=True, compile_filename='test.mm') conf.check_cxx(framework_name='CoreWLAN', uselib_store='OSX_COREWLAN', use="OSX_FOUNDATION", mandatory=True, compile_filename='test.mm') conf.define('HAVE_OSX_FRAMEWORKS', 1) conf.env['HAVE_OSX_FRAMEWORKS'] = True except: Logs.warn( "Compiling on macOS, but required framework(s) is(are) not functional." ) Logs.warn( "Note that the frameworks are known to work only with the Apple clang compiler." )
def configure(conf): if Utils.unversioned_sys_platform() == "darwin": conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION', mandatory=False, compile_filename='test.mm') conf.check_cxx(framework_name='AppKit', uselib_store='OSX_APPKIT', mandatory=False, compile_filename='test.mm') conf.check_cxx(framework_name='CoreWLAN', uselib_store='OSX_COREWLAN', define_name='HAVE_COREWLAN', use="OSX_FOUNDATION", mandatory=False, compile_filename='test.mm') def check_sparkle(**kwargs): conf.check_cxx( framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"], uselib_store='OSX_SPARKLE', define_name='HAVE_SPARKLE', mandatory=True, compile_filename='test.mm', use="OSX_FOUNDATION OSX_APPKIT", **kwargs) try: # Try standard paths first check_sparkle() except: try: # Try local path Logs.info("Check local version of Sparkle framework") check_sparkle( cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) conf.env.HAVE_LOCAL_SPARKLE = 1 except: import urllib, subprocess, os, shutil if not os.path.exists('osx/Frameworks/Sparkle.framework'): # Download to local path and retry Logs.info( "Sparkle framework not found, trying to download it to 'build/'" ) urllib.urlretrieve( "https://github.com/sparkle-project/Sparkle/releases/download/1.17.0/Sparkle-1.17.0.tar.bz2", "build/Sparkle.tar.bz2") if os.path.exists('build/Sparkle.tar.bz2'): try: subprocess.check_call(['mkdir', 'build/Sparkle']) subprocess.check_call([ 'tar', 'xjf', 'build/Sparkle.tar.bz2', '-C', 'build/Sparkle' ]) os.remove("build/Sparkle.tar.bz2") if not os.path.exists("osx/Frameworks"): os.mkdir("osx/Frameworks") os.rename("build/Sparkle/Sparkle.framework", "osx/Frameworks/Sparkle.framework") check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), linkflags="-F%s/osx/Frameworks/" % conf.path.abspath()) conf.env.HAVE_LOCAL_SPARKLE = 1 except subprocess.CalledProcessError as e: conf.fatal( "Cannot find Sparkle framework. Auto download failed: '%s' returned %s" % (' '.join(e.cmd), e.returncode)) except: conf.fatal( "Unknown Error happened when auto downloading Sparkle framework" ) conf.env['LDFLAGS_OSX_SPARKLE'] += [ '-Wl,-rpath,@loader_path/../Frameworks' ] if conf.is_defined('HAVE_SPARKLE'): conf.env.HAVE_SPARKLE = 1 # small cheat for wscript
def check_numini(conf): conf.check_cxx( fragment = fragment, use = ['NUMINI', 'YAML-CPP', 'BOOST'], msg = 'Checking to link with numini', )
def configure(conf): if Utils.unversioned_sys_platform() == "darwin": conf.check_cxx( framework_name="Foundation", uselib_store="OSX_FOUNDATION", mandatory=False, compile_filename="test.mm" ) conf.check_cxx(framework_name="AppKit", uselib_store="OSX_APPKIT", mandatory=False, compile_filename="test.mm") conf.check_cxx( framework_name="CoreWLAN", uselib_store="OSX_COREWLAN", define_name="HAVE_COREWLAN", use="OSX_FOUNDATION", mandatory=False, compile_filename="test.mm", ) if conf.options.autoupdate: def check_sparkle(**kwargs): conf.check_cxx( framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"], uselib_store="OSX_SPARKLE", define_name="HAVE_SPARKLE", mandatory=True, compile_filename="test.mm", use="OSX_FOUNDATION OSX_APPKIT", **kwargs ) try: # Try standard paths first check_sparkle() except: try: # Try local path Logs.info("Check local version of Sparkle framework") check_sparkle( cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), linkflags="-F%s/osx/Frameworks/" % conf.path.abspath(), ) conf.env.HAVE_LOCAL_SPARKLE = 1 except: import urllib, subprocess, os, shutil if not os.path.exists("osx/Frameworks/Sparkle.framework"): # Download to local path and retry Logs.info("Sparkle framework not found, trying to download it to 'build/'") urllib.urlretrieve( "http://sparkle.andymatuschak.org/files/Sparkle%201.5b6.zip", "build/Sparkle.zip" ) if os.path.exists("build/Sparkle.zip"): try: subprocess.check_call(["unzip", "-qq", "build/Sparkle.zip", "-d", "build/Sparkle"]) os.remove("build/Sparkle.zip") if not os.path.exists("osx/Frameworks"): os.mkdir("osx/Frameworks") os.rename("build/Sparkle/Sparkle.framework", "osx/Frameworks/Sparkle.framework") shutil.rmtree("build/Sparkle", ignore_errors=True) check_sparkle( cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(), linkflags="-F%s/osx/Frameworks/" % conf.path.abspath(), ) conf.env.HAVE_LOCAL_SPARKLE = 1 except subprocess.CalledProcessError as e: conf.fatal( "Cannot find Sparkle framework. Auto download failed: '%s' returned %s" % (" ".join(e.cmd), e.returncode) ) except: conf.fatal("Unknown Error happened when auto downloading Sparkle framework") if conf.is_defined("HAVE_SPARKLE"): conf.env.HAVE_SPARKLE = 1 # small cheat for wscript