Esempio n. 1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public CppCompileEnvironment(CppPlatform Platform, CppConfiguration Configuration, string Architecture, CPPHeaders Headers)
 {
     this.Platform      = Platform;
     this.Configuration = Configuration;
     this.Architecture  = Architecture;
     this.Headers       = Headers;
 }
Esempio n. 2
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="Other">Environment to copy settings from</param>
 public CppCompileEnvironment(CppCompileEnvironment Other)
 {
     Platform      = Other.Platform;
     Configuration = Other.Configuration;
     Architecture  = Other.Architecture;
     MetadataCache = Other.MetadataCache;
     SharedPCHs    = Other.SharedPCHs;
     PrecompiledHeaderIncludeFilename = Other.PrecompiledHeaderIncludeFilename;
     PrecompiledHeaderAction          = Other.PrecompiledHeaderAction;
     bUseSharedBuildEnvironment       = Other.bUseSharedBuildEnvironment;
     bUseRTTI     = Other.bUseRTTI;
     bUseInlining = Other.bUseInlining;
     bCompileISPC = Other.bCompileISPC;
     bUseAVX      = Other.bUseAVX;
     bUseUnity    = Other.bUseUnity;
     MinSourceFilesForUnityBuildOverride    = Other.MinSourceFilesForUnityBuildOverride;
     MinFilesUsingPrecompiledHeaderOverride = Other.MinFilesUsingPrecompiledHeaderOverride;
     bBuildLocallyWithSNDBS               = Other.bBuildLocallyWithSNDBS;
     bEnableExceptions                    = Other.bEnableExceptions;
     bEnableObjCExceptions                = Other.bEnableObjCExceptions;
     ShadowVariableWarningLevel           = Other.ShadowVariableWarningLevel;
     UnsafeTypeCastWarningLevel           = Other.UnsafeTypeCastWarningLevel;
     bUndefinedIdentifierWarningsAsErrors = Other.bUndefinedIdentifierWarningsAsErrors;
     bEnableUndefinedIdentifierWarnings   = Other.bEnableUndefinedIdentifierWarnings;
     bOptimizeCode           = Other.bOptimizeCode;
     bOptimizeForSize        = Other.bOptimizeForSize;
     bCreateDebugInfo        = Other.bCreateDebugInfo;
     bIsBuildingLibrary      = Other.bIsBuildingLibrary;
     bIsBuildingDLL          = Other.bIsBuildingDLL;
     bUseStaticCRT           = Other.bUseStaticCRT;
     bUseDebugCRT            = Other.bUseDebugCRT;
     bOmitFramePointers      = Other.bOmitFramePointers;
     bEnableOSX109Support    = Other.bEnableOSX109Support;
     bUsePDBFiles            = Other.bUsePDBFiles;
     bPreprocessOnly         = Other.bPreprocessOnly;
     bSupportEditAndContinue = Other.bSupportEditAndContinue;
     bUseIncrementalLinking  = Other.bUseIncrementalLinking;
     bAllowLTCG                         = Other.bAllowLTCG;
     bPGOOptimize                       = Other.bPGOOptimize;
     bPGOProfile                        = Other.bPGOProfile;
     PGOFilenamePrefix                  = Other.PGOFilenamePrefix;
     PGODirectory                       = Other.PGODirectory;
     bPrintTimingInfo                   = Other.bPrintTimingInfo;
     bGenerateDependenciesFile          = Other.bGenerateDependenciesFile;
     bAllowRemotelyCompiledPCHs         = Other.bAllowRemotelyCompiledPCHs;
     UserIncludePaths                   = new HashSet <DirectoryReference>(Other.UserIncludePaths);
     SystemIncludePaths                 = new HashSet <DirectoryReference>(Other.SystemIncludePaths);
     bCheckSystemHeadersForModification = Other.bCheckSystemHeadersForModification;
     ForceIncludeFiles.AddRange(Other.ForceIncludeFiles);
     AdditionalPrerequisites.AddRange(Other.AdditionalPrerequisites);
     Definitions.AddRange(Other.Definitions);
     AdditionalArguments = Other.AdditionalArguments;
     AdditionalFrameworks.AddRange(Other.AdditionalFrameworks);
     PrecompiledHeaderFile = Other.PrecompiledHeaderFile;
     bHackHeaderGenerator  = Other.bHackHeaderGenerator;
     bHideSymbolsByDefault = Other.bHideSymbolsByDefault;
     CppStandard           = Other.CppStandard;
 }
