Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs
Matt Kuhlenschmidt c72e1e1e70 Copying //UE4/Dev-Editor to //UE4/Dev-Main (Source: //UE4/Dev-Editor @ 3739701)
#lockdown Nick.Penwarden
#rb none

============================
  MAJOR FEATURES & CHANGES
============================

Change 3358367 by tim.gautier

	Submitting resaved QAGame assets - Materials, Material Instances, Material Functions and Parameters

Change 3624848 by Jamie.Dale

	Added a composite font for the editor (and Slate core)

	This is defined in FLegacySlateFontInfoCache::GetDefaultFont and uses our default Roboto fonts (and the culture specific fallback fonts), and is now used as the default font for Slate and the editor.

	This change removes all the manual TTF/OTF file references from the various Slate styles, as well as updating 200+ hard-coded font references to use the new default font.

	This fixes various rendering issues with fonts in the editor when using different languages, and clears a big barrier for removing the legacy localized fallback font support.


Change 3654993 by Jamie.Dale

	'Native' (now called 'FNativeFuncPtr') is now a function pointer that takes a UObject* context, rather than a UObject member function pointer

	This avoids ambiguity when binding a native function pointer to a type that doesn't match the context pointer, as you could end up getting a function called with an incorrect 'this' pointer

	Breaking changes:
	 - Native has been renamed to FNativeFuncPtr.
	 - The signature of a native function has changed (use the DECLARE_FUNCTION and DEFINE_FUNCTION macro pair).
	 - Use P_THIS if you were previously using the 'this' pointer in your native function.

Change 3699591 by Jamie.Dale

	Added support for displaying and editing numbers in a culture correct way

	Numeric input boxes in Slate will now display and accept numbers using the culture correct decimal separators. This is enabled by default, and can be disabled by setting "ShouldUseLocalizedNumericInput" to "False" in XEditorSettings.ini (for the editor), or XGameUserSettings.ini (for a game).

	#jira UE-4028


Change 3719568 by Jamie.Dale

	Allow platforms to override the default ICU timezone calculation


Change 3622366 by Bradut.Palas

	#jira UE-46677

	Don't allow OnLevelRemovedFromWorld to reset the transaction buffer if we're in PIE mode.
	Also, remove one undo barrier in case the event was triggered in PIE mode or else we block the user from undoing previous actions.

Change 3622378 by Bradut.Palas

	#jira UE-46590

	we have a general bug with detecting the size of the last column, but the clamping prevents it from appearing with the other resize modes. The Content Browser is the only one to use fixed width.
	The bug is that the size of the last element is incorrectly reported, after we drag back and forth.
	Fixed by not reading the size real time, but reading it from the SlotInfo structure that is created earlier, which holds the correct value.

Change 3622552 by Jamie.Dale

	Added support for per-culture sub-fonts within a composite font

	This allows you to do things like create a Japanese specific Han sub-font to override the Han characters used in a CJK font (previously you needed to create a localized font asset to achieve this).

Change 3623170 by Jamie.Dale

	Fixing warning

Change 3624846 by Jamie.Dale

	Composite font cache optimizations

	- Converted a typically small sized map to a sorted array + binary search.
	- Converted the already sorted range array to use binary search.
	- Contiguous ranges using the same typeface are now merged in the cache.

Change 3625576 by Cody.Albert

	We now only set the widget tree to transient instead of passing the flag through StaticDuplicateObject. This was causing instanced subobjects to be flagged with RF_DuplicateTransient, preventing them from properly being duplicated when an array of instanced subobjects was modified.

	#jira UE-47971

Change 3626057 by Matt.Kuhlenschmidt

	Expose EUmgSequencePlayMode to blueprints

	#jira UE-49255

Change 3626556 by Matt.Kuhlenschmidt

	Fix window size and position adjustment not accounting for primary monitor not being a high DPI monitor when a secondary monitor is.  Causes flickering and incorrect window positioning.

	#jira UE-48922, UE-48957

Change 3627692 by Matt.Kuhlenschmidt

	PR #3977: Source control submenu menu customization (Contributed by Kryofenix)


Change 3628600 by Arciel.Rekman

	Added AutoCheckout to FAssetRenameManager for commandlet usage.

Change 3630561 by Richard.Hinckley

	Deprecating the version of UFunctionalTestingManager::RunAllFunctionalTests that feature an unused bool parameter, replacing with a new version without that parameter.

Change 3630656 by Richard.Hinckley

	Compile fix.

Change 3630964 by Arciel.Rekman

	Fix CrashReporterClient headless build.

Change 3631050 by Matt.Kuhlenschmidt

	Back out revision 9 from //UE4/Dev-Editor/Engine/Source/Runtime/Slate/Private/Widgets/Layout/SSplitter.cpp

	Causes major problems with resizing splitters in editor

Change 3631140 by Arciel.Rekman

	OpenAL: update Linux version to 1.18.1 (UETOOL-1253)

	- Also remove a hack for RPATH and make it use a generic RPATH mechanism.
	- Bulk of the change from Cengiz.Terzibas

	#jira UETOOL-1253

Change 3632924 by Jamie.Dale

	Added support for a catch-all fallback font within composite fonts

	This allows you to provide broad "font of last resort" behavior on a per-composite font basis, in a way that can also work with different font styles.

Change 3633055 by Jamie.Dale

	Fixed some refresh issues in the font editor

Change 3633062 by Jamie.Dale

	Fixed localization commands being reported as unknown

Change 3633906 by Nick.Darnell

	UMG - You can now store refrences to widgets in the same UserWidget.  If you need to create links between widgets this is valuable.  Will likely introduce new ways to utilize this in the future, for now just getting it working.

Change 3634070 by Arciel.Rekman

	Display actually used values of material overrides.

Change 3634254 by Arciel.Rekman

	Fix ResavePackages working poorly with projects on other drives (UE-49465).

	#jira UE-49465

Change 3635985 by Matt.Kuhlenschmidt

	Fixed typo in function name used by maps

	PR #3975: Add tooltip to Arrays in Editor (Contributed by projectgheist)


Change 3636012 by Matt.Kuhlenschmidt

	PR #3982: Unhide mouse cursor after using Ansel (Contributed by projectgheist)


Change 3636706 by Lauren.Ridge

	Epic Friday: Save parameters to child or sibling  instance functionality

Change 3638706 by Jamie.Dale

	Added an improved Japanese font to the editor

	This is only used when displaying Japanese text when the editor is set to Japanese, and uses a font with Japanese-style unified Han characters (our default fallback font uses Chinese-style unified Han characters).

	#jira UE-33268

Change 3639438 by Arciel.Rekman

	Linux: Repaired ARM server build (UE-49635).

	- Made Steam* plugins compile.
	- Disabled OpenEXR as the libs aren't compiled (need to be done separately).

	(Edigrating CL 3639429 from Release-4.17 to Dev-Editor)

Change 3640625 by Matt.Kuhlenschmidt

	PR #4012: FSlateApplication::ProcessReply use &Reply (Contributed by projectgheist)


Change 3640626 by Matt.Kuhlenschmidt

	PR #4011: Remove space from filename (Contributed by projectgheist)


Change 3640697 by Matt.Kuhlenschmidt

	PR #4010: PNG alpha fix (Contributed by mmdanggg2)


Change 3641137 by Jamie.Dale

	Fixed an issue where a culture specific sub-font could produce incorrect measurements during a culture switch

	It would fallback to the last resort font for a frame or two while the font cache flushed. This has it update the ranges immediately.

Change 3641351 by Jamie.Dale

	Fixing incorrect weights on the Japanese sub-font

Change 3641356 by Jamie.Dale

	Fixing inconsistent font sizes between CoreStyle and EditorStyle

Change 3641710 by Jamie.Dale

	Fixed pure-virtual function call on UMulticastDelegateProperty

Change 3641941 by Lauren.Ridge

	Adding a Parameter Details tab to the Material Editor so users can change default parameter details

Change 3644141 by Jamie.Dale

	Added an improved Korean font to the editor

	This is only used when displaying Korean text when the editor is set to Korean

Change 3644213 by Arciel.Rekman

	Fix the side effects of a fix for UE-49465.

	- Default materials were apparently not being found while building DDC (e.g. making an installed build), now they are
	  and we should not reset loaders on them lest we trigger HasDefaultMaterialsPostLoaded() assert later.

	#jira UE-49465

Change 3644777 by Jamie.Dale

	Reverting Korean editor font back to NanumGothic as NanumBarunGothic looked too squished

Change 3644879 by tim.gautier

	QAGame: Optimized assets for Procedural Foliage testing
	- Added camera bookmarks to Stations in QA-Foliage
	- Renamed QA-FoliageTypeInst assets to ProcFoliage_Shape
	- Fixed up redirectors

Change 3645109 by Matt.Kuhlenschmidt

	PR #3990: Git plugin: fix status of renamed, removed, missing, untracked assets (Contributed by SRombauts)


Change 3645114 by Matt.Kuhlenschmidt

	PR #3991: Git Plugin: Fix RunDumpToFile() leaking Process handles (Contributed by SRombauts)


Change 3645116 by Matt.Kuhlenschmidt

	PR #3996: Git Plugin: run an "UpdateStatus" at "Connect" time to populate the Source Control cache (Contributed by SRombauts)


Change 3645118 by Matt.Kuhlenschmidt

	PR #4005: Git Plugin: Expand the size of the Button "Initialize project with Git" (Contributed by SRombauts)


Change 3645876 by Arciel.Rekman

	Linux: fix submenus of context menu not working (UE-47639).

	- Change by icculus (Ryan Gordon).
	- QA-ClickHUD seems to be not affected by this change (it is already broken alas).

	#jira UE-47639

Change 3648088 by Jamie.Dale

	Fixed some case-sensitivity issues with FText format argument names/pins

	These were originally case-sensitive, but that was lost somewhere along the way. This change restores their original behavior.

	#jira UE-47122

Change 3648097 by Jamie.Dale

	Moved common macOS/iOS localization implementation into FApplePlatformMisc

	#jira UE-49940

Change 3650858 by Arciel.Rekman

	UBT: improve CodeLite project generator (UE-49400).

	- PR #3987 submitted by yaakuro (Cengiz Terzibas).

	#jira UE-49400

Change 3651231 by Arciel.Rekman

	Linux: default to SM5 for Vulkan.

	- Change by Timothee.Bessett.

Change 3653627 by Matt.Kuhlenschmidt

	PR #4020: Source Control Submit Files now interprets Escape key as if the user clicked cancel (Contributed by SRombauts)


Change 3653628 by Matt.Kuhlenschmidt

	PR #4022: Add New C++ Class dialog remember previously selected module. (Contributed by Koderz)


Change 3653984 by Jamie.Dale

	Fixed some redundant string construction

Change 3658528 by Joe.Graf

	UE-45141 - Added CMAKE_CXX_COMPILER and CMAKE_C_COMPILER settings to the generated CMake files

Change 3658594 by Jamie.Dale

	Zipping in UAT now always uses UTF-8 encoding to prevent Unicode issues

	#jira UE-27263

Change 3659643 by Michael.Trepka

	Added a call to FCoreDelegates::ApplicationWillTerminateDelegate.Broadcast(); in Mac RequestExit() to match Windows behavior

	#jira UETOOL-1238

Change 3661908 by Matt.Kuhlenschmidt

	USD asset importing improvements

Change 3664100 by Matt.Kuhlenschmidt

	Fix static analysis

Change 3664107 by Matt.Kuhlenschmidt

	PR #4051: UE-49448: FPropertyChangedEvent to include TopLevelObjects (Contributed by projectgheist)


Change 3664125 by Matt.Kuhlenschmidt

	PR #4036: Add missing GRAPHEDITOR_API (Contributed by projectgheist)


Change 3664340 by Jamie.Dale

	PR #3648: Prevent GatherTextFromSource from failing the commandlet (Contributed by projectgheist)


Change 3664403 by Jamie.Dale

	PR #3769: Fixes UE-46973 - Drag and Dropping Folders with Names (Contributed by LordNed)


Change 3664539 by Jamie.Dale

	PR #3280: Added EditableText functionality (Contributed by projectgheist)


Change 3665433 by Alexis.Matte

	When we finish importing morph target we must re-initialise the render resources since we now use GPU morph target.
	#jira UE-50231

Change 3666747 by Cody.Albert



Change 3669280 by Jamie.Dale

	PR #4060: UE-50455: Verify folder is newly created before removing from tree (Contributed by projectgheist)


Change 3669718 by Jamie.Dale

	PR #4061: Clear Content Browser folder search box on escape key (Contributed by projectgheist)


Change 3670838 by Alexis.Matte

	Fix crash when deleting a skeletal mesh LOD and the mouse is over the "reimport" button.
	#jira UE-50387

Change 3671559 by Matt.Kuhlenschmidt

	Update SimpleUI automation test ground truth

	#jira UE-50325

