Пример #1
0
        /// <summary>
        /// Setup the target environment for building
        /// </summary>
        /// <param name="Target">Settings for the target being compiled</param>
        /// <param name="CompileEnvironment">The compile environment for this target</param>
        /// <param name="LinkEnvironment">The link environment for this target</param>
        public override void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            CompileEnvironment.Definitions.Add("PLATFORM_IOS=1");
            CompileEnvironment.Definitions.Add("PLATFORM_APPLE=1");
            CompileEnvironment.Definitions.Add("GLES_SILENCE_DEPRECATION=1");              // suppress GLES "deprecated" warnings until a proper solution is implemented (see UE-65643)

            CompileEnvironment.Definitions.Add("WITH_TTS=0");
            CompileEnvironment.Definitions.Add("WITH_SPEECH_RECOGNITION=0");
            CompileEnvironment.Definitions.Add("WITH_DATABASE_SUPPORT=0");
            CompileEnvironment.Definitions.Add("WITH_EDITOR=0");
            CompileEnvironment.Definitions.Add("USE_NULL_RHI=0");

            IOSProjectSettings ProjectSettings = ((IOSPlatform)UEBuildPlatform.GetBuildPlatform(Target.Platform)).ReadProjectSettings(Target.ProjectFile);

            if (ProjectSettings.bNotificationsEnabled)
            {
                CompileEnvironment.Definitions.Add("NOTIFICATIONS_ENABLED=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("NOTIFICATIONS_ENABLED=0");
            }
            if (ProjectSettings.bBackgroundFetchEnabled)
            {
                CompileEnvironment.Definitions.Add("BACKGROUNDFETCH_ENABLED=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("BACKGROUNDFETCH_ENABLED=0");
            }

            CompileEnvironment.Definitions.Add("UE_DISABLE_FORCE_INLINE=" + (ProjectSettings.bDisableForceInline ? "1" : "0"));

            if (Target.Architecture == "-simulator")
            {
                CompileEnvironment.Definitions.Add("WITH_SIMULATOR=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("WITH_SIMULATOR=0");
            }

            // if the project has an Oodle compression Dll, enable the decompressor on IOS
            if (Target.ProjectFile != null)
            {
                DirectoryReference ProjectDir   = DirectoryReference.GetParentDirectory(Target.ProjectFile);
                string             OodleDllPath = DirectoryReference.Combine(ProjectDir, "Binaries/ThirdParty/Oodle/Mac/libUnrealPakPlugin.dylib").FullName;
                if (File.Exists(OodleDllPath))
                {
                    Log.TraceVerbose("        Registering custom oodle compressor for {0}", UnrealTargetPlatform.IOS.ToString());
                    CompileEnvironment.Definitions.Add("REGISTER_OODLE_CUSTOM_COMPRESSOR=1");
                }
            }

            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("GameKit"));
            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("StoreKit"));
            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("DeviceCheck"));
        }