Esempio n. 3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 public LinkEnvironment(LinkEnvironment Other)
 {
     Platform              = Other.Platform;
     Configuration         = Other.Configuration;
     Architecture          = Other.Architecture;
     BundleDirectory       = Other.BundleDirectory;
     OutputDirectory       = Other.OutputDirectory;
     IntermediateDirectory = Other.IntermediateDirectory;
     LocalShadowDirectory  = Other.LocalShadowDirectory;
     OutputFilePaths       = Other.OutputFilePaths.ToList();
     LibraryPaths.AddRange(Other.LibraryPaths);
     ExcludedLibraries.AddRange(Other.ExcludedLibraries);
     AdditionalLibraries.AddRange(Other.AdditionalLibraries);
     RuntimeLibraryPaths.AddRange(Other.RuntimeLibraryPaths);
     Frameworks.AddRange(Other.Frameworks);
     AdditionalFrameworks.AddRange(Other.AdditionalFrameworks);
     WeakFrameworks.AddRange(Other.WeakFrameworks);
     AdditionalBundleResources.AddRange(Other.AdditionalBundleResources);
     DelayLoadDLLs.AddRange(Other.DelayLoadDLLs);
     AdditionalArguments         = Other.AdditionalArguments;
     bCreateDebugInfo            = Other.bCreateDebugInfo;
     bGenerateRuntimeSymbolFiles = Other.bGenerateRuntimeSymbolFiles;
     bIsBuildingLibrary          = Other.bIsBuildingLibrary;
     bDisableSymbolCache         = Other.bDisableSymbolCache;
     bIsBuildingDLL = Other.bIsBuildingDLL;
     bIsBuildingConsoleApplication = Other.bIsBuildingConsoleApplication;
     WindowsEntryPointOverride     = Other.WindowsEntryPointOverride;
     bIsCrossReferenced            = Other.bIsCrossReferenced;
     bHasExports = Other.bHasExports;
     bIsBuildingDotNetAssembly = Other.bIsBuildingDotNetAssembly;
     DefaultStackSize          = Other.DefaultStackSize;
     DefaultStackSizeCommit    = Other.DefaultStackSizeCommit;
     bOptimizeForSize          = Other.bOptimizeForSize;
     bOmitFramePointers        = Other.bOmitFramePointers;
     bSupportEditAndContinue   = Other.bSupportEditAndContinue;
     bUseIncrementalLinking    = Other.bUseIncrementalLinking;
     bAllowLTCG               = Other.bAllowLTCG;
     bPGOOptimize             = Other.bPGOOptimize;
     bPGOProfile              = Other.bPGOProfile;
     PGODirectory             = Other.PGODirectory;
     PGOFilenamePrefix        = Other.PGOFilenamePrefix;
     bCreateMapFile           = Other.bCreateMapFile;
     bAllowASLR               = Other.bAllowASLR;
     bUsePDBFiles             = Other.bUsePDBFiles;
     bUseFastPDBLinking       = Other.bUseFastPDBLinking;
     bIgnoreUnresolvedSymbols = Other.bIgnoreUnresolvedSymbols;
     bPrintTimingInfo         = Other.bPrintTimingInfo;
     BundleVersion            = Other.BundleVersion;
     InstallName              = Other.InstallName;
     InputFiles.AddRange(Other.InputFiles);
     DefaultResourceFiles.AddRange(Other.DefaultResourceFiles);
     CommonResourceFiles.AddRange(Other.CommonResourceFiles);
     IncludeFunctions.AddRange(Other.IncludeFunctions);
     ModuleDefinitionFile = Other.ModuleDefinitionFile;
     AdditionalProperties.AddRange(Other.AdditionalProperties);
 }
 /// <summary>
 /// Default constructor.
 /// </summary>
 public CppCompileEnvironment(CppPlatform Platform, CppConfiguration Configuration, string Architecture, SourceFileMetadataCache MetadataCache)
 {
     this.Platform           = Platform;
     this.Configuration      = Configuration;
     this.Architecture       = Architecture;
     this.MetadataCache      = MetadataCache;
     this.SharedPCHs         = new List <PrecompiledHeaderTemplate>();
     this.UserIncludePaths   = new HashSet <DirectoryReference>();
     this.SystemIncludePaths = new HashSet <DirectoryReference>();
 }
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="Other">Environment to copy settings from</param>
 public CppCompileEnvironment(CppCompileEnvironment Other)
 {
     Platform                         = Other.Platform;
     Configuration                    = Other.Configuration;
     Architecture                     = Other.Architecture;
     OutputDirectory                  = Other.OutputDirectory;
     PCHOutputDirectory               = Other.PCHOutputDirectory;
     LocalShadowDirectory             = Other.LocalShadowDirectory;
     PrecompiledHeaderIncludeFilename = Other.PrecompiledHeaderIncludeFilename;
     PrecompiledHeaderAction          = Other.PrecompiledHeaderAction;
     bUseRTTI                         = Other.bUseRTTI;
     bUseInlining                     = Other.bUseInlining;
     bUseAVX             = Other.bUseAVX;
     bFasterWithoutUnity = Other.bFasterWithoutUnity;
     MinSourceFilesForUnityBuildOverride    = Other.MinSourceFilesForUnityBuildOverride;
     MinFilesUsingPrecompiledHeaderOverride = Other.MinFilesUsingPrecompiledHeaderOverride;
     bBuildLocallyWithSNDBS               = Other.bBuildLocallyWithSNDBS;
     bEnableExceptions                    = Other.bEnableExceptions;
     bEnableObjCExceptions                = Other.bEnableObjCExceptions;
     bShadowVariableWarningsAsErrors      = Other.bShadowVariableWarningsAsErrors;
     bEnableShadowVariableWarnings        = Other.bEnableShadowVariableWarnings;
     bUndefinedIdentifierWarningsAsErrors = Other.bUndefinedIdentifierWarningsAsErrors;
     bEnableUndefinedIdentifierWarnings   = Other.bEnableUndefinedIdentifierWarnings;
     bOptimizeCode           = Other.bOptimizeCode;
     bOptimizeForSize        = Other.bOptimizeForSize;
     bCreateDebugInfo        = Other.bCreateDebugInfo;
     bIsBuildingLibrary      = Other.bIsBuildingLibrary;
     bIsBuildingDLL          = Other.bIsBuildingDLL;
     bUseStaticCRT           = Other.bUseStaticCRT;
     bUseDebugCRT            = Other.bUseDebugCRT;
     bOmitFramePointers      = Other.bOmitFramePointers;
     bEnableOSX109Support    = Other.bEnableOSX109Support;
     bUsePDBFiles            = Other.bUsePDBFiles;
     bSupportEditAndContinue = Other.bSupportEditAndContinue;
     bUseIncrementalLinking  = Other.bUseIncrementalLinking;
     bAllowLTCG                 = Other.bAllowLTCG;
     bPGOOptimize               = Other.bPGOOptimize;
     bPGOProfile                = Other.bPGOProfile;
     PGOFilenamePrefix          = Other.PGOFilenamePrefix;
     PGODirectory               = Other.PGODirectory;
     bPrintTimingInfo           = Other.bPrintTimingInfo;
     bAllowRemotelyCompiledPCHs = Other.bAllowRemotelyCompiledPCHs;
     IncludePaths               = new CppIncludePaths(Other.IncludePaths);
     ForceIncludeFiles.AddRange(Other.ForceIncludeFiles);
     Definitions.AddRange(Other.Definitions);
     AdditionalArguments = Other.AdditionalArguments;
     AdditionalFrameworks.AddRange(Other.AdditionalFrameworks);
     PrecompiledHeaderFile = Other.PrecompiledHeaderFile;
     Headers = Other.Headers;
     bHackHeaderGenerator  = Other.bHackHeaderGenerator;
     bHideSymbolsByDefault = Other.bHideSymbolsByDefault;
 }
