示例#1
0
def configure_mono(conf):
	v = conf.env
	v['MONO'] = conf.CreateRootRelativePath('Code/SDKs/Mono/bin/mcs')
	mono_lib_path = conf.CreateRootRelativePath('Code/SDKs/Mono/lib/mono')
	v['MONO_FLAGS'] =   ['-target:library', '-langversion:4', '-platform:anycpu', '-optimize', '-g', '-L ' + mono_lib_path]
	# TODO: for debug add -debug
	v['MONO_TGT_F'] = ['-out:']
示例#2
0
def check_win_x64_android_arm_gcc_installed(conf):
    """
	Check compiler is actually installed on executing machine
	"""
    v = conf.env

    # Setup Tools for GCC Cross Compile Toolchain
    if not conf.is_option_true('auto_detect_compiler'):
        android_sdk_home = conf.CreateRootRelativePath('Code/SDKs/android-sdk')
        android_ndk_home = conf.CreateRootRelativePath('Code/SDKs/android-ndk')
        android_java_home = conf.CreateRootRelativePath('Code/SDKs/jdk')
        android_ant_home = conf.CreateRootRelativePath('Code/SDKs/apache-ant')
    else:
        android_sdk_home = os.getenv('ANDROID_HOME', "")
        android_ndk_home = os.getenv('NDK_ROOT', "")
        android_java_home = os.getenv('JAVA_HOME', "")
        android_ant_home = os.getenv('ANT_HOME', "")

    # Validate paths
    for path in [
            android_sdk_home, android_ndk_home, android_java_home,
            android_ant_home
    ]:
        if not os.path.exists(path):
            conf.cry_warning("Requiered Android SDK path does not exist: %s." %
                             path)
            return False

    # Configure platform and compiler mutations
    platform_target = '/platforms/android-' + str(android_target_version)
    compiler_target = '/arch-arm'
    compiler_version = str(android_compiler_version)
    toolchain = 'arm-linux-androideabi-' + compiler_version

    android_sdk_platform_target = android_sdk_home + platform_target
    android_ndk_platform_compiler_target = android_ndk_home + platform_target + compiler_target
    android_ndk_toolchain_target = android_ndk_home + '/toolchains/' + toolchain + '/prebuilt/windows-x86_64'
    if not os.path.exists(android_ndk_toolchain_target
                          ):  # Fallback if the 64 bit compiler is not found
        android_ndk_toolchain_target = android_ndk_home + '/toolchains/' + toolchain + '/prebuilt/windows'

    # Validate paths
    for path in [
            android_sdk_platform_target, android_ndk_platform_compiler_target,
            android_ndk_toolchain_target
    ]:
        if not os.path.exists(path):
            conf.cry_warning("Requiered Android SDK path does not exist: %s." %
                             path)
            return False

    return True
示例#3
0
def configure_mono(conf):
    v = conf.env
    host = Utils.unversioned_sys_platform()
    if host == 'win32':
        v['MONO'] = conf.CreateRootRelativePath('Code/SDKs/Mono/bin/mcs.bat')
    else:
        v['MONO'] = conf.CreateRootRelativePath('Code/SDKs/Mono/bin/mcs')
    mono_lib_path = conf.CreateRootRelativePath('Code/SDKs/Mono/lib/mono')
    v['MONO_FLAGS'] = [
        '-target:library', '-langversion:4', '-platform:anycpu', '-optimize',
        '-debug', '-lib:' + mono_lib_path
    ]
    # TODO: for debug add -debug
    v['MONO_TGT_F'] = '-out:'
示例#4
0
def configure_swig(conf):
    v = conf.env
    v['SWIG'] = conf.CreateRootRelativePath('Code/SDKs/swig/swig')
    v['SWIG_DEFINES_ST'] = '-D%s'
    v['SWIG_TGT_F'] = ['-o']

    v['DEFINES'] += ['SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR']
def load_cryengine_common_settings(conf):
    """
	Setup all platform, compiler and configuration agnostic settings
	"""
    v = conf.env

    # Generate CODE_BASE_FOLDER define to allow to create absolute paths in source to use for pragma comment lib
    code_node = conf.srcnode.make_node('Code')
    code_path = code_node.abspath()
    code_path = code_path.replace('\\', '/')
    v['DEFINES'] += ['CODE_BASE_FOLDER="' + code_path + '/"']

    # To allow pragma comment (lib, 'SDKs/...) uniformly, pass Code to the libpath
    v['LIBPATH'] += [conf.CreateRootRelativePath('Code')]

    # !! CryAction needs fixing, has interdependecies with other system which is bad and forbidden !!
    v['INCLUDES'] += [conf.CreateRootRelativePath('Code/CryEngine/CryAction')]