Change 3671587 by Alexis.Matte

	Fix fbx importer scale not always apply. A cache array was not reset when opening a fbx file.
	#jira UE-50147

Change 3671730 by Jamie.Dale

	Added PostInitInstance to UClass to allow class types to perform construction time initialization of their instances

Change 3672104 by Michael.Dupuis

	#jira UE-50427: Update the volume visibility list of the editor viewport when changing the procedural foliage settings

Change 3674906 by Alexis.Matte

	Make sure the export LOD option is taken in consideration when exporting a level or the current level selection
	#jira UE-50248

Change 3674942 by Matt.Kuhlenschmidt

	Fix static analysis

Change 3675401 by Alexis.Matte

	-fix export animation, do not truncate the last frame anymore
	-fix the import animation, there was a display issue in the progress bar. Also a floorToInt sometime truncate the last valid frame. We also have a better way to calculate the time increment we use to sample the fbx curves.

	#jira UE-48231

Change 3675990 by Alexis.Matte

	Remove morph target when doing a re-import, so morph will be remove if they do not exist anymore in the fbx.
	This is to avoid driving random vertex with old morph target.
	#jira UE-50391

Change 3676169 by Alexis.Matte

	When we re-import with dialog the option, "Override Full Name" was set to false and save with the option dialog. We now not set it to false, since it was not use during re-import.

Change 3676396 by Alexis.Matte

	Make all LOD 0 name consistent in staticmesh editor
	#jira UE-49461

Change 3677730 by Cody.Albert

	Enable locking of Persistent Level in Levels tab

	#jira UE-50686

Change 3677838 by Jamie.Dale

	Replaced broken version of Roboto Light

Change 3679619 by Alexis.Matte

	Integrate GitHub pr #4029 to fix import fbx chunk material assignation.
	#jira UE-50001

Change 3680093 by Alexis.Matte

	Fix the skeletal mesh so the vertex color is part of the vertex equality like with the static mesh.

Change 3680931 by Arciel.Rekman

	SlateDialogs: show image icon for *.tga (UE-25106).

	- Also reworked the logic somewhat.

	#jira UE-25106

Change 3681966 by Yannick.Lange

	MaterialEditor post-process preview.
	#jira UE-45307

Change 3682407 by Lauren.Ridge

	Fixes for material editor compile errors

Change 3682628 by Lauren.Ridge

	Content browser filters for Material Layers, Blends, and their instances

Change 3682725 by Lauren.Ridge

	Adding filter assets and instance assets to Material Layers and Material Layer Blends. Turning Material Layering on by default

Change 3682921 by Lauren.Ridge

	Fix for instance layers not initializing fully

Change 3682954 by Lauren.Ridge

	Creating Material Layer Test Assets

Change 3683582 by Alexis.Matte

	Fix static analysis build

Change 3683614 by Matt.Kuhlenschmidt

	PR #4062: Git Plugin: Fix UE-44637: Deleting an asset is unsuccessful if the asset is marked for add (Contributed by SRombauts)


Change 3684130 by Lauren.Ridge

	Allow visible parameter retrieval to correctly recurse through internally called functions. Previous check was intended to prevent function previews from leaving their graph through unhooked inputs, but unintentionally blocked all function inputs.

Change 3686289 by Arciel.Rekman

	Remove the pessimization (UE-23791).

Change 3686455 by Lauren.Ridge

	Fixes for adding/removing a layer parameter from the parent not updating the child

Change 3686829 by Jamie.Dale

	No longer include trailing whitespace in the justification calculation for soft-wrapped lines

	#jira UE-50266

Change 3686970 by Lauren.Ridge

	Making material parameter preview work for functions as well

Change 3687077 by Jamie.Dale

	Fixed crash using FActorDetails with the struct details panel

Change 3687152 by Jamie.Dale

	Fixed the row structure tag not appearing in the Content Browser for Data Table assets

	The CDO is used to filter these tags, and the CDO was omiting that tag which caused it to be filtered for all Data Tables.

	#jira UE-48691

Change 3687174 by Lauren.Ridge

	Fix for material layer sub-parameters showing up in the default material parameters panel

Change 3688100 by Lauren.Ridge

	Fixing static analysis error

Change 3688317 by Jamie.Dale

	Fixed crash using the widget reflector in a cooked game

	Editor-style isn't available in cooked games. Core-style should be used instead for the widget reflector.

Change 3689054 by Jamie.Dale

	Reference Viewer can now show/copy references lists for nodes with multiple objects, or multiple selected nodes

	#jira UE-45751

Change 3689513 by Jamie.Dale

	Fixed justification bug with RTL text caused by CL# 3686829

	Also implemented the same alignment fix for visually left-aligned RTL text.

	#jira UE-50266

Change 3690231 by Lauren.Ridge

	Added Material Layers Parameters Preview (all editing disabled) panel to the Material Editor

Change 3690234 by Lauren.Ridge

	Adding Material Layers Function Parameter to Static Parameter Compare

Change 3690750 by Chris.Bunner

	Potential nullptr crash.

Change 3690751 by Chris.Bunner

	Fixed logic on overridden vector parameter retrieval for material instances checking a function owned parameter.

Change 3691010 by Jamie.Dale

	Fixed some clipping issues that could occur with right-aligned text

	FTextBlockLayout::OnPaint was passing an unscaled offset to SetVisibleRegion, and it also wasn't correctly adjusting the offset for RTL text with left-alignment (which becomes a visual right-alignment)

	#jira UE-46760

Change 3691091 by Jamie.Dale

	Renamed FTextBlockLayout to FSlateTextBlockLayout to reflect that it's a Slate specific type

Change 3691134 by Alexis.Matte

	Make sure we instance also the collision mesh when exporting a level to fbx file.
	#jira UE-51066

Change 3691157 by Lauren.Ridge

	Fix for reset to default not refreshing sub-parameters

Change 3691192 by Jamie.Dale

	Fixed Content Browser selection resetting when changing certain view settings

	#jira UE-49611

Change 3691204 by Alexis.Matte

	Remove fbx export file version 2010 compatibility. The 2018 fbx sdk refuse to export earlier then 2011.
	#jira UE-51023

Change 3692335 by Lauren.Ridge

	Setting displayed asset to equal filter asset if no instance has been selected

Change 3692479 by Jamie.Dale

	Fixed whitespace

Change 3692508 by Alexis.Matte

	Make sure we warn the user that there is nothing to export when exporting to fbx using "export selected" or "export All" from the file menu.
	We also prevent the export dialog to show
	#jira UE-50973

Change 3692639 by Jamie.Dale

	Translation Editor now shows stale translations as "Untranslated"

Change 3692743 by Lauren.Ridge

	Smaller blend icons, added icon size override to FObjectEntryBox

Change 3692830 by Alexis.Matte

	Fix linux build

Change 3692894 by Lauren.Ridge

	Tooltip on "Parent" in material layers

Change 3693141 by Jamie.Dale

	Removed dead code

	FastDecimalFormat made this redundant

Change 3693580 by Jamie.Dale

	Added AlwaysSign number formatting option

	#jira UE-10310

Change 3693784 by Jamie.Dale

	Fixed assert extracting the number formatting rules for Arabic

	It uses a character outside the BMP for its plus and minus sign, so we need these to be a string to handle that.

	#jira UE-10310

Change 3694428 by Arciel.Rekman

	Linux: make directory watch request a warning so they don't block cooking.

	- See https://answers.unrealengine.com/questions/715206/cook-error-on-linux.html

Change 3694458 by Matt.Kuhlenschmidt

	Made duplicate keybinding warning non-fatal

Change 3694496 by Alexis.Matte

	fix static analysis build

Change 3694515 by Jamie.Dale

	Added support for culture correct parsing of decimal numbers

	#jira UE-4028

Change 3694621 by Jamie.Dale

	Added a variant of FastDecimalFormat::StringToNumber that takes a string length

	This can be useful if you want to convert a number from within a non-null terminated string

	#jira UE-4028

Change 3694958 by Jamie.Dale

	Added a parsed length output to FastDecimalFormat::StringToNumber to allow permissive parsing

	You can test this rather than the result if you want to attempt to parse a number from a string that may have other data after it. This also fixes the sign-suffix causing the parsing to fail.

	#jira UE-4028

Change 3695083 by Alexis.Matte

	Optimisation of the morph target import
	- We now compute only the normal for the shape the tangent are not necessary
	- The async tasks are create when there is some available cpu thread to avoid filling the memory
	- When we re-import the morph target are deleted in bulk avoiding to initialize the morph map for every morphs targets
	#jira UE-50945

Change 3695122 by Jamie.Dale

	GetCultureAgnosticFormattingRules no longer returns a copy

Change 3695835 by Arciel.Rekman

	TestPAL: greatly expanded malloc test.

Change 3695918 by Arciel.Rekman

	TestPAL: Added thread priority test.

Change 3696589 by Arciel.Rekman

	TestPAL: tweak thread priorities test (better readability).

Change 3697345 by Alexis.Matte

	Fix reorder of material when importing a LOD with new material
	#jira UE-51135

Change 3699590 by Jamie.Dale

	Updated SGraphPinNum to use a numeric editor

	#jira UE-4028

Change 3699698 by Matt.Kuhlenschmidt

	Fix crash opening the level viewport context menu if the actor-component selection is out of sync

	#jira UE-48444

Change 3700158 by Arciel.Rekman

	Enable packaging for Android Vulkan on Linux (UETOOL-1232).

	- Change by Cengiz Terzibas

Change 3700224 by Arciel.Rekman

	TestPAL: fixed a memory leak.

Change 3700775 by Cody.Albert

	Don't need to initialize EnvironmentCubeMap twice.

Change 3700866 by Michael.Trepka

	PR #3223: Remove unnecessary reallocation. (Contributed by foollbar)


	#jira UE-41643

Change 3701132 by Michael.Trepka

	Copy of CL 3671538

	Fixed issues with editor's game mode in high DPI on Mac.

	#jira UE-49947, UE-51063

Change 3701421 by Michael.Trepka

	Fixed a crash in FScreenShotManager caused by an attempt to access a deleted FString in async lambda expression

Change 3701495 by Alexis.Matte

	Fix fbx importer "import normals" option when mix with "mikkt" tangent build it was recomputing the normals instead of importing them.
	#jira UE-UE-51359

Change 3702982 by Jamie.Dale

	Cleaned up some localization setting names

	These now have consistent names and avoid double negatives. This also fixes needing to restart the editor when changing the "ShouldUseLocalizedPropertyNames" setting.

Change 3703517 by Arciel.Rekman

	TestPAL: improved thread test.

	- Changed the counter to a normal variable to reduce possible contentions (threads used to share the counter in an early prototype, hence the usage of an atomic).

Change 3704378 by Michael.Trepka

	Disable Zoom button on Mac if project requests a resizeable window without it.

	#jira UE-51335

Change 3706316 by Jamie.Dale

	Fixed the asset search suggestions list closing if you clicked on its scrollbar

	#jira UE-28885

Change 3706855 by Alexis.Matte

	Support importing animation that has some keys with negative time
	#jira UE-51305

Change 3709634 by Matt.Kuhlenschmidt

	PR #4146: Null access check on ForceLOD in FViewport::HighResScreenshot (Contributed by projectgheist)


Change 3711085 by Michael.Trepka

	Reenabled UBT makefiles on Mac

Change 3713049 by Josh.Engebretson

	The ConfigPropertyEditor now generates a unique runtime UClass.  It uses the outer name on the property instead of a unique ID as a unique id would generate a new UClass every time (and these are RF_Standalone).  I also removed some static qualifiers for Section and Property names which were incorrect.

	#jira UE-51319

Change 3713144 by Lauren.Ridge

	Fixing automated test error

	#jira UE-50982

Change 3713395 by Alexis.Matte

	Fix auto import mountpoint
	#jira UE-51524

Change 3713881 by Michael.Trepka

	Added -buildscw to Mac Build.sh script to build ShaderCompileWorker in addition to the requested target. Xcode passes it to the script when building non-program targets.

	#jira UE-31093

Change 3714197 by Michael.Trepka

	Send IMM key down event to the main window instead of Cocoa key window, as that's what the Slate's active window is. This solves problems with IMM not working in context menu text edit fields.

	#jira UE-47915

Change 3714911 by Joe.Graf

	Merge of cmake changes from Dev-Rendering

Change 3715973 by Michael.Trepka

	Disable OS close button on Windows if project settings request that

	#jira UE-45522

Change 3716390 by Lauren.Ridge

	The color picker summoned when double-clicking vector3 nodes now has its intended "do not refresh until OK is clicked" behavior.

	#jira UE-50916

Change 3716529 by Josh.Engebretson

	Content Browser: Clamp "Assets to Load at Once Before Warning" so it cannot be set below 1

	#jira UE-51341