Esempio n. 6
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 public LinkEnvironment(LinkEnvironment Other)
 {
     Platform              = Other.Platform;
     Configuration         = Other.Configuration;
     Architecture          = Other.Architecture;
     OutputDirectory       = Other.OutputDirectory;
     IntermediateDirectory = Other.IntermediateDirectory;
     LocalShadowDirectory  = Other.LocalShadowDirectory;
     OutputFilePaths       = Other.OutputFilePaths.ToList();
     ProjectFile           = Other.ProjectFile;
     LibraryPaths.AddRange(Other.LibraryPaths);
     ExcludedLibraries.AddRange(Other.ExcludedLibraries);
     AdditionalLibraries.AddRange(Other.AdditionalLibraries);
     Frameworks.AddRange(Other.Frameworks);
     AdditionalShadowFiles.AddRange(Other.AdditionalShadowFiles);
     AdditionalFrameworks.AddRange(Other.AdditionalFrameworks);
     WeakFrameworks.AddRange(Other.WeakFrameworks);
     AdditionalBundleResources.AddRange(Other.AdditionalBundleResources);
     DelayLoadDLLs.AddRange(Other.DelayLoadDLLs);
     AdditionalArguments           = Other.AdditionalArguments;
     bCreateDebugInfo              = Other.bCreateDebugInfo;
     bIsBuildingLibrary            = Other.bIsBuildingLibrary;
     bDisableSymbolCache           = Other.bDisableSymbolCache;
     bIsBuildingDLL                = Other.bIsBuildingDLL;
     bIsBuildingConsoleApplication = Other.bIsBuildingConsoleApplication;
     WindowsEntryPointOverride     = Other.WindowsEntryPointOverride;
     bIsCrossReferenced            = Other.bIsCrossReferenced;
     bHasExports = Other.bHasExports;
     bIsBuildingDotNetAssembly = Other.bIsBuildingDotNetAssembly;
     bOptimizeForSize          = Other.bOptimizeForSize;
     bOmitFramePointers        = Other.bOmitFramePointers;
     bSupportEditAndContinue   = Other.bSupportEditAndContinue;
     bUseIncrementalLinking    = Other.bUseIncrementalLinking;
     bAllowLTCG         = Other.bAllowLTCG;
     bCreateMapFile     = Other.bCreateMapFile;
     bAllowALSR         = Other.bAllowALSR;
     bUsePDBFiles       = Other.bUsePDBFiles;
     bUseFastPDBLinking = Other.bUseFastPDBLinking;
     bPrintTimingInfo   = Other.bPrintTimingInfo;
     BundleVersion      = Other.BundleVersion;
     InputFiles.AddRange(Other.InputFiles);
     InputLibraries.AddRange(Other.InputLibraries);
     DefaultResourceFiles.AddRange(Other.DefaultResourceFiles);
     CommonResourceFiles.AddRange(Other.CommonResourceFiles);
 }
        }                                                                                               // noop

        static void PrintOnceOn(CppConfiguration Configuration, bool bOptimizeForSize)
        {
            if (Configuration == CppConfiguration.Debug)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -O0 faster compile time");
            }
            else if (bOptimizeForSize)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -Oz favor size over speed");
            }
            else if (Configuration == CppConfiguration.Development)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -O2 aggressive size and speed optimization");
            }
            else if (Configuration == CppConfiguration.Shipping)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -O3 favor speed over size");
            }
            PrintOnce = new VerbosePrint(PrintOnceOff);             // clear
        }
