示例#1
0
def mkspec_set_gxx_cxxflags(conf):

    # Optimization flags
    optflags = ['-O2', '-ftree-vectorize', '-finline-functions']

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CXXFLAGS'] += optflags

    # Warning flags
    conf.env['CXXFLAGS'] += ['-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CXXFLAGS'] += ['-g', '-fno-omit-frame-pointer']
    elif not conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Disable dynamic linking if -static is passed
    if '-static' in conf.env['LINKFLAGS']:
        conf.env['SHLIB_MARKER'] = []

    # Use the C++14 language features
    conf.env['CXXFLAGS'] += ['-std=c++14']
示例#2
0
def mkspec_set_gxx_cxxflags(conf):

    # Warning flags
    conf.env["CXXFLAGS"] += ["-Wextra", "-Wall"]

    if conf.has_tool_option("cxx_debug"):
        conf.env["CXXFLAGS"] += ["-g", "-fno-omit-frame-pointer"]

        # Don't add any optimization flags
        conf.env["MKSPEC_DISABLE_OPTIMIZATION"] = True
    elif not conf.get_mkspec_platform() in ["mac", "ios"]:
        conf.env["LINKFLAGS"] += ["-s"]

    # Optimization flags
    optflags = ["-O2", "-ftree-vectorize", "-finline-functions"]

    if not conf.env["MKSPEC_DISABLE_OPTIMIZATION"]:
        conf.env["CXXFLAGS"] += optflags

    if conf.has_tool_option("cxx_nodebug"):
        conf.env["DEFINES"] += ["NDEBUG"]

    # Disable dynamic linking if -static is passed
    if "-static" in conf.env["LINKFLAGS"]:
        conf.env["SHLIB_MARKER"] = []

    # Use the C++14 language features
    conf.env["CXXFLAGS"] += ["-std=c++14"]