Change 3716885 by Josh.Engebretson

	Tracking transactions such as a duplication operation can modify a selection which differs from the initial one.  Added package state tracking to restore unmodified state when necessary.

	#jira UE-48572

Change 3716929 by Josh.Engebretson

	Unshelved from pending changelist '3364093':

	PR #3420: Exe's icons and properties (Contributed by projectgheist)


Change 3716937 by Josh.Engebretson

	Unshelved from pending changelist '3647428':

	PR #4026: Fixed memory leaks for pipe writes and added data pipe writes (Contributed by Hemofektik)


Change 3717002 by Josh.Engebretson

	Fix FileReference/string conversion

Change 3717355 by Joe.Graf

	Fixed CMake file generation on Windows including Engine/Source/ThirdParty source

Change 3718256 by Arciel.Rekman

	TestPAL: slight mod to the malloc test.

	- Touch the allocated memory to check actual resident usage.

Change 3718290 by Arciel.Rekman

	BAFO: place descriptor after the allocation to save some VIRT memory.

	- We're relying on passing correct "Size" argument to Free() anyway, and this modification makes use of that extra information to save on memory for the descriptor.

Change 3718508 by Michael.Trepka

	Fixed vsnprintf on platforms that use our custom implementation in StandardPlatformString.cpp to ignore length modifier for certain types (floating point, pointer)

	#jira UE-46148

Change 3718855 by Lauren.Ridge

	Adding content browser favorite folders. Add or remove folders from the favorite list in the folder's right-click context menu, and hide or show the favorites list in the Content Browser options.

Change 3718932 by Cody.Albert

	Update ActorSequence plugin loading phase to PreDefault

	#jira UE-51612

Change 3719378 by tim.gautier

	QAGame: Renamed multiTxt_Justification > UMG_TextJustification.
	Added additional Text Widgets for testing

Change 3719413 by Lauren.Ridge

	Resubmit of content browser favorites

Change 3719803 by Yannick.Lange

	VREditor: Fix crash with null GEditor
	#jira UE-50103

Change 3721127 by tim.gautier

	QAGame: Fixed up a ton of redirectors within /Content and /Content/Materials
	- Added M_ParamDefaults and MF_ParamDefaults
	- Moved legacy MeshPaint materials into /Content/Materials/MeshPaint
	- Renamed ColorPulse assets from MatFunction_ > MF_, moved into /Content/Materials/Functions

Change 3721255 by Alexis.Matte

	Replace skeletal mesh import option "keep overlapping vertex" by 3 float thresholds allowing the user to control the welding thresholds.
	#jira UE-51363

Change 3721594 by Lauren.Ridge

	Material Blends now have plane mesh previews in their icons.

Change 3722072 by tim.gautier

	QAGame: Updated MF_ParamDefaults - using red channel as roughness
	Updated M_ParamDefaults - tweaked Scalar values

Change 3722180 by Michael.Trepka

	Updated Xcode project generator to sort projects in the navigator by name (within folders) and also sort the list of schemes so that their order matches the order of projects in the navigator.

	#jira UE-25941

Change 3722220 by Michael.Trepka

	Fixed a problem with Xcode project generator not handling quoted preprocessor definitions correctly

	#jira UE-40246

Change 3722806 by Lauren.Ridge

	Fixing non-editor compiles

Change 3722914 by Alexis.Matte

	Fbx importer: Add new attribute type(eSkeleton) for staticmesh socket import.

	#jira UE-51665

Change 3723446 by Michael.Trepka

	Copy of CL 3688862 from 4.18 + one more fix for a deadlock related to window resizing when using IME

	Don't do anything in Mac window's windowWillResize: if we're simply chaning the z order of windows. This way we avoid a rare dead lock when hiding the window.

	#jira UE-48257

Change 3723505 by Matt.Kuhlenschmidt

	Fix duplicate actors being created for USD primitives that specify a custom actor class

Change 3723555 by Matt.Kuhlenschmidt

	Fix crash loading the gameplayabilities module

	#jira UE-51693

Change 3723557 by Matt.Kuhlenschmidt

	Fixed tooltip on viewport dpi scaling option

Change 3723870 by Lauren.Ridge

	Fixing incorrect reset to default visibility, adding clear behavior to fields