Esempio n. 8
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public LinkEnvironment(CppPlatform Platform, CppConfiguration Configuration, string Architecture)
 {
     this.Platform      = Platform;
     this.Configuration = Configuration;
     this.Architecture  = Architecture;
 }
Esempio n. 9
0
 public override string GetArchitectureArgument(CppConfiguration Configuration, string UBTArchitecture)
 {
     // TV is only arm64
     return(" -arch " + (UBTArchitecture == "-simulator" ? "i386" : "arm64"));
 }
Esempio n. 10
0
        string GetSharedArguments_Global(CppConfiguration Configuration, bool bOptimizeForSize, string Architecture, bool bEnableShadowVariableWarnings, bool bShadowVariableWarningsAsErrors, bool bEnableUndefinedIdentifierWarnings, bool bUndefinedIdentifierWarningsAsErrors, bool bUseInlining)
        {
            string Result = " ";

//			string Result = " -Werror";

            Result += " -fdiagnostics-format=msvc";
            Result += " -fno-exceptions";

            Result += " -Wdelete-non-virtual-dtor";
            Result += " -Wno-switch";                                     // many unhandled cases
            Result += " -Wno-tautological-constant-out-of-range-compare"; // comparisons from TCHAR being a char
            Result += " -Wno-tautological-compare";                       // comparison of unsigned expression < 0 is always false" (constant comparisons, which are possible with template arguments)
            Result += " -Wno-tautological-undefined-compare";             // pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate
            Result += " -Wno-inconsistent-missing-override";              // as of 1.35.0, overriding a member function but not marked as 'override' triggers warnings
            Result += " -Wno-undefined-var-template";                     // 1.36.11
            Result += " -Wno-invalid-offsetof";                           // using offsetof on non-POD types
            Result += " -Wno-gnu-string-literal-operator-template";       // allow static FNames

// no longer needed as of UE4.18
//			Result += " -Wno-array-bounds"; // some VectorLoads go past the end of the array, but it's okay in that case

            if (bEnableShadowVariableWarnings)
            {
                Result += " -Wshadow";                 //+ (bShadowVariableWarningsAsErrors ? "" : " -Wno-error=shadow");
            }

            if (bEnableUndefinedIdentifierWarnings)
            {
                Result += " -Wundef";                 //+ (bUndefinedIdentifierWarningsAsErrors ? "" : " -Wno-error=undef");
            }

            // --------------------------------------------------------------------------------

            if (Configuration == CppConfiguration.Debug)
            {                                     // WARNING: UEBuildTarget.cs :: GetCppConfiguration()
                Result += " -O0";                 // faster compile time				//          DebugGame is forced to Development
            }                                     // i.e. this will never get hit...

            else if (bOptimizeForSize)
            {                                     // Engine/Source/Programs/UnrealBuildTool/HTML5/UEBuildHTML5.cs
                Result += " -Oz";                 // favor size over speed				// bCompileForSize=true; // set false, to build -O2 or -O3
            }                                     // SOURCE BUILD ONLY

            else if (Configuration == CppConfiguration.Development)
            {
                Result += " -O2";                 // aggressive size and speed optimization
            }

            else if (Configuration == CppConfiguration.Shipping)
            {
                Result += " -O3";                 // favor speed over size
            }

            if (!bUseInlining)
            {
                Result += " -fno-inline-functions";
            }

            PrintOnce(Configuration, bOptimizeForSize);

            // --------------------------------------------------------------------------------

            // JavaScript option overrides (see src/settings.js)
            if (enableSIMD)
            {
                Result += " -msse2 -s SIMD=1";
            }

            if (enableMultithreading)
            {
                Result += " -s USE_PTHREADS=1";
            }

            // --------------------------------------------------------------------------------

            // Expect that Emscripten SDK has been properly set up ahead in time (with emsdk and prebundled toolchains this is always the case)
            // This speeds up builds a tiny bit.
            Environment.SetEnvironmentVariable("EMCC_SKIP_SANITY_CHECK", "1");

            // THESE ARE TEST/DEBUGGING
//			Environment.SetEnvironmentVariable("EMCC_DEBUG", "1");
//			Environment.SetEnvironmentVariable("EMCC_CORES", "8");
//			Environment.SetEnvironmentVariable("EMCC_OPTIMIZE_NORMALLY", "1");

            // Linux builds needs this - or else system clang will be attempted to be picked up instead of UE4's
            // TODO: test on other platforms to remove this if() check
            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Linux)
            {
                Environment.SetEnvironmentVariable(HTML5SDKInfo.PLATFORM_USER_HOME, HTML5SDKInfo.HTML5Intermediatory);
            }
            return(Result);
        }
