Exemplo n.º 1
0
def load_win_x64_host_settings(conf):
    """
    Setup any environment settings you want to apply globally any time the host doing the building is win x64
    """
    v = conf.env

    # Setup the environment for the AZ Code Generator

    # Look for the most recent version of the code generator subfolder.  This should be either installed or built by the bootstrap process at this point
    global AZCG_VALIDATED_PATH
    if AZCG_VALIDATED_PATH is None:
        az_code_gen_subfolders = ['bin/vc140', 'bin/vc120']
        validated_azcg_dir = None
        for az_code_gen_subfolder in az_code_gen_subfolders:
            azcg_dir = conf.srcnode.make_node(
                'Tools/AzCodeGenerator/{}'.format(
                    az_code_gen_subfolder)).abspath()
            azcg_exe = os.path.join(azcg_dir, AZ_CODE_GEN_EXECUTABLE)
            if os.path.exists(azcg_exe):
                Logs.debug(
                    'lumberyard: Found AzCodeGenerator at {}'.format(azcg_dir))
                validated_azcg_dir = azcg_dir
                break
        AZCG_VALIDATED_PATH = validated_azcg_dir
        if validated_azcg_dir is None:
            conf.fatal(
                'Unable to locate the AzCodeGenerator subfolder.  Make sure that you have either the VS2013 or VS2015 binaries available'
            )

    v['CODE_GENERATOR_EXECUTABLE'] = AZ_CODE_GEN_EXECUTABLE
    v['CODE_GENERATOR_PATH'] = [AZCG_VALIDATED_PATH]
    v['CODE_GENERATOR_PYTHON_PATHS'] = [
        'Tools/Python/2.7.12/windows/Lib', 'Tools/Python/2.7.12/windows/libs',
        'Tools/Python/2.7.12/windows/DLLs', 'Code/SDKs/markupsafe/x64',
        'Code/SDKs/jinja2/x64'
    ]
    v['CODE_GENERATOR_PYTHON_DEBUG_PATHS'] = [
        'Tools/Python/2.7.12/windows/Lib', 'Tools/Python/2.7.12/windows/libs',
        'Tools/Python/2.7.12/windows/DLLs', 'Code/SDKs/markupsafe/x64',
        'Code/SDKs/jinja2/x64'
    ]
    v['CODE_GENERATOR_PYTHON_HOME'] = 'Tools/Python/2.7.12/windows'
    v['CODE_GENERATOR_PYTHON_HOME_DEBUG'] = 'Tools/Python/2.7.12/windows'

    v['CRCFIX_EXECUTABLE'] = 'crcfix.exe'
def find_dx12(conf, windows_kit):
    global DX12_INCLUDE_DIR
    global DX12_LIB_DIR
    if not windows_kit in DX12_INCLUDE_DIR:
        DX12_INCLUDE_DIR[windows_kit] = None
    if not windows_kit in DX12_LIB_DIR:
        DX12_LIB_DIR[windows_kit] = None
    if (DX12_INCLUDE_DIR[windows_kit] is None) or (DX12_LIB_DIR[windows_kit] is
                                                   None):
        DX12_INCLUDE_DIR[windows_kit] = [
        ]  # set to empty, will prevent this part of the function from running more than once even if nothing is found
        DX12_LIB_DIR[windows_kit] = []
        v = conf.env
        includes = v['INCLUDES']
        libs = v['LIBPATH']

        for path in includes:
            if windows_kit in path:
                for root, dirs, files in os.walk(path):
                    if 'd3d12.h' in files:
                        DX12_INCLUDE_DIR[windows_kit] = root
                        break
                if DX12_INCLUDE_DIR[windows_kit]:
                    break

        # this is expensive, so only do it if the include was also found
        if DX12_INCLUDE_DIR[windows_kit]:
            for path in libs:
                if windows_kit in path:
                    for root, dirs, files in os.walk(path):
                        if 'd3d12.lib' in files:
                            Logs.debug(
                                '[DX12] libraries found, can compile for DX12')
                            DX12_LIB_DIR[windows_kit] = root
                            break
                    if DX12_LIB_DIR[windows_kit]:
                        break

    conf.env['DX12_INCLUDES'] = DX12_INCLUDE_DIR[windows_kit]
    conf.env['DX12_LIBPATH'] = DX12_LIB_DIR[windows_kit]
