You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 2948319 on 2016/04/19 by Nick.Shin update zlib to v1.2.8 part 1 of 4 - doing this in stages for tracking purposes #jira UEPLAT-1246 - Update libWebsockets #jira UEPLAT-1221 - update websocket library Change 2948322 on 2016/04/19 by Nick.Shin update libwebsockets to v1.7.4 part 4 of 4 - doing this in stages for tracking purposes #jira UEPLAT-1246 - Update libWebsockets #jira UEPLAT-1221 - update websocket library #jira UEPLAT-1204 - Rebuild libwebsockets with SSL Change 2948661 on 2016/04/19 by Nick.Shin keep using old zlibs until they are recompiled with the newer version Change 2948737 on 2016/04/19 by Nick.Shin build warning fix Change 2949334 on 2016/04/20 by Nick.Shin fix library path for some reason, NetworkFileSystem and HttpNetworkReplayStreaming on Mac platform needs full path - even though lib path was set... Change 2951556 on 2016/04/21 by Nick.Shin static libs double checked #jira UE-29674 - Editor fails to open in Dev-Platform Change 2951559 on 2016/04/21 by Nick.Shin static libs double checked forgot these files - they were in another changelist #jira UE-29674 - Editor fails to open in Dev-Platform Change 2952411 on 2016/04/22 by Nick.Shin add win32 build targets for zlib openssl libcurl libwebsockets part 1 of 2: these are the C# build scripts Change 2970016 on 2016/05/07 by Nick.Shin undo all of the following upgrades: - zlib - openssl - libcurl - libwebsockets and reset webrtc #jira UE-30298 - Fortnite and Orion crash on login Change 3118163 on 2016/09/08 by Josh.Adams perm test 2, not a useful file at all Change 3121142 on 2016/09/12 by Daniel.Lamb Attempt to fix deterministic cooking issue for particlelodlevel. Ensure the spawn module has had postload called on it before using. #test Paragon cook Change 3121150 on 2016/09/12 by Daniel.Lamb Added warning logs to help track down issue UE-33453. Change 3121201 on 2016/09/12 by Keith.Judge Xbox One - Replicate CL 3114357 from 4.13 branch. ESRAM clear on create fix. Change 3121302 on 2016/09/12 by Joe.Graf Fixed up the IMPLEMENT_MODULE macro usage to avoid the link errors Change 3121379 on 2016/09/12 by Dmitry.Rekman Linux: only link libraries that export needed symbols (UE-35720). - Fixes very long startup times of modular builds. - Includes PR #2778 by slonopotamus. #jira UE-35720 Change 3121383 on 2016/09/12 by Dmitry.Rekman Linux: added some missing _API declarations on symbols used externally. - Compiling editor with -fvisibility=hidden works after this fix (although running still doesn't). Change 3121456 on 2016/09/12 by Daniel.Lamb Attempt to fix deterministic cooking issue for particlelodlevel. Ensure the spawn module has had postload called on it before using. #test Paragon cook Change 3122939 on 2016/09/13 by Luke.Thatcher [PLATFORM] [PS4] [!] Skip orbismemdmp files in the PS4 crash handler web service. - Writing these files to disk causes orbis-tm.exe to take a file lock on them, which means we can't move the crash directory to the landing zone. Change 3123040 on 2016/09/13 by Brent.Pease + Fix VS compile error by removing ENGINE_API from virtual method decls since ENGINE_API is defined for the entire class now. Change 3123664 on 2016/09/13 by Nick.Shin this was originally checked into: release 4.13.1 bringing here to dev-platform -- original submit comments -- first, safari has a problem with firing off "window resized" events - causing an infinite loop of the window "resizing" next, retina has "bigger" size calculations going off -- so y-delta checks greater than 2 are done to prevent resize event firing off in an infinite loop jira UE-35363 - Huge game window when launching onto Safari 9.1.2 Change 3125282 on 2016/09/14 by Michael.Trepka Fixed iOS and tvOS code indexing in Xcode project Change 3126812 on 2016/09/15 by Josh.Adams Merged Wolf support into Dev-Platform (hidden from almost all people still). Non-Wolf-specific changes: - Added Parse function to JsonObject.cs to be able to parse a string - Replaced some hacky post-reflection-capture functions with RHISubmitCommandsAndFlushGPU() - Split PLATFORM_HAS_BSD_SOCKET_FEATURE_GETADDRINFO off from PLATFORM_HAS_BSD_SOCKET_FEATURE_GETHOSTNAME - Converted the PS4MallocCrash class into a generic one (that Wolf is now also using) - Added AddGenericToInQueueOnlineThread(), useful running a delegate on Online thread instead of game thread - Refactored the GL shader compiler to allow Wolf to modify behavior without a lot of if WOLF checks everywhere - Added ability in the cross compiler to convert the global uniform arrays into named uniform buffer objects - Added ability for GL shader compiler to output original resources names ("VertColor" instead of "u_v[3]" or whatever) - Added "FORCELODGROUP" console command that will apply a StaticMesh LODGroup to selected meshes in the editor. This can batch-Simplygonify all meshes in a level. Should maybe become an editor tool. - Added ability for arrays of structs to specify a property to be the key. So, with LODGroups, the Name key inside the struct can be the unique key, so when you have multiple .ini files in the hierarchy overriding the same LODGroup by name, it will repalce the first with the second, instead of adding two entries with the same name. Set by @ArrayName=KeyPropertyName. Per Object Config sections need a little different handling, which uses * (see BaseDeviceProfiles.ini) - Added ability to change DeviceProfiles at runtime. Use "dp.override <name>". If you do it again to another one, it will reset the settings to what they were originally, before applying the second new DP. This is because the second DP may not set all settings the first one did, but we want to undo the first settings that the second doesn't contain. - Added FRHICommandListImmediate::IsStalled() - returns true while FRHICommandListImmediate::StallRHIThread is happening - Changed runtime GetFeatureLevelMaxTextureSamplers() calls to the new GetMaxTextureSamplers() which can now be handled by the platform. Renamed GetFeatureLevelMaxTextureSamplers to GetExpectedFeatureLevelMaxTextureSamplers() (only used by the shader editor) to guess at what maybe the samplers count will be - but it's not guaranteed correct. - Renamed a UT copy of a global function to not linker-conflict - Changed the OOMBackupMemoryPool to allow each platform to set how much memory to allocate. See FPlatformMemory::GetBackMemoryPoolSize(). Defaults to 0, which was the previous behavior with the now removed FPlatformMemory::SupportBackupMemoryPool(), which was only true in Windows and PS4. - Added an OOM delegate so other systems can get a callback after OOM occurs (after deleting the backup memory pool if it exists) - Changed SetQualityLevels() (in Scalability.cpp) to no longer change the SetBy priority when setting CVars, and now keeps the SetBy the same as it was. Helps with conflicts between game settings and device profiles. See SetWithCurrentPriority() - Added GetRenderingThreadPriority to FPlatformAffinity to allow a platform override priority. Not sure about this one, so may remove it, or maybe add more priorities for all the threads? - Added a new file into the ini hierarchy to begin fixing the Engine/Base -> Project/Default -> Engine/Platform -> Project/Platform mess. We now have Engine/Base -> Engine/BasePlatform -> Project/Default -> Engine/Platform -> Project/Platform. However, Engine/Platform will soonm be deprecated as we move things over to Engine/BasePlatform, that are safe to move. Change 3126842 on 2016/09/15 by Michael.Trepka Make SAssertPicker's search box the default widget to focus on activate so that it doesn't get deactivated on Mac, where we get the window activation event in a tick after SAssertPicker creation. Change 3126956 on 2016/09/15 by Michael.Trepka Added support for compiling Vulkan shaders for Android on Mac Change 3127206 on 2016/09/15 by Michael.Trepka PR #2604: Remove some warnings. (Contributed by reapazor) Change 3127324 on 2016/09/15 by Michael.Trepka Allow third party dylibs on Mac to be loaded from plugin subfolders Change 3127924 on 2016/09/16 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) Change 3128369 on 2016/09/16 by Nick.Shin zlib 1.2.8 headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128377 on 2016/09/16 by Nick.Shin openssl 1_0_2h headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128383 on 2016/09/16 by Nick.Shin libcurl 7_48_0 headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128384 on 2016/09/16 by Nick.Shin libwebsockets 1.7.4 headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128464 on 2016/09/16 by Nick.Shin webRTC rev.12643 NOTE: VS2015 - only Win64 is available - Win32 versions is crashing (e.g. EpicGamesLauncher) at the moment NOTE: VS2013 - not tested (i'm working on getting a VS2013 pro license) - so not checking in with this changelist - also, VS2013 is no longer supported by webRTC build scripts, so it will be old anyways FUTURE NOTE: - will continue to try to get VS2015 Win32 functional - and am working on trying to get VS2013 tested headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128500 on 2016/09/16 by Nick.Shin zlib 1.2.8 - OSX headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128504 on 2016/09/16 by Nick.Shin openssl 1_0_2h - OSX headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change3128506on 2016/09/16 by Nick.Shin libcurl 7_48_0 - OSX headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128508 on 2016/09/16 by Nick.Shin libwebsockets 1.7.4 - OSX headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128513 on 2016/09/16 by Nick.Shin webRTC rev.12643 - OSX headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128602 on 2016/09/16 by Nick.Shin webRTC rev.9862 - Win64 VS2013 NOTE: - not tested (i'm working on getting a VS2013 pro license) - checking in for testing purposes WARNING: - VS2013 is no longer supported by webRTC latest headers and lib updates part of [ zlib openssl libcurl libwebsockets webrtc ] updates Change 3128605 on 2016/09/16 by Nick.Shin re-enabling updated ThirdParySoftware libs: - zlib (v.1.2.8) - openssl (1.0.2h) - libcurl (7_48_0) - libwebsocket (v.1.7.4) - webRTC (rev.12643) to the codereviewers, in my attempt to ensure the older libs are still used for console, mobile and linux -- please refer to this checkin if i broke the build... Change 3128651 on 2016/09/16 by Nick.Shin fix Win32 build error from CL: #3128605 Change 3128704 on 2016/09/16 by Nick.Shin fix Win32 build error from CL: #3128605 - this time actually compiling it... Change 3128825 on 2016/09/16 by Dmitry.Rekman Linux: proper fix for too slow startup times (UE-35967). - Pull request #2793 by slonopotamus. - Now without stripping dependencies on libraries specified before. - Contains a work around for ld bug <2.25. Change 3128972 on 2016/09/16 by Nick.Shin fix to local build error. Change 3129283 on 2016/09/16 by Brent.Pease + Add Android local notification support based on existing system used for iOS + Initial API has been added for cancelling local notifications but the actual platform implementation will be done in the next release Change 3129494 on 2016/09/17 by Nick.Shin fix CIS build errors Change 3129503 on 2016/09/17 by Dmitry.Rekman Fix Linux build (case sensitivity issue). Change 3129514 on 2016/09/17 by Nick.Shin fix CIS build errors for consoles - missing zlib include path special thanks to Dmitry.Rekman for pointing me in the right direction Change 3129647 on 2016/09/17 by Dmitry.Rekman Linux: fix non-unity build. Change 3131043 on 2016/09/19 by Nick.Shin archiving build instructions/steps when building: - zlib (v.1.2.8) win: #3128369 osx: #3128500 - openssl (1.0.2h) win: #3128377 osx: #3128504 - libcurl (7_48_0) win: #3128383 osx: #3128506 - libwebsocket (v.1.7.4) win: #3128384 osx: #3128508 - webRTC win: #3128464 (rev.12643 for vs2015) + 3128602 (rev:9862 for vs2013) -- NOTE: win32 is WiP osx: #3128513 Change 3132801 on 2016/09/20 by Dmitry.Rekman Linux: support specifying default OpenGL version via configs (UE-34777). - The first targeted RHI is going to be used. Change 3132905 on 2016/09/20 by Josh.Adams - Fixed up some paths with the WolfPlat rename Change 3133148 on 2016/09/20 by Josh.Adams - Only show UT EULA if PLATFORM_DESKTOP Change 3133152 on 2016/09/20 by Josh.Adams - Beginning support for applets. Disabled unless you have a special SDK with applet support. Change 3133169 on 2016/09/20 by Josh.Adams - Fixed issue with Wolf access but no SDK installed Change 3133344 on 2016/09/20 by Daniel.Lamb Fixed issue with Iterative cooking not detecting changes to ini files which are loaded using LoadLocalFile. Added new flag to limit number of concurrent shader compiles. #test Cook QAGame, Cook Paragon Change 3133345 on 2016/09/20 by Daniel.Lamb FRedirectCollector collects string asset references all the time when running the editor. #test Cook paragon cook QAGame. Change 3133852 on 2016/09/21 by Luke.Thatcher [PLATFORM] [PS4] [^] Performing merge between 3.508.201 LCUE files in CarefullyRedist and Dev-Platform to populate integration history. No files have actually changed in this CL, only Perforce metadata is updated. Change 3133875 on 2016/09/21 by Luke.Thatcher [PLATFORM] [PS4] [^] Performing merge between 3.508.201 LCUE files in CarefullyRedist and Dev-Platform to populate integration history. No files have actually changed in this CL, only Perforce metadata is updated. (Attempt 2) Change 3134403 on 2016/09/21 by Jonathan.Fitzpatrick Per PS4 documentation, app_type requires the alternate spelling of 'upgradeable', 'upgradable'. Change 3134544 on 2016/09/21 by Josh.Adams - Reduced UT textures for Wolf Change 3134915 on 2016/09/21 by Jonathan.Fitzpatrick FPS4Time::SystemTime now calculates the local machine time, instead of UTC. #jira UE-35170 Change 3135036 on 2016/09/21 by Michael.Trepka Quit the UE4EditorServices app when quitting the Launcher if it was the launcher that spawned the services process Change 3135142 on 2016/09/21 by Jonathan.Fitzpatrick GetBackMemoryPoolSize returned bool on PS4 by accident, should be uint32 Change 3135292 on 2016/09/21 by Jeff.Campeau Change include order to favor the XDK edition specific headers where available. Change 3136414 on 2016/09/22 by Josh.Adams - Fixed a checkf() that had the case reversed #jira ue-36311 Change 3137082 on 2016/09/22 by Dmitry.Rekman Added support for Linux installed builds to 4.14 Change 3137220 on 2016/09/22 by Dmitry.Rekman Linux: do not rebuild hlslcc on each setup. - Now that hlslcc is set to use bundled libc++ there should be no STL binary compatibility conflicts between the engine and hlslcc binary. Change 3137227 on 2016/09/22 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) Change 3137259 on 2016/09/22 by Dmitry.Rekman Linux installed build: fix CIS (missed one .csproj) Change 3137290 on 2016/09/22 by Dmitry.Rekman Linux installed builds: fix for the resulting directory. Change 3137291 on 2016/09/22 by Chris.Babcock Restore texture filtering mode properly when movie played on Android #jira UE-36342 #ue4 #android Change 3137376 on 2016/09/22 by Dmitry.Rekman Linux: re-enabled crash handler stack smash protection. - Race condition in FRunnableThreadPThread has been previously fixed. Change 3138498 on 2016/09/23 by Dmitry.Rekman Linux: add missed package for installed builds. - mono-devel package for resgen2. Change 3138523 on 2016/09/23 by Dmitry.Rekman Linux: Update hlslcc now that we're not rebuilding it each time. Change 3138658 on 2016/09/23 by Josh.Adams - Moved UT's Social Plugin into NotForLicensees Change 3139042 on 2016/09/23 by Dmitry.Rekman Linux: more robust check of installed packages. - Also added mono-devel to the list of packages installed on 14.04. Change 3139674 on 2016/09/26 by Dmitry.Rekman Fix crash when editing widget blueprints (UE-35185). - Caused by name collision due to copy/pasted code; aliased classes diverged and this resulted in all kinds of weird memory stomping. - Renamed the class and also applied the same workaround (removing static) to prevent likely crashes on exit as happened with the original class (see UE-30795). Change 3140203 on 2016/09/26 by Josh.Adams - Wolf Fix for SHIPPING Change 3140206 on 2016/09/26 by Josh.Adams - NEX work, still in progress Change 3140276 on 2016/09/26 by Josh.Adams - Fixed Wolf compile error Change 3140485 on 2016/09/26 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) Change 3140570 on 2016/09/26 by Dmitry.Rekman SDL2: Delete obsolete files. - We now have local changes to SDL2, so this tarball is no longer accurate and just takes unnecessary space. Change 3140577 on 2016/09/26 by Dmitry.Rekman Fix CudaTest monolithic build. - Not the best fix, the better fix is to build against bundled libc++. Change3141184on 2016/09/27 by Keith.Judge Add FXboxOneApplication::GetXboxOneApplication to fix a save/load game assert. #jira UE-35973 Change 3141623 on 2016/09/27 by Chris.Babcock Support hiding virtual keyboard on Android #jira UE-34201 #ue4 #android Change 3141887 on 2016/09/27 by Joe.Graf Added support for additional plugin directories that are specified by the .uproject file New plugin wizard adds to the additional plugin directories if the user specifies a directory outside of Engine/Plugins or Game/Plugins Change 3141916 on 2016/09/27 by Josh.Adams - Worked around compile issues (at least with Wolf UT). This is well documented in a Jira (UE-29925) Change 3141926 on 2016/09/27 by Josh.Adams - Support for skipping Wolf user selector (-nologinui) Change 3141938 on 2016/09/27 by Chris.Babcock Allow Android media player to seek past 999ms (contributed by rcywongaa) #jira UE-36453 #PR #2797 #ue4 #android Change 3142207 on 2016/09/27 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) Change 3142219 on 2016/09/27 by Josh.Adams - Wolf PhysX 3.4 libs and includes Change 3142220 on 2016/09/27 by Josh.Adams - File that had to be fixed up after main merge (missed adding it to the huge integrate CL) Change 3142314 on 2016/09/27 by Chase.McAllister #jira UE-35011 fixes to some assets to remove redundancies/output log spam Change 3142510 on 2016/09/27 by Daniel.Lamb Fixed up resave lightmaps commandlet so that world transforms don't get applied twice. #jira UE-35942 Change 3142650 on 2016/09/27 by Chris.Babcock Android support for Linux by yaakuro - requires CodeWorks for Android Linux installed and OpenJDK 1.8 - need to set Android SDK paths manually in Project Settings #jira UE-32752 #jira UE-32753 #PR #2564 #PR #2565 #ue4 #android #linux Change3142802on 2016/09/27 by Dmitry.Rekman Upgrade to SDL 2.0.5-ish (still technically 2.0.4). - Upstream revision 10374:dccf51aee79b. - Merged all our changes hopefully. Change 3143075 on 2016/09/28 by Luke.Thatcher [RENDERING] [~] Add check to FBatchedElements::AddSprite to catch null textures. If the texture is null here, we will crash later in the RHI. At least now we'll get the callstack of the code adding the null textured sprite, since I don't have a repro. #jira UE-33077 Change 3143219 on 2016/09/28 by Daniel.Lamb Added new is compiling function which tells you if it's really compiling instead of lying. If def out additional logging for debugging shader compilation issue for 4.14 release. Change 3143428 on 2016/09/28 by Luke.Thatcher [PLATFORM] [PS4] [+] Use PS4 SDK 4.008.061 Change 3143488 on 2016/09/28 by Daniel.Lamb Changed defaults for skip cooking editor content to true. Change 3143526 on 2016/09/28 by Daniel.Lamb Increased the concurrent shader compile limit while in the cooker. #test Cook paragon Change 3143874 on 2016/09/28 by Chris.Babcock Read Android environment variables from .bashrc on Linux #jira UE-36565 #ue4 #android #linux Change 3143911 on 2016/09/28 by Dmitry.Rekman Fix SDL EGL API binding (UE-18979). - Contains PR #1398 by x414e54. - Also fixes offscreen backend that needed to provide a global mouse state after the SDL upgrade. Change 3143929 on 2016/09/28 by Daniel.Lamb Removed some more temporary logging. #test Cook paragon Change 3143959 on 2016/09/28 by Jeff.Campeau Media Player for Xbox One Change 3143997 on 2016/09/28 by Dmitry.Rekman Linux: faster linking in Debug. - Do not apply --as-needed to Debug build since taking a hit of several tens of seconds on startup is better than linking for ~4 more minutes when iterating. Change 3144004 on 2016/09/28 by Dmitry.Rekman Linux: make SCW dump core on crash in debug builds. - If the editor (not SCW itself) is built in Debug, make SCW dump cores if they ever crash. This makes it debug easier (at the risk of running of disk space). Change 3144007 on 2016/09/28 by Dmitry.Rekman Linux: Allow equals character in command line parameter value (UE-26406). - PR #2019 by bozzaro. - Allows passing parameters like -Switch=Key=Value. Change 3144042 on 2016/09/28 by Jeff.Campeau Add tag for DX12 support being experimental in target settings. #jira UE-36150 Change 3144068 on 2016/09/28 by Dmitry.Rekman Linux: enable using xgConsole in UAT (UE-28096). - PR #2144 by bozzaro. - Picks correct xgConsole binary. - Allegedly fixes crash in CombineXGEItemFile on mono. Change 3144120 on 2016/09/28 by Michael.Trepka Copying //Tasks/UE4/Dev-HighDPI/... to //UE4/Dev-Platform/... Change 3144172 on 2016/09/28 by Chris.Babcock Add libpng 1.5.27 for Android #jira UE-36573 #ue4 #android Change 3144318 on 2016/09/28 by Chris.Babcock Correct logic for checking .bashrc on Linux #ue4 #android Change 3144331 on 2016/09/28 by Dmitry.Rekman Linux: repair ARM server builds. - Also: print info about C++ library being used and allow the override via environment variable UE4_LINUX_USE_LIBCXX (either 0 or 1). Change 3144354 on 2016/09/28 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) this is intermediate, not fully working Change 3144368 on 2016/09/28 by Josh.Adams - Moved the new Social files into NFL Change 3144395 on 2016/09/28 by Chris.Babcock Add missing functions for AndroidWebBrowserWindow #ue4 #android Change 3144417 on 2016/09/28 by Josh.Adams - Probable fix for FWebBrowserWindow missing virtuals Change 3144438 on 2016/09/28 by Jeff.Campeau XDK updated to 160802 Change 3144569 on 2016/09/29 by Dmitry.Rekman Linux: allow a selectable clock source (UE-36564). - The engine will now select the best performing clock on start instead of hard-coding CLOCK_REALTIME. This will happen as part of global initialization before main() to prevent clock skew. - Also fixes a problem of the engine not being able to start on Windows 10 since previously hard-coded clock id was not supported there. #tests Compiled and ran a few targets (including non-monolithic). Tried bogus clock sources. Haven't actually tried on Win10 (don't have a machine atm). Change 3145108 on 2016/09/29 by Joe.Graf Fixed cases where path relative external plugin paths would generate the wrong path when running Unreal Header Tool (and probably other tools) Change 3145245 on 2016/09/29 by Joe.Graf #wolf Checking in removal of plugin use on Win64 per Josh's request Change 3145514 on 2016/09/29 by Will.Fissler Updated Mac Info.plist files to disable high DPI on macOS 10.12 Change 3145538 on 2016/09/29 by Josh.Adams - Worked around a physics task graph issue with using the new lock free stuff on Wolf, joining PS4 and XboxOne. Wolf was crashing on some boots. Change 3145540 on 2016/09/29 by Josh.Adams - Fix for checking some Wolf dev tool installation existence - Fix for various Wolf build issues - Fix for Wolf devices not showing up in Launch on Change 3145542 on 2016/09/29 by Josh.Adams - Pulled over Wolf changes from Wolf branch into Dev-Platform Change 3145572 on 2016/09/29 by Josh.Adams - Cleaned up Wolf SDK error logs which really messed up GenProjectFiles for some class of people. #jira UE-36591 Change 3145769 on 2016/09/29 by Chris.Babcock Remove duplicate platforms from deploy list in UFE #jira UE-36636 #ue4 Change 3146061 on 2016/09/29 by Chris.Babcock Linux: be less spammy in log when launching external procs #jira UE-36638 #ue4 #linux Change 3146208 on 2016/09/29 by Dmitry.Rekman Linux: fix PhysX crash (UE-36613). - PX_RESTRICT was unwarrantedly applied to memMove, allowing clang to replace the memmove() call to memcpy() at -O2 and above. - This caused PxArray::remove() to duplicate the elements of its array (in POD case) and this opened doors to all kinds of fun. #jira UE-36613 Change 3146476 on 2016/09/30 by Josh.Adams - Moved a UBT log that could pollute QA logs with Wolf secrets to Verbose Change 3146554 on 2016/09/30 by Josh.Adams - Removed another wolf secret log Change 3146626 on 2016/09/30 by Josh.Adams Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform) Change 3146712 on 2016/09/30 by Josh.Adams - Fixed case for building Android on Linux #jira #UE-36652 Change 3146844 on 2016/09/30 by Josh.Adams - Removed ES2 shader compiling from TVOS, and force Metal compiling #jira UE-36306 Change 3146865 on 2016/09/30 by Daniel.Lamb Removed temp logging for materials #test Launch on paragon Change 3146874 on 2016/09/30 by Dmitry.Rekman Linux: add rpath for libTextureConverter.so (UE-36620). Change 3147030 on 2016/09/30 by Josh.Adams - Version check workaround for IOS9.3/TVOS9.2 defining __IPHONE_10_0 which breaks our IOS10 code checks #jira UE-36623 Change 3147151 on 2016/09/30 by Josh.Adams - Fixed zlib.build.cs for XboxOne, which came in from another branch without an include path, yet somehow main is compiling? Change 3147621 on 2016/09/30 by Michael.Trepka Fix for setting up RPATHs for third party dylibs for packaged code-based games on Mac Change 3147712 on 2016/09/30 by Josh.Adams - Fixed metal crash StrategyGame crash. Recent code was checking IsES2Platform for HDR decoding in scene capture, and Metal hasn't been IsES2 since may. Changed to IsMobilePlatform. #jira UE-36225 Change 3147725 on 2016/09/30 by Josh.Adams - Fixed yet another Wolf log for people with Wolf access but no SDK [CL 3147801 by Josh Adams in Main branch]
1331 lines
49 KiB
C#
1331 lines
49 KiB
C#
// Copyright 1998-2016 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;
|
|
|
|
namespace UnrealBuildTool
|
|
{
|
|
public class AndroidToolChain : UEToolChain
|
|
{
|
|
private FileReference ProjectFile;
|
|
|
|
// the number of the clang version being used to compile
|
|
private float ClangVersionFloat = 0;
|
|
|
|
// the list of architectures we will compile for
|
|
private List<string> Arches = null;
|
|
// the list of GPU architectures we will compile for
|
|
private List<string> GPUArchitectures = null;
|
|
// a list of all architecture+GPUArchitecture names (-armv7-es2, etc)
|
|
private List<string> AllComboNames = null;
|
|
|
|
static private Dictionary<string, string[]> AllArchNames = new Dictionary<string, string[]> {
|
|
{ "-armv7", new string[] { "armv7", "armeabi-v7a", } },
|
|
{ "-arm64", new string[] { "arm64", "arm64-v8a", } },
|
|
{ "-x86", new string[] { "x86", } },
|
|
{ "-x64", new string[] { "x64", "x86_64", } },
|
|
};
|
|
|
|
static private Dictionary<string, string[]> LibrariesToSkip = new Dictionary<string, string[]> {
|
|
{ "-armv7", new string[] { } },
|
|
{ "-arm64", new string[] { "nvToolsExt", "nvToolsExtStub", "oculus", "vrapi", "ovrkernel", "systemutils", "openglloader", } },
|
|
{ "-x86", new string[] { "nvToolsExt", "nvToolsExtStub", "oculus", "vrapi", "ovrkernel", "systemutils", "openglloader", } },
|
|
{ "-x64", new string[] { "nvToolsExt", "nvToolsExtStub", "oculus", "vrapi", "ovrkernel", "systemutils", "openglloader", "gpg", } },
|
|
};
|
|
|
|
static private Dictionary<string, string[]> ModulesToSkip = new Dictionary<string, string[]> {
|
|
{ "-armv7", new string[] { } },
|
|
{ "-arm64", new string[] { } },
|
|
{ "-x86", new string[] { } },
|
|
{ "-x64", new string[] { "OnlineSubsystemGooglePlay", } },
|
|
};
|
|
|
|
public AndroidToolChain(FileReference InProjectFile)
|
|
: base(CPPTargetPlatform.Android)
|
|
{
|
|
ProjectFile = InProjectFile;
|
|
|
|
string NDKPath = Environment.GetEnvironmentVariable("NDKROOT");
|
|
|
|
// don't register if we don't have an NDKROOT specified
|
|
if (String.IsNullOrEmpty(NDKPath))
|
|
{
|
|
throw new BuildException("NDKROOT is not specified; cannot use Android toolchain.");
|
|
}
|
|
|
|
NDKPath = NDKPath.Replace("\"", "");
|
|
|
|
string ClangVersion = "";
|
|
string GccVersion = "";
|
|
|
|
string ArchitecturePath = "";
|
|
string ArchitecturePathWindows32 = @"prebuilt/windows";
|
|
string ArchitecturePathWindows64 = @"prebuilt/windows-x86_64";
|
|
string ArchitecturePathMac = @"prebuilt/darwin-x86_64";
|
|
string ArchitecturePathLinux = @"prebuilt/linux-x86_64";
|
|
string ExeExtension = ".exe";
|
|
|
|
if (Directory.Exists(Path.Combine(NDKPath, ArchitecturePathWindows64)))
|
|
{
|
|
Log.TraceVerbose(" Found Windows 64 bit versions of toolchain");
|
|
ArchitecturePath = ArchitecturePathWindows64;
|
|
}
|
|
else if (Directory.Exists(Path.Combine(NDKPath, ArchitecturePathWindows32)))
|
|
{
|
|
Log.TraceVerbose(" Found Windows 32 bit versions of toolchain");
|
|
ArchitecturePath = ArchitecturePathWindows32;
|
|
}
|
|
else if (Directory.Exists(Path.Combine(NDKPath, ArchitecturePathMac)))
|
|
{
|
|
Log.TraceVerbose(" Found Mac versions of toolchain");
|
|
ArchitecturePath = ArchitecturePathMac;
|
|
ExeExtension = "";
|
|
}
|
|
else if (Directory.Exists(Path.Combine(NDKPath, ArchitecturePathLinux)))
|
|
{
|
|
Log.TraceVerbose(" Found Linux versions of toolchain");
|
|
ArchitecturePath = ArchitecturePathLinux;
|
|
ExeExtension = "";
|
|
}
|
|
else
|
|
{
|
|
throw new BuildException("Couldn't find 32-bit or 64-bit versions of the Android toolchain");
|
|
}
|
|
|
|
// prefer clang 3.6, but fall back if needed for now
|
|
if (Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm-3.6")))
|
|
{
|
|
ClangVersionFloat = 3.6f;
|
|
ClangVersion = "-3.6";
|
|
GccVersion = "4.9";
|
|
}
|
|
else if (Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm-3.5")))
|
|
{
|
|
ClangVersionFloat = 3.5f;
|
|
ClangVersion = "-3.5";
|
|
GccVersion = "4.9";
|
|
}
|
|
else if (Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm-3.3")))
|
|
{
|
|
ClangVersionFloat = 3.3f;
|
|
ClangVersion = "-3.3";
|
|
GccVersion = "4.8";
|
|
}
|
|
else if (Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm-3.1")))
|
|
{
|
|
ClangVersionFloat = 3.1f;
|
|
ClangVersion = "-3.1";
|
|
GccVersion = "4.6";
|
|
}
|
|
else if (Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm")))
|
|
{
|
|
// look for version in AndroidVersion.txt (fail if not found)
|
|
string VersionFilename = Path.Combine(NDKPath, @"toolchains/llvm/", ArchitecturePath, @"AndroidVersion.txt");
|
|
if (!File.Exists(VersionFilename))
|
|
{
|
|
throw new BuildException("Cannot find supported Android toolchain");
|
|
}
|
|
string[] VersionFile = File.ReadAllLines(VersionFilename);
|
|
string[] VersionParts = VersionFile[0].Split('.');
|
|
ClangVersionFloat = float.Parse(VersionParts[0] + "." + VersionParts[1], System.Globalization.CultureInfo.InvariantCulture);
|
|
ClangVersion = "";
|
|
GccVersion = "4.9";
|
|
}
|
|
else
|
|
{
|
|
throw new BuildException("Cannot find supported Android toolchain");
|
|
}
|
|
|
|
// set up the path to our toolchains
|
|
ClangPath = Path.Combine(NDKPath, @"toolchains/llvm" + ClangVersion, ArchitecturePath, @"bin/clang++" + ExeExtension);
|
|
ArPathArm = Path.Combine(NDKPath, @"toolchains/arm-linux-androideabi-" + GccVersion, ArchitecturePath, @"bin/arm-linux-androideabi-ar" + ExeExtension); //@todo android: use llvm-ar.exe instead?
|
|
ArPathArm64 = Path.Combine(NDKPath, @"toolchains/aarch64-linux-android-" + GccVersion, ArchitecturePath, @"bin/aarch64-linux-android-ar" + ExeExtension); //@todo android: use llvm-ar.exe instead?
|
|
ArPathx86 = Path.Combine(NDKPath, @"toolchains/x86-" + GccVersion, ArchitecturePath, @"bin/i686-linux-android-ar" + ExeExtension); //@todo android: verify x86 toolchain
|
|
ArPathx64 = Path.Combine(NDKPath, @"toolchains/x86_64-" + GccVersion, ArchitecturePath, @"bin/x86_64-linux-android-ar" + ExeExtension); //@todo android: verify x64 toolchain
|
|
|
|
// NDK setup (use no less than 21 for 64-bit targets)
|
|
int NDKApiLevelInt = GetNdkApiLevelInt();
|
|
string NDKApiLevel32Bit = GetNdkApiLevel();
|
|
string NDKApiLevel64Bit = NDKApiLevel32Bit;
|
|
if (NDKApiLevelInt < 21)
|
|
{
|
|
NDKApiLevel64Bit = "android-21";
|
|
}
|
|
|
|
// toolchain params
|
|
ToolchainParamsArm = " -target armv7-none-linux-androideabi" +
|
|
" --sysroot=\"" + Path.Combine(NDKPath, "platforms", NDKApiLevel32Bit, "arch-arm") + "\"" +
|
|
" -gcc-toolchain \"" + Path.Combine(NDKPath, @"toolchains/arm-linux-androideabi-" + GccVersion, ArchitecturePath) + "\"";
|
|
ToolchainParamsArm64 = " -target aarch64-none-linux-android" +
|
|
" --sysroot=\"" + Path.Combine(NDKPath, "platforms", NDKApiLevel64Bit, "arch-arm64") + "\"" +
|
|
" -gcc-toolchain \"" + Path.Combine(NDKPath, @"toolchains/aarch64-linux-android-" + GccVersion, ArchitecturePath) + "\"";
|
|
ToolchainParamsx86 = " -target i686-none-linux-android" +
|
|
" --sysroot=\"" + Path.Combine(NDKPath, "platforms", NDKApiLevel32Bit, "arch-x86") + "\"" +
|
|
" -gcc-toolchain \"" + Path.Combine(NDKPath, @"toolchains/x86-" + GccVersion, ArchitecturePath) + "\"";
|
|
ToolchainParamsx64 = " -target x86_64-none-linux-android" +
|
|
" --sysroot=\"" + Path.Combine(NDKPath, "platforms", NDKApiLevel64Bit, "arch-x86_64") + "\"" +
|
|
" -gcc-toolchain \"" + Path.Combine(NDKPath, @"toolchains\x86_64-" + GccVersion, ArchitecturePath) + "\"";
|
|
}
|
|
|
|
public void ParseArchitectures()
|
|
{
|
|
// look in ini settings for what platforms to compile for
|
|
ConfigCacheIni Ini = ConfigCacheIni.CreateConfigCacheIni(UnrealTargetPlatform.Android, "Engine", DirectoryReference.FromFile(ProjectFile));
|
|
Arches = new List<string>();
|
|
bool bBuild = true;
|
|
if (Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBuildForArmV7", out bBuild) && bBuild
|
|
|| UEBuildConfiguration.Architectures.Contains("armv7", StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
Arches.Add("-armv7");
|
|
}
|
|
if (Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBuildForArm64", out bBuild) && bBuild
|
|
|| UEBuildConfiguration.Architectures.Contains("arm64", StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
Arches.Add("-arm64");
|
|
}
|
|
if (Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBuildForx86", out bBuild) && bBuild
|
|
|| UEBuildConfiguration.Architectures.Contains("x86", StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
Arches.Add("-x86");
|
|
}
|
|
if (Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBuildForx8664", out bBuild) && bBuild
|
|
|| UEBuildConfiguration.Architectures.Contains("x64", StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
Arches.Add("-x64");
|
|
}
|
|
|
|
// force armv7 if something went wrong
|
|
if (Arches.Count == 0)
|
|
{
|
|
Arches.Add("-armv7");
|
|
}
|
|
|
|
// Parse selected GPU architectures
|
|
GPUArchitectures = new List<string>();
|
|
if (Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBuildForES2", out bBuild) && bBuild
|
|
|| UEBuildConfiguration.GPUArchitectures.Contains("es2", StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
GPUArchitectures.Add("-es2");
|
|
}
|
|
if (Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBuildForESDeferred", out bBuild) && bBuild
|
|
|| UEBuildConfiguration.GPUArchitectures.Contains("esdeferred", StringComparer.OrdinalIgnoreCase))
|
|
{
|
|
GPUArchitectures.Add("-esdeferred");
|
|
}
|
|
if (GPUArchitectures.Count == 0)
|
|
{
|
|
GPUArchitectures.Add("-es2");
|
|
}
|
|
|
|
AllComboNames = (from Arch in Arches
|
|
from GPUArch in GPUArchitectures
|
|
select Arch + GPUArch).ToList();
|
|
}
|
|
|
|
static public string GetGLESVersionFromGPUArch(string GPUArch)
|
|
{
|
|
GPUArch = GPUArch.Substring(1); // drop the '-' from the start
|
|
string GLESversion = "";
|
|
switch (GPUArch)
|
|
{
|
|
case "es2":
|
|
GLESversion = "0x00020000";
|
|
break;
|
|
case "esdeferred":
|
|
GLESversion = "0x00030001";
|
|
break;
|
|
default:
|
|
GLESversion = "0x00020000";
|
|
break;
|
|
}
|
|
|
|
return GLESversion;
|
|
}
|
|
|
|
public override void SetUpGlobalEnvironment()
|
|
{
|
|
base.SetUpGlobalEnvironment();
|
|
|
|
ParseArchitectures();
|
|
}
|
|
|
|
public List<string> GetAllArchitectures()
|
|
{
|
|
if (Arches == null)
|
|
{
|
|
ParseArchitectures();
|
|
}
|
|
|
|
return Arches;
|
|
}
|
|
|
|
public List<string> GetAllGPUArchitectures()
|
|
{
|
|
if (GPUArchitectures == null)
|
|
{
|
|
ParseArchitectures();
|
|
}
|
|
|
|
return GPUArchitectures;
|
|
}
|
|
|
|
public int GetNdkApiLevelInt(int MinNdk = 19)
|
|
{
|
|
string NDKVersion = GetNdkApiLevel();
|
|
int NDKVersionInt = MinNdk;
|
|
if (NDKVersion.Contains("-"))
|
|
{
|
|
int Version;
|
|
if (int.TryParse(NDKVersion.Substring(NDKVersion.LastIndexOf('-') + 1), out Version))
|
|
{
|
|
if (Version > NDKVersionInt)
|
|
NDKVersionInt = Version;
|
|
}
|
|
}
|
|
return NDKVersionInt;
|
|
}
|
|
|
|
public string GetNdkApiLevel()
|
|
{
|
|
// ask the .ini system for what version to use
|
|
ConfigCacheIni Ini = ConfigCacheIni.CreateConfigCacheIni(UnrealTargetPlatform.Android, "Engine", DirectoryReference.FromFile(ProjectFile));
|
|
string NDKLevel;
|
|
Ini.GetString("/Script/AndroidPlatformEditor.AndroidSDKSettings", "NDKAPILevel", out NDKLevel);
|
|
|
|
if (NDKLevel == "latest")
|
|
{
|
|
// get a list of NDK platforms
|
|
string PlatformsDir = Environment.ExpandEnvironmentVariables("%NDKROOT%/platforms");
|
|
if (!Directory.Exists(PlatformsDir))
|
|
{
|
|
throw new BuildException("No platforms found in {0}", PlatformsDir);
|
|
}
|
|
|
|
// return the largest of them
|
|
NDKLevel = GetLargestApiLevel(Directory.GetDirectories(PlatformsDir));
|
|
}
|
|
|
|
return NDKLevel;
|
|
}
|
|
|
|
public string GetLargestApiLevel(string[] ApiLevels)
|
|
{
|
|
int LargestLevel = 0;
|
|
string LargestString = null;
|
|
|
|
// look for largest integer
|
|
foreach (string Level in ApiLevels)
|
|
{
|
|
string LocalLevel = Path.GetFileName(Level);
|
|
string[] Tokens = LocalLevel.Split("-".ToCharArray());
|
|
if (Tokens.Length >= 2)
|
|
{
|
|
try
|
|
{
|
|
int ParsedLevel = int.Parse(Tokens[1]);
|
|
// bigger? remember it
|
|
if (ParsedLevel > LargestLevel)
|
|
{
|
|
LargestLevel = ParsedLevel;
|
|
LargestString = LocalLevel;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// ignore poorly formed string
|
|
}
|
|
}
|
|
}
|
|
|
|
return LargestString;
|
|
}
|
|
|
|
string GetCLArguments_Global(CPPEnvironment CompileEnvironment, string Architecture)
|
|
{
|
|
string Result = "";
|
|
|
|
switch (Architecture)
|
|
{
|
|
case "-armv7": Result += ToolchainParamsArm; break;
|
|
case "-arm64": Result += ToolchainParamsArm64; break;
|
|
case "-x86": Result += ToolchainParamsx86; break;
|
|
case "-x64": Result += ToolchainParamsx64; break;
|
|
default: Result += ToolchainParamsArm; break;
|
|
}
|
|
|
|
// build up the commandline common to C and C++
|
|
Result += " -c";
|
|
Result += " -fdiagnostics-format=msvc";
|
|
Result += " -Wall";
|
|
|
|
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";
|
|
// 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 will prevent the issue of warnings for unused private variables.
|
|
Result += " -Wno-unused-private-field";
|
|
Result += " -Wno-local-type-template-args"; // engine triggers this
|
|
Result += " -Wno-return-type-c-linkage"; // needed for PhysX
|
|
Result += " -Wno-reorder"; // member initialization order
|
|
Result += " -Wno-unknown-pragmas"; // probably should kill this one, sign of another issue in PhysX?
|
|
Result += " -Wno-invalid-offsetof"; // needed to suppress warnings about using offsetof on non-POD types.
|
|
Result += " -Wno-logical-op-parentheses"; // needed for external headers we can't change
|
|
|
|
if (CompileEnvironment.Config.bEnableShadowVariableWarning)
|
|
{
|
|
Result += " -Wshadow -Wno-error=shadow";
|
|
}
|
|
|
|
// new for clang4.5 warnings:
|
|
if (ClangVersionFloat >= 3.5f)
|
|
{
|
|
Result += " -Wno-undefined-bool-conversion"; // 'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true (if (this))
|
|
|
|
// we use this feature to allow static FNames.
|
|
Result += " -Wno-gnu-string-literal-operator-template";
|
|
}
|
|
|
|
if (ClangVersionFloat >= 3.6f)
|
|
{
|
|
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.
|
|
}
|
|
|
|
// shipping builds will cause this warning with "ensure", so disable only in those case
|
|
if (CompileEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Shipping)
|
|
{
|
|
Result += " -Wno-unused-value";
|
|
}
|
|
|
|
// debug info
|
|
if (CompileEnvironment.Config.bCreateDebugInfo)
|
|
{
|
|
Result += " -g2 -gdwarf-4";
|
|
}
|
|
|
|
// optimization level
|
|
if (CompileEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug)
|
|
{
|
|
Result += " -O0";
|
|
}
|
|
else
|
|
{
|
|
if (UEBuildConfiguration.bCompileForSize)
|
|
{
|
|
Result += " -Oz";
|
|
}
|
|
else
|
|
{
|
|
Result += " -O3";
|
|
}
|
|
}
|
|
|
|
//@todo android: these are copied verbatim from UE3 and probably need adjustment
|
|
if (Architecture == "-armv7")
|
|
{
|
|
// Result += " -mthumb-interwork"; // Generates code which supports calling between ARM and Thumb instructions, w/o it you can't reliability use both together
|
|
Result += " -funwind-tables"; // Just generates any needed static data, affects no code
|
|
Result += " -fstack-protector"; // Emits extra code to check for buffer overflows
|
|
// Result += " -mlong-calls"; // Perform function calls by first loading the address of the function into a reg and then performing the subroutine call
|
|
Result += " -fno-strict-aliasing"; // Prevents unwanted or invalid optimizations that could produce incorrect code
|
|
Result += " -fpic"; // Generates position-independent code (PIC) suitable for use in a shared library
|
|
Result += " -fno-exceptions"; // Do not enable exception handling, generates extra code needed to propagate exceptions
|
|
Result += " -fno-rtti"; //
|
|
Result += " -fno-short-enums"; // Do not allocate to an enum type only as many bytes as it needs for the declared range of possible values
|
|
// Result += " -finline-limit=64"; // GCC limits the size of functions that can be inlined, this flag allows coarse control of this limit
|
|
// Result += " -Wno-psabi"; // Warn when G++ generates code that is probably not compatible with the vendor-neutral C++ ABI
|
|
|
|
Result += " -march=armv7-a";
|
|
Result += " -mfloat-abi=softfp";
|
|
Result += " -mfpu=vfpv3-d16"; //@todo android: UE3 was just vfp. arm7a should all support v3 with 16 registers
|
|
|
|
// Add flags for on-device debugging
|
|
if (CompileEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug)
|
|
{
|
|
Result += " -fno-omit-frame-pointer"; // Disable removing the save/restore frame pointer for better debugging
|
|
if (ClangVersionFloat >= 3.6f)
|
|
{
|
|
Result += " -fno-function-sections"; // Improve breakpoint location
|
|
}
|
|
}
|
|
|
|
// Some switches interfere with on-device debugging
|
|
if (CompileEnvironment.Config.Target.Configuration != CPPTargetConfiguration.Debug)
|
|
{
|
|
Result += " -ffunction-sections"; // Places each function in its own section of the output file, linker may be able to perform opts to improve locality of reference
|
|
}
|
|
|
|
Result += " -fsigned-char"; // Treat chars as signed //@todo android: any concerns about ABI compatibility with libs here?
|
|
}
|
|
else if (Architecture == "-arm64")
|
|
{
|
|
Result += " -funwind-tables"; // Just generates any needed static data, affects no code
|
|
Result += " -fstack-protector"; // Emits extra code to check for buffer overflows
|
|
Result += " -fno-strict-aliasing"; // Prevents unwanted or invalid optimizations that could produce incorrect code
|
|
Result += " -fpic"; // Generates position-independent code (PIC) suitable for use in a shared library
|
|
Result += " -fno-exceptions"; // Do not enable exception handling, generates extra code needed to propagate exceptions
|
|
Result += " -fno-rtti"; //
|
|
Result += " -fno-short-enums"; // Do not allocate to an enum type only as many bytes as it needs for the declared range of possible values
|
|
|
|
Result += " -D__arm64__"; // for some reason this isn't defined and needed for PhysX
|
|
|
|
Result += " -march=armv8-a";
|
|
//Result += " -mfloat-abi=softfp";
|
|
//Result += " -mfpu=vfpv3-d16"; //@todo android: UE3 was just vfp. arm7a should all support v3 with 16 registers
|
|
|
|
// Some switches interfere with on-device debugging
|
|
if (CompileEnvironment.Config.Target.Configuration != CPPTargetConfiguration.Debug)
|
|
{
|
|
Result += " -ffunction-sections"; // Places each function in its own section of the output file, linker may be able to perform opts to improve locality of reference
|
|
}
|
|
|
|
Result += " -fsigned-char"; // Treat chars as signed //@todo android: any concerns about ABI compatibility with libs here?
|
|
}
|
|
else if (Architecture == "-x86")
|
|
{
|
|
Result += " -fstrict-aliasing";
|
|
Result += " -fno-omit-frame-pointer";
|
|
Result += " -fno-strict-aliasing";
|
|
Result += " -fno-short-enums";
|
|
Result += " -fno-exceptions";
|
|
Result += " -fno-rtti";
|
|
Result += " -march=atom";
|
|
}
|
|
else if (Architecture == "-x64")
|
|
{
|
|
Result += " -fstrict-aliasing";
|
|
Result += " -fno-omit-frame-pointer";
|
|
Result += " -fno-strict-aliasing";
|
|
Result += " -fno-short-enums";
|
|
Result += " -fno-exceptions";
|
|
Result += " -fno-rtti";
|
|
Result += " -march=atom";
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
static string GetCompileArguments_CPP(bool bDisableOptimizations)
|
|
{
|
|
string Result = "";
|
|
|
|
Result += " -x c++";
|
|
Result += " -std=c++11";
|
|
|
|
// optimization level
|
|
if (bDisableOptimizations)
|
|
{
|
|
Result += " -O0";
|
|
}
|
|
else
|
|
{
|
|
Result += " -O3";
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
static string GetCompileArguments_C(bool bDisableOptimizations)
|
|
{
|
|
string Result = "";
|
|
|
|
Result += " -x c";
|
|
|
|
// optimization level
|
|
if (bDisableOptimizations)
|
|
{
|
|
Result += " -O0";
|
|
}
|
|
else
|
|
{
|
|
Result += " -O3";
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
static string GetCompileArguments_PCH(bool bDisableOptimizations)
|
|
{
|
|
string Result = "";
|
|
|
|
Result += " -x c++-header";
|
|
Result += " -std=c++11";
|
|
|
|
// optimization level
|
|
if (bDisableOptimizations)
|
|
{
|
|
Result += " -O0";
|
|
}
|
|
else
|
|
{
|
|
Result += " -O3";
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
string GetLinkArguments(LinkEnvironment LinkEnvironment, string Architecture)
|
|
{
|
|
string Result = "";
|
|
|
|
Result += " -nostdlib";
|
|
Result += " -Wl,-shared,-Bsymbolic";
|
|
Result += " -Wl,--no-undefined";
|
|
|
|
if (Architecture == "-arm64")
|
|
{
|
|
Result += ToolchainParamsArm64;
|
|
Result += " -march=armv8-a";
|
|
}
|
|
else if (Architecture == "-x86")
|
|
{
|
|
Result += ToolchainParamsx86;
|
|
Result += " -march=atom";
|
|
}
|
|
else if (Architecture == "-x64")
|
|
{
|
|
Result += ToolchainParamsx64;
|
|
Result += " -march=atom";
|
|
}
|
|
else // if (Architecture == "-armv7")
|
|
{
|
|
Result += ToolchainParamsArm;
|
|
Result += " -march=armv7-a";
|
|
Result += " -Wl,--fix-cortex-a8"; // required to route around a CPU bug in some Cortex-A8 implementations
|
|
}
|
|
|
|
if (BuildConfiguration.bUseUnityBuild && ClangVersionFloat >= 3.6f && ClangVersionFloat < 3.8f)
|
|
{
|
|
Result += " -fuse-ld=gold"; // ld.gold is available in r10e (clang 3.6)
|
|
}
|
|
|
|
// make sure the DT_SONAME field is set properly (or we can a warning toast at startup on new Android)
|
|
Result += " -Wl,-soname,libUE4.so";
|
|
|
|
// verbose output from the linker
|
|
// Result += " -v";
|
|
|
|
return Result;
|
|
}
|
|
|
|
static string GetArArguments(LinkEnvironment LinkEnvironment)
|
|
{
|
|
string Result = "";
|
|
|
|
Result += " -r";
|
|
|
|
return Result;
|
|
}
|
|
|
|
static bool IsDirectoryForArch(string Dir, string Arch)
|
|
{
|
|
// make sure paths use one particular slash
|
|
Dir = Dir.Replace("\\", "/").ToLowerInvariant();
|
|
|
|
// look for other architectures in the Dir path, and fail if it finds it
|
|
foreach (var Pair in AllArchNames)
|
|
{
|
|
if (Pair.Key != Arch)
|
|
{
|
|
foreach (var ArchName in Pair.Value)
|
|
{
|
|
// if there's a directory in the path with a bad architecture name, reject it
|
|
if (Regex.IsMatch(Dir, "/" + ArchName + "$") || Regex.IsMatch(Dir, "/" + ArchName + "/"))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// if nothing was found, we are okay
|
|
return true;
|
|
}
|
|
|
|
static bool ShouldSkipModule(string ModuleName, string Arch)
|
|
{
|
|
foreach (var ModName in ModulesToSkip[Arch])
|
|
{
|
|
if (ModName == ModuleName)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// if nothing was found, we are okay
|
|
return false;
|
|
}
|
|
|
|
bool ShouldSkipLib(string Lib, string Arch, string GPUArchitecture)
|
|
{
|
|
// reject any libs we outright don't want to link with
|
|
foreach (var LibName in LibrariesToSkip[Arch])
|
|
{
|
|
if (LibName == Lib)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// if another architecture is in the filename, reject it
|
|
foreach (string ComboName in AllComboNames)
|
|
{
|
|
if (ComboName != Arch + GPUArchitecture)
|
|
{
|
|
if (Path.GetFileNameWithoutExtension(Lib).EndsWith(ComboName))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
// if nothing was found, we are okay
|
|
return false;
|
|
}
|
|
|
|
static void ConditionallyAddNDKSourceFiles(List<FileItem> SourceFiles, string ModuleName)
|
|
{
|
|
// We need to add the extra glue and cpu code only to Launch module.
|
|
if (ModuleName.Equals("Launch"))
|
|
{
|
|
SourceFiles.Add(FileItem.GetItemByPath(Environment.GetEnvironmentVariable("NDKROOT") + "/sources/android/native_app_glue/android_native_app_glue.c"));
|
|
|
|
// Newer NDK cpu_features.c uses getauxval() which causes a SIGSEGV in libhoudini.so (ARM on Intel translator) in older versions of Houdini
|
|
// so we patch the file to use alternative methods of detecting CPU features if libhoudini.so is detected
|
|
// The basis for this patch is from here: https://android-review.googlesource.com/#/c/110650/
|
|
string CpuFeaturesPath = Environment.GetEnvironmentVariable("NDKROOT") + "/sources/android/cpufeatures/";
|
|
string CpuFeaturesPatchedFile = CpuFeaturesPath + "cpu-features-patched.c";
|
|
if (!File.Exists(CpuFeaturesPatchedFile))
|
|
{
|
|
// Either make a copy or patch it
|
|
string[] CpuFeaturesLines = File.ReadAllLines(CpuFeaturesPath + "cpu-features.c");
|
|
|
|
// Look for get_elf_hwcap_from_getauxval in the file
|
|
bool NeedsPatch = false;
|
|
int LineIndex;
|
|
for (LineIndex = 0; LineIndex < CpuFeaturesLines.Length; ++LineIndex)
|
|
{
|
|
if (CpuFeaturesLines[LineIndex].Contains("get_elf_hwcap_from_getauxval"))
|
|
{
|
|
NeedsPatch = true;
|
|
|
|
// Make sure it doesn't already have the patch (r10c and 10d have it already, but removed in 10e)
|
|
for (int LineIndex2 = LineIndex; LineIndex2 < CpuFeaturesLines.Length; ++LineIndex2)
|
|
{
|
|
if (CpuFeaturesLines[LineIndex2].Contains("has_houdini_binary_translator(void)"))
|
|
{
|
|
NeedsPatch = false;
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Apply patch or write unchanged
|
|
if (NeedsPatch)
|
|
{
|
|
List<string> CpuFeaturesList = new List<string>(CpuFeaturesLines);
|
|
|
|
// Skip down to section to add Houdini check function for arm
|
|
while (!CpuFeaturesList[++LineIndex].StartsWith("#if defined(__arm__)")) ;
|
|
CpuFeaturesList.Insert(++LineIndex, "/* Check Houdini Binary Translator is installed on the system.");
|
|
CpuFeaturesList.Insert(++LineIndex, " *");
|
|
CpuFeaturesList.Insert(++LineIndex, " * If this function returns 1, get_elf_hwcap_from_getauxval() function");
|
|
CpuFeaturesList.Insert(++LineIndex, " * will causes SIGSEGV while calling getauxval() function.");
|
|
CpuFeaturesList.Insert(++LineIndex, " */");
|
|
CpuFeaturesList.Insert(++LineIndex, "static int");
|
|
CpuFeaturesList.Insert(++LineIndex, "has_houdini_binary_translator(void) {");
|
|
CpuFeaturesList.Insert(++LineIndex, " int found = 0;");
|
|
CpuFeaturesList.Insert(++LineIndex, " if (access(\"/system/lib/libhoudini.so\", F_OK) != -1) {");
|
|
CpuFeaturesList.Insert(++LineIndex, " D(\"Found Houdini binary translator\\n\");");
|
|
CpuFeaturesList.Insert(++LineIndex, " found = 1;");
|
|
CpuFeaturesList.Insert(++LineIndex, " }");
|
|
CpuFeaturesList.Insert(++LineIndex, " return found;");
|
|
CpuFeaturesList.Insert(++LineIndex, "}");
|
|
CpuFeaturesList.Insert(++LineIndex, "");
|
|
|
|
// Add the Houdini check call
|
|
while (!CpuFeaturesList[++LineIndex].Contains("/* Extract the list of CPU features from ELF hwcaps */")) ;
|
|
CpuFeaturesList.Insert(LineIndex++, " /* Check Houdini binary translator is installed */");
|
|
CpuFeaturesList.Insert(LineIndex++, " int has_houdini = has_houdini_binary_translator();");
|
|
CpuFeaturesList.Insert(LineIndex++, "");
|
|
|
|
// Make the get_elf_hwcap_from_getauxval() calls conditional
|
|
while (!CpuFeaturesList[++LineIndex].Contains("hwcaps = get_elf_hwcap_from_getauxval(AT_HWCAP);")) ;
|
|
CpuFeaturesList.Insert(LineIndex++, " if (!has_houdini) {");
|
|
CpuFeaturesList.Insert(++LineIndex, " }");
|
|
while (!CpuFeaturesList[++LineIndex].Contains("hwcaps2 = get_elf_hwcap_from_getauxval(AT_HWCAP2);")) ;
|
|
CpuFeaturesList.Insert(LineIndex++, " if (!has_houdini) {");
|
|
CpuFeaturesList.Insert(++LineIndex, " }");
|
|
|
|
File.WriteAllLines(CpuFeaturesPatchedFile, CpuFeaturesList.ToArray());
|
|
}
|
|
else
|
|
{
|
|
File.WriteAllLines(CpuFeaturesPatchedFile, CpuFeaturesLines);
|
|
}
|
|
}
|
|
SourceFiles.Add(FileItem.GetItemByPath(CpuFeaturesPatchedFile));
|
|
}
|
|
}
|
|
|
|
void GenerateEmptyLinkFunctionsForRemovedModules(List<FileItem> SourceFiles, string ModuleName, DirectoryReference OutputDirectory)
|
|
{
|
|
// Only add to UELinkerFixups module
|
|
if (!ModuleName.Equals("Launch"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
string LinkerExceptionsName = "../UELinkerExceptions";
|
|
FileReference LinkerExceptionsCPPFilename = FileReference.Combine(OutputDirectory, LinkerExceptionsName + ".cpp");
|
|
|
|
// Create the cpp filename
|
|
if (!LinkerExceptionsCPPFilename.Exists())
|
|
{
|
|
// Create a dummy file in case it doesn't exist yet so that the module does not complain it's not there
|
|
ResponseFile.Create(LinkerExceptionsCPPFilename, new List<string>());
|
|
}
|
|
|
|
var Result = new List<string>();
|
|
foreach (string Arch in Arches)
|
|
{
|
|
switch (Arch)
|
|
{
|
|
case "-armv7": Result.Add("#if PLATFORM_ANDROID_ARM"); break;
|
|
case "-arm64": Result.Add("#if PLATFORM_ANDROID_ARM64"); break;
|
|
case "-x86": Result.Add("#if PLATFORM_ANDROID_X86"); break;
|
|
case "-x64": Result.Add("#if PLATFORM_ANDROID_X64"); break;
|
|
default: Result.Add("#if PLATFORM_ANDROID_ARM"); break;
|
|
}
|
|
|
|
foreach (var ModName in ModulesToSkip[Arch])
|
|
{
|
|
Result.Add(" void EmptyLinkFunctionForStaticInitialization" + ModName + "(){}");
|
|
}
|
|
Result.Add("#endif");
|
|
}
|
|
|
|
// Determine if the file changed. Write it if it either doesn't exist or the contents are different.
|
|
bool bShouldWriteFile = true;
|
|
if (LinkerExceptionsCPPFilename.Exists())
|
|
{
|
|
string[] ExistingExceptionText = File.ReadAllLines(LinkerExceptionsCPPFilename.FullName);
|
|
string JoinedNewContents = string.Join("", Result.ToArray());
|
|
string JoinedOldContents = string.Join("", ExistingExceptionText);
|
|
bShouldWriteFile = (JoinedNewContents != JoinedOldContents);
|
|
}
|
|
|
|
// If we determined that we should write the file, write it now.
|
|
if (bShouldWriteFile)
|
|
{
|
|
ResponseFile.Create(LinkerExceptionsCPPFilename, Result);
|
|
}
|
|
|
|
SourceFiles.Add(FileItem.GetItemByFileReference(LinkerExceptionsCPPFilename));
|
|
}
|
|
|
|
// cache the location of NDK tools
|
|
static string ClangPath;
|
|
static string ToolchainParamsArm;
|
|
static string ToolchainParamsArm64;
|
|
static string ToolchainParamsx86;
|
|
static string ToolchainParamsx64;
|
|
static string ArPathArm;
|
|
static string ArPathArm64;
|
|
static string ArPathx86;
|
|
static string ArPathx64;
|
|
|
|
static public string GetStripExecutablePath(string UE4Arch)
|
|
{
|
|
string StripPath;
|
|
|
|
switch (UE4Arch)
|
|
{
|
|
case "-armv7": StripPath = ArPathArm; break;
|
|
case "-arm64": StripPath = ArPathArm64; break;
|
|
case "-x86": StripPath = ArPathx86; break;
|
|
case "-x64": StripPath = ArPathx64; break;
|
|
default: StripPath = ArPathArm; break;
|
|
}
|
|
return StripPath.Replace("-ar", "-strip");
|
|
}
|
|
|
|
static private bool bHasPrintedApiLevel = false;
|
|
public override CPPOutput CompileCPPFiles(UEBuildTarget Target, CPPEnvironment CompileEnvironment, List<FileItem> SourceFiles, string ModuleName)
|
|
{
|
|
if (Arches.Count == 0)
|
|
{
|
|
throw new BuildException("At least one architecture (armv7, x86, etc) needs to be selected in the project settings to build");
|
|
}
|
|
|
|
if (!bHasPrintedApiLevel)
|
|
{
|
|
Console.WriteLine("Compiling Native code with NDK API '{0}'", GetNdkApiLevel());
|
|
bHasPrintedApiLevel = true;
|
|
}
|
|
|
|
string BaseArguments = "";
|
|
|
|
if (CompileEnvironment.Config.PrecompiledHeaderAction != PrecompiledHeaderAction.Create)
|
|
{
|
|
BaseArguments += " -Werror";
|
|
|
|
}
|
|
|
|
// Directly added NDK files for NDK extensions
|
|
ConditionallyAddNDKSourceFiles(SourceFiles, ModuleName);
|
|
|
|
// Deal with dynamic modules removed by architecture
|
|
GenerateEmptyLinkFunctionsForRemovedModules(SourceFiles, ModuleName, CompileEnvironment.Config.OutputDirectory);
|
|
|
|
// Add preprocessor definitions to the argument list.
|
|
foreach (string Definition in CompileEnvironment.Config.Definitions)
|
|
{
|
|
BaseArguments += string.Format(" -D \"{0}\"", Definition);
|
|
}
|
|
|
|
var BuildPlatform = UEBuildPlatform.GetBuildPlatformForCPPTargetPlatform(CompileEnvironment.Config.Target.Platform);
|
|
var NDKRoot = Environment.GetEnvironmentVariable("NDKROOT").Replace("\\", "/");
|
|
|
|
string BasePCHName = "";
|
|
var PCHExtension = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.Android).GetBinaryExtension(UEBuildBinaryType.PrecompiledHeader);
|
|
if (CompileEnvironment.Config.PrecompiledHeaderAction == PrecompiledHeaderAction.Include)
|
|
{
|
|
BasePCHName = RemoveArchName(CompileEnvironment.PrecompiledHeaderFile.AbsolutePath).Replace(PCHExtension, "");
|
|
}
|
|
|
|
// Create a compile action for each source file.
|
|
CPPOutput Result = new CPPOutput();
|
|
foreach (string Arch in Arches)
|
|
{
|
|
if (ShouldSkipModule(ModuleName, Arch))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
foreach (string GPUArchitecture in GPUArchitectures)
|
|
{
|
|
// which toolchain to use
|
|
string Arguments = GetCLArguments_Global(CompileEnvironment, Arch) + BaseArguments;
|
|
|
|
switch (Arch)
|
|
{
|
|
case "-armv7": Arguments += " -DPLATFORM_64BITS=0 -DPLATFORM_ANDROID_ARM=1"; break;
|
|
case "-arm64": Arguments += " -DPLATFORM_64BITS=1 -DPLATFORM_ANDROID_ARM64=1"; break;
|
|
case "-x86": Arguments += " -DPLATFORM_64BITS=0 -DPLATFORM_ANDROID_X86=1"; break;
|
|
case "-x64": Arguments += " -DPLATFORM_64BITS=1 -DPLATFORM_ANDROID_X64=1"; break;
|
|
default: Arguments += " -DPLATFORM_64BITS=0 -DPLATFORM_ANDROID_ARM=1"; break;
|
|
}
|
|
|
|
if (GPUArchitecture == "-esdeferred")
|
|
{
|
|
Arguments += " -DPLATFORM_ANDROIDESDEFERRED=1";
|
|
}
|
|
|
|
// which PCH file to include
|
|
string PCHArguments = "";
|
|
if (CompileEnvironment.Config.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.
|
|
PCHArguments += string.Format(" -include \"{0}\"", InlineArchName(BasePCHName, Arch, GPUArchitecture));
|
|
}
|
|
|
|
// Add include paths to the argument list (filtered by architecture)
|
|
foreach (string IncludePath in CompileEnvironment.Config.CPPIncludeInfo.SystemIncludePaths)
|
|
{
|
|
if (IsDirectoryForArch(IncludePath, Arch))
|
|
{
|
|
Arguments += string.Format(" -I\"{0}\"", IncludePath);
|
|
}
|
|
}
|
|
foreach (string IncludePath in CompileEnvironment.Config.CPPIncludeInfo.IncludePaths)
|
|
{
|
|
if (IsDirectoryForArch(IncludePath, Arch))
|
|
{
|
|
Arguments += string.Format(" -I\"{0}\"", IncludePath);
|
|
}
|
|
}
|
|
|
|
foreach (FileItem SourceFile in SourceFiles)
|
|
{
|
|
Action CompileAction = new Action(ActionType.Compile);
|
|
string FileArguments = "";
|
|
bool bIsPlainCFile = Path.GetExtension(SourceFile.AbsolutePath).ToUpperInvariant() == ".C";
|
|
bool bDisableShadowWarning = false;
|
|
|
|
// should we disable optimizations on this file?
|
|
// @todo android - We wouldn't need this if we could disable optimizations per function (via pragma)
|
|
bool bDisableOptimizations = false;// SourceFile.AbsolutePath.ToUpperInvariant().IndexOf("\\SLATE\\") != -1;
|
|
if (bDisableOptimizations && CompileEnvironment.Config.Target.Configuration != CPPTargetConfiguration.Debug)
|
|
{
|
|
Log.TraceWarning("Disabling optimizations on {0}", SourceFile.AbsolutePath);
|
|
}
|
|
|
|
bDisableOptimizations = bDisableOptimizations || CompileEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug;
|
|
|
|
// Add C or C++ specific compiler arguments.
|
|
if (CompileEnvironment.Config.PrecompiledHeaderAction == PrecompiledHeaderAction.Create)
|
|
{
|
|
FileArguments += GetCompileArguments_PCH(bDisableOptimizations);
|
|
}
|
|
else if (bIsPlainCFile)
|
|
{
|
|
FileArguments += GetCompileArguments_C(bDisableOptimizations);
|
|
|
|
// remove shadow variable warnings for NDK files
|
|
if (SourceFile.AbsolutePath.Replace("\\", "/").StartsWith(NDKRoot))
|
|
{
|
|
bDisableShadowWarning = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
FileArguments += GetCompileArguments_CPP(bDisableOptimizations);
|
|
|
|
// only use PCH for .cpp files
|
|
FileArguments += PCHArguments;
|
|
}
|
|
|
|
// Add the C++ source file and its included files to the prerequisite item list.
|
|
AddPrerequisiteSourceFile(Target, BuildPlatform, CompileEnvironment, SourceFile, CompileAction.PrerequisiteItems);
|
|
|
|
if (CompileEnvironment.Config.PrecompiledHeaderAction == PrecompiledHeaderAction.Create)
|
|
{
|
|
// Add the precompiled header file to the produced item list.
|
|
FileItem PrecompiledHeaderFile = FileItem.GetItemByFileReference(
|
|
FileReference.Combine(
|
|
CompileEnvironment.Config.OutputDirectory,
|
|
Path.GetFileName(InlineArchName(SourceFile.AbsolutePath, Arch, GPUArchitecture) + PCHExtension)
|
|
)
|
|
);
|
|
|
|
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, false);
|
|
}
|
|
else
|
|
{
|
|
if (CompileEnvironment.Config.PrecompiledHeaderAction == PrecompiledHeaderAction.Include)
|
|
{
|
|
CompileAction.bIsUsingPCH = true;
|
|
FileItem ArchPrecompiledHeaderFile = FileItem.GetItemByPath(InlineArchName(BasePCHName, Arch, GPUArchitecture) + PCHExtension);
|
|
CompileAction.PrerequisiteItems.Add(ArchPrecompiledHeaderFile);
|
|
}
|
|
|
|
var ObjectFileExtension = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.Android).GetBinaryExtension(UEBuildBinaryType.Object);
|
|
|
|
// Add the object file to the produced item list.
|
|
FileItem ObjectFile = FileItem.GetItemByFileReference(
|
|
FileReference.Combine(
|
|
CompileEnvironment.Config.OutputDirectory,
|
|
InlineArchName(Path.GetFileName(SourceFile.AbsolutePath) + ObjectFileExtension, Arch, GPUArchitecture)
|
|
)
|
|
);
|
|
CompileAction.ProducedItems.Add(ObjectFile);
|
|
Result.ObjectFiles.Add(ObjectFile);
|
|
|
|
FileArguments += string.Format(" -o \"{0}\"", ObjectFile.AbsolutePath, false);
|
|
}
|
|
|
|
// Add the source file path to the command-line.
|
|
FileArguments += string.Format(" \"{0}\"", SourceFile.AbsolutePath);
|
|
|
|
// Build a full argument list
|
|
string AllArguments = Arguments + FileArguments + CompileEnvironment.Config.AdditionalArguments;
|
|
AllArguments = ActionThread.ExpandEnvironmentVariables(AllArguments);
|
|
AllArguments = AllArguments.Replace("\\", "/");
|
|
|
|
// Remove shadow warning for this file if requested
|
|
if (bDisableShadowWarning)
|
|
{
|
|
int WarningIndex = AllArguments.IndexOf(" -Wshadow");
|
|
if (WarningIndex > 0)
|
|
{
|
|
AllArguments = AllArguments.Remove(WarningIndex, 9);
|
|
}
|
|
}
|
|
|
|
// Create the response file
|
|
FileReference ResponseFileName = CompileAction.ProducedItems[0].Reference + ".response";
|
|
string ResponseArgument = string.Format("@\"{0}\"", ResponseFile.Create(ResponseFileName, new List<string> { AllArguments }).FullName);
|
|
|
|
CompileAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
|
|
CompileAction.CommandPath = ClangPath;
|
|
CompileAction.CommandArguments = ResponseArgument;
|
|
CompileAction.StatusDescription = string.Format("{0} [{1}-{2}]", Path.GetFileName(SourceFile.AbsolutePath), Arch.Replace("-", ""), GPUArchitecture.Replace("-", ""));
|
|
|
|
// VC++ always outputs the source file name being compiled, so we don't need to emit this ourselves
|
|
CompileAction.bShouldOutputStatusDescription = true;
|
|
|
|
// Don't farm out creation of pre-compiled headers as it is the critical path task.
|
|
CompileAction.bCanExecuteRemotely =
|
|
CompileEnvironment.Config.PrecompiledHeaderAction != PrecompiledHeaderAction.Create ||
|
|
BuildConfiguration.bAllowRemotelyCompiledPCHs;
|
|
}
|
|
}
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
static public string InlineArchName(string Pathname, string Arch, string GPUArchitecture)
|
|
{
|
|
return Path.Combine(Path.GetDirectoryName(Pathname), Path.GetFileNameWithoutExtension(Pathname) + Arch + GPUArchitecture + Path.GetExtension(Pathname));
|
|
}
|
|
|
|
public string RemoveArchName(string Pathname)
|
|
{
|
|
// remove all architecture names
|
|
foreach (string Arch in GetAllArchitectures())
|
|
{
|
|
foreach (string GPUArchitecture in GetAllGPUArchitectures())
|
|
{
|
|
Pathname = Path.Combine(Path.GetDirectoryName(Pathname), Path.GetFileName(Pathname).Replace(Arch + GPUArchitecture, ""));
|
|
}
|
|
}
|
|
return Pathname;
|
|
}
|
|
|
|
public override FileItem[] LinkAllFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly)
|
|
{
|
|
List<FileItem> Outputs = new List<FileItem>();
|
|
|
|
var NDKRoot = Environment.GetEnvironmentVariable("NDKROOT").Replace("\\", "/");
|
|
int NDKApiLevelInt = GetNdkApiLevelInt();
|
|
string OptionalLinkArguments;
|
|
|
|
for (int ArchIndex = 0; ArchIndex < Arches.Count; ArchIndex++)
|
|
{
|
|
string Arch = Arches[ArchIndex];
|
|
|
|
// 32-bit ABI may need fixup for removed bsd_signal in NDK11 for android-21+
|
|
OptionalLinkArguments = "";
|
|
if (NDKApiLevelInt >= 21)
|
|
{
|
|
// this file was added in NDK11 so use existence to detect (RELEASE.TXT no longer present)
|
|
if (File.Exists(Path.Combine(NDKRoot, "source.properties")))
|
|
{
|
|
switch (Arch)
|
|
{
|
|
case "-armv7":
|
|
OptionalLinkArguments = string.Format(" \"{0}\"", Path.Combine(UnrealBuildTool.EngineDirectory.FullName, "Build/Android/Prebuilt/bsdsignal/lib/armeabi-v7a/libbsdsignal.a"));
|
|
break;
|
|
|
|
case "-x86":
|
|
OptionalLinkArguments = string.Format(" \"{0}\"", Path.Combine(UnrealBuildTool.EngineDirectory.FullName, "Build/Android/Prebuilt/bsdsignal/lib/x86/libbsdsignal.a"));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (int GPUArchIndex = 0; GPUArchIndex < GPUArchitectures.Count; GPUArchIndex++)
|
|
{
|
|
string GPUArchitecture = GPUArchitectures[GPUArchIndex];
|
|
int OutputPathIndex = ArchIndex * GPUArchitectures.Count + GPUArchIndex;
|
|
|
|
// Android will have an array of outputs
|
|
if (LinkEnvironment.Config.OutputFilePaths.Count < OutputPathIndex ||
|
|
!LinkEnvironment.Config.OutputFilePaths[OutputPathIndex].GetFileNameWithoutExtension().EndsWith(Arch + GPUArchitecture))
|
|
{
|
|
throw new BuildException("The OutputFilePaths array didn't match the Arches array in AndroidToolChain.LinkAllFiles");
|
|
}
|
|
|
|
// Create an action that invokes the linker.
|
|
Action LinkAction = new Action(ActionType.Link);
|
|
LinkAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
|
|
|
|
if (LinkEnvironment.Config.bIsBuildingLibrary)
|
|
{
|
|
switch (Arch)
|
|
{
|
|
case "-armv7": LinkAction.CommandPath = ArPathArm; break;
|
|
case "-arm64": LinkAction.CommandPath = ArPathArm64; break;
|
|
case "-x86": LinkAction.CommandPath = ArPathx86; ; break;
|
|
case "-x64": LinkAction.CommandPath = ArPathx64; ; break;
|
|
default: LinkAction.CommandPath = ArPathArm; ; break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
LinkAction.CommandPath = ClangPath;
|
|
}
|
|
|
|
string LinkerPath = LinkAction.WorkingDirectory;
|
|
|
|
LinkAction.WorkingDirectory = LinkEnvironment.Config.IntermediateDirectory.FullName;
|
|
|
|
// Get link arguments.
|
|
LinkAction.CommandArguments = LinkEnvironment.Config.bIsBuildingLibrary ? GetArArguments(LinkEnvironment) : GetLinkArguments(LinkEnvironment, Arch);
|
|
|
|
// Add the output file as a production of the link action.
|
|
FileItem OutputFile;
|
|
OutputFile = FileItem.GetItemByFileReference(LinkEnvironment.Config.OutputFilePaths[OutputPathIndex]);
|
|
Outputs.Add(OutputFile);
|
|
LinkAction.ProducedItems.Add(OutputFile);
|
|
LinkAction.StatusDescription = string.Format("{0}", Path.GetFileName(OutputFile.AbsolutePath));
|
|
|
|
// LinkAction.bPrintDebugInfo = true;
|
|
|
|
// Add the output file to the command-line.
|
|
if (LinkEnvironment.Config.bIsBuildingLibrary)
|
|
{
|
|
LinkAction.CommandArguments += string.Format(" \"{0}\"", OutputFile.AbsolutePath);
|
|
}
|
|
else
|
|
{
|
|
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> InputFileNames = new List<string>();
|
|
foreach (FileItem InputFile in LinkEnvironment.InputFiles)
|
|
{
|
|
// make sure it's for current Arch
|
|
if (Path.GetFileNameWithoutExtension(InputFile.AbsolutePath).EndsWith(Arch + GPUArchitecture))
|
|
{
|
|
string AbsolutePath = InputFile.AbsolutePath.Replace("\\", "/");
|
|
|
|
AbsolutePath = AbsolutePath.Replace(LinkEnvironment.Config.IntermediateDirectory.FullName.Replace("\\", "/"), "");
|
|
AbsolutePath = AbsolutePath.TrimStart(new char[] { '/' });
|
|
|
|
InputFileNames.Add(string.Format("\"{0}\"", AbsolutePath));
|
|
LinkAction.PrerequisiteItems.Add(InputFile);
|
|
}
|
|
}
|
|
|
|
FileReference ResponseFileName = GetResponseFileName(LinkEnvironment, OutputFile);
|
|
LinkAction.CommandArguments += string.Format(" @\"{0}\"", ResponseFile.Create(ResponseFileName, InputFileNames));
|
|
|
|
// libs don't link in other libs
|
|
if (!LinkEnvironment.Config.bIsBuildingLibrary)
|
|
{
|
|
// Add the library paths to the argument list.
|
|
foreach (string LibraryPath in LinkEnvironment.Config.LibraryPaths)
|
|
{
|
|
// LinkerPaths could be relative or absolute
|
|
string AbsoluteLibraryPath = ActionThread.ExpandEnvironmentVariables(LibraryPath);
|
|
if (IsDirectoryForArch(AbsoluteLibraryPath, Arch))
|
|
{
|
|
// environment variables aren't expanded when using the $( style
|
|
if (Path.IsPathRooted(AbsoluteLibraryPath) == false)
|
|
{
|
|
AbsoluteLibraryPath = Path.Combine(LinkerPath, AbsoluteLibraryPath);
|
|
}
|
|
LinkAction.CommandArguments += string.Format(" -L\"{0}\"", AbsoluteLibraryPath);
|
|
}
|
|
}
|
|
|
|
// add libraries in a library group
|
|
LinkAction.CommandArguments += string.Format(" -Wl,--start-group");
|
|
foreach (string AdditionalLibrary in LinkEnvironment.Config.AdditionalLibraries)
|
|
{
|
|
if (!ShouldSkipLib(AdditionalLibrary, Arch, GPUArchitecture))
|
|
{
|
|
if (String.IsNullOrEmpty(Path.GetDirectoryName(AdditionalLibrary)))
|
|
{
|
|
LinkAction.CommandArguments += string.Format(" \"-l{0}\"", AdditionalLibrary);
|
|
}
|
|
else
|
|
{
|
|
// full pathed libs are compiled by us, so we depend on linking them
|
|
LinkAction.CommandArguments += string.Format(" \"{0}\"", Path.GetFullPath(AdditionalLibrary));
|
|
LinkAction.PrerequisiteItems.Add(FileItem.GetItemByPath(AdditionalLibrary));
|
|
}
|
|
}
|
|
}
|
|
LinkAction.CommandArguments += OptionalLinkArguments;
|
|
LinkAction.CommandArguments += string.Format(" -Wl,--end-group");
|
|
}
|
|
|
|
// Add the additional arguments specified by the environment.
|
|
LinkAction.CommandArguments += LinkEnvironment.Config.AdditionalArguments;
|
|
LinkAction.CommandArguments = LinkAction.CommandArguments.Replace("\\", "/");
|
|
|
|
// Only execute linking on the local PC.
|
|
LinkAction.bCanExecuteRemotely = false;
|
|
}
|
|
}
|
|
|
|
return Outputs.ToArray();
|
|
}
|
|
|
|
public override void ModifyBuildProducts(UEBuildBinary Binary, Dictionary<FileReference, BuildProductType> BuildProducts)
|
|
{
|
|
// the binary will have all of the .so's in the output files, we need to trim down to the shared apk (which is what needs to go into the manifest)
|
|
if (Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
|
|
{
|
|
foreach (FileReference BinaryPath in Binary.Config.OutputFilePaths)
|
|
{
|
|
FileReference ApkFile = BinaryPath.ChangeExtension(".apk");
|
|
BuildProducts.Add(ApkFile, BuildProductType.Executable);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void CompileCSharpProject(CSharpEnvironment CompileEnvironment, FileReference ProjectFileName, FileReference DestinationFile)
|
|
{
|
|
throw new BuildException("Android cannot compile C# files");
|
|
}
|
|
|
|
public static void OutputReceivedDataEventHandler(Object Sender, DataReceivedEventArgs Line)
|
|
{
|
|
if ((Line != null) && (Line.Data != null))
|
|
{
|
|
Log.TraceInformation(Line.Data);
|
|
}
|
|
}
|
|
|
|
public override void StripSymbols(string SourceFileName, string TargetFileName)
|
|
{
|
|
File.Copy(SourceFileName, TargetFileName, true);
|
|
|
|
ProcessStartInfo StartInfo = new ProcessStartInfo();
|
|
if (SourceFileName.Contains("-armv7"))
|
|
{
|
|
StartInfo.FileName = ArPathArm.Replace("-ar.exe", "-strip.exe");
|
|
}
|
|
else
|
|
if (SourceFileName.Contains("-arm64"))
|
|
{
|
|
StartInfo.FileName = ArPathArm64.Replace("-ar.exe", "-strip.exe");
|
|
}
|
|
else
|
|
if (SourceFileName.Contains("-x86"))
|
|
{
|
|
StartInfo.FileName = ArPathx86.Replace("-ar.exe", "-strip.exe");
|
|
}
|
|
else
|
|
if (SourceFileName.Contains("-x64"))
|
|
{
|
|
StartInfo.FileName = ArPathx64.Replace("-ar.exe", "-strip.exe");
|
|
}
|
|
else
|
|
{
|
|
throw new BuildException("Couldn't determine Android architecture to strip symbols from {0}", SourceFileName);
|
|
}
|
|
StartInfo.Arguments = "--strip-debug " + TargetFileName;
|
|
StartInfo.UseShellExecute = false;
|
|
StartInfo.CreateNoWindow = true;
|
|
Utils.RunLocalProcessAndLogOutput(StartInfo);
|
|
}
|
|
};
|
|
}
|