def load_win_x64_win_x64_vs2015_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_win_x64 configurations """ v = conf.env global PLATFORM # Add defines to indicate a win64 build v['DEFINES'] += ['_WIN32', '_WIN64', 'NOMINMAX'] # Make sure this is a supported platform if PLATFORM not in conf.get_supported_platforms(): return # Attempt to detect the C++ compiler for VS 2015 ( msvs version 14.0 ) windows_kit = conf.options.win_vs2015_winkit try: conf.auto_detect_msvc_compiler('msvc 14.0', 'x64', windows_kit) except: Logs.warn( 'Unable to find Visual Studio 2015 C++ compiler and/or Windows Kit {}, removing build target' .format(windows_kit)) conf.mark_supported_platform_for_removal(PLATFORM) return # Detect the QT binaries conf.find_qt5_binaries(PLATFORM) # Introduce the linker to generate 64 bit code v['LINKFLAGS'] += ['/MACHINE:X64'] v['ARFLAGS'] += ['/MACHINE:X64'] VS2015_FLAGS = [ '/FS', # Fix for issue writing to pdb files '/Wv:18' # Stick with 2013 warnings for the time being... ] v['CFLAGS'] += VS2015_FLAGS v['CXXFLAGS'] += VS2015_FLAGS if conf.options.use_uber_files: v['CFLAGS'] += ['/bigobj'] v['CXXFLAGS'] += ['/bigobj'] azcg_dir = conf.Path('Tools/AzCodeGenerator/bin/vc140') if not os.path.exists(azcg_dir): conf.fatal( 'Unable to locate the AzCodeGenerator subfolder. Make sure that you have VS2015 AzCodeGenerator binaries available' ) v['CODE_GENERATOR_PATH'] = [azcg_dir] crcfix_dir = conf.Path('Tools/crcfix/bin/vc140') if not os.path.exists(crcfix_dir): Logs.warn( 'Unable to locate the crcfix subfolder. Make sure that you have VS2015 crcfix binaries available' ) v['CRCFIX_PATH'] = [crcfix_dir] conf.find_dx12(windows_kit)
def load_win_x64_win_x64_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_win_x64 configurations """ v = conf.env # Add defines to indicate a win64 build v['DEFINES'] += ['_WIN32', '_WIN64', 'NOMINMAX'] # currently only the Visual Studio 2013 tool chain can build the win x64 target platform # Once we can compile across multiple ranges, enable the min and max versions properly try: conf.auto_detect_msvc_compiler('msvc 12.0', 'x64') except: if 'win_x64' in conf.get_supported_platforms(): Logs.warn( 'Unable to find Visual Studio 2013 for win_x64, removing build target' ) conf.mark_supported_platform_for_removal('win_x64') return # Introduce the linker to generate 64 bit code v['LINKFLAGS'] += ['/MACHINE:X64'] v['ARFLAGS'] += ['/MACHINE:X64'] VS2013_FLAGS = [ '/FS' # Fix for issue writing to pdb files ] v['CFLAGS'] += VS2013_FLAGS v['CXXFLAGS'] += VS2013_FLAGS if conf.options.use_uber_files: v['CFLAGS'] += ['/bigobj'] v['CXXFLAGS'] += ['/bigobj']
def load_win_x64_win_x64_vs2013_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_win_x64 configurations """ v = conf.env global PLATFORM # Add defines to indicate a win64 build v['DEFINES'] += ['_WIN32', '_WIN64', 'NOMINMAX'] # Make sure this is a supported platform if PLATFORM not in conf.get_supported_platforms(): return # Attempt to detect the C++ compiler for VS 2013 ( msvs version 12.0 ) try: conf.auto_detect_msvc_compiler('msvc 12.0', 'x64') except: Logs.warn( 'Unable to detect find the C++ compiler for Visual Studio 2013, removing build target' ) conf.mark_supported_platform_for_removal(PLATFORM) return # Detect the QT binaries conf.find_qt5_binaries(PLATFORM) # Introduce the linker to generate 64 bit code v['LINKFLAGS'] += ['/MACHINE:X64'] v['ARFLAGS'] += ['/MACHINE:X64'] VS2013_FLAGS = [ '/FS', # Fix for issue writing to pdb files '/Zo' # Enhanced optimized debugging (increases pdb size but has no effect on code size and improves debugging) - this is enabled by default for vs2015. ] v['CFLAGS'] += VS2013_FLAGS v['CXXFLAGS'] += VS2013_FLAGS if conf.options.use_uber_files: v['CFLAGS'] += ['/bigobj'] v['CXXFLAGS'] += ['/bigobj'] azcg_dir = conf.srcnode.make_node( 'Tools/AzCodeGenerator/bin/vc120').abspath() if not os.path.exists(azcg_dir): conf.fatal( 'Unable to locate the AzCodeGenerator subfolder. Make sure that you have VS2013 AzCodeGenerator binaries available' ) v['CODE_GENERATOR_PATH'] = [azcg_dir] crcfix_dir = conf.srcnode.make_node('Tools/crcfix/bin/vc120').abspath() if not os.path.exists(crcfix_dir): Logs.warn( 'Unable to locate the crcfix subfolder. Make sure that you have VS2013 crcfix binaries available' ) v['CRCFIX_PATH'] = [crcfix_dir]
def load_win_x64_win_x64_vs2015_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_win_x64 configurations """ v = conf.env global PLATFORM # Add defines to indicate a win64 build v['DEFINES'] += ['_WIN32', '_WIN64', 'NOMINMAX'] restricted_tool_list_macro_header = 'AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS=' restricted_tool_list_macro = restricted_tool_list_macro_header if len(restricted_tool_list_macro) > len(restricted_tool_list_macro_header): v['DEFINES'] += [ restricted_tool_list_macro ] # Make sure this is a supported platform if PLATFORM not in conf.get_supported_platforms(): return # Attempt to detect the C++ compiler for VS 2015 ( msvs version 14.0 ) windows_kit = conf.options.win_vs2015_winkit try: conf.auto_detect_msvc_compiler('msvc 14.0', 'x64', windows_kit) except: Logs.warn('Unable to find Visual Studio 2015 C++ compiler and/or Windows Kit {}, removing build target'.format(windows_kit)) conf.mark_supported_platform_for_removal(PLATFORM) return # Detect the QT binaries, if the current capabilities selected requires it. _, enabled, _, _ = conf.tp.get_third_party_path(PLATFORM, 'qt') if enabled: conf.find_qt5_binaries(PLATFORM) # Introduce the linker to generate 64 bit code v['LINKFLAGS'] += ['/MACHINE:X64'] v['ARFLAGS'] += ['/MACHINE:X64'] VS2015_FLAGS = [ '/FS' # Fix for issue writing to pdb files ] v['CFLAGS'] += VS2015_FLAGS v['CXXFLAGS'] += VS2015_FLAGS if conf.options.use_uber_files: v['CFLAGS'] += ['/bigobj'] v['CXXFLAGS'] += ['/bigobj'] crcfix_dir = conf.Path('Tools/crcfix/bin/vc140') if not os.path.exists(crcfix_dir): Logs.warn('Unable to locate the crcfix subfolder. Make sure that you have VS2015 crcfix binaries available') v['CRCFIX_PATH'] = [crcfix_dir] conf.find_dx12(windows_kit)
def load_win_x64_win_x64_vs2010_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_win_x64_vs2010 configurations """ try: conf.auto_detect_msvc_compiler('msvc 10.0', 'x64') except: if 'win_x64_vs2010' in conf.get_supported_platforms(): Logs.warn( 'Unable to find Visual Studio 2010, removing build target') conf.mark_supported_platform_for_removal('win_x64_vs2010') return v = conf.env # Add defines to indicate a win64 build v['DEFINES'] += ['_WIN32', '_WIN64', 'NOMINMAX'] # Introduce the linker to generate 64 bit code v['LINKFLAGS'] += ['/MACHINE:X64'] v['ARFLAGS'] += ['/MACHINE:X64']
def load_win_x64_win_x64_vs2017_common_settings(conf): """ Setup all compiler and linker settings shared over all win_x64_win_x64 configurations """ v = conf.env global PLATFORM # Add defines to indicate a win64 build and configure VS2017 warnings v['DEFINES'] += [ '_WIN32', '_WIN64', 'NOMINMAX', '_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING', '_ENABLE_EXTENDED_ALIGNED_STORAGE' ] restricted_tool_list_macro_header = 'AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS=' restricted_tool_list_macro = restricted_tool_list_macro_header if len(restricted_tool_list_macro) > len( restricted_tool_list_macro_header): v['DEFINES'] += [restricted_tool_list_macro] # Make sure this is a supported platform if PLATFORM not in conf.get_supported_platforms(): return # Attempt to detect the C++ compiler for VS 2017 ( msvs version 15.0 ) windows_kit = conf.options.win_vs2017_winkit vcvarsall_args = windows_kit + ' ' + conf.options.win_vs2017_vcvarsall_args try: conf.auto_detect_msvc_compiler('msvc 15', 'x64', vcvarsall_args) except: Logs.warn( 'MSVS 2017 will be removed as a build target. We were unable to find an installation of Visual Studio 2017 that matches win_vs2017_vswhere_args=({}), Windows Kit with win_vs2017_winkit=({}), and win_vs2017_vcvarsall_args=({}).' .format(conf.options.win_vs2017_vswhere_args, windows_kit, conf.options.win_vs2017_vcvarsall_args)) Logs.warn( 'Lumberyard defaults use a known good set of options at the time of product release. If your project requires different configuration for MSVS 2017, you can modify these settings in _WAF_/user_settings.options under [Windows Options].' ) conf.mark_supported_platform_for_removal(PLATFORM) return # Detect the QT binaries, if the current capabilities selected requires it. _, enabled, _, _ = conf.tp.get_third_party_path(PLATFORM, 'qt') if enabled: conf.find_qt5_binaries(PLATFORM) # Introduce the linker to generate 64 bit code v['LINKFLAGS'] += ['/MACHINE:X64'] v['ARFLAGS'] += ['/MACHINE:X64'] VS2017_FLAGS = [ '/FS' # Fix for issue writing to pdb files ] v['CFLAGS'] += VS2017_FLAGS v['CXXFLAGS'] += VS2017_FLAGS if conf.options.use_uber_files: v['CFLAGS'] += ['/bigobj'] v['CXXFLAGS'] += ['/bigobj'] azcg_dir = conf.Path('Tools/AzCodeGenerator/bin/vc141') if not os.path.exists(azcg_dir): azcg_dir = conf.Path('Tools/AzCodeGenerator/bin/vc140') if not os.path.exists(azcg_dir): conf.fatal( 'Unable to locate the AzCodeGenerator subfolder. Make sure that you have VS2017 AzCodeGenerator binaries available' ) v['CODE_GENERATOR_PATH'] = [azcg_dir] crcfix_dir = conf.Path('Tools/crcfix/bin/vc141') if not os.path.exists(crcfix_dir): crcfix_dir = conf.Path('Tools/crcfix/bin/vc140') if not os.path.exists(crcfix_dir): Logs.warn( 'Unable to locate the crcfix subfolder. Make sure that you have VS2017 crcfix binaries available' ) v['CRCFIX_PATH'] = [crcfix_dir] conf.find_dx12(windows_kit)
def load_msvc_compiler(conf, target, arch): """ Loads the MSVC compiler for the given target/arch tuple into the current environment """ v = conf.env # Check if we already have diagnosed problem output for this target/arch tuple # Note: Even if we diagnose a potential problem, this is no longer a fatal error # Any fatal errors will already have occurred during the detect function call above global HAS_DIAGNOSED has_diagnosed = True if not target + '_' + arch in HAS_DIAGNOSED: HAS_DIAGNOSED += [ target + '_' + arch ] has_diagnosed = False verbose = conf.is_option_true('auto_detect_verbose') and not has_diagnosed # Get the compiler and SDK to use if not conf.is_option_true('auto_detect_compiler'): sdk, compiler = conf.detect_bootstrapped_msvc_compiler(target, arch) type = 'bootstrapped' if verbose: print '[NOTE] Ignoring --auto-detect-verbose when --auto-detect-compiler is disabled' else: sdk, compiler = conf.auto_detect_msvc_compiler(target, arch, verbose) type = 'auto-detected' if not has_diagnosed: # Show diagnostics for this target/arch pair print '[NOTE] Using %s MSVC %s (%s) with Windows SDK %s' % (type, compiler['version'], os.path.split(compiler['bin'])[1], sdk['version']) # Apply general paths v['PATH'] = compiler['path'] + sdk['path'] v['INCLUDES'] = compiler['include'] + sdk['include'] v['LIBPATH'] = compiler['lib'] + sdk['lib'] # Apply programs to use for build v['AR'] = os.path.join(compiler['bin'], 'lib.exe') v['CC'] = v['CXX'] = os.path.join(compiler['bin'], 'cl.exe') v['LINK'] = v['LINK_CC'] = v['LINK_CXX'] = os.path.join(compiler['bin'], 'link.exe') v['MT'] = os.path.join(sdk['bin'], 'mt.exe') v['WINRC'] = os.path.join(sdk['bin'], 'rc.exe') # Verify the tools exist if not os.path.isfile(v['AR']): conf.fatal('C/C++ archiver not found at ' + v['AR']) if not os.path.isfile(v['CC']): conf.fatal('C/C++ compiler not found at ' + v['CC']) if not os.path.isfile(v['LINK']): conf.fatal('C/C++ linker not found at ' + v['LINK']) if not os.path.isfile(v['MT']): conf.fatal('Windows Manifest tool not found at ' + v['MT']) if not os.path.isfile(v['WINRC']): conf.fatal('Windows Resource Compiler tool not found at ' + v['WINRC']) # Apply MSVC paths (for later use by MSVC specific build steps) v['MSVC_PATH'] = compiler['root'] v['MSVC_VERSION'] = compiler['version'] v['MSVC_COMPILER'] = v['CC_NAME'] = v['CXX_NAME'] = 'msvc' v['MSVC_TARGETS'] = [ target ] # Apply WINSDK paths (for later use by Windows specific build steps) v['WINSDK_PATH'] = sdk['root'] v['WINSDK_VERSION'] = sdk['version'] # Apply merged redist path dictionaries v['REDIST_PATH'] = {} v['REDIST_PATH'].update(compiler['redist']) v['REDIST_PATH'].update(sdk['redist']) # Add MSVC required path to global path v.env = os.environ.copy() if not 'PATH' in v.env: v.env['PATH'] = '' v.env['PATH'] = ';'.join(v['PATH']) + ';' + v.env['PATH'] # Strip duplicate paths v.env['PATH'] =';'.join(set(v.env['PATH'].split(';')))