Пример #2
0
        public virtual void SetUpSpecificEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            // we want gcc toolchain 4.9, but fall back to 4.8 or 4.6 for now if it doesn't exist
            string NDKPath = Environment.GetEnvironmentVariable("NDKROOT");

            NDKPath = NDKPath.Replace("\"", "");

            AndroidToolChain ToolChain = new AndroidToolChain(Target.ProjectFile, false, Target.AndroidPlatform.Architectures, Target.AndroidPlatform.GPUArchitectures);

            // figure out the NDK version
            string NDKToolchainVersion = ToolChain.NDKToolchainVersion;
            string NDKDefine           = ToolChain.NDKDefine;

            // PLATFORM_ANDROID_NDK_VERSION is in the form 150100, where 15 is major version, 01 is the letter (1 is 'a'), 00 indicates beta revision if letter is 00
            Log.TraceInformation("PLATFORM_ANDROID_NDK_VERSION = {0}", NDKDefine);
            CompileEnvironment.Definitions.Add("PLATFORM_ANDROID_NDK_VERSION=" + NDKDefine);

            string GccVersion    = "4.6";
            int    NDKVersionInt = ToolChain.GetNdkApiLevelInt();

            if (Directory.Exists(Path.Combine(NDKPath, @"sources/cxx-stl/gnu-libstdc++/4.9")))
            {
                GccVersion = "4.9";
            }
            else
            if (Directory.Exists(Path.Combine(NDKPath, @"sources/cxx-stl/gnu-libstdc++/4.8")))
            {
                GccVersion = "4.8";
            }

            Log.TraceInformation("NDK toolchain: {0}, NDK version: {1}, GccVersion: {2}, ClangVersion: {3}", NDKToolchainVersion, NDKVersionInt.ToString(), GccVersion, ToolChain.GetClangVersionString());


            CompileEnvironment.Definitions.Add("PLATFORM_USED_NDK_VERSION_INTEGER=" + NDKVersionInt);


            CompileEnvironment.Definitions.Add("PLATFORM_DESKTOP=0");
            CompileEnvironment.Definitions.Add("PLATFORM_CAN_SUPPORT_EDITORONLY_DATA=0");

            CompileEnvironment.Definitions.Add("WITH_OGGVORBIS=1");

            CompileEnvironment.Definitions.Add("UNICODE");
            CompileEnvironment.Definitions.Add("_UNICODE");

            CompileEnvironment.Definitions.Add("PLATFORM_ANDROID=1");
            CompileEnvironment.Definitions.Add("ANDROID=1");

            CompileEnvironment.Definitions.Add("WITH_DATABASE_SUPPORT=0");
            CompileEnvironment.Definitions.Add("WITH_EDITOR=0");
            CompileEnvironment.Definitions.Add("USE_NULL_RHI=0");
            CompileEnvironment.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS");

            DirectoryReference NdkDir = new DirectoryReference(NDKPath);

            CompileEnvironment.IncludePaths.SystemIncludePaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/include"));

            // the toolchain will actually filter these out
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a/include"));
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/arm64-v8a/include"));
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86/include"));
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86_64/include"));

            LinkEnvironment.LibraryPaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a"));
            LinkEnvironment.LibraryPaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/arm64-v8a"));
            LinkEnvironment.LibraryPaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86"));
            LinkEnvironment.LibraryPaths.Add(DirectoryReference.Combine(NdkDir, "sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86_64"));

            CompileEnvironment.IncludePaths.SystemIncludePaths.Add(DirectoryReference.Combine(NdkDir, "sources/android/native_app_glue"));
            CompileEnvironment.IncludePaths.SystemIncludePaths.Add(DirectoryReference.Combine(NdkDir, "sources/android/cpufeatures"));


            // if the project has an Oodle compression Dll, enable the decompressor on Android
            DirectoryReference ProjectDir = Target.ProjectFile != null?DirectoryReference.GetParentDirectory(Target.ProjectFile) : UnrealBuildTool.EngineDirectory;

            string OodleDllPath = DirectoryReference.Combine(ProjectDir, "Binaries/ThirdParty/Oodle/Win64/UnrealPakPlugin.dll").FullName;

            if (File.Exists(OodleDllPath))
            {
                CompileEnvironment.Definitions.Add("REGISTER_OODLE_CUSTOM_COMPRESSOR=1");
            }

            //@TODO: Tegra Gfx Debugger - standardize locations - for now, change the hardcoded paths and force this to return true to test
            if (UseTegraGraphicsDebugger(Target))
            {
                //LinkEnvironment.LibraryPaths.Add("ThirdParty/NVIDIA/TegraGfxDebugger");
                //LinkEnvironment.LibraryPaths.Add("F:/NVPACK/android-kk-egl-t124-a32/stub");
                //LinkEnvironment.AdditionalLibraries.Add("Nvidia_gfx_debugger_stub");
            }

            if (!UseTegraGraphicsDebugger(Target))
            {
                LinkEnvironment.AdditionalLibraries.Add("GLESv2");
                LinkEnvironment.AdditionalLibraries.Add("EGL");
            }
            LinkEnvironment.AdditionalLibraries.Add("android");
            LinkEnvironment.AdditionalLibraries.Add("OpenSLES");
        }