示例#6
0
def configure_protoc(conf):
    v = conf.env
    bin_temp_folder_node = conf.get_bintemp_folder_node().make_node(
        'protobuf').make_node('GeneratedFiles')
    proto_compiler_folder = conf.CreateRootRelativePath(
        'Code/SDKs/protobuf-3.1.0')
    proto_plugin_folder = conf.CreateRootRelativePath(proto_plugins_rpath)

    if 'linux' in sys.platform:
        v['PROTOC'] = proto_compiler_folder + '/bin/linux/protoc'
    else:
        v['PROTOC'] = proto_compiler_folder + '/bin/win_x86/protoc.exe'

    #conf.check_cfg(package="protobuf", uselib_store="PROTOBUF", args=['--cflags', '--libs'])
    #conf.find_program('protoc', var='PROTOC')

    protobuf_include_path = [
        conf.CreateRootRelativePath('Code/SDKs/protobuf-3.1.0/include/'),
        conf.CreateRootRelativePath('Code/CryCloud/ProtocolBase/'),
        conf.CreateRootRelativePath('Code/CryCloud/Messaging/'),
        conf.CreateRootRelativePath(
            'Code/CryCloud/GameModules/Common/GameCommon/Protobuf/'),
        conf.CreateRootRelativePath(
            'Code/CryCloud/GameTelemetryProvider/protobuf/'),
        conf.get_bintemp_folder_node().make_node('protobuf').abspath(),
        bin_temp_folder_node.abspath()
    ]
    v['PROTOC_INCLUDE_PATHS'] = protobuf_include_path
    v['PROTOC_INCLUDE_ST'] = '-I%s'
    v['PROTOC_FLAGS'] = '--cpp_out=%s' % bin_temp_folder_node.abspath()
    v['PROTOCPLUGIN_FLAGS'] = '--cry_out=%s' % bin_temp_folder_node.abspath()
    v['PROTOCPLUGIN'] = '--plugin=protoc-gen-cry=%s' % (
        os.path.normpath(proto_plugin_folder + cpp_plugin_file))
def load_cryengine_common_settings(conf):
    """
    Setup all platform, compiler and configuration agnostic settings
    """
    v = conf.env

    if conf.is_option_true('enable_memory_tracking'):
        append_to_unique_list(v['DEFINES'], 'AZCORE_ENABLE_MEMORY_TRACKING')
    
    # To allow pragma comment (lib, 'SDKs/...) uniformly, pass Code to the libpath
    append_to_unique_list(v['LIBPATH'], conf.CreateRootRelativePath('Code'))
def load_cryengine_common_settings(conf):
    """
	Setup all platform, compiler and configuration agnostic settings
	"""
    v = conf.env

    # Generate CODE_BASE_FOLDER define to allow to create absolute paths in source to use for pragma comment lib
    code_node = conf.srcnode.make_node('Code')
    code_path = code_node.abspath()
    code_path = code_path.replace('\\', '/')
    v['DEFINES'] += ['CODE_BASE_FOLDER="' + code_path + '/"']

    # To allow pragma comment (lib, 'SDKs/...) uniformly, pass Code to the libpath
    v['LIBPATH'] += [conf.CreateRootRelativePath('Code')]
def load_performance_win_x64_win_x86_settings(conf):
    """
	Setup all compiler and linker settings shared over all win_x64_win_x86 configurations for
	the 'performance' configuration
	"""
    v = conf.env
    conf.load_win_x64_win_x86_common_settings()

    # Load addional shared settings
    conf.load_performance_cryengine_settings()
    conf.load_performance_msvc_settings()
    conf.load_performance_windows_settings()

    # Link againt GPA lib for profiling
    v['INCLUDES'] += [conf.CreateRootRelativePath('Code/SDKs/GPA/include')]
def load_cryengine_common_settings(conf):
    """
    Setup all platform, compiler and configuration agnostic settings
    """
    v = conf.env

    # Generate CODE_BASE_FOLDER define to allow to create absolute paths in source to use for pragma comment lib
    code_node = conf.engine_node.make_node('Code')
    code_path = code_node.abspath()
    code_path = code_path.replace('\\', '/')
    v['DEFINES'] += ['CODE_BASE_FOLDER="' + code_path + '/"']
    if conf.is_option_true('enable_memory_tracking'):
        append_to_unique_list(v['DEFINES'], 'AZCORE_ENABLE_MEMORY_TRACKING')

    # To allow pragma comment (lib, 'SDKs/...) uniformly, pass Code to the libpath
    append_to_unique_list(v['LIBPATH'], conf.CreateRootRelativePath('Code'))
def initialize_lumberyard(ctx):
    """
    Setup all platform, compiler and configuration agnostic settings
    """
    v = ctx.env

    if conf.is_option_true('enable_memory_tracking'):
        append_to_unique_list(v['DEFINES'], 'AZCORE_ENABLE_MEMORY_TRACKING')

    # BEGIN JAVELIN MOD: https://jira.agscollab.com/browse/JAV-18779 Allows for an AZ Allocator to be used for memory management
    # removed below if check because of issues related to https://jira.agscollab.com/browse/LYAJAV-126
    # if conf.is_option_true('use_az_allocator_for_cry_memory_manager'):
    #    append_to_unique_list(v['DEFINES'], 'USE_AZ_ALLOCATOR_FOR_CRY_MEMORY_MANAGER')
    v['DEFINES'] += ['USE_AZ_ALLOCATOR_FOR_CRY_MEMORY_MANAGER']
    # END JAVELIN MOD

    # To allow pragma comment (lib, 'SDKs/...) uniformly, pass Code to the libpath
    append_to_unique_list(v['LIBPATH'], conf.CreateRootRelativePath('Code'))
    return True