示例#3
0
def mkspec_set_clang_cxxflags(conf, force_debug=False):

    optflag = '-O2'

    # Use -Os (optimize for size) flag on iOS, because -O2 produces unstable
    # code on this platform
    if conf.get_mkspec_platform() in ['ios', 'android']:
        optflag = '-Os'

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CXXFLAGS'] += [optflag]

    # Warning flags
    conf.env['CXXFLAGS'] += ['-pedantic', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CXXFLAGS'] += ['-g']
    elif not conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Use the C++14 language features
    conf.env['CXXFLAGS'] += ['-std=c++14']

    # Use clang's own C++ standard library on Mac OSX and iOS
    # Add other platforms when the library becomes stable there
    if conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['CXXFLAGS'] += ['-stdlib=libc++']
        conf.env['LINKFLAGS'] += ['-lc++']
def mkspec_get_toolchain_paths(conf):
    """
    :return: the common paths where we may find the g++ binary
    """
    # The default path to search
    path_list = os.environ.get("PATH", "").split(os.pathsep)

    if conf.is_mkspec_platform("mac"):

        # If the compiler is installed using macports
        path_list += ["/opt/local/bin"]

    if conf.is_mkspec_platform("android"):
        # If specified, the android_ndk_dir option overrides the OS path
        if conf.has_tool_option("android_ndk_dir"):
            ndk = conf.get_tool_option("android_ndk_dir")
            ndk = os.path.abspath(os.path.expanduser(ndk))
            ndk_path = [ndk, os.path.join(ndk, "bin")]
            return ndk_path

    if conf.is_mkspec_platform("ios"):
        if conf.has_tool_option("ios_toolchain_dir"):
            toolchain = conf.get_tool_option("ios_toolchain_dir")
        else:
            toolchain = "/Applications/Xcode.app/Contents/Developer/" "Toolchains/XcodeDefault.xctoolchain/usr/bin/"
        toolchain = os.path.abspath(os.path.expanduser(toolchain))
        # toolchain_path = [toolchain, os.path.join(toolchain,'bin')]

        return toolchain

    return path_list
示例#5
0
def mkspec_get_toolchain_paths(conf):
    """
    :return: the common paths where we may find the g++ binary
    """
    # The default path to search
    path_list = os.environ.get('PATH', '').split(os.pathsep)

    if conf.is_mkspec_platform('mac'):

        # If the compiler is installed using macports
        path_list += ['/opt/local/bin']

    if conf.is_mkspec_platform('android'):
        # If specified, the android_ndk_dir option overrides the OS path
        if conf.has_tool_option('android_ndk_dir'):
            ndk = conf.get_tool_option('android_ndk_dir')
            ndk = os.path.abspath(os.path.expanduser(ndk))
            ndk_path = [ndk, os.path.join(ndk, 'bin')]
            return ndk_path

    if conf.is_mkspec_platform('ios'):
        if conf.has_tool_option('ios_toolchain_dir'):
            toolchain = conf.get_tool_option('ios_toolchain_dir')
        else:
            toolchain = "/Applications/Xcode.app/Contents/Developer/" \
                        "Toolchains/XcodeDefault.xctoolchain/usr/bin/"
        toolchain = os.path.abspath(os.path.expanduser(toolchain))
        #toolchain_path = [toolchain, os.path.join(toolchain,'bin')]

        return toolchain

    return path_list
示例#6
0
def configure(conf):

    # Which mkspec should we use, by default, use the cxx_default
    # that simply fallbacks to use waf auto detect of compiler etc.
    mkspec = "cxx_default"

    if conf.has_tool_option("cxx_mkspec"):
        mkspec = conf.get_tool_option("cxx_mkspec")

    conf.msg("Using the mkspec:", mkspec)

    # Additional flags for C/C++ compiler and linker
    if conf.has_tool_option("cflags"):
        conf.env["CFLAGS"] += conf.get_tool_option("cflags").split(";")
    if conf.has_tool_option("cxxflags"):
        conf.env["CXXFLAGS"] += conf.get_tool_option("cxxflags").split(";")
    if conf.has_tool_option("linkflags"):
        conf.env["LINKFLAGS"] += conf.get_tool_option("linkflags").split(";")

    # Common flags to be set for C/C++ compiler and linker
    if conf.has_tool_option("commonflags"):
        conf.env["CFLAGS"] += conf.get_tool_option("commonflags").split(";")
        conf.env["CXXFLAGS"] += conf.get_tool_option("commonflags").split(";")
        conf.env["LINKFLAGS"] += conf.get_tool_option("commonflags").split(";")

    # Find and call the mkspec function on the conf object
    if hasattr(conf, mkspec):
        getattr(conf, mkspec)()
    else:
        conf.fatal("The mkspec is not available: {0}".format(mkspec))
def configure(conf):
    # Which mkspec should we use, by default, use the cxx_default
    # that simply fallbacks to use waf auto detect of compiler etc.
    mkspec = "cxx_default"

    if conf.has_tool_option('cxx_mkspec'):
        mkspec = conf.get_tool_option('cxx_mkspec')

    conf.msg('Using the mkspec:', mkspec)
    if mkspec == "cxx_default":
        conf.load_external_tool('mkspec', mkspec)
    else:
        # Find and call the mkspec function on the conf object
        if hasattr(conf, mkspec):
            getattr(conf, mkspec)()
        else:
            conf.fatal("The mkspec is not available: {0}".format(mkspec))

    # Additional flags for C/C++ compiler and linker
    if conf.has_tool_option('cflags'):
        conf.env['CFLAGS'] += conf.get_tool_option('cflags').split(';')
    if conf.has_tool_option('cxxflags'):
        conf.env['CXXFLAGS'] += conf.get_tool_option('cxxflags').split(';')
    if conf.has_tool_option('linkflags'):
        conf.env['LINKFLAGS'] += conf.get_tool_option('linkflags').split(';')

    # Common flags to be set for C/C++ compiler and linker
    if conf.has_tool_option('commonflags'):
        conf.env['CFLAGS'] += conf.get_tool_option('commonflags').split(';')
        conf.env['CXXFLAGS'] += conf.get_tool_option('commonflags').split(';')
        conf.env['LINKFLAGS'] += conf.get_tool_option('commonflags').split(';')
示例#8
0
def mkspec_get_toolchain_paths(conf):
    """
    Return the common paths where the g++ binaries are located.

    :return: the common paths where we may find the g++ binary
    """
    # The default path to search
    path_list = os.environ.get('PATH', '').split(os.pathsep)

    if conf.is_mkspec_platform('mac'):

        # If the compiler is installed using macports
        path_list += ['/opt/local/bin']

    if conf.is_mkspec_platform('android'):
        # If specified, the android_ndk_dir option overrides the OS path
        if conf.has_tool_option('android_ndk_dir'):
            ndk = conf.get_tool_option('android_ndk_dir')
            ndk = os.path.abspath(os.path.expanduser(ndk))
            ndk_path = [ndk, os.path.join(ndk, 'bin')]
            return ndk_path

    if conf.is_mkspec_platform('ios'):
        if conf.has_tool_option('ios_toolchain_dir'):
            toolchain = conf.get_tool_option('ios_toolchain_dir')
        else:
            toolchain = "/Applications/Xcode.app/Contents/Developer/" \
                        "Toolchains/XcodeDefault.xctoolchain/usr/bin/"
        toolchain = os.path.abspath(os.path.expanduser(toolchain))

        return toolchain

    return path_list
示例#9
0
def configure(conf):

    # Which mkspec should we use, by default, use the cxx_default
    # that simply fallbacks to use waf auto detect of compiler etc.
    mkspec = "cxx_default"

    if conf.has_tool_option('cxx_mkspec'):
        mkspec = conf.get_tool_option('cxx_mkspec')

    conf.msg('Using the mkspec:', mkspec)

    # Find and call the mkspec function on the conf object
    if hasattr(conf, mkspec):
        getattr(conf, mkspec)()
    else:
        conf.fatal("The mkspec is not available: {0}".format(mkspec))

    # Additional flags for C/C++ compiler and linker
    if conf.has_tool_option('cflags'):
        conf.env['CFLAGS'] += conf.get_tool_option('cflags').split(';')
    if conf.has_tool_option('cxxflags'):
        conf.env['CXXFLAGS'] += conf.get_tool_option('cxxflags').split(';')
    if conf.has_tool_option('linkflags'):
        conf.env['LINKFLAGS'] += conf.get_tool_option('linkflags').split(';')

    # Common flags to be set for C/C++ compiler and linker
    if conf.has_tool_option('commonflags'):
        conf.env['CFLAGS'] += conf.get_tool_option('commonflags').split(';')
        conf.env['CXXFLAGS'] += conf.get_tool_option('commonflags').split(';')
        conf.env['LINKFLAGS'] += conf.get_tool_option('commonflags').split(';')
示例#10
0
def mkspec_set_msvc_flags(conf):

    # Set _CRT_SECURE_NO_WARNINGS and _SCL_SECURE_NO_WARNINGS to suppress
    # deprecation warnings for strcpy, sprintf, etc.
    if conf.has_tool_option('cxx_debug'):
        # Produce full-symbolic debugging information in a .pdb file
        # Use the multithread, debug version of the run-time library
        conf.env['CXXFLAGS'] += ['/Zi', '/MTd', '/D_SCL_SECURE_NO_WARNINGS']
        conf.env['LINKFLAGS'] += ['/DEBUG']
    else:
        # Use the multithread, release version of the run-time library
        conf.env['CXXFLAGS'] += ['/MT', '/D_CRT_SECURE_NO_WARNINGS']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Set _WIN32_WINNT=0x0501 (i.e. Windows XP target)
    # to suppress warnings in boost asio
    # Disable warning C4345 which only states that msvc follows the
    # C++ standard for initializing POD types when the () form is used
    # Treat C4100 unreferenced parameter warning as Level 3
    # instead of Level 4 to better match g++ warnings
    conf.env['CXXFLAGS'] += ['/O2', '/Ob2', '/W3', '/wd4345', '/w34100',
                             '/EHs', '/D_WIN32_WINNT=0x0501']

    # Disable LNK4221 linker warning for empty object files
    conf.env['LINKFLAGS'] += ['/ignore:4221']  # used for LINK.exe
    conf.env['ARFLAGS'] += ['/ignore:4221']  # used for LIB.exe
示例#11
0
def mkspec_set_msvc_flags(conf):

    # Set _CRT_SECURE_NO_WARNINGS and _SCL_SECURE_NO_WARNINGS to suppress
    # deprecation warnings for strcpy, sprintf, etc.
    if conf.has_tool_option('cxx_debug'):
        # Produce full-symbolic debugging information in a .pdb file
        # Use the multithread, debug version of the run-time library
        conf.env['CXXFLAGS'] += ['/Zi', '/MTd', '/D_SCL_SECURE_NO_WARNINGS']
        conf.env['LINKFLAGS'] += ['/DEBUG']
    else:
        # Use the multithread, release version of the run-time library
        conf.env['CXXFLAGS'] += ['/MT', '/D_CRT_SECURE_NO_WARNINGS']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Set _WIN32_WINNT=0x0501 (i.e. Windows XP target)
    # to suppress warnings in boost asio
    # Disable warning C4345 which only states that msvc follows the
    # C++ standard for initializing POD types when the () form is used
    # Treat C4100 unreferenced parameter warning as Level 3
    # instead of Level 4 to better match g++ warnings
    conf.env['CXXFLAGS'] += [
        '/O2', '/Ob2', '/W3', '/wd4345', '/w34100', '/EHs',
        '/D_WIN32_WINNT=0x0501'
    ]

    # Disable LNK4221 linker warning for empty object files
    conf.env['LINKFLAGS'] += ['/ignore:4221']  # used for LINK.exe
    conf.env['ARFLAGS'] += ['/ignore:4221']  # used for LIB.exe
示例#12
0
def mkspec_set_clang_cxxflags(conf, force_debug=False):

    if conf.has_tool_option("cxx_debug") or force_debug:
        conf.env["CXXFLAGS"] += ["-g", "-fno-omit-frame-pointer"]

        # Don't add any optimization flags
        conf.env["MKSPEC_DISABLE_OPTIMIZATION"] = True
    elif not conf.get_mkspec_platform() in ["mac", "ios"]:
        conf.env["LINKFLAGS"] += ["-s"]

    optflags = ["-O2"]

    if not conf.env["MKSPEC_DISABLE_OPTIMIZATION"]:
        conf.env["CXXFLAGS"] += optflags

    # Warning flags
    conf.env["CXXFLAGS"] += ["-Wextra", "-Wall"]

    if conf.has_tool_option("cxx_nodebug"):
        conf.env["DEFINES"] += ["NDEBUG"]

    # Use the C++14 language features
    conf.env["CXXFLAGS"] += ["-std=c++14"]

    # Use clang's own C++ standard library on Mac OSX and iOS
    # Add other platforms when the library becomes stable there
    if conf.get_mkspec_platform() in ["mac", "ios"]:
        conf.env["CXXFLAGS"] += ["-stdlib=libc++"]
        conf.env["LINKFLAGS"] += ["-lc++"]
示例#13
0
def mkspec_set_clang_cxxflags(conf, force_debug=False):

    optflag = '-O2'

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CXXFLAGS'] += [optflag]

    # Warning flags
    conf.env['CXXFLAGS'] += ['-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CXXFLAGS'] += ['-g', '-fno-omit-frame-pointer']
    elif not conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Use the C++14 language features
    conf.env['CXXFLAGS'] += ['-std=c++14']

    # Use clang's own C++ standard library on Mac OSX and iOS
    # Add other platforms when the library becomes stable there
    if conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['CXXFLAGS'] += ['-stdlib=libc++']
        conf.env['LINKFLAGS'] += ['-lc++']
示例#14
0
def mkspec_set_clang_cxxflags(conf, force_debug=False):

    optflag = '-O2'
    # Use -Os (optimize for size) flag on iOS, because -O2 produces unstable
    # code on this platform
    if conf.get_mkspec_platform() == 'ios':
        optflag = '-Os'
    conf.env['CXXFLAGS'] += [optflag, '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CXXFLAGS'] += ['-g']
    elif not conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Use the more restrictive c++0x option for linux
    if conf.is_mkspec_platform('linux'):
        conf.env['CXXFLAGS'] += ['-std=c++0x']
    else:
        # Other platforms might need some non-standard functions
        # therefore we use gnu++0x
        # For Android see: http://stackoverflow.com/questions/9247151
        # For MinGW: http://stackoverflow.com/questions/6312151
        conf.env['CXXFLAGS'] += ['-std=gnu++0x']

    # To enable the latest standard on Mac OSX
    #conf.env['CXXFLAGS'] += ['-std=gnu++11']

    # Use clang's own C++ standard library on Mac OSX and iOS
    # Add other platforms when the library becomes stable there
    if conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['CXXFLAGS'] += ['-stdlib=libc++']
        conf.env['LINKFLAGS'] += ['-lc++']
示例#15
0
def mkspec_set_gcc_ccflags(conf):

    conf.env['CFLAGS'] += ['-O2', '-ftree-vectorize', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#16
0
def mkspec_set_gcc_ccflags(conf):

    conf.env['CFLAGS'] += ['-O2', '-ftree-vectorize', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#17
0
def mkspec_set_clang_ccflags(conf, force_debug=False):

    optflag = '-O2'
    # Use -Os (optimize for size) flag on iOS, because -O2 produces unstable
    # code on this platform
    if conf.get_mkspec_platform() == 'ios':
        optflag = '-Os'
    conf.env['CFLAGS'] += [optflag, '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#18
0
def mkspec_set_clang_ccflags(conf, force_debug=False):

    optflag = '-O2'

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CFLAGS'] += [optflag]

    # Warning flags
    conf.env['CFLAGS'] += [optflag, '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CFLAGS'] += ['-g', '-fno-omit-frame-pointer']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#19
0
def cxx_poky_gxx63_armv7(conf):
    """
    Detect and setup the g++ 6.3 cross compiler for the
    Yocto based Poky distribution.
    """

    conf.mkspec_gxx_configure(
        major=6, minor=3, prefix='arm-poky-linux-gnueabi')

    # Note: A static version of libstdc++ is not available in the
    # poky SDK so we cannot use -static-libstdc++ for statically
    # linking.

    flags = ['-march=armv7-a', '-marm', '-mfpu=neon',
             '-mfloat-abi=hard', '-mcpu=cortex-a9']

    if conf.has_tool_option('poky_sdk_path'):
        sdk_path = conf.get_tool_option('poky_sdk_path')

        sysroot = os.path.join(
            sdk_path, 'sysroots', 'cortexa9hf-neon-poky-linux-gnueabi')

        flags.append('--sysroot=%s' % sysroot)

    conf.env['LINKFLAGS'] += flags
    conf.env['CXXFLAGS'] += flags

    # Set the target CPU
    conf.env['DEST_CPU'] = 'arm'
示例#20
0
def cxx_poky_gxx63_armv7(conf):
    """
    Detect and setup the g++ 6.3 cross compiler for the
    Yocto based Poky distribution.
    """

    conf.mkspec_gxx_configure(major=6,
                              minor=3,
                              prefix="arm-poky-linux-gnueabi")

    # Note: A static version of libstdc++ is not available in the
    # poky SDK so we cannot use -static-libstdc++ for statically
    # linking.

    flags = [
        "-march=armv7-a",
        "-marm",
        "-mfpu=neon",
        "-mfloat-abi=hard",
        "-mcpu=cortex-a9",
    ]

    if conf.has_tool_option("poky_sdk_path"):
        sdk_path = conf.get_tool_option("poky_sdk_path")

        sysroot = os.path.join(sdk_path, "sysroots",
                               "cortexa9hf-neon-poky-linux-gnueabi")

        flags.append("--sysroot=%s" % sysroot)

    conf.env["LINKFLAGS"] += flags
    conf.env["CXXFLAGS"] += flags

    # Set the target CPU
    conf.env["DEST_CPU"] = "arm"
示例#21
0
def cxx_poky_gxx63_armv7(conf):
    """
    Detect and setup the g++ 6.3 cross compiler for the
    Yocto based Poky distribution.
    """

    conf.mkspec_gxx_configure(major=6,
                              minor=3,
                              prefix='arm-poky-linux-gnueabi')

    # Note: A static version of libstdc++ is not available in the
    # poky SDK so we cannot use -static-libstdc++ for statically
    # linking.

    flags = [
        '-march=armv7-a', '-marm', '-mfpu=neon', '-mfloat-abi=hard',
        '-mcpu=cortex-a9'
    ]

    if conf.has_tool_option('poky_sdk_path'):
        sdk_path = conf.get_tool_option('poky_sdk_path')

        sysroot = os.path.join(sdk_path, 'sysroots',
                               'cortexa9hf-neon-poky-linux-gnueabi')

        flags.append('--sysroot=%s' % sysroot)

    conf.env['LINKFLAGS'] += flags
    conf.env['CXXFLAGS'] += flags

    # Set the target CPU
    conf.env['DEST_CPU'] = 'arm'
示例#22
0
def mkspec_set_gcc_ccflags(conf):

    # Optimization flags
    optflags = ['-O2', '-ftree-vectorize', '-finline-functions']

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CFLAGS'] += optflags

    # Warning flags
    conf.env['CFLAGS'] += ['-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CFLAGS'] += ['-g', '-fno-omit-frame-pointer']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#23
0
def mkspec_set_gcc_ccflags(conf):

    # Optimization flags
    optflags = ['-O2', '-ftree-vectorize', '-finline-functions']

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CFLAGS'] += optflags

    # Warning flags
    conf.env['CFLAGS'] += ['-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CFLAGS'] += ['-g', '-fno-omit-frame-pointer']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#24
0
def mkspec_get_toolchain_paths(conf):
    """
    Return the common paths where the g++ binaries are located.

    :return: the common paths where we may find the g++ binary
    """
    # The default path to search
    path_list = os.environ.get("PATH", "").split(os.pathsep)

    if conf.is_mkspec_platform("mac"):

        # If the compiler is installed using macports
        path_list += ["/opt/local/bin"]

    if conf.is_mkspec_platform("android"):
        # If specified, the android_ndk_dir option overrides the OS path
        if conf.has_tool_option("android_ndk_dir"):
            ndk = conf.get_tool_option("android_ndk_dir")
            ndk = os.path.abspath(os.path.expanduser(ndk))
            ndk_path = [ndk, os.path.join(ndk, "bin")]
            return ndk_path

    if conf.is_mkspec_platform("ios"):
        if conf.has_tool_option("ios_toolchain_dir"):
            toolchain = conf.get_tool_option("ios_toolchain_dir")
        else:
            toolchain = ("/Applications/Xcode.app/Contents/Developer/"
                         "Toolchains/XcodeDefault.xctoolchain/usr/bin/")
        toolchain = os.path.abspath(os.path.expanduser(toolchain))

        return toolchain

    if conf.has_tool_option("poky_sdk_path"):
        sdk_path = conf.get_tool_option("poky_sdk_path")
        cross_compiler = os.path.join(
            sdk_path,
            "sysroots",
            "x86_64-pokysdk-linux",
            "usr",
            "bin",
            "arm-poky-linux-gnueabi",
        )

        path_list = [cross_compiler] + path_list

    return path_list
示例#25
0
def mkspec_set_msvc_flags(conf):

    if conf.has_tool_option('cxx_debug'):
        # Use the multithread, debug version of the run-time library
        conf.env['CXXFLAGS'] += ['/MTd']
        # Include all debugging information in the .obj files.
        # No .pdb files are produced to prevent warnings.
        conf.env['CXXFLAGS'] += ['/Z7']

        conf.env['LINKFLAGS'] += ['/DEBUG']
    else:
        # Use the multithread, release version of the run-time library
        conf.env['CXXFLAGS'] += ['/MT']

    # Add various defines to suppress deprecation warnings for common
    # functions like strcpy, sprintf and socket API calls
    conf.env['CXXFLAGS'] += \
        ['/D_SCL_SECURE_NO_WARNINGS', '/D_CRT_SECURE_NO_WARNINGS',
         '/D_WINSOCK_DEPRECATED_NO_WARNINGS']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # The /EHs flag only allows standard C++ exceptions (which might also
    # originate from extern "C" functions).
    # Set _WIN32_WINNT=0x0501 (i.e. Windows XP target) to suppress warnings
    # in Boost Asio.
    # Disabled compiler warnings:
    # - C4503 that complains about the length of decorated template names.
    #   This occurs frequently as we compile heavily templated code, and
    #   we also have to enable /bigobj to allow large object files.
    # - C4312 that warns about assigning a 32-bit value to a 64-bit pointer
    #   type which is commonly used in our unit tests.
    conf.env['CXXFLAGS'] += \
        ['/O2', '/W2', '/wd4503', '/wd4312',
         '/EHs', '/D_WIN32_WINNT=0x0501', '/bigobj']

    # Do not generate .manifest files (the /MANIFEST flag is added by waf)
    conf.env['LINKFLAGS'].remove('/MANIFEST')
    conf.env['LINKFLAGS'] += ['/MANIFEST:NO']
    conf.env['MSVC_MANIFEST'] = False

    # Disable LNK4221 linker warning for empty object files
    conf.env['LINKFLAGS'] += ['/ignore:4221']  # used for LINK.exe
    conf.env['ARFLAGS'] += ['/ignore:4221']  # used for LIB.exe
示例#26
0
def mkspec_set_msvc_flags(conf):

    if conf.has_tool_option('cxx_debug'):
        # Use the multithread, debug version of the run-time library
        conf.env['CXXFLAGS'] += ['/MTd']
        # Include all debugging information in the .obj files.
        # No .pdb files are produced to prevent warnings.
        conf.env['CXXFLAGS'] += ['/Z7']

        conf.env['LINKFLAGS'] += ['/DEBUG']
    else:
        # Use the multithread, release version of the run-time library
        conf.env['CXXFLAGS'] += ['/MT']

    # Add various defines to suppress deprecation warnings for common
    # functions like strcpy, sprintf and socket API calls
    conf.env['CXXFLAGS'] += \
        ['/D_SCL_SECURE_NO_WARNINGS', '/D_CRT_SECURE_NO_WARNINGS',
         '/D_WINSOCK_DEPRECATED_NO_WARNINGS']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # The /EHs flag only allows standard C++ exceptions (which might also
    # originate from extern "C" functions).
    # Set _WIN32_WINNT=0x0501 (i.e. Windows XP target) to suppress warnings
    # in Boost Asio.
    # Disabled compiler warnings:
    # - C4503 that complains about the length of decorated template names.
    #   This occurs frequently as we compile heavily templated code, and
    #   we also have to enable /bigobj to allow large object files.
    # - C4312 that warns about assigning a 32-bit value to a 64-bit pointer
    #   type which is commonly used in our unit tests.
    conf.env['CXXFLAGS'] += \
        ['/O2', '/W2', '/wd4503', '/wd4312',
         '/EHs', '/D_WIN32_WINNT=0x0501', '/bigobj']

    # Do not generate .manifest files (the /MANIFEST flag is added by waf)
    conf.env['LINKFLAGS'].remove('/MANIFEST')
    conf.env['LINKFLAGS'] += ['/MANIFEST:NO']
    conf.env['MSVC_MANIFEST'] = False

    # Disable LNK4221 linker warning for empty object files
    conf.env['LINKFLAGS'] += ['/ignore:4221']  # used for LINK.exe
    conf.env['ARFLAGS'] += ['/ignore:4221']  # used for LIB.exe
示例#27
0
def mkspec_set_clang_ccflags(conf, force_debug=False):

    if conf.has_tool_option("cxx_debug") or force_debug:
        conf.env["CFLAGS"] += ["-g", "-fno-omit-frame-pointer"]

        # Don't add any optimization flags
        conf.env["MKSPEC_DISABLE_OPTIMIZATION"] = True

    optflags = ["-O2"]

    if not conf.env["MKSPEC_DISABLE_OPTIMIZATION"]:
        conf.env["CFLAGS"] += optflags

    # Warning flags
    conf.env["CFLAGS"] += ["-Wextra", "-Wall"]

    if conf.has_tool_option("cxx_nodebug"):
        conf.env["DEFINES"] += ["NDEBUG"]
示例#28
0
def mkspec_set_gcc_ccflags(conf):

    if conf.has_tool_option("cxx_debug"):
        conf.env["CFLAGS"] += ["-g", "-fno-omit-frame-pointer"]

        # Don't add any optimization flags
        conf.env["MKSPEC_DISABLE_OPTIMIZATION"] = True

    # Optimization flags
    optflags = ["-O2", "-ftree-vectorize", "-finline-functions"]

    if not conf.env["MKSPEC_DISABLE_OPTIMIZATION"]:
        conf.env["CFLAGS"] += optflags

    # Warning flags
    conf.env["CFLAGS"] += ["-Wextra", "-Wall"]

    if conf.has_tool_option("cxx_nodebug"):
        conf.env["DEFINES"] += ["NDEBUG"]
示例#29
0
def mkspec_set_clang_ccflags(conf, force_debug=False):

    optflag = '-O2'

    # Use -Os (optimize for size) flag on iOS, because -O2 produces unstable
    # code on this platform
    if conf.get_mkspec_platform() in ['ios', 'android']:
        optflag = '-Os'

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CFLAGS'] += [optflag]

    # Warning flags
    conf.env['CFLAGS'] += [optflag, '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#30
0
def mkspec_get_toolchain_paths(conf):
    """
    Return the common paths where the g++ binaries are located.

    :return: the common paths where we may find the g++ binary
    """
    # The default path to search
    path_list = os.environ.get('PATH', '').split(os.pathsep)

    if conf.is_mkspec_platform('mac'):

        # If the compiler is installed using macports
        path_list += ['/opt/local/bin']

    if conf.is_mkspec_platform('android'):
        # If specified, the android_ndk_dir option overrides the OS path
        if conf.has_tool_option('android_ndk_dir'):
            ndk = conf.get_tool_option('android_ndk_dir')
            ndk = os.path.abspath(os.path.expanduser(ndk))
            ndk_path = [ndk, os.path.join(ndk, 'bin')]
            return ndk_path

    if conf.is_mkspec_platform('ios'):
        if conf.has_tool_option('ios_toolchain_dir'):
            toolchain = conf.get_tool_option('ios_toolchain_dir')
        else:
            toolchain = "/Applications/Xcode.app/Contents/Developer/" \
                        "Toolchains/XcodeDefault.xctoolchain/usr/bin/"
        toolchain = os.path.abspath(os.path.expanduser(toolchain))

        return toolchain

    if conf.has_tool_option('poky_sdk_path'):
        sdk_path = conf.get_tool_option('poky_sdk_path')
        cross_compiler = os.path.join(sdk_path, 'sysroots',
                                      'x86_64-pokysdk-linux', 'usr', 'bin',
                                      'arm-poky-linux-gnueabi')

        path_list = [cross_compiler] + path_list

    return path_list
示例#31
0
def mkspec_set_gxx_cxxflags(conf):

    # Optimization flags
    optflags = ['-O2', '-ftree-vectorize', '-finline-functions']

    if not conf.env['MKSPEC_DISABLE_OPTIMIZATION']:
        conf.env['CXXFLAGS'] += optflags

    # Warning flags (pedantic ensures ISO C++ conformance)
    conf.env['CXXFLAGS'] += ['-pedantic', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CXXFLAGS'] += ['-g', '-fno-omit-frame-pointer']
    elif not conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Use the C++14 language features
    conf.env['CXXFLAGS'] += ['-std=c++14']
示例#32
0
def mkspec_set_gxx_cxxflags(conf):

    conf.env['CXXFLAGS'] += ['-O2', '-ftree-vectorize', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CXXFLAGS'] += ['-g']
    elif not conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Use the more restrictive c++0x option for linux
    if conf.is_mkspec_platform('linux'):
        conf.env['CXXFLAGS'] += ['-std=c++0x']
    else:
        # Other platforms might need some non-standard functions
        # therefore we use gnu++0x
        # For Android see: http://stackoverflow.com/questions/9247151
        # For MinGW: http://stackoverflow.com/questions/6312151
        conf.env['CXXFLAGS'] += ['-std=gnu++0x']
示例#33
0
def mkspec_set_gxx_cxxflags(conf):

    conf.env['CXXFLAGS'] += ['-O2', '-ftree-vectorize', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug'):
        conf.env['CXXFLAGS'] += ['-g']
    elif not conf.get_mkspec_platform() in ['mac', 'ios']:
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    # Use the more restrictive c++0x option for linux
    if conf.is_mkspec_platform('linux'):
        conf.env['CXXFLAGS'] += ['-std=c++0x']
    else:
        # Other platforms might need some non-standard functions
        # therefore we use gnu++0x
        # For Android see: http://stackoverflow.com/questions/9247151
        # For MinGW: http://stackoverflow.com/questions/6312151
        conf.env['CXXFLAGS'] += ['-std=gnu++0x']
示例#34
0
def mkspec_set_ios_options(conf, min_ios_version, cpu):

    using_simulator = bool(cpu in ["i386", "x86_64"])

    sdk_type = "iPhoneOS"

    # If cpu is 'i386', then we are building for the iOS simulator
    if using_simulator:
        sdk_type = "iPhoneSimulator"

    if conf.has_tool_option("ios_sdk_dir"):
        sdk = conf.get_tool_option("ios_sdk_dir")
    else:
        # Use the standard location of the iOS SDK
        sdk = ("/Applications/Xcode.app/Contents/Developer/Platforms"
               "/{}.platform/Developer/SDKs/{}.sdk".format(sdk_type, sdk_type))
    sdk = os.path.abspath(os.path.expanduser(sdk))

    # Set the IPHONE define - some libraries rely on this define being
    # present
    conf.env.DEFINES += ["IPHONE"]

    # Add common libraries for iOS here
    conf.env["LINKFLAGS"] += ["-lSystem"]  # links with libSystem.dylib

    # Define what are the necessary common compiler and linker options
    # to build for the iOS platform. We tell the ARM cross-compiler
    # to target the specified arm-apple-ios platform triplet, specify
    # the location of the iOS SDK, use the compiler's integrated
    # assembler and set the minimal supported iOS version

    triple = "{}-apple-ios{}.0".format(cpu, min_ios_version)

    ios_version_arg = "-miphoneos-version-min={}"
    if using_simulator:
        ios_version_arg = "-mios-simulator-version-min={}"

    ios_flags = [
        "-target",
        triple,
        "-integrated-as",
        "-isysroot",
        sdk,
        ios_version_arg.format(min_ios_version),
    ]

    conf.env["CFLAGS"] += ios_flags
    conf.env["CXXFLAGS"] += ios_flags
    conf.env["LINKFLAGS"] += ios_flags
示例#35
0
def mkspec_set_android_options(conf):
    # The android_sdk_dir option is optional, if adb is in the OS path
    if conf.has_tool_option("android_sdk_dir"):
        sdk = conf.get_tool_option("android_sdk_dir")
        sdk = os.path.abspath(os.path.expanduser(sdk))
        sdk_path = [sdk, os.path.join(sdk, "platform-tools")]
        conf.find_program("adb", path_list=sdk_path, var="ADB")
    else:
        conf.find_program("adb", var="ADB")

    # Set the android define - some libraries rely on this define
    # being present
    conf.env.DEFINES += ["ANDROID"]

    # Add common libraries for Android here
    conf.env["LINKFLAGS"] += ["-llog"]
示例#36
0
def mkspec_set_android_options(conf):
    # The android_sdk_dir option is optional, if adb is in the OS path
    if conf.has_tool_option('android_sdk_dir'):
        sdk = conf.get_tool_option('android_sdk_dir')
        sdk = os.path.abspath(os.path.expanduser(sdk))
        sdk_path = [sdk, os.path.join(sdk, 'platform-tools')]
        conf.find_program('adb', path_list=sdk_path, var='ADB')
    else:
        conf.find_program('adb', var='ADB')

    # Set the android define - some libraries rely on this define
    # being present
    conf.env.DEFINES += ['ANDROID']

    # Add common libraries for Android here
    conf.env['LINKFLAGS'] += ['-llog']
示例#37
0
def mkspec_set_android_options(conf):
    # The android_sdk_dir option is optional, if adb is in the OS path
    if conf.has_tool_option('android_sdk_dir'):
        sdk = conf.get_tool_option('android_sdk_dir')
        sdk = os.path.abspath(os.path.expanduser(sdk))
        sdk_path = [sdk, os.path.join(sdk, 'platform-tools')]
        conf.find_program('adb', path_list=sdk_path, var='ADB')
    else:
        conf.find_program('adb', var='ADB')

    # Set the android define - some libraries rely on this define
    # being present
    conf.env.DEFINES += ['ANDROID']

    # Add common libraries for Android here
    conf.env['LINKFLAGS'] += ['-llog']
示例#38
0
def mkspec_set_android_options(conf):
    # The android_sdk_dir option is optional, if adb is in the OS path
    if conf.has_tool_option("android_sdk_dir"):
        sdk = conf.get_tool_option("android_sdk_dir")
        sdk = os.path.abspath(os.path.expanduser(sdk))
        sdk_path = [sdk, os.path.join(sdk, "platform-tools")]
        conf.find_program("adb", path_list=sdk_path, var="ADB")
    else:
        conf.find_program("adb", var="ADB")

    # Set the android define - some libraries rely on this define
    # being present
    conf.env.DEFINES += ["ANDROID"]

    # Add common libraries for Android here
    conf.env["LINKFLAGS"] += ["-llog"]
示例#39
0
def mkspec_set_ios_options(conf, min_ios_version, cpu):

    using_simulator = bool(cpu in ['i386', 'x86_64'])

    sdk_type = 'iPhoneOS'

    # If cpu is 'i386', then we are building for the iOS simulator
    if using_simulator:
        sdk_type = 'iPhoneSimulator'

    if conf.has_tool_option('ios_sdk_dir'):
        sdk = conf.get_tool_option('ios_sdk_dir')
    else:
        # Use the standard location of the iOS SDK
        sdk = "/Applications/Xcode.app/Contents/Developer/Platforms" \
              "/{}.platform/Developer/SDKs/{}.sdk".format(sdk_type, sdk_type)
    sdk = os.path.abspath(os.path.expanduser(sdk))

    # Set the IPHONE define - some libraries rely on this define being
    # present
    conf.env.DEFINES += ['IPHONE']

    # Add common libraries for iOS here
    conf.env['LINKFLAGS'] += ['-lSystem']  # links with libSystem.dylib

    # Define what are the necessary common compiler and linker options
    # to build for the iOS platform. We tell the ARM cross-compiler
    # to target the specified arm-apple-ios platform triplet, specify
    # the location of the iOS SDK, use the compiler's integrated
    # assembler and set the minimal supported iOS version

    triple = "{}-apple-ios{}.0".format(cpu, min_ios_version)

    ios_version_arg = '-miphoneos-version-min={}'
    if using_simulator:
        ios_version_arg = '-mios-simulator-version-min={}'

    ios_flags = [
        "-target", triple,
        "-integrated-as",
        "-isysroot", sdk,
        ios_version_arg.format(min_ios_version)
    ]

    conf.env['CFLAGS'] += ios_flags
    conf.env['CXXFLAGS'] += ios_flags
    conf.env['LINKFLAGS'] += ios_flags
示例#40
0
def mkspec_set_msvc_flags(conf):

    if conf.has_tool_option("cxx_debug"):
        # Use the multithread, debug version of the run-time library
        conf.env["CXXFLAGS"] += ["/MTd"]
        # Include all debugging information in the .obj files.
        # No .pdb files are produced to prevent warnings.
        conf.env["CXXFLAGS"] += ["/Z7"]

        conf.env["LINKFLAGS"] += ["/DEBUG"]

        # Don't add any optimization flags
        conf.env["MKSPEC_DISABLE_OPTIMIZATION"] = True
    else:
        # Use the multithread, release version of the run-time library
        conf.env["CXXFLAGS"] += ["/MT"]

    # Optimization flags
    optflags = ["/O2"]

    if not conf.env["MKSPEC_DISABLE_OPTIMIZATION"]:
        conf.env["CXXFLAGS"] += optflags

    # Add various defines to suppress deprecation warnings for common
    # functions like strcpy, sprintf and socket API calls
    conf.env["CXXFLAGS"] += [
        "/D_SCL_SECURE_NO_WARNINGS",
        "/D_CRT_SECURE_NO_WARNINGS",
        "/D_WINSOCK_DEPRECATED_NO_WARNINGS",
    ]

    if conf.has_tool_option("cxx_nodebug"):
        conf.env["DEFINES"] += ["NDEBUG"]

    # The /EHs flag only allows standard C++ exceptions (which might also
    # originate from extern "C" functions).
    # Set _WIN32_WINNT=0x0600 (i.e. Windows Vista target) to suppress warnings
    # in Boost Asio.
    # Disabled compiler warnings:
    # - C4503 that complains about the length of decorated template names.
    #   This occurs frequently as we compile heavily templated code, and
    #   we also have to enable /bigobj to allow large object files.
    # - C4312 that warns about assigning a 32-bit value to a 64-bit pointer
    #   type which is commonly used in our unit tests.
    conf.env["CXXFLAGS"] += [
        "/W2",
        "/wd4503",
        "/wd4312",
        "/EHs",
        "/D_WIN32_WINNT=0x0600",
        "/bigobj",
    ]

    # Do not generate .manifest files (the /MANIFEST flag is added by waf)
    conf.env["LINKFLAGS"].remove("/MANIFEST")
    conf.env["LINKFLAGS"] += ["/MANIFEST:NO"]
    conf.env["MSVC_MANIFEST"] = False

    # Disable LNK4221 linker warning for empty object files
    conf.env["LINKFLAGS"] += ["/ignore:4221"]  # used for LINK.exe
    conf.env["ARFLAGS"] += ["/ignore:4221"]  # used for LIB.exe
示例#41
0
def mkspec_emscripten_configure(conf, major, minor, minimum=False,
                                force_debug=False):

    print('***emscripten_common.py::mkspec_emscripten_configure')
    """
    :param force_debug: Always compile with debugging flags, if true
    """
    conf.set_mkspec_platform('emscripten')

    # The path to the emscripten compiler
    paths = conf.get_tool_option('emscripten_path')

    # The node.js binary can be "nodejs" or simply "node"
    conf.find_program(['nodejs', 'node'], var='NODEJS')

    # Find the clang++ compiler
    cxx = conf.find_program(['em++'], path_list=paths)
    cxx = conf.cmd_to_list(cxx)
    conf.env['CXX'] = cxx
    conf.env['CXX_NAME'] = os.path.basename(conf.env.get_flat('CXX'))

    conf.check_emscripten_version(cxx, major, minor, minimum)

    # Find clang as the C compiler
    cc = conf.find_program(['emcc'], path_list=paths)
    cc = conf.cmd_to_list(cc)
    conf.env['CC'] = cc
    conf.env['CC_NAME'] = os.path.basename(conf.env.get_flat('CC'))

    conf.check_emscripten_version(cc, major, minor, minimum)

    # Find the archiver
    conf.find_program('emar', path_list=paths, var='AR')
    conf.env.ARFLAGS = ['rcs']

    # Set up C++ tools and flags
    conf.gxx_common_flags()
    conf.cxx_load_tools()
    conf.cxx_add_flags()

    # Also set up C tools and flags
    conf.gcc_common_flags()
    conf.cc_load_tools()
    conf.cc_add_flags()

    # Add linker flags
    conf.link_add_flags()

    # Add the special flags required for emscripten
    conf.env.cshlib_PATTERN = '%s.js'
    conf.env.cxxshlib_PATTERN = '%s.js'
    conf.env.cstlib_PATTERN = '%s.a'
    conf.env.cxxstlib_PATTERN = '%s.a'
    conf.env.cprogram_PATTERN = conf.env.cxxprogram_PATTERN = '%s.js'
    conf.env.CXX_TGT_F = ['-c', '-o', '']
    conf.env.CC_TGT_F = ['-c', '-o', '']
    conf.env.CXXLNK_TGT_F = ['-o', '']
    conf.env.CCLNK_TGT_F = ['-o', '']
    conf.env.append_value('LINKFLAGS',['-Wl,--enable-auto-import'])

    # Add our own cxx flags
    conf.env['CXXFLAGS'] += \
        ['-O2', '-Wextra', '-Wall', '-Wno-warn-absolute-paths']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CXXFLAGS'] += ['-g']
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    conf.env['CXXFLAGS'] += ['-std=c++11']

    # Add our own cc flags
    conf.env['CFLAGS'] += \
        ['-O2', '-Wextra', '-Wall', '-Wno-warn-absolute-paths']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#42
0
def mkspec_emscripten_configure(conf, major, minor, minimum=False,
                                force_debug=False):
    """
    :param force_debug: Always compile with debugging flags, if true
    """
    conf.set_mkspec_platform('emscripten')

    # The path to the emscripten compiler
    paths = conf.get_tool_option('emscripten_path')

    # The node.js binary can be "nodejs" or simply "node"
    conf.find_program(['nodejs', 'node'], var='NODEJS')

    # Find the clang++ compiler
    cxx = conf.find_program(['em++'], path_list=paths)
    cxx = conf.cmd_to_list(cxx)
    conf.env['CXX'] = cxx
    conf.env['CXX_NAME'] = os.path.basename(conf.env.get_flat('CXX'))

    conf.check_emscripten_version(cxx, major, minor, minimum)

    # Find clang as the C compiler
    cc = conf.find_program(['emcc'], path_list=paths)
    cc = conf.cmd_to_list(cc)
    conf.env['CC'] = cc
    conf.env['CC_NAME'] = os.path.basename(conf.env.get_flat('CC'))

    conf.check_emscripten_version(cc, major, minor, minimum)

    # Find the archiver
    conf.find_program('emar', path_list=paths, var='AR')
    conf.env.ARFLAGS = ['rcs']

    # Set up C++ tools and flags
    conf.gxx_common_flags()
    conf.cxx_load_tools()
    conf.cxx_add_flags()

    # Also set up C tools and flags
    conf.gcc_common_flags()
    conf.cc_load_tools()
    conf.cc_add_flags()

    # Add linker flags
    conf.link_add_flags()

    # Add the special flags required for emscripten
    conf.env.cshlib_PATTERN = '%s.js'
    conf.env.cxxshlib_PATTERN = '%s.js'
    conf.env.cstlib_PATTERN = '%s.a'
    conf.env.cxxstlib_PATTERN = '%s.a'
    conf.env.cprogram_PATTERN = conf.env.cxxprogram_PATTERN = '%s.js'
    conf.env.CXX_TGT_F = ['-c', '-o', '']
    conf.env.CC_TGT_F = ['-c', '-o', '']
    conf.env.CXXLNK_TGT_F = ['-o', '']
    conf.env.CCLNK_TGT_F = ['-o', '']
    conf.env.append_value('LINKFLAGS',['-Wl,--enable-auto-import'])

    # Add our own cxx flags
    conf.env['CXXFLAGS'] += \
        ['-O2', '-Wextra', '-Wall', '-Wno-warn-absolute-paths']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CXXFLAGS'] += ['-g']
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    conf.env['CXXFLAGS'] += ['-std=c++11']

    # Add our own cc flags
    conf.env['CFLAGS'] += \
        ['-O2', '-Wextra', '-Wall', '-Wno-warn-absolute-paths']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
示例#43
0
def mkspec_emscripten_configure(conf, major, minor, minimum=False, force_debug=False):
    """
    :param force_debug: Always compile with debugging flags, if true
    """
    conf.set_mkspec_platform("emscripten")

    # The path to the emscripten compiler
    paths = conf.get_tool_option("emscripten_path")

    # The node.js binary can be "nodejs" or simply "node"
    conf.find_program(["nodejs", "node"], var="NODEJS")

    # Find the clang++ compiler
    cxx = conf.find_program(["em++"], path_list=paths)
    cxx = conf.cmd_to_list(cxx)
    conf.env["CXX"] = cxx
    conf.env["CXX_NAME"] = os.path.basename(conf.env.get_flat("CXX"))

    conf.check_emscripten_version(cxx, major, minor, minimum)

    # Find clang as the C compiler
    cc = conf.find_program(["emcc"], path_list=paths)
    cc = conf.cmd_to_list(cc)
    conf.env["CC"] = cc
    conf.env["CC_NAME"] = os.path.basename(conf.env.get_flat("CC"))

    conf.check_emscripten_version(cc, major, minor, minimum)

    # Find the archiver
    conf.find_program("emar", path_list=paths, var="AR")
    conf.env.ARFLAGS = ["rcs"]

    # Set up C++ tools and flags
    conf.gxx_common_flags()
    conf.cxx_load_tools()
    conf.cxx_add_flags()

    # Also set up C tools and flags
    conf.gcc_common_flags()
    conf.cc_load_tools()
    conf.cc_add_flags()

    # Add linker flags
    conf.link_add_flags()

    # Add the special flags required for emscripten
    conf.env.cshlib_PATTERN = "%s.js"
    conf.env.cxxshlib_PATTERN = "%s.js"
    conf.env.cstlib_PATTERN = "%s.a"
    conf.env.cxxstlib_PATTERN = "%s.a"
    conf.env.cprogram_PATTERN = conf.env.cxxprogram_PATTERN = "%s.js"
    conf.env.CXX_TGT_F = ["-c", "-o", ""]
    conf.env.CC_TGT_F = ["-c", "-o", ""]
    conf.env.CXXLNK_TGT_F = ["-o", ""]
    conf.env.CCLNK_TGT_F = ["-o", ""]
    conf.env.append_value("LINKFLAGS", ["-Wl,--enable-auto-import"])

    # Add our own cxx flags
    conf.env["CXXFLAGS"] += ["-Wextra", "-Wall", "-Wno-warn-absolute-paths"]

    if conf.has_tool_option("cxx_debug") or force_debug:
        conf.env["CXXFLAGS"] += ["-g"]
        conf.env["LINKFLAGS"] += ["-s"]

        # Don't add any optimization flags
        conf.env["MKSPEC_DISABLE_OPTIMIZATION"] = True

    cxxoptflags = ["-O2"]

    if not conf.env["MKSPEC_DISABLE_OPTIMIZATION"]:
        conf.env["CXXFLAGS"] += cxxoptflags

    if conf.has_tool_option("cxx_nodebug"):
        conf.env["DEFINES"] += ["NDEBUG"]

    conf.env["CXXFLAGS"] += ["-std=c++11"]

    if conf.has_tool_option("cxx_debug") or force_debug:
        conf.env["CFLAGS"] += ["-g"]
        # Don't add any optimization flags
        conf.env["MKSPEC_DISABLE_OPTIMIZATION"] = True

    coptflags = ["-O2"]

    if not conf.env["MKSPEC_DISABLE_OPTIMIZATION"]:
        conf.env["CFLAGS"] += coptflags

    # Add our own cc flags
    conf.env["CFLAGS"] += ["-Wextra", "-Wall", "-Wno-warn-absolute-paths"]

    if conf.has_tool_option("cxx_nodebug"):
        conf.env["DEFINES"] += ["NDEBUG"]
示例#44
0
def mkspec_emscripten_configure(conf, major, minor, minimum=False,
                                force_debug=False):
    """
    :param force_debug: Always compile with debugging flags, if true
    """
    # The path to the emscripten compiler
    paths = conf.get_tool_option('emscripten_path')

    # The node.js binary can be "nodejs" or simply "node"
    conf.find_program(['nodejs', 'node'], var='NODEJS')

    # Find the clang++ compiler
    cxx = conf.find_program(['em++'], path_list=paths)
    cxx = conf.cmd_to_list(cxx)
    conf.env['CXX'] = cxx
    conf.env['CXX_NAME'] = os.path.basename(conf.env.get_flat('CXX'))

    conf.check_emscripten_version(cxx, major, minor, minimum)

    # Find clang as the C compiler
    cc = conf.find_program(['emcc'], path_list=paths)
    cc = conf.cmd_to_list(cc)
    conf.env['CC'] = cc
    conf.env['CC_NAME'] = os.path.basename(conf.env.get_flat('CC'))

    conf.check_emscripten_version(cc, major, minor, minimum)

    # Find the archiver
    conf.find_program('emar', path_list=paths, var='AR')
    conf.env.ARFLAGS = 'rcs'

    # Set up C++ tools and flags
    conf.gxx_common_flags()
    #conf.gxx_modifier_platform()
    conf.cxx_load_tools()
    conf.cxx_add_flags()

    # Also set up C tools and flags
    conf.gcc_common_flags()
    #conf.gcc_modifier_platform()
    conf.cc_load_tools()
    conf.cc_add_flags()

    # Add linker flags
    conf.link_add_flags()

    # Add our own cxx flags
    conf.env['CXXFLAGS'] += ['-O2', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CXXFLAGS'] += ['-g']
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    conf.env['CXXFLAGS'] += ['-std=c++0x']

    # Add our own cc flags
    conf.env['CFLAGS'] += ['-O2', '-Wextra', '-Wall']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    conf.env['cprogram_PATTERN'] = conf.env['cxxprogram_PATTERN'] = '%s.js'

    conf.set_mkspec_platform('emscripten')