Пример #3
0
        /// <summary>
        /// Setup the target environment for building
        /// </summary>
        /// <param name="Target">Settings for the target being compiled</param>
        /// <param name="CompileEnvironment">The compile environment for this target</param>
        /// <param name="LinkEnvironment">The link environment for this target</param>
        public override void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            IOSProjectSettings ProjectSettings = ((IOSPlatform)UEBuildPlatform.GetBuildPlatform(Target.Platform)).ReadProjectSettings(Target.ProjectFile);

            if (!ProjectFileGenerator.bGenerateProjectFiles)
            {
                Log.TraceInformation("Compiling against OS Version {0} [minimum allowed at runtime]", ProjectSettings.RuntimeVersion);
            }

            CompileEnvironment.Definitions.Add("PLATFORM_IOS=1");
            CompileEnvironment.Definitions.Add("PLATFORM_APPLE=1");
            CompileEnvironment.Definitions.Add("GLES_SILENCE_DEPRECATION=1");              // suppress GLES "deprecated" warnings until a proper solution is implemented (see UE-65643)

            CompileEnvironment.Definitions.Add("WITH_TTS=0");
            CompileEnvironment.Definitions.Add("WITH_SPEECH_RECOGNITION=0");
            CompileEnvironment.Definitions.Add("WITH_EDITOR=0");
            CompileEnvironment.Definitions.Add("USE_NULL_RHI=0");

            if (ProjectSettings.bNotificationsEnabled)
            {
                CompileEnvironment.Definitions.Add("NOTIFICATIONS_ENABLED=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("NOTIFICATIONS_ENABLED=0");
            }
            if (ProjectSettings.bBackgroundFetchEnabled)
            {
                CompileEnvironment.Definitions.Add("BACKGROUNDFETCH_ENABLED=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("BACKGROUNDFETCH_ENABLED=0");
            }
            if (ProjectSettings.bFileSharingEnabled)
            {
                CompileEnvironment.Definitions.Add("FILESHARING_ENABLED=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("FILESHARING_ENABLED=0");
            }

            CompileEnvironment.Definitions.Add("UE_DISABLE_FORCE_INLINE=" + (ProjectSettings.bDisableForceInline ? "1" : "0"));

            if (Target.Architecture == "-simulator")
            {
                CompileEnvironment.Definitions.Add("WITH_SIMULATOR=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("WITH_SIMULATOR=0");
            }

            if (ProjectSettings.bEnableAdvertisingIdentifier)
            {
                CompileEnvironment.Definitions.Add("ENABLE_ADVERTISING_IDENTIFIER=1");
            }

            CompileEnvironment.Definitions.Add("HAS_OPENGL_ES=" + ((Target.IOSPlatform.RuntimeVersion < 12.0) ? "1" : "0"));

            // if the project has an Oodle compression Dll, enable the decompressor on IOS
            if (Target.ProjectFile != null)
            {
                DirectoryReference ProjectDir   = DirectoryReference.GetParentDirectory(Target.ProjectFile);
                string             OodleDllPath = DirectoryReference.Combine(ProjectDir, "Binaries/ThirdParty/Oodle/Mac/libUnrealPakPlugin.dylib").FullName;
                if (File.Exists(OodleDllPath))
                {
                    Log.TraceVerbose("        Registering custom oodle compressor for {0}", UnrealTargetPlatform.IOS.ToString());
                    CompileEnvironment.Definitions.Add("REGISTER_OODLE_CUSTOM_COMPRESSOR=1");
                }
            }

            // convert runtime version into standardized integer
            float TargetFloat = Target.IOSPlatform.RuntimeVersion;
            int   IntPart     = (int)TargetFloat;
            int   FracPart    = (int)((TargetFloat - IntPart) * 10);
            int   TargetNum   = IntPart * 10000 + FracPart * 100;

            CompileEnvironment.Definitions.Add("MINIMUM_UE4_COMPILED_IOS_VERSION=" + TargetNum);

            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("GameKit"));
            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("StoreKit"));
            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("DeviceCheck"));
        }