示例#12
0
def load_cppcheck_common_settings(conf):
	v = conf.env
		
	# CC/CXX Compiler	
	v['CC'] 		= v['CXX'] 			= conf.CreateRootRelativePath('Tools/CppCheck/cppcheck.exe')
	v['CC_NAME']	= v['CXX_NAME'] 	= 'cppcheck'
	v['CC_SRC_F']  	= v['CXX_SRC_F']	= []
	v['CC_TGT_F'] 	= v['CXX_TGT_F']	= []
	

	v['CCLNK_SRC_F'] = v['CXXLNK_SRC_F'] = []
	v['CCLNK_TGT_F'] = v['CXXLNK_TGT_F'] = ''
		
	# Specify how to translate some common operations for a specific compiler
	v['CPPPATH_ST'] 	= '-I%s'
	v['DEFINES_ST'] 	= '-D%s'
	v['LIB_ST'] 		= ''
	v['LIBPATH_ST'] 	= ''
	v['STLIB_ST'] 		= ''
	v['STLIBPATH_ST'] 	= ''
	
	# Pattern to transform outputs
	v['cprogram_PATTERN'] 	= ''
	v['cxxprogram_PATTERN'] = ''
	v['cshlib_PATTERN'] 	= ''
	v['cxxshlib_PATTERN'] 	= ''
	v['cstlib_PATTERN']      = ''
	v['cxxstlib_PATTERN']    = ''
		
		
	# Set up compiler flags
	COMMON_COMPILER_FLAGS = [
		#'-v',
		'--inline-suppr',
		'--template=vs',
		'--enable=style',
		'--force',
		]
		
	# Copy common flags to prevent modifing references
	v['CFLAGS'] = COMMON_COMPILER_FLAGS[:]
	v['CXXFLAGS'] = COMMON_COMPILER_FLAGS[:]	