def load_win_x64_host_settings(conf):
    """
    Setup any environment settings you want to apply globally any time the host doing the building is win x64
    """
    v = conf.env

    # Setup the environment for the AZ Code Generator

    # Look for the most recent version of the code generator subfolder.  This should be either installed or built by the bootstrap process at this point
    global AZCG_VALIDATED_PATH
    if AZCG_VALIDATED_PATH is None:
        az_code_gen_subfolders = ['bin/windows']
        validated_azcg_dir = None
        for az_code_gen_subfolder in az_code_gen_subfolders:
            azcg_dir = conf.Path(
                'Tools/AzCodeGenerator/{}'.format(az_code_gen_subfolder))
            azcg_exe = os.path.join(azcg_dir, AZ_CODE_GEN_EXECUTABLE)
            if os.path.exists(azcg_exe):
                Logs.debug(
                    'lumberyard: Found AzCodeGenerator at {}'.format(azcg_dir))
                validated_azcg_dir = azcg_dir
                break
        AZCG_VALIDATED_PATH = validated_azcg_dir
        if validated_azcg_dir is None:
            conf.fatal(
                'Unable to locate the AzCodeGenerator subfolder.  Make sure that the Windows binaries are available'
            )

    v['CODE_GENERATOR_EXECUTABLE'] = AZ_CODE_GEN_EXECUTABLE
    v['CODE_GENERATOR_PATH'] = [AZCG_VALIDATED_PATH]
    v['CODE_GENERATOR_PYTHON_PATHS'] = [
        conf.Path('Tools/Python/3.7.10/windows/Lib'),
        conf.Path('Tools/Python/3.7.10/windows/libs'),
        conf.Path('Tools/Python/3.7.10/windows/DLLs'),
        conf.ThirdPartyPath('markupsafe', 'x64'),
        conf.ThirdPartyPath('jinja2', 'x64')
    ]
    v['CODE_GENERATOR_PYTHON_DEBUG_PATHS'] = [
        conf.Path('Tools/Python/3.7.10/windows/Lib'),
        conf.Path('Tools/Python/3.7.10/windows/libs'),
        conf.Path('Tools/Python/3.7.10/windows/DLLs'),
        conf.ThirdPartyPath('markupsafe', 'x64'),
        conf.ThirdPartyPath('jinja2', 'x64')
    ]
    v['EMBEDDED_PYTHON_HOME_RELATIVE_PATH'] = 'Tools/Python/3.7.10/windows'
    v['CODE_GENERATOR_PYTHON_HOME'] = conf.Path(
        v['EMBEDDED_PYTHON_HOME_RELATIVE_PATH'])
    v['CODE_GENERATOR_PYTHON_HOME_DEBUG'] = conf.Path(
        'Tools/Python/3.7.10/windows')
    v['CODE_GENERATOR_INCLUDE_PATHS'] = []

    v['EMBEDDED_PYTHON_HOME'] = v['CODE_GENERATOR_PYTHON_HOME']
    v['EMBEDDED_PYTHON_INCLUDE_PATH'] = os.path.join(v['EMBEDDED_PYTHON_HOME'],
                                                     'include')
    v['EMBEDDED_PYTHON_LIBPATH'] = os.path.join(v['EMBEDDED_PYTHON_HOME'],
                                                'libs')
    v['EMBEDDED_PYTHON_SHARED_OBJECT'] = os.path.join(
        v['EMBEDDED_PYTHON_HOME'], 'python37.dll')

    crcfix_dir = conf.Path('Tools/crcfix/bin/windows')
    if not os.path.exists(crcfix_dir):
        Logs.warn(
            'Unable to locate the crcfix subfolder.  Make sure that the Windows crcfix binaries are available'
        )
    v['CRCFIX_PATH'] = [crcfix_dir]
    v['CRCFIX_EXECUTABLE'] = 'crcfix.exe'