Esempio n. 11
0
 static VerbosePrint PrintOnce = new VerbosePrint(PrintOnceOn);                                  // fn ptr
 static void PrintOnceOff(CppConfiguration Configuration, bool bOptimizeForSize)
 {
 }                                                                                               // noop
Esempio n. 12
0
        string GetSharedArguments_Global(CppConfiguration Configuration, bool bOptimizeForSize, string Architecture, bool bEnableShadowVariableWarnings, bool bShadowVariableWarningsAsErrors, bool bEnableUndefinedIdentifierWarnings, bool bUndefinedIdentifierWarningsAsErrors)
        {
            string Result = " ";

            if (Architecture == "-win32")             // simulator
            {
                return(Result);
            }

            Result += " -fno-exceptions";

            Result += " -Wdelete-non-virtual-dtor";
            Result += " -Wno-unused-value";                               // appErrorf triggers this
            Result += " -Wno-switch";                                     // many unhandled cases
            Result += " -Wno-tautological-constant-out-of-range-compare"; // disables some warnings about comparisons from TCHAR being a char
            // 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";
            Result += " -Wno-inconsistent-missing-override"; // as of 1.35.0, overriding a member function but not marked as 'override' triggers warnings
            Result += " -Wno-expansion-to-defined";          // 1.36.11
            Result += " -Wno-undefined-var-template";        // 1.36.11
            Result += " -Wno-nonportable-include-path";      // 1.36.11

            Result += " -Wno-logical-op-parentheses";        // appErrorf triggers this
            Result += " -Wno-array-bounds";                  // some VectorLoads go past the end of the array, but it's okay in that case
            // 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";

            if (bEnableShadowVariableWarnings)
            {
                Result += " -Wshadow" + (bShadowVariableWarningsAsErrors ? "" : " -Wno-error=shadow");
            }

            if (bEnableUndefinedIdentifierWarnings)
            {
                Result += " -Wundef" + (bUndefinedIdentifierWarningsAsErrors ? "" : " -Wno-error=undef");
            }

            // --------------------------------------------------------------------------------

            if (Configuration == CppConfiguration.Debug)
            {                                     // WARNING: UEBuildTarget.cs :: GetCppConfiguration()
                Result += " -O0";                 // faster compile time				//          DebugGame is forced to Development
            }                                     // i.e. this will never get hit...

            else if (bOptimizeForSize)
            {                                     // Engine/Source/Programs/UnrealBuildTool/HTML5/UEBuildHTML5.cs
                Result += " -Oz";                 // favor size over speed				// bCompileForSize=true; // set false, to build -O2 or -O3
            }                                     // SOURCE BUILD ONLY

            else if (Configuration == CppConfiguration.Development)
            {
                Result += " -O2";                 // aggressive size and speed optimization
            }

            else if (Configuration == CppConfiguration.Shipping)
            {
                Result += " -O3";                 // favor speed over size
            }

            PrintOnce(Configuration, bOptimizeForSize);

            // --------------------------------------------------------------------------------

            // JavaScript option overrides (see src/settings.js)
            if (enableSIMD)
            {
                Result += " -msse2 -s SIMD=1";
            }

            if (enableMultithreading)
            {
                Result += " -s USE_PTHREADS=1";
            }

            // --------------------------------------------------------------------------------
            // normally, these option are for linking -- but it using here to force recompile when
            if (targetingWasm)             // flipping between asmjs and wasm
            {
                Result += " -s BINARYEN=1";
            }
            else
            {
                Result += " -s BINARYEN=0";
            }
            if (targetWebGL2)             // flipping between webgl1 and webgl2
            {
                Result += " -s USE_WEBGL2=1";
            }
            else
            {
                Result += " -s USE_WEBGL2=0";
            }
            // --------------------------------------------------------------------------------

            // Expect that Emscripten SDK has been properly set up ahead in time (with emsdk and prebundled toolchains this is always the case)
            // This speeds up builds a tiny bit.
            Environment.SetEnvironmentVariable("EMCC_SKIP_SANITY_CHECK", "1");

            // THESE ARE TEST/DEBUGGING
//			Environment.SetEnvironmentVariable("EMCC_DEBUG", "1");
//			Environment.SetEnvironmentVariable("EMCC_CORES", "8");
//			Environment.SetEnvironmentVariable("EMCC_OPTIMIZE_NORMALLY", "1");

            // Linux builds needs this - or else system clang will be attempted to be picked up instead of UE4's
            // TODO: test on other platforms to remove this if() check
            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Linux)
            {
                Environment.SetEnvironmentVariable(HTML5SDKInfo.PLATFORM_USER_HOME, HTML5SDKInfo.HTML5Intermediatory);
            }
            return(Result);
        }
