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++']
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++']
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_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++"]
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']
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"]
def cxx_msvc11_x64(conf): """ Detect and setup the Microsoft Visual C++ 2012 compiler for 64-bit windows """ if conf.is_mkspec_platform("windows"): conf.env.MSVC_TARGETS = ["x86_amd64"] conf.mkspec_msvc_configure("11.0") else: conf.fatal("This mkspec is not supported on {0}.".format(conf.get_mkspec_platform()))
def cxx_msvc12_x64(conf): """ Detect and setup the Microsoft Visual C++ 2013 compiler for 64-bit windows """ if conf.is_mkspec_platform("windows"): conf.env.MSVC_TARGETS = ["x86_amd64"] conf.mkspec_msvc_configure("12.0") else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_msvc12_x64(conf): """ Detect and setup the Microsoft Visual C++ 2013 compiler for 64-bit windows """ if conf.is_mkspec_platform('windows'): conf.env.MSVC_TARGETS = ['x86_amd64'] conf.mkspec_msvc_configure('12.0') else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_msvc11_x64(conf): """ Detect and setup the Microsoft Visual C++ 2012 compiler for 64-bit windows """ if conf.is_mkspec_platform('windows'): conf.env.MSVC_TARGETS = ['x86_amd64'] conf.mkspec_msvc_configure('11.0') else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_apple_llvm50_x86(conf): """ Detect and setup the 32-bit Apple llvm 5.0 compiler (clang 3.3) """ if conf.is_mkspec_platform('mac'): conf.mkspec_clang_configure(5, 0) conf.mkspec_add_common_flag('-m32') else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_apple_llvm42_x64(conf): """ Detect and setup the 64-bit Apple llvm 4.2 compiler (clang 3.2) """ if conf.is_mkspec_platform('mac'): conf.mkspec_clang_configure(4, 2) conf.mkspec_add_common_flag('-m64') else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_apple_llvm100_x64(conf): """ Detect and setup the 64-bit Apple LLVM 10.0 compiler """ if conf.is_mkspec_platform('mac'): conf.mkspec_clang_configure(10, 0) conf.mkspec_add_common_flag('-m64') else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_apple_llvm130_x64(conf): """ Detect and setup the 64-bit Apple LLVM 13.0 compiler """ if conf.is_mkspec_platform("mac"): conf.mkspec_clang_configure(13, 0) conf.mkspec_add_common_flag("-m64") else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
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']
def cxx_msvc15_x86(conf): """ Configure the Visual Studio 2017 (version 15.x) compiler for 32-bit """ if conf.is_mkspec_platform('windows'): # Use the native x86 toolchain when available, future versions of # Visual Studio might only provide amd64_x86, which is a 64-bit # compiler that cross-compiles to 32-bit conf.env.MSVC_TARGETS = ['x86', 'amd64_x86'] version = conf.mkspec_find_installed_msvc_version(15) conf.mkspec_msvc_configure(version) else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_msvc15_x86(conf): """ Configure the Visual Studio 2017 (version 15.x) compiler for 32-bit """ if conf.is_mkspec_platform("windows"): # Use the native x86 toolchain when available, future versions of # Visual Studio might only provide amd64_x86, which is a 64-bit # compiler that cross-compiles to 32-bit conf.env.MSVC_TARGETS = ["x86", "amd64_x86"] version = conf.mkspec_find_installed_msvc_version(15) conf.mkspec_msvc_configure(version) else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_msvc15_x64(conf): """ Configure the Visual Studio 2017 (version 15.x) compiler for 64-bit """ if conf.is_mkspec_platform('windows'): # The x64 native toolchain is preferred over the x86_amd64 toolchain # which is a 32-bit compiler that cross-compiles to 64-bit (Visual # Studio 2017 Express only provides x86_amd64, but other versions # provide both options) conf.env.MSVC_TARGETS = ['x64', 'x86_amd64'] version = conf.mkspec_find_installed_msvc_version(15) conf.mkspec_msvc_configure(version) else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
def cxx_msvc16_x64(conf): """ Configure the Visual Studio 2019 (version 16.x) compiler for 64-bit """ if conf.is_mkspec_platform("windows"): # The x64 native toolchain is preferred over the x86_amd64 toolchain # which is a 32-bit compiler that cross-compiles to 64-bit (Visual # Studio 2017 Express only provides x86_amd64, but other versions # provide both options) conf.env.MSVC_TARGETS = ["x64", "x86_amd64"] version = conf.mkspec_find_installed_msvc_version(16) conf.mkspec_msvc_configure(version) else: conf.fatal("This mkspec is not supported on {0}.".format( conf.get_mkspec_platform()))
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']
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']
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']
def is_mkspec_platform(conf, platform): return conf.get_mkspec_platform() == platform
def is_mkspec_platform(conf, platform): print('***wurf_cxx_mkspect.py::is_mkspec_platform') return conf.get_mkspec_platform() == platform