def load_win_x64_android_arm_common_settings(conf):
    """Setup all compiler and linker settings shared over all win_x64_arm_linux_androideabi_4_8 configurations
	"""

    v = conf.env

    # Setup Tools for GCC Cross Compile Toolchain
    if not conf.is_option_true('auto_detect_compiler'):
        android_sdk_home = conf.CreateRootRelativePath('Code/SDKs/android-sdk')
        android_ndk_home = conf.CreateRootRelativePath('Code/SDKs/android-ndk')
        android_java_home = conf.CreateRootRelativePath('Code/SDKs/jdk')
        android_ant_home = conf.CreateRootRelativePath('Code/SDKs/apache-ant')

        # Validate paths
        for path in [
                android_sdk_home, android_ndk_home, android_java_home,
                android_ant_home
        ]:
            if not os.path.exists(path):
                conf.cry_error(
                    "Requiered Android SDK path does not exist: %s. Fix path or try running WAF with 'auto_detect_compiler' option enabled."
                    % path)
    else:
        android_sdk_home = os.getenv('ANDROID_HOME', "")
        android_ndk_home = os.getenv('NDK_ROOT', "")
        android_java_home = os.getenv('JAVA_HOME', "")
        android_ant_home = os.getenv('ANT_HOME', "")

        # Validate paths
        if not os.path.exists(android_sdk_home):
            conf.cry_error(
                "Unable to locate ANDROID SDK. Environment variable 'ANDROID_HOME' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )
        if not os.path.exists(android_ndk_home):
            conf.cry_error(
                "Unable to locate ANDROID NDK. Environment variable 'NDK_ROOT' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )
        if not os.path.exists(android_java_home):
            conf.cry_error(
                "Unable to locate JAVA. Environment variable 'JAVA_HOME' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )
        if not os.path.exists(android_ant_home):
            conf.cry_error(
                "Unable to locate APACHE ANT. Environment variable 'ANT_HOME' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )

    # Configure platform and compiler mutations
    platform_target = '/platforms/android-' + str(android_target_version)
    compiler_target = '/arch-arm'

    clang_toolchain = 'llvm'
    gnu_toolchain = 'arm-linux-androideabi-' + str(android_gcc_version)

    android_sdk_platform_target = android_sdk_home + platform_target
    android_ndk_platform_compiler_target = android_ndk_home + platform_target + compiler_target

    # Clang
    android_ndk_clang_toolchain_target = android_ndk_home + '/toolchains/' + clang_toolchain + '/prebuilt/windows-x86_64'

    # GNU
    android_ndk_gcc_toolchain_target = android_ndk_home + '/toolchains/' + gnu_toolchain + '/prebuilt/windows-x86_64'

    # LLVM STL
    #android_stl_home = android_ndk_home + '/sources/cxx-stl/llvm-libc++'
    #android_stl_include_paths =  [android_stl_home + '/libcxx/include']
    #android_stl_lib_name = 'c++_shared'

    # GNU STL
    android_stl_home = android_ndk_home + '/sources/cxx-stl/gnu-libstdc++/' + str(
        android_gcc_version)
    android_stl_include_paths = [
        android_stl_home + '/include',
        android_stl_home + 'libs/armeabi-v7a/include',
        android_stl_home + 'include/backward'
    ]
    android_stl_lib_name = 'gnustl_shared'

    android_stl_lib = android_stl_home + '/libs/armeabi-v7a/lib' + android_stl_lib_name + '.so'

    v['AR'] = android_ndk_gcc_toolchain_target + '/arm-linux-androideabi/bin/ar.exe'
    v['CC'] = android_ndk_clang_toolchain_target + '/bin/clang.exe'
    v['CXX'] = android_ndk_clang_toolchain_target + '/bin/clang++.exe'
    v['LINK'] = v['LINK_CC'] = v[
        'LINK_CXX'] = android_ndk_clang_toolchain_target + '/bin/clang++.exe'
    v['STRIP'] = android_ndk_gcc_toolchain_target + '/arm-linux-androideabi/bin/strip.exe'

    v['JAR'] = android_java_home + '/bin/jar.exe'
    v['JAVAC'] = android_java_home + '/bin/javac.exe'
    v['ANDROID_CLASSPATH'] = android_sdk_platform_target + '/android.jar'
    v['ANDROID_TARGET_VERSION'] = android_target_version

    v['ANT'] = android_ant_home + '/bin/ant.bat'

    v['ANDROID_NDK_HOME'] = android_ndk_home
    v['ANDROID_SDL_HOME'] = android_stl_home
    v['ANDROID_SDK_HOME'] = android_sdk_home
    v['ANDROID_JAVA_HOME'] = android_java_home
    v['ANDROID_ANT_HOME'] = android_ant_home

    v['ANDROID_SDL_LIB_PATH'] = android_stl_lib
    v['ANDROID_SDL_LIB_NAME'] = android_stl_lib_name

    v['cprogram_PATTERN'] = '%s'
    v['cxxprogram_PATTERN'] = '%s'
    v['cshlib_PATTERN'] = 'lib%s.so'
    v['cxxshlib_PATTERN'] = 'lib%s.so'
    v['cstlib_PATTERN'] = 'lib%s.a'
    v['cxxstlib_PATTERN'] = 'lib%s.a'

    v['DEFINES'] += ['_LINUX', 'LINUX', 'LINUX32', 'ANDROID', '_HAS_C9X']

    if android_target_version >= 21:
        v['DEFINES'] += ['HAS_STPCPY=1']

    # Setup global include paths
    v['INCLUDES'] += android_stl_include_paths + [
        android_ndk_platform_compiler_target + '/usr/include', android_stl_home
        + '/include', android_stl_home + '/libs/armeabi-v7a/include',
        android_ndk_home + '/sources/android/support/include',
        android_ndk_home + '/sources/android/native_app_glue'
    ]

    # Setup global library search path
    v['LIBPATH'] += [
        android_stl_home + '/libs/armeabi-v7a',
        android_ndk_home + platform_target + '/arch-arm/usr/lib'
    ]

    v['LIB'] = [
        'c',
        android_stl_lib_name,
        'log',
        'm',
        'android',
    ] + v['LIB']
    # Introduce the compiler to generate 32 bit code
    #-ffunction-sections
    #-funwind-tables
    #-fstack-protector-strong
    #-no-canonical-prefixes
    #-march=armv7-a
    #-mfloat-abi=softfp
    #-mfpu=vfpv3-d16
    #-fno-integrated-as
    #-mthumb
    #-Wa,--noexecstack
    #-Wformat -Werror=format-security
    #-fno-exceptions
    #-fno-rtti -g
    #
    #-DANDROID
    #-ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti -std=c++11 -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info  -fPIC -MD

    common_flag = [
        '-target', 'armv7-none-linux-androideabi', '-gcc-toolchain',
        android_ndk_gcc_toolchain_target,
        '--sysroot=' + android_ndk_platform_compiler_target, '-march=armv7-a'
    ]

    compiler_flags = common_flag + ['-g', '-mfpu=neon', '-fpic']

    # LINKER
    #-DANDROID
    #-ffunction-sections
    #-funwind-tables
    #-fstack-protector-strong
    #-no-canonical-prefixes
    #-march=armv7-a
    #-mfloat-abi=softfp
    #-mfpu=vfpv3-d16
    #-fno-integrated-as
    #-mthumb
    #-Wa,--noexecstack -Wformat
    #-Werror=format-security
    #-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-z,nocopyreloc
    #-pie
    #-fPIE  -lm

    # Compiler
    #cxx_flags = [
    #-cc1
    #-triple armv7-none-linux-android
    #-S -disable-free
    #-disable-llvm-verifier
    #-main-file-name Cry3DEngine_main_2_uber.cpp
    #-mrelocation-model pic
    #-pic-level 2
    #-mthread-model posix
    #-mdisable-fp-elim
    #-relaxed-aliasing
    #-fmath-errno
    #-masm-verbose
    #-no-integrated-as
    #-mconstructor-aliases
    #-munwind-tables
    #-fuse-init-array
    #-target-cpu cortex-a8
    #-target-feature
    #+soft-float-abi
    #-target-feature
    #-fp-only-sp
    #-target-feature
    #-d16
    #-target-feature +vfp3
    #-target-feature -fp16
    #-target-feature -vfp4
    #-target-feature -fp-armv8
    #-target-feature +neon
    #-target-feature -crypto
    #-target-abi aapcs-linux
    #-mfloat-abi soft
    #-target-linker-version 2.24
    #-dwarf-column-info
    #-debug-info-kind=standalone
    #-dwarf-version=4
    #-debugger-tuning=gdb
    #-ffunction-sections
    #-fdata-sections
    #-resource-dir "C:\NVPACK\android-sdk-windows\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\lib64\clang\3.8.256229"
    #-dependency-file "Code\CryEngine\Cry3DEngine\CMakeFiles\Cry3DEngine.dir\Cry3DEngine_main_2_uber.cpp.o.d"
    #-sys-header-deps
    #-MT Code/CryEngine/Cry3DEngine/CMakeFiles/Cry3DEngine.dir/Cry3DEngine_main_2_uber.cpp.o
    #-isystem D:/code/marioc_FRWP1MARIOC_cemain/Code/CryEngine/CryCommon
    #-isystem D:/code/marioc_FRWP1MARIOC_cemain/Code/SDKs/boost
    #-isystem C:/NVPACK/android-sdk-windows/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include
    #-isystem C:/NVPACK/android-sdk-windows/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include
    #-isystem C:/NVPACK/android-sdk-windows/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
    #-D ANDROID
    #-D ANDROID_NDK
    #-D CRY_IS_MONOLITHIC_BUILD
    #-D CRY_MOBILE
    #-D DISABLE_IMPORTGL
    #-D HAS_STPCPY=1 -D LINUX -D LINUX32 -D PROFILE -D _DLL -D _LIB -D _LINUX -D _MT -D _PROFILE -D __ANDROID__ -D __ARM_ARCH_7A__ -I D:/code/marioc_FRWP1MARIOC_cemain/Code/CryEngine/Cry3DEngine -I D:/code/marioc_FRWP1MARIOC_cemain/Code/Libs/yasli -I D:/code/marioc_FRWP1MARIOC_cemain/Code/Libs/yasli/../../SDKs/yasli -I D:/code/marioc_FRWP1MARIOC_cemain/Code/Libs/lz4/../../SDKs/lz4/lib -D ANDROID -D ANDROID -isysroot C:/NVPACK/android-sdk-windows/ndk-bundle/platforms/android-21/arch-arm -internal-isystem C:/NVPACK/android-sdk-windows/ndk-bundle/platforms/android-21/arch-arm/usr/local/include -internal-isystem "C:\NVPACK\android-sdk-windows\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\lib64\clang\3.8.256229\include" -internal-externc-isystem C:/NVPACK/android-sdk-windows/ndk-bundle/platforms/android-21/arch-arm/include -internal-externc-isystem C:/NVPACK/android-sdk-windows/ndk-bundle/platforms/android-21/arch-arm/usr/include -O0 -Wformat -Werror=format-security -Wformat -Werror=format-security -Wno-switch -Wno-parentheses -Wno-multichar -Wno-format-security -Wno-unused-value -Wno-comment -Wno-sizeof-pointer-memaccess -Wno-empty-body -Wno-writable-strings -Wno-logical-op-parentheses -Wno-invalid-offsetof -Wno-tautological-compare -Wno-shift-negative-value -Wno-null-conversion -Wno-c++11-narrowing -Wno-write-strings -Wno-narrowing -std=c++11 -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir "E:\AndroidStudioProjects\MyFirstCmakeTest\app\.externalNativeBuild\cmake\debug\armeabi-v7a"
    #-ferror-limit 19 -fmessage-length 0 -femulated-tls -stack-protector 2 -fallow-half-arguments-and-returns -fno-rtti -fobjc-runtime=gcc
    #-fdiagnostics-show-option

    v['CFLAGS'] += compiler_flags
    v['CXXFLAGS'] += compiler_flags

    #v['CFLAGS'] += ['-march=armeabi-v7a']
    #v['CXXFLAGS'] += ['-march=armeabi-v7a']

    #v['CFLAGS'] += [ '--sysroot=' + android_ndk_platform_compiler_target ]
    #v['CXXFLAGS'] += [ '--sysroot=' + android_ndk_platform_compiler_target ]
    v['LINKFLAGS'] += common_flag + [v['ANDROID_SDL_LIB_PATH']]
示例#14
0
def find_msvc(conf):
    """Due to path format limitations, limit operation only to native Win32. Yeah it sucks."""
    if sys.platform == 'cygwin':
        conf.fatal('MSVC module does not work under cygwin Python!')

    # the autodetection is supposed to be performed before entering in this method
    v = conf.env
    path = v['PATH']
    compiler = v['MSVC_COMPILER']
    version = v['MSVC_VERSION']

    compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
    v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (
        compiler == 'wsdk' and version >= 6) or (compiler == 'intel'
                                                 and version >= 11)

    # compiler
    cxx = None
    if v['CXX']: cxx = v['CXX']
    elif 'CXX' in conf.environ: cxx = conf.environ['CXX']
    cxx = conf.find_program(compiler_name,
                            var='CXX',
                            path_list=path,
                            silent_output=True)
    cxx = conf.cmd_to_list(cxx)

    # before setting anything, check if the compiler is really msvc
    env = dict(conf.environ)
    if path: env.update(PATH=';'.join(path))
    if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env):
        conf.fatal('the msvc compiler could not be identified')

    # c/c++ compiler
    v['CC'] = v['CXX'] = cxx[0]
    v['CC_NAME'] = v['CXX_NAME'] = 'msvc'

    # Bullseye code coverage
    if conf.is_option_true('use_bullseye_coverage'):
        # TODO: Error handling for this is opaque. This will fail the MSVS 2015 tool check,
        # and not say anything about bullseye being missing.
        try:
            covc = conf.find_program('covc',
                                     var='BULL_COVC',
                                     path_list=path,
                                     silent_output=True)
            covlink = conf.find_program('covlink',
                                        var='BULL_COVLINK',
                                        path_list=path,
                                        silent_output=True)
            covselect = conf.find_program('covselect',
                                          var='BULL_COVSELECT',
                                          path_list=path,
                                          silent_output=True)
            v['BULL_COVC'] = covc
            v['BULL_COVLINK'] = covlink
            v['BULL_COV_FILE'] = conf.CreateRootRelativePath(
                conf.options.bullseye_cov_file)
            # Update the coverage file with the region selections detailed in the settings regions parameters
            # NOTE: should we clear other settings at this point, or allow them to accumulate?
            # Maybe we need a flag for that in the setup?
            regions = conf.options.bullseye_coverage_regions.replace(
                ' ', '').split(',')
            conf.cmd_and_log(
                ([covselect] + ['--file', v['BULL_COV_FILE'], '-a'] + regions))
        except:
            Logs.error(
                'Could not find the Bullseye Coverage tools on the path, or coverage tools are not correctly installed. Coverage build disabled.'
            )

    # linker
    if not v['LINK_CXX']:
        link = conf.find_program(linker_name,
                                 path_list=path,
                                 silent_output=True)
        if link: v['LINK_CXX'] = link
        else: conf.fatal('%s was not found (linker)' % linker_name)
        v['LINK'] = link

    if not v['LINK_CC']:
        v['LINK_CC'] = v['LINK_CXX']

    # staticlib linker
    if not v['AR']:
        stliblink = conf.find_program(lib_name,
                                      path_list=path,
                                      var='AR',
                                      silent_output=True)
        if not stliblink: return
        v['ARFLAGS'] = ['/NOLOGO']

    # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later
    if v.MSVC_MANIFEST:
        conf.find_program('MT', path_list=path, var='MT', silent_output=True)
        v['MTFLAGS'] = ['/NOLOGO']

    # call configure on the waflib winres module to setup the environment for configure
    # conf.load('winres') caches the environment as part of the module load key, and we just modified
    # the environment, causing the cache to miss, and extra calls import/load the module
    # winres is loaded
    try:
        module = sys.modules['waflib.Tools.winres']
        func = getattr(module, 'configure', None)
        if func:
            func(conf)
    except Error as e:
        warn(
            'Resource compiler not found. Compiling resource file is disabled')
示例#15
0
def load_win_x64_android_arm_gcc_common_settings(conf):
    """Setup all compiler and linker settings shared over all win_x64_arm_linux_androideabi_4_8 configurations
	"""

    v = conf.env

    # Setup Tools for GCC Cross Compile Toolchain
    if not conf.is_option_true('auto_detect_compiler'):
        android_sdk_home = conf.CreateRootRelativePath('Code/SDKs/android-sdk')
        android_ndk_home = conf.CreateRootRelativePath('Code/SDKs/android-ndk')
        android_java_home = conf.CreateRootRelativePath('Code/SDKs/jdk')
        android_ant_home = conf.CreateRootRelativePath('Code/SDKs/apache-ant')

        # Validate paths
        for path in [
                android_sdk_home, android_ndk_home, android_java_home,
                android_ant_home
        ]:
            if not os.path.exists(path):
                conf.cry_error(
                    "Requiered Android SDK path does not exist: %s. Fix path or try running WAF with 'auto_detect_compiler' option enabled."
                    % path)
    else:
        android_sdk_home = os.getenv('ANDROID_HOME', "")
        android_ndk_home = os.getenv('NDK_ROOT', "")
        android_java_home = os.getenv('JAVA_HOME', "")
        android_ant_home = os.getenv('ANT_HOME', "")

        # Validate paths
        if not os.path.exists(android_sdk_home):
            conf.cry_error(
                "Unable to locate ANDROID SDK. Environment variable 'ANDROID_HOME' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )
        if not os.path.exists(android_ndk_home):
            conf.cry_error(
                "Unable to locate ANDROID NDK. Environment variable 'NDK_ROOT' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )
        if not os.path.exists(android_java_home):
            conf.cry_error(
                "Unable to locate JAVA. Environment variable 'JAVA_HOME' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )
        if not os.path.exists(android_ant_home):
            conf.cry_error(
                "Unable to locate APACHE ANT. Environment variable 'ANT_HOME' not set? Do you have Tegra Android Development Pack (TADP) installed?"
            )

    # Configure platform and compiler mutations
    platform_target = '/platforms/android-' + str(android_target_version)
    compiler_target = '/arch-arm'
    compiler_version = str(android_compiler_version)
    toolchain = 'arm-linux-androideabi-' + compiler_version

    android_sdk_platform_target = android_sdk_home + platform_target
    android_ndk_platform_compiler_target = android_ndk_home + platform_target + compiler_target
    android_ndk_toolchain_target = android_ndk_home + '/toolchains/' + toolchain + '/prebuilt/windows-x86_64'
    if not os.path.exists(android_ndk_toolchain_target
                          ):  # Fallback if the 64 bit compiler is not found
        android_ndk_toolchain_target = android_ndk_home + '/toolchains/' + toolchain + '/prebuilt/windows'

    android_stl_home = android_ndk_home + '/sources/cxx-stl/gnu-libstdc++/' + compiler_version

    v['AR'] = android_ndk_toolchain_target + '/bin/arm-linux-androideabi-ar'
    v['CC'] = android_ndk_toolchain_target + '/bin/arm-linux-androideabi-gcc.exe'
    v['CXX'] = android_ndk_toolchain_target + '/bin/arm-linux-androideabi-g++.exe'
    v['LINK'] = v['LINK_CC'] = v[
        'LINK_CXX'] = android_ndk_toolchain_target + '/bin/arm-linux-androideabi-g++.exe'
    v['STRIP'] = android_ndk_toolchain_target + '/bin/arm-linux-androideabi-strip.exe'

    v['JAR'] = android_java_home + '/bin/jar.exe'
    v['JAVAC'] = android_java_home + '/bin/javac.exe'
    v['ANDROID_CLASSPATH'] = android_sdk_platform_target + '/android.jar'
    v['ANDROID_TARGET_VERSION'] = android_target_version

    v['ANT'] = android_ant_home + '/bin/ant.bat'

    v['ANDROID_NDK_HOME'] = android_ndk_home
    v['ANDROID_SDL_HOME'] = android_stl_home
    v['ANDROID_SDK_HOME'] = android_sdk_home
    v['ANDROID_JAVA_HOME'] = android_java_home

    v['cprogram_PATTERN'] = '%s'
    v['cxxprogram_PATTERN'] = '%s'
    v['cshlib_PATTERN'] = 'lib%s.so'
    v['cxxshlib_PATTERN'] = 'lib%s.so'
    v['cstlib_PATTERN'] = 'lib%s.a'
    v['cxxstlib_PATTERN'] = 'lib%s.a'

    v['DEFINES'] += ['_LINUX', 'LINUX', 'LINUX32', 'ANDROID', '_HAS_C9X']

    # Setup global include paths
    v['INCLUDES'] += [
        android_ndk_platform_compiler_target + '/usr/include',
        android_stl_home + '/include',
        android_stl_home + '/libs/armeabi-v7a/include',
        android_ndk_home + '/sources/android/support/include',
        android_ndk_home + '/sources/android/native_app_glue',
        conf.CreateRootRelativePath('Code/Tools/SDLExtension/src/include'),
    ]

    # Setup global library search path
    v['LIBPATH'] += [
        android_stl_home + 'libs/armeabi-v7a', platform_target + '/usr/lib'
    ]
    # Introduce the compiler to generate 32 bit code
    v['CFLAGS'] += ['-mfpu=neon', '-mfloat-abi=softfp', '-march=armv7-a']
    v['CXXFLAGS'] += ['-mfpu=neon', '-mfloat-abi=softfp', '-march=armv7-a']

    v['CFLAGS'] += ['--sysroot=' + android_ndk_platform_compiler_target]
    v['CXXFLAGS'] += ['--sysroot=' + android_ndk_platform_compiler_target]
    v['LINKFLAGS'] += [
        '--sysroot=' + android_ndk_platform_compiler_target,
        android_stl_home + '/libs/armeabi-v7a/libgnustl_shared.so'
    ]
示例#16
0
def load_msvc_common_settings(conf):
    """
    Setup all compiler/linker flags with are shared over all targets using the microsoft compiler
    
    !!! But not the actual compiler, since the compiler depends on the target !!!
    """
    v = conf.env

    # MT Tool
    v['MTFLAGS'] = ['/NOLOGO']

    # AR Tools
    v['ARFLAGS'] += ['/NOLOGO']
    v['AR_TGT_F'] = '/OUT:'

    # CC/CXX Compiler
    v['CC_NAME'] = v['CXX_NAME'] = 'msvc'
    v['CC_SRC_F'] = v['CXX_SRC_F'] = []
    v['CC_TGT_F'] = v['CXX_TGT_F'] = ['/c', '/Fo']

    v['CPPPATH_ST'] = '/I%s'
    v['SYSTEM_CPPPATH_ST'] = '/external:I%s'
    v['DEFINES_ST'] = '/D%s'

    v['PCH_FILE_ST'] = '/Fp%s'
    v['PCH_CREATE_ST'] = '/Yc%s'
    v['PCH_USE_ST'] = '/Yu%s'

    v['ARCH_ST'] = ['/arch:']

    # Linker
    v['CCLNK_SRC_F'] = v['CXXLNK_SRC_F'] = []
    v['CCLNK_TGT_F'] = v['CXXLNK_TGT_F'] = '/OUT:'

    v['LIB_ST'] = '%s.lib'
    v['LIBPATH_ST'] = '/LIBPATH:%s'
    v['STLIB_ST'] = '%s.lib'
    v['STLIBPATH_ST'] = '/LIBPATH:%s'

    v['cprogram_PATTERN'] = '%s.exe'
    v['cxxprogram_PATTERN'] = '%s.exe'

    # shared library settings
    v['CFLAGS_cshlib'] = v['CFLAGS_cxxshlib'] = []
    v['CXXFLAGS_cshlib'] = v['CXXFLAGS_cxxshlib'] = []

    v['LINKFLAGS_cshlib'] = ['/DLL']
    v['LINKFLAGS_cxxshlib'] = ['/DLL']

    v['cshlib_PATTERN'] = '%s.dll'
    v['cxxshlib_PATTERN'] = '%s.dll'

    # static library settings
    v['CFLAGS_cstlib'] = v['CFLAGS_cxxstlib'] = []
    v['CXXFLAGS_cstlib'] = v['CXXFLAGS_cxxstlib'] = []

    v['LINKFLAGS_cxxstlib'] = []
    v['LINKFLAGS_cxxshtib'] = []

    v['cstlib_PATTERN'] = '%s.lib'
    v['cxxstlib_PATTERN'] = '%s.lib'

    # Compile options appended if compiler optimization is disabled
    v['COMPILER_FLAGS_DisableOptimization'] = ['/Od']

    # Compile options appended if debug symbols are generated
    # Create a external Program Data Base (PDB) for debugging symbols
    #v['COMPILER_FLAGS_DebugSymbols'] = [ '/Zi' ]
    v['COMPILER_FLAGS_DebugSymbols'] = ['/Z7']

    # Linker flags when building with debug symbols
    v['LINKFLAGS_DebugSymbols'] = ['/DEBUG', '/PDBALTPATH:%_PDB%']

    # Store settings for show includes option
    v['SHOWINCLUDES_cflags'] = ['/showIncludes']
    v['SHOWINCLUDES_cxxflags'] = ['/showIncludes']

    # Store settings for preprocess to file option
    v['PREPROCESS_cflags'] = ['/P', '/C']
    v['PREPROCESS_cxxflags'] = ['/P', '/C']
    v['PREPROCESS_cc_tgt_f'] = ['/c', '/Fi']
    v['PREPROCESS_cxx_tgt_f'] = ['/c', '/Fi']

    # Store settings for preprocess to file option
    v['DISASSEMBLY_cflags'] = ['/FAcs']
    v['DISASSEMBLY_cxxflags'] = ['/FAcs']
    v['DISASSEMBLY_cc_tgt_f'] = ['/c', '/Fa']
    v['DISASSEMBLY_cxx_tgt_f'] = ['/c', '/Fa']

    # ASAN and ASLR
    v['LINKFLAGS_ASLR'] = ['/DYNAMICBASE']
    v['ASAN_cflags'] = ['/GS']
    v['ASAN_cxxflags'] = ['/GS']
    """
    LTCG defaults to 4 threads, and can be set as high as 8.  Any setting over 8 is overridden to 1 by the linker.
    Any setting over the number of available hw threads incurs some thread scheduling overhead in a multiproc system.
    If the hw thread count is > 4, scale the setting up to 8.  This is independent of jobs or link_jobs running, and
    these threads are only active during the LTCG portion of the linker.  The overhead is ~50k/thread, and execution
    time doesn't scale linearly with threads.  Use the undocument linkflag /Time+ for extended information on the amount
    of time the linker spends in link time code generation
    """

    hw_thread_count = Options.options.jobs
    if hw_thread_count > 4:
        v['SET_LTCG_THREADS_FLAG'] = True
        ltcg_thread_count = min(hw_thread_count, 8)
        v['LTCG_THREADS_COUNT'] = str(ltcg_thread_count)
    else:
        v['SET_LTCG_THREADS_FLAG'] = False

    # Bullseye code coverage
    if conf.is_option_true('use_bullseye_coverage'):
        # TODO: Error handling for this is opaque. This will fail the MSVS 2015 tool check,
        # and not say anything about bullseye being missing.
        try:
            path = v['PATH']
            covc = conf.find_program('covc',
                                     var='BULL_COVC',
                                     path_list=path,
                                     silent_output=True)
            covlink = conf.find_program('covlink',
                                        var='BULL_COVLINK',
                                        path_list=path,
                                        silent_output=True)
            covselect = conf.find_program('covselect',
                                          var='BULL_COVSELECT',
                                          path_list=path,
                                          silent_output=True)
            v['BULL_COVC'] = covc
            v['BULL_COVLINK'] = covlink
            v['BULL_COV_FILE'] = conf.CreateRootRelativePath(
                conf.options.bullseye_cov_file)
            # Update the coverage file with the region selections detailed in the settings regions parameters
            # NOTE: should we clear other settings at this point, or allow them to accumulate?
            # Maybe we need a flag for that in the setup?
            regions = conf.options.bullseye_coverage_regions.replace(
                ' ', '').split(',')
            conf.cmd_and_log(
                ([covselect] + ['--file', v['BULL_COV_FILE'], '-a'] + regions))
        except Exception as e:
            Logs.error(
                'Could not find the Bullseye Coverage tools on the path, or coverage tools '
                'are not correctly installed. Coverage build disabled. '
                'Error: {}'.format(e))

    # Adds undocumented time flags for cl.exe and link.exe for measuring compiler frontend, code generation and link time code generation
    # timings
    compile_timing_flags = []

    if conf.is_option_true('report_compile_timing'):
        compile_timing_flags.append('/Bt+')
    if conf.is_option_true('report_cxx_frontend_timing'):
        compile_timing_flags.append('/d1reportTime')
    if conf.is_option_true('output_msvc_code_generation_summary'):
        compile_timing_flags.append('/d2cgsummary')
    v['CFLAGS'] += compile_timing_flags
    v['CXXFLAGS'] += compile_timing_flags

    link_timing_flags = []
    if conf.is_option_true('report_link_timing'):
        link_timing_flags.append('/time+')
    v['LINKFLAGS'] += link_timing_flags