Change 3723917 by Arciel.Rekman

	Linux: fix compilation with glibc 2.26+ (UE-51699).

	- Fixes compilation on Ubuntu 17.10 among others.

	(Merging 3723489 from //UE4/Release-4.18/... to //UE4/Dev-Editor/...)

Change 3723918 by Arciel.Rekman

	Linux: do not test for popcnt presence unnecessarily (UE-51677).

	(Merging 3723904 from //UE4/Release-4.18/... to //UE4/Dev-Editor/...)

Change 3724229 by Arciel.Rekman

	Fix FOutputDeviceStdOutput to use printf() on Unix platforms.

Change 3724261 by Arciel.Rekman

	TestPAL: fix thread priority test (zero the counter).

Change 3724978 by Arciel.Rekman

	Linux: fix priority calculation.

	- Rlimit values are always positive, so this was completely broken when the RLIMIT_NICE is non-0.

Change 3725382 by Matt.Kuhlenschmidt

	Guard against crashes and add more logging when actor creation fails.
	Looks like it could be manual garbage collections triggered before conversion is complete so those have been removed

	#jira UE-47464

Change 3725559 by Matt.Kuhlenschmidt

	Added a setting to enable/disable high dpi support in editor.   This currently only functions in Windows.
	Moved some files around for better consistency

Change 3725640 by Arciel.Rekman

	Fix Linux thread/process priorities.

	- Should also speed up SCW on Linux by deprioritizing them less.

Change 3726101 by Matt.Kuhlenschmidt

	Fix logic bug in USD child "kind" type resolving

Change 3726244 by Joe.Graf

	Added an option to generate a minimal set of targets for cmake files
	Added shader and config files to cmake file generation for searching within IDEs

Change 3726506 by Arciel.Rekman

	Fix compile issue after DPI change.

Change 3726549 by Matt.Kuhlenschmidt

	Remove unnecessary indirection to cached widgets in the hit test grid

Change 3726660 by Arciel.Rekman

	Enable DPI switch on Linux.

Change 3726763 by Arciel.Rekman

	Fix mismatching "noperspective" qualifier (UE-50807).

	- Pull request #4080 by TTimo.

Change 3727080 by Michael.Trepka

	Added support for editor's EnableHighDPIAwareness setting on Mac

Change 3727658 by Matt.Kuhlenschmidt

	Fix shutdown crash if level editor is still referenced after the object system has been gc'd

	#jira UE-51630

Change 3728270 by Matt.Kuhlenschmidt

	Remove propertyeditor dependency from editorstyle

Change 3728291 by Arciel.Rekman

	Linux: fix for a crash on a headless system (UE-51714).

	- Preliminary change before merging to 4.18.

Change 3728293 by Arciel.Rekman

	Linux: remove unneeded dependency on CEF.

	- Old workaround should no longer be needed, while this dependency makes UE4 depend on a ton of external libs.

Change 3728524 by Michael.Trepka

	Copy of CL 3725570

	Removed Enable Fullscreen option from editor's Window menu on Mac. Windowed fullscreen mode is currently unavailable on Mac in editor mode as supporting it properly would require it to work with multiple spaces and split screen, which we currently don't handle (requested in UE-27240)

	#jira UE-51709

Change 3728875 by Michael.Trepka

	Fixed compile error in Mac SlateOpenGLContext.cpp

Change 3728880 by Matt.Kuhlenschmidt

	Guard against invalid worlds in thumbnail renderers

Change 3728924 by Michael.Trepka

	Don't defer MacApplication->CloseWindow() call. This should fix a rare problem with deferred call executing during Slate's PrepassWindowAndChildren call.

	#jira UE-51711

Change 3729288 by Joe.Graf

	Added the .idea/misc.xml file generation to speed up CLion indexing

Change 3729935 by Michael.Dupuis

	#jira UE-51722: Hide from UI invalid enum values

Change 3730234 by Matt.Kuhlenschmidt

	Fix "Game Gets Mouse Control" setting no longer functioning and instead the mouse was always captured.

	#jira UE-51801

Change 3730349 by Michael.Dupuis

	#jira UE-51324: Clear the UI selection when rebuilding the palette, as we destroyed all items and recreate them, so selection is on invalid item

Change 3730438 by Lauren.Ridge

	Cleaning up material layering UI functions

Change 3730723 by Jamie.Dale

	Fixed FastDecimalFormat::StringToNumber incorrectly reporting that number-like sequences that lacked digits had been parsed as numbers

	#jira UE-51799

Change 3731008 by Lauren.Ridge

	Changing Layers and Blends from proxy assets to real assets

Change 3731026 by Arciel.Rekman

	libelf: make elf_end() visible (UE-51843).

	- This repairs compilation for a case when CUDA is being used.
	- Also added some missing files for ARM 32-bit.

Change 3731081 by Lauren.Ridge

	New material layer test assets

Change 3731186 by Josh.Engebretson

	Adding camera speed scalar setting and Toolbar UI to increase range on camera speed presets

	#jira UE-50104

Change 3731188 by Mike.Erwin

	Improve responsiveness of Open Asset dialog.

	On large projects, there's a noticeable delay when opening and searching/filtering assets.

	Stopwatch measurements on my machine (seconds for ~122,000 assets):
		before	with this CL
	ctrl-P	1.4	0.45
	search	1.8	0.55

	CollectionManagerModule was the main culprit for search/filter slowness.

	Open Asset delay was due to filtering out plugin content. We were doing a lot of redundant work for what is essentially a read-only operation.

Change 3731682 by Arciel.Rekman

	UnrealEd: Allow unattended commandlets to rename/save packages.

Change 3732305 by Michael.Dupuis

	#jira UE-48434 : Only register if the foliage type still has a valid mesh

Change 3732361 by Matt.Kuhlenschmidt

	Fix two settings objects being created in the transient package with the same name

	#jira UE-51891

Change 3732895 by Josh.Engebretson

	https://jira.it.epicgames.net/browse/UE-51706

	If a shared DDC is not being used, present a notification to the licensee with a link on how to setup a shared DDC.
	Adds DDC notification events for check/put and query for whether a shared DDC is in use.

	#jira UE-51706

Change 3733025 by Arciel.Rekman

	UBT: make sure new clang versions are invoked.

Change 3733311 by Mike.Erwin

	Fix Linux compile warning from CL 3731188

	It didn't like mixing && and || without parentheses. Reworked logic to do one test at a time, put cheaper tests first to avoid calls to more expensive IsPluginFolder.

Change 3733658 by Josh.Engebretson

	Add a missing #undef LOCTEXT_NAMESPACE

Change 3734003 by Arciel.Rekman

	Fix Windows attempting to use printf %ls and crashing at that (UE-51934).

Change 3734039 by Michael.Trepka

	Fixed a couple of merge issues in Mac ApplicationCore

Change 3734052 by Michael.Trepka

	One more Mac ApplicationCore fix

Change 3734244 by Lauren.Ridge

	Fix for accessing Slate window on render thread

Change 3734950 by Josh.Engebretson

	Fixing clang warning

Change 3734978 by Jamie.Dale

	Relaxed enum property importing to allow valid numeric values to be imported too

	This was previously made more strict which caused a regression in Data Table importing

	#jira UE-51848

Change 3734999 by Arciel.Rekman

	Linux: add LTO support and more.

	- Adds ability to use link-time opitimization (reusing current target property bAllowLTCG).
	- Supports using llvm-ar and lld instead of ar/ranlib and ld.
	- More build information printed (and in a better organized way).
	- Native scripts updated to install packages with the appropriate tools on supported systems
	- AutoSDKs updated to require a new toolchain (already checked in).
	- Required disabling OpenAL due to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219089

Change 3735268 by Matt.Kuhlenschmidt

	Added support for canvas based DPI scaling.

	-Scene canvas is by default not scaled as this could severely impact any game using a canvas based UI
	-The debug canvas for stats is always dpi scaled in editor and pie.
	-Eliminated text scaling workaround now that the entire canvas is properly scaled
	-Enabled canvas scaling in cascade UI

Change 3735329 by Matt.Kuhlenschmidt

	Fix potential crash if an asset editor has an object deleted out from under it

	#jira UE-51941



Change 3735502 by Arciel.Rekman

	Fix compile issue (bShouldUpdateScreenPercentage).

Change 3735878 by Jamie.Dale

	Updated FString::SanitizeFloat to allow you to specify the min number of fractional digits to have in the resultant string

	This defaults to 1 as that was the old behavior of FString::SanitizeFloat, but can also be set to 0 to prevent adding .0 to whole numbers.

Change 3735881 by Jamie.Dale

	JsonValue no longer stringifies whole numbers as floats

Change 3735884 by Jamie.Dale

	Only allow enums to import integral values

Change 3735912 by Josh.Engebretson

	Improving cook process error/warning handling including asset warning/error content browser links and manual dismiss for cook error notifications

	#jira UE-48131

Change 3736280 by Matt.Kuhlenschmidt

	Fix 0 dpi scale for canvases

	#jira UE-51995

Change 3736298 by Matt.Kuhlenschmidt

	Force focus of game viewports in vr mode

Change 3736374 by Jamie.Dale

	Fixed some places where input chords were being used without testing that they had a valid key set

	#jira UE-51799

Change 3738543 by Matt.Kuhlenschmidt

	Better fix for edit condition crashes

	#jira UE-51886

Change 3738603 by Lauren.Ridge

	Copy over of drag and drop non-array onto array fix

Change 3739701 by Chris.Babcock

	Fix crashlytics merge error
	#jira UE-52064
	#ue4
	#android

[CL 3739980 by Matt Kuhlenschmidt in Main branch]
2017-11-06 18:22:01 -05:00

1597 lines
60 KiB
C#

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.Win32;
using Tools.DotNETCommon;
namespace UnrealBuildTool
{
class LinuxToolChain : UEToolChain
{
/** Flavor of the current build (target triplet)*/
string Architecture;
/** Cache to avoid making multiple checks for lld availability/usability */
bool bUseLld = false;
public LinuxToolChain(string InArchitecture)
: base(CppPlatform.Linux)
{
Architecture = InArchitecture;
if (!CrossCompiling())
{
// use native linux toolchain
ClangPath = LinuxCommon.WhichClang();
GCCPath = LinuxCommon.WhichGcc();
ArPath = LinuxCommon.Which("ar");
LlvmArPath = LinuxCommon.Which("llvm-ar");
RanlibPath = LinuxCommon.Which("ranlib");
StripPath = LinuxCommon.Which("strip");
// if clang is available, zero out gcc (@todo: support runtime switching?)
if (!String.IsNullOrEmpty(ClangPath))
{
GCCPath = null;
}
// When compiling on Linux, use a faster way to relink circularly dependent libraries.
// Race condition between actions linking to the .so and action overwriting it is avoided thanks to inodes
bUseFixdeps = false;
}
else
{
// if new multi-arch toolchain is used, prefer it
string MultiArchRoot = Environment.GetEnvironmentVariable("LINUX_MULTIARCH_ROOT");
if (MultiArchRoot != null)
{
// FIXME: UBT should loop across all the architectures and compile for all the selected ones.
BaseLinuxPath = Path.Combine(MultiArchRoot, Architecture);
Console.WriteLine("Using LINUX_MULTIARCH_ROOT, building with toolchain '{0}'", BaseLinuxPath);
}
else
{
// use cross linux toolchain if LINUX_ROOT is specified
BaseLinuxPath = Environment.GetEnvironmentVariable("LINUX_ROOT");
Console.WriteLine("Using LINUX_ROOT (deprecated, consider LINUX_MULTIARCH_ROOT), building with toolchain '{0}'", BaseLinuxPath);
}
// don't register if we don't have an LINUX_ROOT specified
if (String.IsNullOrEmpty(BaseLinuxPath))
{
throw new BuildException("LINUX_ROOT environment variable is not set; cannot instantiate Linux toolchain");
}
BaseLinuxPath = BaseLinuxPath.Replace("\"", "");
// set up the path to our toolchains
GCCPath = "";
ClangPath = Path.Combine(BaseLinuxPath, @"bin\clang++.exe");
// ar and ranlib will be switched later to match the architecture
ArPath = "ar.exe";
LlvmArPath = "llvm-ar.exe";
RanlibPath = "ranlib.exe";
StripPath = "strip.exe";
// When cross-compiling on Windows, use old FixDeps. It is slow, but it does not have timing issues
bUseFixdeps = (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 || BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32);
}
if (!DetermineCompilerVersion())
{
throw new BuildException("Could not determine version of the compiler, not registering Linux toolchain.");
}
// refuse to use compilers that we know won't work
// disable that only if you are a dev and you know what you are doing
if (!UsingClang())
{
throw new BuildException("This version of the engine can only be compiled by clang - refusing to register the Linux toolchain.");
}
else if (CompilerVersionMajor == 3 && CompilerVersionMinor == 4)
{
throw new BuildException("clang 3.4.x is known to miscompile the engine - refusing to register the Linux toolchain.");
}
// prevent unknown clangs since the build is likely to fail on too old or too new compilers
else if ((CompilerVersionMajor * 10 + CompilerVersionMinor) > 50 || (CompilerVersionMajor * 10 + CompilerVersionMinor) < 35)
{
throw new BuildException(
string.Format("This version of the Unreal Engine can only be compiled with clang 5.0, 4.0, 3.9, 3.8, 3.7, 3.6 and 3.5. clang {0} may not build it - please use a different version.",
CompilerVersionString)
);
}
// trust lld only for clang 5.x and above (FIXME: also find if present on the system?)
// NOTE: with early version you can run into errors like "failed to compute relocation:" and others
bUseLld = (CompilerVersionMajor >= 5);
}
protected static bool CrossCompiling()
{
return BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Linux;
}
protected static bool UsingClang()
{
return !String.IsNullOrEmpty(ClangPath);
}
/// <summary>
/// Splits compiler version string into numerical components, leaving unchanged if not known
/// </summary>
private void DetermineCompilerMajMinPatchFromVersionString()
{
string[] Parts = CompilerVersionString.Split('.');
if (Parts.Length >= 1)
{
CompilerVersionMajor = Convert.ToInt32(Parts[0]);
}
if (Parts.Length >= 2)
{
CompilerVersionMinor = Convert.ToInt32(Parts[1]);
}
if (Parts.Length >= 3)
{
CompilerVersionPatch = Convert.ToInt32(Parts[2]);
}
}
/// <summary>
/// Queries compiler for the version
/// </summary>
private bool DetermineCompilerVersion()
{
CompilerVersionString = null;
CompilerVersionMajor = -1;
CompilerVersionMinor = -1;
CompilerVersionPatch = -1;
Process Proc = new Process();
Proc.StartInfo.UseShellExecute = false;
Proc.StartInfo.CreateNoWindow = true;
Proc.StartInfo.RedirectStandardOutput = true;
Proc.StartInfo.RedirectStandardError = true;
if (!String.IsNullOrEmpty(GCCPath) && File.Exists(GCCPath))
{
Proc.StartInfo.FileName = GCCPath;
Proc.StartInfo.Arguments = " -dumpversion";
Proc.Start();
Proc.WaitForExit();
if (Proc.ExitCode == 0)
{
// read just the first string
CompilerVersionString = Proc.StandardOutput.ReadLine();
DetermineCompilerMajMinPatchFromVersionString();
}
}
else if (!String.IsNullOrEmpty(ClangPath) && File.Exists(ClangPath))
{
Proc.StartInfo.FileName = ClangPath;
Proc.StartInfo.Arguments = " --version";
Proc.Start();
Proc.WaitForExit();
if (Proc.ExitCode == 0)
{
// read just the first string
string VersionString = Proc.StandardOutput.ReadLine();
Regex VersionPattern = new Regex("version \\d+(\\.\\d+)+");
Match VersionMatch = VersionPattern.Match(VersionString);
// version match will be like "version 3.3", so remove the "version"
if (VersionMatch.Value.StartsWith("version "))
{
CompilerVersionString = VersionMatch.Value.Replace("version ", "");
DetermineCompilerMajMinPatchFromVersionString();
}
}
}
else
{
// icl?
}
return !String.IsNullOrEmpty(CompilerVersionString);
}
/// <summary>
/// Checks if compiler version matches the requirements
/// </summary>
private static bool CompilerVersionGreaterOrEqual(int Major, int Minor, int Patch)
{
return CompilerVersionMajor > Major ||
(CompilerVersionMajor == Major && CompilerVersionMinor > Minor) ||
(CompilerVersionMajor == Major && CompilerVersionMinor == Minor && CompilerVersionPatch >= Patch);
}
/// <summary>
/// Architecture-specific compiler switches
/// </summary>
static string ArchitectureSpecificSwitches(string Architecture)
{
string Result = "";
if (Architecture.StartsWith("arm") || Architecture.StartsWith("aarch64"))
{
Result += " -fsigned-char";
}
return Result;
}
static string ArchitectureSpecificDefines(string Architecture)
{
string Result = "";
if (Architecture.StartsWith("x86_64") || Architecture.StartsWith("aarch64"))
{
Result += " -D_LINUX64";
}
return Result;
}
/// <summary>
/// Gets architecture-specific ar paths
/// </summary>
private static string GetArPath(string Architecture)
{
if (CrossCompiling())
{
return Path.Combine(Path.Combine(BaseLinuxPath, String.Format("bin/{0}-{1}", Architecture, ArPath)));
}
return ArPath;
}
/// <summary>
/// Gets architecture-specific ranlib paths
/// </summary>
private static string GetRanlibPath(string Architecture)
{
if (CrossCompiling())
{
return Path.Combine(Path.Combine(BaseLinuxPath, String.Format("bin/{0}-{1}", Architecture, RanlibPath)));
}
return RanlibPath;
}
/// <summary>
/// Gets architecture-specific strip path
/// </summary>
private static string GetStripPath(string Architecture)
{
if (CrossCompiling())
{
return Path.Combine(Path.Combine(BaseLinuxPath, String.Format("bin/{0}-{1}", Architecture, StripPath)));
}
return StripPath;
}
private static bool ShouldUseLibcxx(string Architecture)
{
// set UE4_LINUX_USE_LIBCXX to either 0 or 1. If unset, defaults to 1.
string UseLibcxxEnvVarOverride = Environment.GetEnvironmentVariable("UE4_LINUX_USE_LIBCXX");
if (string.IsNullOrEmpty(UseLibcxxEnvVarOverride) || UseLibcxxEnvVarOverride == "1")
{
// at the moment ARM32 libc++ remains missing
return Architecture.StartsWith("x86_64") || Architecture.StartsWith("aarch64") || Architecture.StartsWith("i686");
}
return false;
}
string GetCLArguments_Global(CppCompileEnvironment CompileEnvironment)
{
string Result = "";
// build up the commandline common to C and C++
Result += " -c";
Result += " -pipe";
if (ShouldUseLibcxx(CompileEnvironment.Architecture))
{
Result += " -nostdinc++";
Result += " -I" + "ThirdParty/Linux/LibCxx/include/";
Result += " -I" + "ThirdParty/Linux/LibCxx/include/c++/v1";
}
Result += " -Wall -Werror";
// test without this next line?
Result += " -funwind-tables"; // generate unwind tables as they seem to be needed for stack tracing (why??)
Result += " -Wsequence-point"; // additional warning not normally included in Wall: warns if order of operations is ambigious
//Result += " -Wunreachable-code"; // additional warning not normally included in Wall: warns if there is code that will never be executed - not helpful due to bIsGCC and similar
//Result += " -Wshadow"; // additional warning not normally included in Wall: warns if there variable/typedef shadows some other variable - not helpful because we have gobs of code that shadows variables
Result += " -Wdelete-non-virtual-dtor";
Result += ArchitectureSpecificSwitches(CompileEnvironment.Architecture);
Result += " -fno-math-errno"; // do not assume that math ops have side effects
Result += GetRTTIFlag(CompileEnvironment); // flag for run-time type info
if (String.IsNullOrEmpty(ClangPath))
{
// GCC only option
Result += " -fno-strict-aliasing";
Result += " -Wno-sign-compare"; // needed to suppress: comparison between signed and unsigned integer expressions
Result += " -Wno-enum-compare"; // Stats2.h triggers this (alignof(int64) <= DATA_ALIGN)
Result += " -Wno-return-type"; // Variant.h triggers this
Result += " -Wno-unused-local-typedefs";
Result += " -Wno-multichar";
Result += " -Wno-unused-but-set-variable";
Result += " -Wno-strict-overflow"; // Array.h:518
}
else
{
// Clang only options
if (CrossCompiling())
{
Result += " -fdiagnostics-format=msvc"; // make diagnostics compatible with MSVC when cross-compiling
}
Result += " -Wno-unused-private-field"; // MultichannelTcpSocket.h triggers this, possibly more
// this hides the "warning : comparison of unsigned expression < 0 is always false" type warnings due to constant comparisons, which are possible with template arguments
Result += " -Wno-tautological-compare";
// this switch is understood by clang 3.5.0, but not clang-3.5 as packaged by Ubuntu 14.04 atm
if (CompilerVersionGreaterOrEqual(3, 5, 0))
{
Result += " -Wno-undefined-bool-conversion"; // hides checking if 'this' pointer is null
}
if (CompilerVersionGreaterOrEqual(3, 6, 0))
{
Result += " -Wno-unused-local-typedef"; // clang is being overly strict here? PhysX headers trigger this.
Result += " -Wno-inconsistent-missing-override"; // these have to be suppressed for UE 4.8, should be fixed later.
}
if (CompilerVersionGreaterOrEqual(3, 9, 0))
{
Result += " -Wno-undefined-var-template"; // not really a good warning to disable
}
if (CompilerVersionGreaterOrEqual(5, 0, 0))
{
Result += " -Wno-unused-lambda-capture"; // suppressed because capturing of compile-time constants is seemingly inconsistent. And MSVC doesn't do that.
}
}
Result += " -Wno-unused-variable";
// this will hide the warnings about static functions in headers that aren't used in every single .cpp file
Result += " -Wno-unused-function";
// this hides the "enumeration value 'XXXXX' not handled in switch [-Wswitch]" warnings - we should maybe remove this at some point and add UE_LOG(, Fatal, ) to default cases
Result += " -Wno-switch";
Result += " -Wno-unknown-pragmas"; // Slate triggers this (with its optimize on/off pragmas)
// needed to suppress warnings about using offsetof on non-POD types.
Result += " -Wno-invalid-offsetof";
// we use this feature to allow static FNames.
Result += " -Wno-gnu-string-literal-operator-template";
// whether we actually can do that is checked in CanUseLTO() earlier
if (CompileEnvironment.bAllowLTCG)
{
Result += " -flto";
}
if (CompileEnvironment.bEnableShadowVariableWarnings)
{
Result += " -Wshadow" + (CompileEnvironment.bShadowVariableWarningsAsErrors ? "" : " -Wno-error=shadow");
}
if (CompileEnvironment.bEnableUndefinedIdentifierWarnings)
{
Result += " -Wundef" + (CompileEnvironment.bUndefinedIdentifierWarningsAsErrors ? "" : " -Wno-error=undef");
}
//Result += " -DOPERATOR_NEW_INLINE=FORCENOINLINE";
// shipping builds will cause this warning with "ensure", so disable only in those case
if (CompileEnvironment.Configuration == CppConfiguration.Shipping)
{
Result += " -Wno-unused-value";
Result += " -fomit-frame-pointer";
}
// switches to help debugging
else if (CompileEnvironment.Configuration == CppConfiguration.Debug)
{
Result += " -fno-inline"; // disable inlining for better debuggability (e.g. callstacks, "skip file" in gdb)
Result += " -fno-omit-frame-pointer"; // force not omitting fp
Result += " -fstack-protector"; // detect stack smashing
//Result += " -fsanitize=address"; // detect address based errors (support properly and link to libasan)
}
// debug info
// bCreateDebugInfo is normally set for all configurations, including Shipping - this is needed to enable callstack in Shipping builds (proper resolution: UEPLAT-205, separate files with debug info)
if (CompileEnvironment.bCreateDebugInfo)
{
// libdwarf (from elftoolchain 0.6.1) doesn't support DWARF4
Result += " -gdwarf-3";
}
// optimization level
if (!CompileEnvironment.bOptimizeCode)
{
Result += " -O0";
}
else
{
Result += " -O2"; // warning: as of now (2014-09-28), clang 3.5.0 miscompiles PlatformerGame with -O3 (bitfields?)
}
if (CompileEnvironment.bIsBuildingDLL)
{
Result += " -fPIC";
// Use local-dynamic TLS model. This generates less efficient runtime code for __thread variables, but avoids problems of running into
// glibc/ld.so limit (DTV_SURPLUS) for number of dlopen()'ed DSOs with static TLS (see e.g. https://www.cygwin.com/ml/libc-help/2013-11/msg00033.html)
Result += " -ftls-model=local-dynamic";
}
if (CompileEnvironment.bEnableExceptions)
{
Result += " -fexceptions";
Result += " -DPLATFORM_EXCEPTIONS_DISABLED=0";
}
else
{
Result += " -fno-exceptions"; // no exceptions
Result += " -DPLATFORM_EXCEPTIONS_DISABLED=1";
}
//Result += " -v"; // for better error diagnosis
Result += ArchitectureSpecificDefines(CompileEnvironment.Architecture);
if (CrossCompiling())
{
if (UsingClang())
{
Result += String.Format(" -target {0}", CompileEnvironment.Architecture); // Set target triple
}
Result += String.Format(" --sysroot=\"{0}\"", BaseLinuxPath);
}
return Result;
}
/// <summary>
/// Sanitizes a definition argument if needed.
/// </summary>
/// <param name="definition">A string in the format "foo=bar".</param>
/// <returns></returns>
internal static string EscapeArgument(string definition)
{
string[] splitData = definition.Split('=');
string myKey = splitData.ElementAtOrDefault(0);
string myValue = splitData.ElementAtOrDefault(1);
if (string.IsNullOrEmpty(myKey)) { return ""; }
if (!string.IsNullOrEmpty(myValue))
{
if (!myValue.StartsWith("\"") && (myValue.Contains(" ") || myValue.Contains("$")))
{
myValue = myValue.Trim('\"'); // trim any leading or trailing quotes
myValue = "\"" + myValue + "\""; // ensure wrap string with double quotes
}
// replace double quotes to escaped double quotes if exists
myValue = myValue.Replace("\"", "\\\"");
}
return myValue == null
? string.Format("{0}", myKey)
: string.Format("{0}={1}", myKey, myValue);
}
static string GetCompileArguments_CPP()
{
string Result = "";
Result += " -x c++";
Result += " -std=c++14";
return Result;
}
static string GetCompileArguments_C()
{
string Result = "";
Result += " -x c";
return Result;
}
static string GetCompileArguments_MM()
{
string Result = "";
Result += " -x objective-c++";
Result += " -fobjc-abi-version=2";
Result += " -fobjc-legacy-dispatch";
Result += " -std=c++14";
return Result;
}
// Conditionally enable (default disabled) generation of information about every class with virtual functions for use by the C++ runtime type identification features
// (`dynamic_cast' and `typeid'). If you don't use those parts of the language, you can save some space by using -fno-rtti.
// Note that exception handling uses the same information, but it will generate it as needed.
static string GetRTTIFlag(CppCompileEnvironment CompileEnvironment)
{
string Result = "";
if (CompileEnvironment.bUseRTTI)
{
Result = " -frtti";
}
else
{
Result = " -fno-rtti";
}
return Result;
}
static string GetCompileArguments_M()
{
string Result = "";
Result += " -x objective-c";
Result += " -fobjc-abi-version=2";
Result += " -fobjc-legacy-dispatch";
Result += " -std=c++14";
return Result;
}
static string GetCompileArguments_PCH()
{
string Result = "";
Result += " -x c++-header";
Result += " -std=c++14";
return Result;
}
string GetLinkArguments(LinkEnvironment LinkEnvironment)
{
string Result = "";
if (UsingLld() && !LinkEnvironment.bIsBuildingDLL)
{
Result += CrossCompiling() ? " -fuse-ld=lld.exe" : " -fuse-ld=lld";
}
// debugging symbols
// Applying to all configurations @FIXME: temporary hack for FN to enable callstack in Shipping builds (proper resolution: UEPLAT-205)
Result += " -rdynamic"; // needed for backtrace_symbols()...
if (LinkEnvironment.bIsBuildingDLL)
{
Result += " -shared";
}
else
{
// ignore unresolved symbols in shared libs
Result += string.Format(" -Wl,--unresolved-symbols=ignore-in-shared-libs");
}
// RPATH for third party libs
Result += " -Wl,-rpath=${ORIGIN}";
Result += " -Wl,-rpath-link=${ORIGIN}";
Result += " -Wl,-rpath=${ORIGIN}/../../../Engine/Binaries/Linux";
Result += " -Wl,-rpath=${ORIGIN}/.."; // for modules that are in sub-folders of the main Engine/Binary/Linux folder
// FIXME: really ugly temp solution. Modules need to be able to specify this
Result += " -Wl,-rpath=${ORIGIN}/../../../Engine/Binaries/ThirdParty/Steamworks/Steamv139/x86_64-unknown-linux-gnu";
if (LinkEnvironment.Architecture.StartsWith("x86_64"))
{
Result += " -Wl,-rpath=${ORIGIN}/../../../Engine/Binaries/ThirdParty/Qualcomm/Linux";
}
else
{
// x86_64 is now using updated ICU that doesn't need extra .so
Result += " -Wl,-rpath=${ORIGIN}/../../../Engine/Binaries/ThirdParty/ICU/icu4c-53_1/Linux/" + LinkEnvironment.Architecture;
}
Result += " -Wl,-rpath=${ORIGIN}/../../../Engine/Binaries/ThirdParty/OpenVR/OpenVRv1_0_10/linux64";
// Some OS ship ld with new ELF dynamic tags, which use DT_RUNPATH vs DT_RPATH. Since DT_RUNPATH do not propagate to dlopen()ed DSOs,
// this breaks the editor on such systems. See https://kenai.com/projects/maxine/lists/users/archive/2011-01/message/12 for details
Result += " -Wl,--disable-new-dtags";
// This severely improves dynamic linker performance, but affects iteration times. Do not do it in Debug,
// because taking a hit of several tens of seconds on startup is better than linking for ~4 more minutes when iterating
if (LinkEnvironment.Configuration != CppConfiguration.Debug)
{
Result += " -Wl,--as-needed";
}
// Additionally speeds up editor startup by 1-2s
Result += " -Wl,--hash-style=gnu";
// This apparently can help LLDB speed up symbol lookups
Result += " -Wl,--build-id";
// whether we actually can do that is checked in CanUseLTO() earlier
if (LinkEnvironment.bAllowLTCG)
{
Result += " -flto";
}
if (CrossCompiling())
{
if (UsingClang())
{
Result += String.Format(" -target {0}", LinkEnvironment.Architecture); // Set target triple
}
string SysRootPath = BaseLinuxPath.TrimEnd(new char[] { '\\', '/' });
Result += String.Format(" \"--sysroot={0}\"", SysRootPath);
}
return Result;
}
string GetArchiveArguments(LinkEnvironment LinkEnvironment)
{
return " rcs";
}
public static void CrossCompileOutputReceivedDataEventHandler(Object Sender, DataReceivedEventArgs e)
{
Debug.Assert(CrossCompiling());
string Output = e.Data;
if (String.IsNullOrEmpty(Output))
{
return;
}
// format the string so the output errors are clickable in Visual Studio
// Need to match following for clickable links
string RegexFilePath = @"^[A-Z]\:([\\\/][A-Za-z0-9_\-\.]*)+\.(cpp|c|mm|m|hpp|h)";
string RegexLineNumber = @"\:\d+\:\d+\:";
string RegexDescription = @"(\serror:\s|\swarning:\s|\snote:\s).*";
// Get Matches
string MatchFilePath = Regex.Match(Output, RegexFilePath).Value.Replace("Engine\\Source\\..\\..\\", "");
string MatchLineNumber = Regex.Match(Output, RegexLineNumber).Value;
string MatchDescription = Regex.Match(Output, RegexDescription).Value;
// If any of the above matches failed, do nothing
if (MatchFilePath.Length == 0 ||
MatchLineNumber.Length == 0 ||
MatchDescription.Length == 0)
{
Console.WriteLine(Output);
return;
}
// Convert Path
string RegexStrippedPath = @"\\Engine\\.*"; //@"(Engine\/|[A-Za-z0-9_\-\.]*\/).*";
string ConvertedFilePath = Regex.Match(MatchFilePath, RegexStrippedPath).Value;
ConvertedFilePath = Path.GetFullPath("..\\.." + ConvertedFilePath);
// Extract Line + Column Number
string ConvertedLineNumber = Regex.Match(MatchLineNumber, @"\d+").Value;
string ConvertedColumnNumber = Regex.Match(MatchLineNumber, @"(?<=:\d+:)\d+").Value;
// Write output
string ConvertedExpression = " " + ConvertedFilePath + "(" + ConvertedLineNumber + "," + ConvertedColumnNumber + "):" + MatchDescription;
Console.WriteLine(ConvertedExpression); // To create clickable vs link
}
// cache the location of NDK tools
static string BaseLinuxPath;
static string ClangPath;
static string GCCPath;
static string ArPath;
static string LlvmArPath;
static string RanlibPath;
static string StripPath;
/// <summary>
/// Version string of the current compiler, whether clang or gcc or whatever
/// </summary>
static string CompilerVersionString;
/// <summary>
/// Major version of the current compiler, whether clang or gcc or whatever
/// </summary>
static int CompilerVersionMajor = -1;
/// <summary>
/// Minor version of the current compiler, whether clang or gcc or whatever
/// </summary>
static int CompilerVersionMinor = -1;
/// <summary>
/// Patch version of the current compiler, whether clang or gcc or whatever
/// </summary>
static int CompilerVersionPatch = -1;
/// <summary>
/// Whether to use old, slower way to relink circularly dependent libraries.
/// It makes sense to use it when cross-compiling on Windows due to race conditions between actions reading and modifying the libs.
/// </summary>
private bool bUseFixdeps = false;
/// <summary>
/// Track which scripts need to be deleted before appending to
/// </summary>
private bool bHasWipedFixDepsScript = false;
/// <summary>
/// Holds all the binaries for a particular target (except maybe the executable itself).
/// </summary>
private static List<FileItem> AllBinaries = new List<FileItem>();
/// <summary>
/// Tracks that information about used C++ library is only printed once
/// </summary>
private bool bHasPrintedBuildDetails = false;
/// <summary>
/// Checks if we actually can use LTO with this set of tools
/// </summary>
private bool CanUseLTO()
{
return UsingLld() && !String.IsNullOrEmpty(LlvmArPath);
}
/// <summary>
/// Returns a helpful string for the user
/// </summary>
protected string ExplainWhyCannotUseLTO()
{
string Explanation = "Cannot use LTO on this toolchain:";
int NumProblems = 0;
if (!UsingLld())
{
Explanation += " not using lld";
++NumProblems;
}
if (String.IsNullOrEmpty(LlvmArPath))
{
if (NumProblems > 0)
{
Explanation += " and";
}
Explanation += " llvm-ar was not found";
}
return Explanation;
}
protected void PrintBuildDetails(CppCompileEnvironment CompileEnvironment)
{
Console.WriteLine("------- Build details --------");
Console.WriteLine("Using {0} ({1}) version '{2}' (string), {3} (major), {4} (minor), {5} (patch)",
String.IsNullOrEmpty(ClangPath) ? "gcc" : "clang",
String.IsNullOrEmpty(ClangPath) ? GCCPath : ClangPath,
CompilerVersionString, CompilerVersionMajor, CompilerVersionMinor, CompilerVersionPatch);
if (UsingClang())
{
// inform the user which C++ library the engine is going to be compiled against - important for compatibility with third party code that uses STL
Console.WriteLine("Using {0} standard C++ library.", ShouldUseLibcxx(CompileEnvironment.Architecture) ? "bundled libc++" : "compiler default (most likely libstdc++)");
Console.WriteLine("Using {0}", UsingLld() ? "lld linker" : "default linker (ld)");
Console.WriteLine("Using {0}", !String.IsNullOrEmpty(LlvmArPath) ? String.Format("llvm-ar : {0}", LlvmArPath) : String.Format("ar and ranlib: {0}, {1}", GetArPath(CompileEnvironment.Architecture), GetRanlibPath(CompileEnvironment.Architecture)));
}
// Also print other once-per-build information
if (bUseFixdeps)
{
Console.WriteLine("Using old way to relink circularly dependent libraries (with a FixDeps step).");
}
else
{
Console.WriteLine("Using fast way to relink circularly dependent libraries (no FixDeps).");
}
if (CompileEnvironment.bAllowLTCG)
{
Console.WriteLine("Using LTO (link-time optimization).");
}
Console.WriteLine("------------------------------");
}
public override CPPOutput CompileCPPFiles(CppCompileEnvironment CompileEnvironment, List<FileItem> SourceFiles, string ModuleName, ActionGraph ActionGraph)
{
string Arguments = GetCLArguments_Global(CompileEnvironment);
string PCHArguments = "";
if (!bHasPrintedBuildDetails)
{
PrintBuildDetails(CompileEnvironment);
bHasPrintedBuildDetails = true;
}
if (CompileEnvironment.bAllowLTCG && !CanUseLTO())
{
throw new BuildException(ExplainWhyCannotUseLTO());
}
if (CompileEnvironment.PrecompiledHeaderAction == PrecompiledHeaderAction.Include)
{
// Add the precompiled header file's path to the include path so Clang can find it.
// This needs to be before the other include paths to ensure Clang uses it instead of the source header file.
var PrecompiledFileExtension = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.Linux).GetBinaryExtension(UEBuildBinaryType.PrecompiledHeader);
PCHArguments += string.Format(" -include \"{0}\"", CompileEnvironment.PrecompiledHeaderFile.AbsolutePath.Replace(PrecompiledFileExtension, ""));
}
foreach(FileReference ForceIncludeFile in CompileEnvironment.ForceIncludeFiles)
{
PCHArguments += String.Format(" -include \"{0}\"", ForceIncludeFile.FullName);
}
// Add include paths to the argument list.
foreach (string IncludePath in CompileEnvironment.IncludePaths.UserIncludePaths)
{
Arguments += string.Format(" -I\"{0}\"", IncludePath);
}
foreach (string IncludePath in CompileEnvironment.IncludePaths.SystemIncludePaths)
{
Arguments += string.Format(" -I\"{0}\"", IncludePath);
}
// Add preprocessor definitions to the argument list.
foreach (string Definition in CompileEnvironment.Definitions)
{
Arguments += string.Format(" -D \"{0}\"", EscapeArgument(Definition));
}
// Create a compile action for each source file.
CPPOutput Result = new CPPOutput();
foreach (FileItem SourceFile in SourceFiles)
{
Action CompileAction = ActionGraph.Add(ActionType.Compile);
string FileArguments = "";
string Extension = Path.GetExtension(SourceFile.AbsolutePath).ToUpperInvariant();
// Add C or C++ specific compiler arguments.
if (CompileEnvironment.PrecompiledHeaderAction == PrecompiledHeaderAction.Create)
{
FileArguments += GetCompileArguments_PCH();
}
else if (Extension == ".C")
{
// Compile the file as C code.
FileArguments += GetCompileArguments_C();
}
else if (Extension == ".CC")
{
// Compile the file as C++ code.
FileArguments += GetCompileArguments_CPP();
}
else if (Extension == ".MM")
{
// Compile the file as Objective-C++ code.
FileArguments += GetCompileArguments_MM();
FileArguments += GetRTTIFlag(CompileEnvironment);
}
else if (Extension == ".M")
{
// Compile the file as Objective-C code.
FileArguments += GetCompileArguments_M();
}
else
{
FileArguments += GetCompileArguments_CPP();
// only use PCH for .cpp files
FileArguments += PCHArguments;
}
// Add the C++ source file and its included files to the prerequisite item list.
AddPrerequisiteSourceFile(CompileEnvironment, SourceFile, CompileAction.PrerequisiteItems);
if (CompileEnvironment.PrecompiledHeaderAction == PrecompiledHeaderAction.Create)
{
var PrecompiledFileExtension = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.Linux).GetBinaryExtension(UEBuildBinaryType.PrecompiledHeader);
// Add the precompiled header file to the produced item list.
FileItem PrecompiledHeaderFile = FileItem.GetItemByFileReference(
FileReference.Combine(
CompileEnvironment.OutputDirectory,
Path.GetFileName(SourceFile.AbsolutePath) + PrecompiledFileExtension
)
);
CompileAction.ProducedItems.Add(PrecompiledHeaderFile);
Result.PrecompiledHeaderFile = PrecompiledHeaderFile;
// Add the parameters needed to compile the precompiled header file to the command-line.
FileArguments += string.Format(" -o \"{0}\"", PrecompiledHeaderFile.AbsolutePath);
}
else
{
if (CompileEnvironment.PrecompiledHeaderAction == PrecompiledHeaderAction.Include)
{
CompileAction.bIsUsingPCH = true;
CompileAction.PrerequisiteItems.Add(CompileEnvironment.PrecompiledHeaderFile);
}
var ObjectFileExtension = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.Linux).GetBinaryExtension(UEBuildBinaryType.Object);
// Add the object file to the produced item list.
FileItem ObjectFile = FileItem.GetItemByFileReference(
FileReference.Combine(
CompileEnvironment.OutputDirectory,
Path.GetFileName(SourceFile.AbsolutePath) + ObjectFileExtension
)
);
CompileAction.ProducedItems.Add(ObjectFile);
Result.ObjectFiles.Add(ObjectFile);
FileArguments += string.Format(" -o \"{0}\"", ObjectFile.AbsolutePath);
}
// Add the source file path to the command-line.
FileArguments += string.Format(" \"{0}\"", SourceFile.AbsolutePath);
CompileAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
if (!UsingClang())
{
CompileAction.CommandPath = GCCPath;
}
else
{
CompileAction.CommandPath = ClangPath;
}
CompileAction.CommandArguments = Arguments + FileArguments + CompileEnvironment.AdditionalArguments;
CompileAction.CommandDescription = "Compile";
CompileAction.StatusDescription = Path.GetFileName(SourceFile.AbsolutePath);
CompileAction.bIsGCCCompiler = true;
// Don't farm out creation of pre-compiled headers as it is the critical path task.
CompileAction.bCanExecuteRemotely =
CompileEnvironment.PrecompiledHeaderAction != PrecompiledHeaderAction.Create ||
CompileEnvironment.bAllowRemotelyCompiledPCHs;
// piping output through the handler during native builds is unnecessary and reportedly causes problems with tools like octobuild.
if (CrossCompiling())
{
CompileAction.OutputEventHandler = new DataReceivedEventHandler(CrossCompileOutputReceivedDataEventHandler);
}
}
return Result;
}
bool UsingLld()
{
return bUseLld;
}
/// <summary>
/// Creates an action to archive all the .o files into single .a file
/// </summary>
public FileItem CreateArchiveAndIndex(LinkEnvironment LinkEnvironment, ActionGraph ActionGraph)
{
// Create an archive action
Action ArchiveAction = ActionGraph.Add(ActionType.Link);
ArchiveAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
bool bUsingSh = BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Win64 && BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Win32;
if (bUsingSh)
{
ArchiveAction.CommandPath = "/bin/sh";
ArchiveAction.CommandArguments = "-c '";
}
else
{
ArchiveAction.CommandPath = "cmd.exe";
ArchiveAction.CommandArguments = "/c \"";
}
// this will produce a final library
ArchiveAction.bProducesImportLibrary = true;
// Add the output file as a production of the link action.
FileItem OutputFile = FileItem.GetItemByFileReference(LinkEnvironment.OutputFilePath);
ArchiveAction.ProducedItems.Add(OutputFile);
ArchiveAction.CommandDescription = "Archive";
ArchiveAction.StatusDescription = Path.GetFileName(OutputFile.AbsolutePath);
ArchiveAction.CommandArguments += string.Format("\"{0}\" {1} \"{2}\"", GetArPath(LinkEnvironment.Architecture), GetArchiveArguments(LinkEnvironment), OutputFile.AbsolutePath);
// Add the input files to a response file, and pass the response file on the command-line.
List<string> InputFileNames = new List<string>();
foreach (FileItem InputFile in LinkEnvironment.InputFiles)
{
string InputAbsolutePath = InputFile.AbsolutePath.Replace("\\", "/");
InputFileNames.Add(string.Format("\"{0}\"", InputAbsolutePath));
ArchiveAction.PrerequisiteItems.Add(InputFile);
}
// this won't stomp linker's response (which is not used when compiling static libraries)
FileReference ResponsePath = GetResponseFileName(LinkEnvironment, OutputFile);
if (!ProjectFileGenerator.bGenerateProjectFiles)
{
ResponseFile.Create(ResponsePath, InputFileNames);
}
ArchiveAction.CommandArguments += string.Format(" @\"{0}\"", ConvertPath(ResponsePath.FullName));
// add ranlib if not using llvm-ar
if (String.IsNullOrEmpty(LlvmArPath))
{
ArchiveAction.CommandArguments += string.Format(" && \"{0}\" \"{1}\"", GetRanlibPath(LinkEnvironment.Architecture), OutputFile.AbsolutePath);
}
// Add the additional arguments specified by the environment.
ArchiveAction.CommandArguments += LinkEnvironment.AdditionalArguments;
ArchiveAction.CommandArguments = ArchiveAction.CommandArguments.Replace("\\", "/");
if (bUsingSh)
{
ArchiveAction.CommandArguments += "'";
}
else
{
ArchiveAction.CommandArguments += "\"";
}
// Only execute linking on the local PC.
ArchiveAction.bCanExecuteRemotely = false;
// piping output through the handler during native builds is unnecessary and reportedly causes problems with tools like octobuild.
if (CrossCompiling())
{
ArchiveAction.OutputEventHandler = new DataReceivedEventHandler(CrossCompileOutputReceivedDataEventHandler);
}
return OutputFile;
}
public FileItem FixDependencies(LinkEnvironment LinkEnvironment, FileItem Executable, ActionGraph ActionGraph)
{
if (bUseFixdeps)
{
if (!LinkEnvironment.bIsCrossReferenced)
{
return null;
}
Log.TraceVerbose("Adding postlink step");
bool bUseCmdExe = BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 || BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32;
string ShellBinary = bUseCmdExe ? "cmd.exe" : "/bin/sh";
string ExecuteSwitch = bUseCmdExe ? " /C" : ""; // avoid -c so scripts don't need +x
string ScriptName = bUseCmdExe ? "FixDependencies.bat" : "FixDependencies.sh";
FileItem FixDepsScript = FileItem.GetItemByFileReference(FileReference.Combine(LinkEnvironment.LocalShadowDirectory, ScriptName));
Action PostLinkAction = ActionGraph.Add(ActionType.Link);
PostLinkAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
PostLinkAction.CommandPath = ShellBinary;
PostLinkAction.StatusDescription = string.Format("{0}", Path.GetFileName(Executable.AbsolutePath));
PostLinkAction.CommandDescription = "FixDeps";
PostLinkAction.bCanExecuteRemotely = false;
PostLinkAction.CommandArguments = ExecuteSwitch;
PostLinkAction.CommandArguments += bUseCmdExe ? " \"" : " -c '";
FileItem OutputFile = FileItem.GetItemByFileReference(FileReference.Combine(LinkEnvironment.LocalShadowDirectory, Path.GetFileNameWithoutExtension(Executable.AbsolutePath) + ".link"));
// Make sure we don't run this script until the all executables and shared libraries
// have been built.
PostLinkAction.PrerequisiteItems.Add(Executable);
foreach (FileItem Dependency in AllBinaries)
{
PostLinkAction.PrerequisiteItems.Add(Dependency);
}
PostLinkAction.CommandArguments += ShellBinary + ExecuteSwitch + " \"" + FixDepsScript.AbsolutePath + "\" && ";
// output file should not be empty or it will be rebuilt next time
string Touch = bUseCmdExe ? "echo \"Dummy\" >> \"{0}\" && copy /b \"{0}\" +,," : "echo \"Dummy\" >> \"{0}\"";
PostLinkAction.CommandArguments += String.Format(Touch, OutputFile.AbsolutePath);
PostLinkAction.CommandArguments += bUseCmdExe ? "\"" : "'";
System.Console.WriteLine("{0} {1}", PostLinkAction.CommandPath, PostLinkAction.CommandArguments);
// piping output through the handler during native builds is unnecessary and reportedly causes problems with tools like octobuild.
if (CrossCompiling())
{
PostLinkAction.OutputEventHandler = new DataReceivedEventHandler(CrossCompileOutputReceivedDataEventHandler);
}
PostLinkAction.ProducedItems.Add(OutputFile);
return OutputFile;
}
else
{
return null;
}
}
public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly, ActionGraph ActionGraph)
{
Debug.Assert(!bBuildImportLibraryOnly);
if (LinkEnvironment.bAllowLTCG && !CanUseLTO())
{
throw new BuildException(ExplainWhyCannotUseLTO());
}
List<string> RPaths = new List<string>();
if (LinkEnvironment.bIsBuildingLibrary || bBuildImportLibraryOnly)
{
return CreateArchiveAndIndex(LinkEnvironment, ActionGraph);
}
// Create an action that invokes the linker.
Action LinkAction = ActionGraph.Add(ActionType.Link);
LinkAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
if (String.IsNullOrEmpty(ClangPath))
{
LinkAction.CommandPath = GCCPath;
}
else
{
LinkAction.CommandPath = ClangPath;
}
// Get link arguments.
LinkAction.CommandArguments = GetLinkArguments(LinkEnvironment);
// Tell the action that we're building an import library here and it should conditionally be
// ignored as a prerequisite for other actions
LinkAction.bProducesImportLibrary = LinkEnvironment.bIsBuildingDLL;
// Add the output file as a production of the link action.
FileItem OutputFile = FileItem.GetItemByFileReference(LinkEnvironment.OutputFilePath);
LinkAction.ProducedItems.Add(OutputFile);
LinkAction.CommandDescription = LinkEnvironment.bAllowLTCG ? "Link-LTO" : "Link"; // LTO can take a lot of time, make it clear for the user
// because the logic choosing between lld and ld is somewhat messy atm (lld fails to link .DSO due to bugs), make the name of the linker clear
LinkAction.CommandDescription += (LinkAction.CommandArguments.Contains("-fuse-ld=lld")) ? " (lld)" : " (ld)";
LinkAction.StatusDescription = Path.GetFileName(OutputFile.AbsolutePath);
// Add the output file to the command-line.
LinkAction.CommandArguments += string.Format(" -o \"{0}\"", OutputFile.AbsolutePath);
// Add the input files to a response file, and pass the response file on the command-line.
List<string> ResponseLines = new List<string>();
foreach (FileItem InputFile in LinkEnvironment.InputFiles)
{
ResponseLines.Add(string.Format("\"{0}\"", InputFile.AbsolutePath.Replace("\\", "/")));
LinkAction.PrerequisiteItems.Add(InputFile);
}
if (LinkEnvironment.bIsBuildingDLL)
{
ResponseLines.Add(string.Format(" -soname={0}", OutputFile));
}
// Start with the configured LibraryPaths and also add paths to any libraries that
// we depend on (libraries that we've build ourselves).
List<string> AllLibraryPaths = LinkEnvironment.LibraryPaths;
foreach (string AdditionalLibrary in LinkEnvironment.AdditionalLibraries)
{
string PathToLib = Path.GetDirectoryName(AdditionalLibrary);
if (!String.IsNullOrEmpty(PathToLib))
{
// make path absolute, because FixDependencies script may be executed in a different directory
string AbsolutePathToLib = Path.GetFullPath(PathToLib);
if (!AllLibraryPaths.Contains(AbsolutePathToLib))
{
AllLibraryPaths.Add(AbsolutePathToLib);
}
}
if ((AdditionalLibrary.Contains("Plugins") || AdditionalLibrary.Contains("Binaries/ThirdParty") || AdditionalLibrary.Contains("Binaries\\ThirdParty")) && Path.GetDirectoryName(AdditionalLibrary) != Path.GetDirectoryName(OutputFile.AbsolutePath))
{
string RelativePath = new FileReference(AdditionalLibrary).Directory.MakeRelativeTo(OutputFile.Reference.Directory);
if (!RPaths.Contains(RelativePath))
{
RPaths.Add(RelativePath);
ResponseLines.Add(string.Format(" -rpath=\"${{ORIGIN}}/{0}\"", RelativePath.Replace('\\', '/')));
}
}
}
ResponseLines.Add(string.Format(" -rpath-link=\"{0}\"", Path.GetDirectoryName(OutputFile.AbsolutePath)));
// Add the library paths to the argument list.
foreach (string LibraryPath in AllLibraryPaths)
{
// use absolute paths because of FixDependencies script again
ResponseLines.Add(string.Format(" -L\"{0}\"", Path.GetFullPath(LibraryPath).Replace('\\', '/')));
}
List<string> EngineAndGameLibrariesLinkFlags = new List<string>();
List<FileItem> EngineAndGameLibrariesFiles = new List<FileItem>();
// Pre-2.25 ld has symbol resolution problems when .so are mixed with .a in a single --start-group/--end-group
// when linking with --as-needed.
// Move external libraries to a separate --start-group/--end-group to fix it (and also make groups smaller and faster to link).
// See https://github.com/EpicGames/UnrealEngine/pull/2778 and https://github.com/EpicGames/UnrealEngine/pull/2793 for discussion
string ExternalLibraries = "";
// add libraries in a library group
ResponseLines.Add(string.Format(" --start-group"));
foreach (string AdditionalLibrary in LinkEnvironment.AdditionalLibraries)
{
if (String.IsNullOrEmpty(Path.GetDirectoryName(AdditionalLibrary)))
{
// library was passed just like "jemalloc", turn it into -ljemalloc
ExternalLibraries += string.Format(" -l{0}", AdditionalLibrary);
}
else if (Path.GetExtension(AdditionalLibrary) == ".a")
{
// static library passed in, pass it along but make path absolute, because FixDependencies script may be executed in a different directory
string AbsoluteAdditionalLibrary = Path.GetFullPath(AdditionalLibrary);
if (AbsoluteAdditionalLibrary.Contains(" "))
{
AbsoluteAdditionalLibrary = string.Format("\"{0}\"", AbsoluteAdditionalLibrary);
}
AbsoluteAdditionalLibrary = AbsoluteAdditionalLibrary.Replace('\\', '/');
// libcrypto/libssl contain number of functions that are being used in different DSOs. FIXME: generalize?
if (LinkEnvironment.bIsBuildingDLL && (AbsoluteAdditionalLibrary.Contains("libcrypto") || AbsoluteAdditionalLibrary.Contains("libssl")))
{
ResponseLines.Add(" --whole-archive " + AbsoluteAdditionalLibrary + " --no-whole-archive");
}
else
{
ResponseLines.Add(" " + AbsoluteAdditionalLibrary);
}
LinkAction.PrerequisiteItems.Add(FileItem.GetItemByPath(AdditionalLibrary));
}
else
{
// Skip over full-pathed library dependencies when building DLLs to avoid circular
// dependencies.
FileItem LibraryDependency = FileItem.GetItemByPath(AdditionalLibrary);
var LibName = Path.GetFileNameWithoutExtension(AdditionalLibrary);
if (LibName.StartsWith("lib"))
{
// Remove lib prefix
LibName = LibName.Remove(0, 3);
}
string LibLinkFlag = string.Format(" -l{0}", LibName);
if (LinkEnvironment.bIsBuildingDLL && LinkEnvironment.bIsCrossReferenced)
{
// We are building a cross referenced DLL so we can't actually include
// dependencies at this point. Instead we add it to the list of
// libraries to be used in the FixDependencies step.
EngineAndGameLibrariesLinkFlags.Add(LibLinkFlag);
EngineAndGameLibrariesFiles.Add(LibraryDependency);
// it is important to add this exactly to the same place where the missing libraries would have been, it will be replaced later
if (!ExternalLibraries.Contains("--allow-shlib-undefined"))
{
ExternalLibraries += string.Format(" -Wl,--allow-shlib-undefined");
}
}
else
{
LinkAction.PrerequisiteItems.Add(LibraryDependency);
ExternalLibraries += LibLinkFlag;
}
}
}
ResponseLines.Add(" --end-group");
FileReference ResponseFileName = GetResponseFileName(LinkEnvironment, OutputFile);
LinkAction.CommandArguments += string.Format(" -Wl,@\"{0}\"", ResponseFile.Create(ResponseFileName, ResponseLines));
LinkAction.CommandArguments += " -Wl,--start-group";
LinkAction.CommandArguments += ExternalLibraries;
LinkAction.CommandArguments += " -Wl,--end-group";
LinkAction.CommandArguments += " -lrt"; // needed for clock_gettime()
LinkAction.CommandArguments += " -lm"; // math
if (ShouldUseLibcxx(LinkEnvironment.Architecture))
{
// libc++ and its abi lib
LinkAction.CommandArguments += " -nodefaultlibs";
LinkAction.CommandArguments += " -L" + "ThirdParty/Linux/LibCxx/lib/Linux/" + LinkEnvironment.Architecture + "/";
LinkAction.CommandArguments += " " + "ThirdParty/Linux/LibCxx/lib/Linux/" + LinkEnvironment.Architecture + "/libc++.a";
LinkAction.CommandArguments += " " + "ThirdParty/Linux/LibCxx/lib/Linux/" + LinkEnvironment.Architecture + "/libc++abi.a";
LinkAction.CommandArguments += " -lm";
LinkAction.CommandArguments += " -lc";
LinkAction.CommandArguments += " -lgcc_s";
LinkAction.CommandArguments += " -lgcc";
}
// these can be helpful for understanding the order of libraries or library search directories
//LinkAction.CommandArguments += " -Wl,--verbose";
//LinkAction.CommandArguments += " -Wl,--trace";
//LinkAction.CommandArguments += " -v";
// Add the additional arguments specified by the environment.
LinkAction.CommandArguments += LinkEnvironment.AdditionalArguments;
LinkAction.CommandArguments = LinkAction.CommandArguments.Replace("\\\\", "/");
LinkAction.CommandArguments = LinkAction.CommandArguments.Replace("\\", "/");
/* The linker script that hid global constructor signatures was needed to work around problems like third party libraries
alloctating classes through a custom new overload but deleting through global delete. This in particular was needed for Steam.
Right now we are not aware of third party libs behaving that way, and hiding global new/delete introduces other problems, particularly
when linking to libs that use STL. Hence the script is unnecessary and should not be used, unless you understand what it is doing
and you are sure you are running into a similar problem like above. The proper solution though is to always ask the library author
to use matching new/delete signatures.
*//*
// prepare a linker script
FileReference LinkerScriptPath = FileReference.Combine(LinkEnvironment.LocalShadowDirectory, "remove-sym.ldscript");
if (!DirectoryReference.Exists(LinkEnvironment.LocalShadowDirectory))
{
DirectoryReference.CreateDirectory(LinkEnvironment.LocalShadowDirectory);
}
if (FileReference.Exists(LinkerScriptPath))
{
FileReference.Delete(LinkerScriptPath);
}
using (StreamWriter Writer = File.CreateText(LinkerScriptPath.FullName))
{
Writer.WriteLine("UE4 {");
Writer.WriteLine(" global: *;");
Writer.WriteLine(" local: _Znwm;");
Writer.WriteLine(" _ZnwmRKSt9nothrow_t;");
Writer.WriteLine(" _Znam;");
Writer.WriteLine(" _ZnamRKSt9nothrow_t;");
Writer.WriteLine(" _ZdaPv;");
Writer.WriteLine(" _ZdaPvRKSt9nothrow_t;");
Writer.WriteLine(" _ZdlPv;");
Writer.WriteLine(" _ZdlPvRKSt9nothrow_t;");
// Hide ALL std:: symbols as they can collide
// with any c++ library out there (like LLVM)
// and this may lead to operator new/delete mismatches
Writer.WriteLine(" _ZNSt8*;");
Writer.WriteLine("};");
};
LinkAction.CommandArguments += string.Format(" -Wl,--version-script=\"{0}\"", LinkerScriptPath);
*/
// Only execute linking on the local PC.
LinkAction.bCanExecuteRemotely = false;
// Prepare a script that will run later, once all shared libraries and the executable
// are created. This script will be called by action created in FixDependencies()
if (LinkEnvironment.bIsCrossReferenced && LinkEnvironment.bIsBuildingDLL)
{
if (bUseFixdeps)
{
bool bUseCmdExe = BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 || BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32;
string ScriptName = bUseCmdExe ? "FixDependencies.bat" : "FixDependencies.sh";
string FixDepsScriptPath = Path.Combine(LinkEnvironment.LocalShadowDirectory.FullName, ScriptName);
if (!bHasWipedFixDepsScript)
{
bHasWipedFixDepsScript = true;
Log.TraceVerbose("Creating script: {0}", FixDepsScriptPath);
StreamWriter Writer = File.CreateText(FixDepsScriptPath);
if (bUseCmdExe)
{
Writer.Write("@echo off\n");
Writer.Write("rem Automatically generated by UnrealBuildTool\n");
Writer.Write("rem *DO NOT EDIT*\n\n");
}
else
{
Writer.Write("#!/bin/sh\n");
Writer.Write("# Automatically generated by UnrealBuildTool\n");
Writer.Write("# *DO NOT EDIT*\n\n");
Writer.Write("set -o errexit\n");
}
Writer.Close();
}
StreamWriter FixDepsScript = File.AppendText(FixDepsScriptPath);
string EngineAndGameLibrariesString = "";
foreach (string Library in EngineAndGameLibrariesLinkFlags)
{
EngineAndGameLibrariesString += Library;
}
FixDepsScript.Write(string.Format("echo Fixing {0}\n", Path.GetFileName(OutputFile.AbsolutePath)));
if (!bUseCmdExe)
{
FixDepsScript.Write(string.Format("TIMESTAMP=`stat --format %y \"{0}\"`\n", OutputFile.AbsolutePath));
}
string FixDepsLine = LinkAction.CommandPath + " " + LinkAction.CommandArguments;
string Replace = "-Wl,--allow-shlib-undefined";
FixDepsLine = FixDepsLine.Replace(Replace, EngineAndGameLibrariesString);
string OutputFileForwardSlashes = OutputFile.AbsolutePath.Replace("\\", "/");
FixDepsLine = FixDepsLine.Replace(OutputFileForwardSlashes, OutputFileForwardSlashes + ".fixed");
FixDepsLine = FixDepsLine.Replace("$", "\\$");
FixDepsScript.Write(FixDepsLine + "\n");
if (bUseCmdExe)
{
FixDepsScript.Write(string.Format("move /Y \"{0}.fixed\" \"{0}\"\n", OutputFile.AbsolutePath));
}
else
{
FixDepsScript.Write(string.Format("mv \"{0}.fixed\" \"{0}\"\n", OutputFile.AbsolutePath));
FixDepsScript.Write(string.Format("touch -d \"$TIMESTAMP\" \"{0}\"\n\n", OutputFile.AbsolutePath));
}
FixDepsScript.Close();
}
else
{
// Create the action to relink the library. This actions does not overwrite the source file so it can be executed in parallel
Action RelinkAction = ActionGraph.Add(ActionType.Link);
RelinkAction.WorkingDirectory = LinkAction.WorkingDirectory;
RelinkAction.StatusDescription = LinkAction.StatusDescription;
RelinkAction.CommandDescription = "Relink";
RelinkAction.bCanExecuteRemotely = false;
RelinkAction.ProducedItems.Clear();
RelinkAction.PrerequisiteItems = new List<FileItem>(LinkAction.PrerequisiteItems);
foreach (FileItem Dependency in EngineAndGameLibrariesFiles)
{
RelinkAction.PrerequisiteItems.Add(Dependency);
}
RelinkAction.PrerequisiteItems.Add(OutputFile); // also depend on the first link action's output
string LinkOutputFileForwardSlashes = OutputFile.AbsolutePath.Replace("\\", "/");
string RelinkedFileForwardSlashes = Path.Combine(LinkEnvironment.LocalShadowDirectory.FullName, OutputFile.Reference.GetFileName()) + ".relinked";
// cannot use the real product because we need to maintain the timestamp on it
FileReference RelinkActionDummyProductRef = FileReference.Combine(LinkEnvironment.LocalShadowDirectory, LinkEnvironment.OutputFilePath.GetFileNameWithoutExtension() + ".relinked_action_ran");
RelinkAction.ProducedItems.Add(FileItem.GetItemByFileReference(RelinkActionDummyProductRef));
string EngineAndGameLibrariesString = "";
foreach (string Library in EngineAndGameLibrariesLinkFlags)
{
EngineAndGameLibrariesString += Library;
}
// create the action
bool bUseCmdExe = BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 || BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32;
string ShellBinary = bUseCmdExe ? "cmd.exe" : "/bin/sh";
string ExecuteSwitch = bUseCmdExe ? " /C" : ""; // avoid -c so scripts don't need +x
// create the relinking step
string RelinkScriptName = string.Format((bUseCmdExe ? "Relink-{0}.bat" : "Relink-{0}.sh"), OutputFile);
string RelinkScriptFullPath = Path.Combine(LinkEnvironment.LocalShadowDirectory.FullName, RelinkScriptName);
Log.TraceVerbose("Creating script: {0}", RelinkScriptFullPath);
StreamWriter RelinkWriter = File.CreateText(RelinkScriptFullPath);
string RelinkInvocation = LinkAction.CommandPath + " " + LinkAction.CommandArguments;
string Replace = "-Wl,--allow-shlib-undefined";
RelinkInvocation = RelinkInvocation.Replace(Replace, EngineAndGameLibrariesString);
// should be the same as RelinkedFileRef
RelinkInvocation = RelinkInvocation.Replace(LinkOutputFileForwardSlashes, RelinkedFileForwardSlashes);
RelinkInvocation = RelinkInvocation.Replace("$", "\\$");
if (bUseCmdExe)
{
RelinkWriter.Write("@echo off\n");
RelinkWriter.Write("rem Automatically generated by UnrealBuildTool\n");
RelinkWriter.Write("rem *DO NOT EDIT*\n\n");
RelinkWriter.Write("set Retries=0\n");
RelinkWriter.Write(":relinkloop\n");
RelinkWriter.Write("if %Retries% GEQ 10 goto failedtorelink\n");
RelinkWriter.Write(RelinkInvocation + "\n");
RelinkWriter.Write("if %errorlevel% neq 0 goto sleepandretry\n");
RelinkWriter.Write("copy /B \"{0}\" \"{1}.temp\" >NUL 2>NUL\n", RelinkedFileForwardSlashes, OutputFile.AbsolutePath);
RelinkWriter.Write("if %errorlevel% neq 0 goto sleepandretry\n");
RelinkWriter.Write("move /Y \"{0}.temp\" \"{1}\" >NUL 2>NUL\n", OutputFile.AbsolutePath, OutputFile.AbsolutePath);
RelinkWriter.Write("if %errorlevel% neq 0 goto sleepandretry\n");
RelinkWriter.Write(string.Format("echo \"Dummy\" >> \"{0}\" && copy /b \"{0}\" +,,\n", RelinkActionDummyProductRef.FullName));
RelinkWriter.Write("echo Relinked {0} successfully after %Retries% retries\n", OutputFile.AbsolutePath);
RelinkWriter.Write("exit 0\n");
RelinkWriter.Write(":sleepandretry\n");
RelinkWriter.Write("ping 127.0.0.1 -n 1 -w 5000 >NUL 2>NUL\n"); // timeout complains about lack of redirection
RelinkWriter.Write("set /a Retries+=1\n");
RelinkWriter.Write("goto relinkloop\n");
RelinkWriter.Write(":failedtorelink\n");
RelinkWriter.Write("echo Failed to relink {0} after %Retries% retries\n", OutputFile.AbsolutePath);
RelinkWriter.Write("exit 1\n");
}
else
{
RelinkWriter.Write("#!/bin/sh\n");
RelinkWriter.Write("# Automatically generated by UnrealBuildTool\n");
RelinkWriter.Write("# *DO NOT EDIT*\n\n");
RelinkWriter.Write("set -o errexit\n");
RelinkWriter.Write(RelinkInvocation + "\n");
RelinkWriter.Write(string.Format("TIMESTAMP=`stat --format %y \"{0}\"`\n", OutputFile.AbsolutePath));
RelinkWriter.Write("cp \"{0}\" \"{1}.temp\"\n", RelinkedFileForwardSlashes, OutputFile.AbsolutePath);
RelinkWriter.Write("mv \"{0}.temp\" \"{1}\"\n", OutputFile.AbsolutePath, OutputFile.AbsolutePath);
RelinkWriter.Write(string.Format("touch -d \"$TIMESTAMP\" \"{0}\"\n\n", OutputFile.AbsolutePath));
RelinkWriter.Write(string.Format("echo \"Dummy\" >> \"{0}\"", RelinkActionDummyProductRef.FullName));
}
RelinkWriter.Close();
RelinkAction.CommandPath = ShellBinary;
RelinkAction.CommandArguments = ExecuteSwitch + " \"" + RelinkScriptFullPath + "\"";
// piping output through the handler during native builds is unnecessary and reportedly causes problems with tools like octobuild.
if (CrossCompiling())
{
RelinkAction.OutputEventHandler = new DataReceivedEventHandler(CrossCompileOutputReceivedDataEventHandler);
}
}
}
if (CrossCompiling())
{
LinkAction.OutputEventHandler = new DataReceivedEventHandler(CrossCompileOutputReceivedDataEventHandler);
}
return OutputFile;
}
public override void SetupBundleDependencies(List<UEBuildBinary> Binaries, string GameName)
{
if (bUseFixdeps)
{
foreach (UEBuildBinary Binary in Binaries)
{
AllBinaries.Add(FileItem.GetItemByFileReference(Binary.Config.OutputFilePath));
}
}
}
/// <summary>
/// Converts the passed in path from UBT host to compiler native format.
/// </summary>
public static string ConvertPath(string OriginalPath)
{
if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Linux)
{
return OriginalPath.Replace("\\", "/");
}
else
{
return OriginalPath;
}
}
public override ICollection<FileItem> PostBuild(FileItem Executable, LinkEnvironment BinaryLinkEnvironment, ActionGraph ActionGraph)
{
var OutputFiles = base.PostBuild(Executable, BinaryLinkEnvironment, ActionGraph);
if (bUseFixdeps)
{
if (BinaryLinkEnvironment.bIsBuildingDLL || BinaryLinkEnvironment.bIsBuildingLibrary)
{
return OutputFiles;
}
FileItem FixDepsOutputFile = FixDependencies(BinaryLinkEnvironment, Executable, ActionGraph);
if (FixDepsOutputFile != null)
{
OutputFiles.Add(FixDepsOutputFile);
}
}
else
{
// make build product of cross-referenced DSOs to be *.relinked_action_ran, so the relinking steps are executed
if (BinaryLinkEnvironment.bIsBuildingDLL && BinaryLinkEnvironment.bIsCrossReferenced)
{
FileReference RelinkedMapRef = FileReference.Combine(BinaryLinkEnvironment.LocalShadowDirectory, BinaryLinkEnvironment.OutputFilePath.GetFileNameWithoutExtension() + ".relinked_action_ran");
OutputFiles.Add(FileItem.GetItemByFileReference(RelinkedMapRef));
}
}
return OutputFiles;
}
public void StripSymbols(FileReference SourceFile, FileReference TargetFile)
{
if (SourceFile != TargetFile)
{
// Strip command only works in place so we need to copy original if target is different
File.Copy(SourceFile.FullName, TargetFile.FullName, true);
}
ProcessStartInfo StartInfo = new ProcessStartInfo();
StartInfo.FileName = GetStripPath(Architecture);
StartInfo.Arguments = "--strip-debug \"" + TargetFile.FullName + "\"";
StartInfo.UseShellExecute = false;
StartInfo.CreateNoWindow = true;
Utils.RunLocalProcessAndLogOutput(StartInfo);
}
}
}