Esempio n. 13
0
        string GetSharedArguments_Global(CppConfiguration Configuration, bool bOptimizeForSize, string Architecture, bool bEnableShadowVariableWarnings, bool bShadowVariableWarningsAsErrors, bool bEnableUndefinedIdentifierWarnings, bool bUndefinedIdentifierWarningsAsErrors, bool bUseInlining)
        {
            string Result = " ";

//			string Result = " -Werror";

            Result += " -fdiagnostics-format=msvc";
            Result += " -fno-exceptions";

            Result += " -Wdelete-non-virtual-dtor";
            Result += " -Wno-switch";                                     // many unhandled cases
            Result += " -Wno-tautological-constant-out-of-range-compare"; // comparisons from TCHAR being a char
            Result += " -Wno-tautological-compare";                       // comparison of unsigned expression < 0 is always false" (constant comparisons, which are possible with template arguments)
            Result += " -Wno-tautological-undefined-compare";             // pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate
            Result += " -Wno-inconsistent-missing-override";              // as of 1.35.0, overriding a member function but not marked as 'override' triggers warnings
            Result += " -Wno-undefined-var-template";                     // 1.36.11
            Result += " -Wno-invalid-offsetof";                           // using offsetof on non-POD types
            Result += " -Wno-gnu-string-literal-operator-template";       // allow static FNames

            if (bEnableShadowVariableWarnings)
            {
                Result += " -Wshadow";                 //+ (bShadowVariableWarningsAsErrors ? "" : " -Wno-error=shadow");
            }

            if (bEnableUndefinedIdentifierWarnings)
            {
                Result += " -Wundef";                 //+ (bUndefinedIdentifierWarningsAsErrors ? "" : " -Wno-error=undef");
            }

            // --------------------------------------------------------------------------------

            if (Configuration == CppConfiguration.Debug)
            {                                     // WARNING: UEBuildTarget.cs :: GetCppConfiguration()
                Result += " -O0";                 // faster compile time				//          DebugGame is forced to Development
            }                                     // i.e. this will never get hit...

            else if (bOptimizeForSize)
            {                                     // Engine/Source/Programs/UnrealBuildTool/HTML5/UEBuildHTML5.cs
                Result += " -Oz";                 // favor size over speed				// bCompileForSize=true; // set false, to build -O2 or -O3
            }                                     // SOURCE BUILD ONLY

            else if (Configuration == CppConfiguration.Development)
            {
                Result += " -O2";                 // aggressive size and speed optimization
            }

            else if (Configuration == CppConfiguration.Shipping)
            {
                Result += " -O3";                 // favor speed over size
            }

            if (!bUseInlining)
            {
                Result += " -fno-inline-functions";
            }

            PrintOnce(Configuration, bOptimizeForSize);

            // --------------------------------------------------------------------------------

            // JavaScript option overrides (see src/settings.js)
            if (enableSIMD)
            {
//				Result += " -msse2 -s SIMD=1";
            }

            if (enableMultithreading)
            {
//				Result += " -msse2 -s USE_PTHREADS=1";
                Result += " -s USE_PTHREADS=1";
                Result += " -DEXPERIMENTAL_OPENGL_RHITHREAD=" + (bMultithreading_UseOffscreenCanvas ? "0" : "1");

                // NOTE: use "emscripten native" video, keyboard, mouse
            }
            else
            {
                // SDL2 is not supported for multi-threading WASM builds
                // WARNING: SDL2 may be removed in a future UE4 release
                // can comment out to use "emscripten native" single threaded
                //			Result += " -DHTML5_USE_SDL2";
            }

            if (useLLVMwasmBackend)              // experimental - LLVMWasmBackend
            {
                Result += " -s WASM_OBJECT_FILES=1";
                Environment.SetEnvironmentVariable("EMCC_WASM_BACKEND", "1");
            }

            // --------------------------------------------------------------------------------

            // emscripten ports
// WARNING: seems emscripten ports cannot be currently used
// there might be UE4 changes needed that are found in Engine/Source/ThirdParty/...

//			Result += " -s USE_ZLIB=1";
//			Result += " -s USE_LIBPNG=1";
//			Result += " -s USE_VORBIS=1";
//			Result += " -s USE_OGG=1";
//			Result += " -s USE_FREETYPE=1";	// TAG = 'release_1'
//			Result += " -s USE_HARFBUZZ=1";	// TAG = '1.2.4				note: path is https://github.com/harfbuzz/harfbuzz/archive/1.2.4.zip
//			Result += " -s USE_ICU=1";		// TAG = 'release-53-1'

            // SDL_Audio needs to be linked in [no matter if -DHTML5_USE_SDL2 is used or not]
// TODO: remove AudioMixerSDL from Engine/Source/Runtime/Launch/Launch.Build.cs and replace with emscripten native functions
//			Result += " -s USE_SDL=2";

            // --------------------------------------------------------------------------------

            // Expect that Emscripten SDK has been properly set up ahead in time (with emsdk and prebundled toolchains this is always the case)
            // This speeds up builds a tiny bit.
            Environment.SetEnvironmentVariable("EMCC_SKIP_SANITY_CHECK", "1");

            // THESE ARE TEST/DEBUGGING -- TRY NOT TO USE THESE
//			Environment.SetEnvironmentVariable("EMCC_DEBUG", "1"); // NOTE: try to use -v instead of EMCC_DEBUG
//			Environment.SetEnvironmentVariable("EMCC_CORES", "8");
//			Environment.SetEnvironmentVariable("EMCC_OPTIMIZE_NORMALLY", "1");

            // enable verbose mode
//			Result += " -v"; // useful for path hunting issues

            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Linux)
            {
                // Packaging on Linux needs this - or else system clang will be attempted to be picked up instead of UE4's included emsdk
                Environment.SetEnvironmentVariable(HTML5SDKInfo.PLATFORM_USER_HOME, HTML5SDKInfo.HTML5Intermediatory);
            }
            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 || BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32)
            {
                // Packaging on Window needs this - zap any existing HOME environment variables to prevent any accidental pick ups
                Environment.SetEnvironmentVariable("HOME", "");
            }
            return(Result);
        }
        string GetSharedArguments_Global(CppConfiguration Configuration, bool bOptimizeForSize, string Architecture, bool bEnableShadowVariableWarnings, bool bShadowVariableWarningsAsErrors, bool bEnableUndefinedIdentifierWarnings, bool bUndefinedIdentifierWarningsAsErrors)
        {
            string Result = " ";

            if (Architecture == "-win32")             // simulator
            {
                return(Result);
            }

            Result += " -fno-exceptions";

            Result += " -Wno-unused-value";                               // appErrorf triggers this
            Result += " -Wno-switch";                                     // many unhandled cases
            Result += " -Wno-tautological-constant-out-of-range-compare"; // disables some warnings about comparisons from TCHAR being a char
            // 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";
            Result += " -Wno-inconsistent-missing-override"; // as of 1.35.0, overriding a member function but not marked as 'override' triggers warnings
            Result += " -Wno-expansion-to-defined";          // 1.36.11
            Result += " -Wno-undefined-var-template";        // 1.36.11
            Result += " -Wno-nonportable-include-path";      // 1.36.11

            Result += " -Wno-logical-op-parentheses";        // appErrorf triggers this
            Result += " -Wno-array-bounds";                  // some VectorLoads go past the end of the array, but it's okay in that case
            // 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";

            if (bEnableShadowVariableWarnings)
            {
                Result += " -Wshadow" + (bShadowVariableWarningsAsErrors ? "" : " -Wno-error=shadow");
            }

            if (bEnableUndefinedIdentifierWarnings)
            {
                Result += " -Wundef" + (bUndefinedIdentifierWarningsAsErrors ? "" : " -Wno-error=undef");
            }

            // --------------------------------------------------------------------------------

            if (Configuration == CppConfiguration.Debug)
            {
                Result += " -O0";
            }
            else if (bOptimizeForSize)
            {
                Result += " -Oz";
            }
            else if (Configuration == CppConfiguration.Development)
            {
                Result += " -O2";
            }
            else if (Configuration == CppConfiguration.Shipping)
            {
                Result += " -O3";
            }

            // --------------------------------------------------------------------------------

            // JavaScript option overrides (see src/settings.js)
            if (enableSIMD)
            {
                Result += " -msse2 -s SIMD=1";
            }

            if (enableMultithreading)
            {
                Result += " -s USE_PTHREADS=1";
            }

            // --------------------------------------------------------------------------------

            // Expect that Emscripten SDK has been properly set up ahead in time (with emsdk and prebundled toolchains this is always the case)
            // This speeds up builds a tiny bit.
            Environment.SetEnvironmentVariable("EMCC_SKIP_SANITY_CHECK", "1");

            // THESE ARE TEST/DEBUGGING
//			Environment.SetEnvironmentVariable("EMCC_DEBUG", "1");
//			Environment.SetEnvironmentVariable("EMCC_CORES", "8");
//			Environment.SetEnvironmentVariable("EMCC_OPTIMIZE_NORMALLY", "1");

            return(Result);
        }
Esempio n. 15
0
        static string GetSharedArguments_Global(CppConfiguration TargetConfiguration, string Architecture, bool bEnableShadowVariableWarnings, bool bShadowVariableWarningsAsErrors, bool bEnableUndefinedIdentifierWarnings, bool bUndefinedIdentifierWarningsAsErrors)
        {
            string Result = " ";

            if (Architecture == "-win32")             // simulator
            {
                return(Result);
            }

//			Result += " -funsigned-char";
//			Result += " -fno-strict-aliasing";
            Result += " -fno-exceptions";
//			Result += " -fno-short-enums";

            Result += " -Wno-unused-value";                               // appErrorf triggers this
            Result += " -Wno-switch";                                     // many unhandled cases
            Result += " -Wno-tautological-constant-out-of-range-compare"; // disables some warnings about comparisons from TCHAR being a char
            // 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";
            Result += " -Wno-inconsistent-missing-override";    // as of 1.35.0, overriding a member function but not marked as 'override' triggers warnings
            Result += " -Wno-expansion-to-defined";             // 1.36.11
            Result += " -Wno-undefined-var-template";           // 1.36.11
            Result += " -Wno-nonportable-include-path";         // 1.36.11

            // okay, in UE4, we'd fix the code for these, but in UE3, not worth it
            Result += " -Wno-logical-op-parentheses";   // appErrorf triggers this
            Result += " -Wno-array-bounds";             // some VectorLoads go past the end of the array, but it's okay in that case
            // 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";

            if (bEnableShadowVariableWarnings)
            {
                Result += " -Wshadow" + (bShadowVariableWarningsAsErrors ? "" : " -Wno-error=shadow");
            }

            if (bEnableUndefinedIdentifierWarnings)
            {
                Result += " -Wundef" + (bUndefinedIdentifierWarningsAsErrors ? "" : " -Wno-error=undef");
            }

            // JavsScript option overrides (see src/settings.js)

            // we have to specify the full amount of memory with Asm.JS (1.5 G)
//			ConfigHierarchy cc = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(ProjectFile), UnrealTargetPlatform.HTML5);
//			int TotalMemory = HTML5SDKInfo.HeapSize(cc, TargetConfiguration.ToString()) * 1024 * 1024;
//			Result += " -s TOTAL_MEMORY=" + TotalMemory.ToString();
            // and, have to specify size smaller than used and must use "grow memory" !!!
            Result += " -s TOTAL_MEMORY=" + 128 * 1024 * 1024;
            Result += " -s ALLOW_MEMORY_GROWTH=1";

            // no need for exceptions
            Result += " -s DISABLE_EXCEPTION_CATCHING=1";
            // enable checking for missing functions at link time as opposed to runtime
            Result += " -s WARN_ON_UNDEFINED_SYMBOLS=1";

            // enable hardware accelerated and advanced instructions/functions
//			Result += " -s USE_WEBGL2=1 -s FULL_ES3=1";
            Result += " -s FULL_ES2=1";
//			Result += " -msse";
//			Result += " -msse2";
//			Result += " -s SIMD=1";
//			Result += " -s USE_PTHREADS=1"; // 2:polyfill -- SharedInt\d+Array available by ES7

            // THESE ARE TEST/DEBUGGING
//			Environment.SetEnvironmentVariable("EMCC_DEBUG", "1");
//			Environment.SetEnvironmentVariable("EMCC_CORES", "8");
//			Environment.SetEnvironmentVariable("EMCC_OPTIMIZE_NORMALLY", "1");

            // export console command handler. Export main func too because default exports ( e.g Main ) are overridden if we use custom exported functions.
            Result += " -s EXPORTED_FUNCTIONS=\"['_main', '_on_fatal']\"";

            // NOTE: This may slow down the compiler's startup time!
            {
                Result += " -s NO_EXIT_RUNTIME=1 --memory-init-file 1";
            }

            if (bEnableTracing)
            {
                Result += " --tracing";
            }
            return(Result);
        }