Esempio n. 1
0
        /// <summary>
        /// Write C++ toolchain information to JSON writer
        /// </summary>
        /// <param name="Target"></param>
        /// <param name="Writer"></param>
        private void ExportEnvironmentToJson(UEBuildTarget Target, JsonWriter Writer)
        {
            CppCompileEnvironment GlobalCompileEnvironment = Target.CreateCompileEnvironmentForProjectFiles();

            RootToolchainInfo = GenerateToolchainInfo(GlobalCompileEnvironment);

            Writer.WriteObjectStart("ToolchainInfo");
            foreach (Tuple <string, object> Field in RootToolchainInfo.GetFields())
            {
                WriteField(Target.TargetName, Writer, Field);
            }
            Writer.WriteObjectEnd();

            Writer.WriteArrayStart("EnvironmentIncludePaths");
            foreach (DirectoryReference Path in GlobalCompileEnvironment.UserIncludePaths)
            {
                Writer.WriteValue(Path.FullName);
            }
            foreach (DirectoryReference Path in GlobalCompileEnvironment.SystemIncludePaths)
            {
                Writer.WriteValue(Path.FullName);
            }

            if (UEBuildPlatform.IsPlatformInGroup(Target.Platform, UnrealPlatformGroup.Windows))
            {
                foreach (DirectoryReference Path in Target.Rules.WindowsPlatform.Environment.IncludePaths)
                {
                    Writer.WriteValue(Path.FullName);
                }
            }
            else if (UEBuildPlatform.IsPlatformInGroup(Target.Platform, UnrealPlatformGroup.Apple) &&
                     UEBuildPlatform.IsPlatformInGroup(BuildHostPlatform.Current.Platform, UnrealPlatformGroup.Apple))
            {
                // Only generate Apple system include paths when host platform is Apple OS
                // TODO: Fix case when working with MacOS on Windows host platform
                foreach (string Path in AppleHelper.GetAppleSystemIncludePaths(GlobalCompileEnvironment.Architecture, Target.Platform))
                {
                    Writer.WriteValue(Path);
                }
            }
            // TODO: get corresponding includes for Linux

            Writer.WriteArrayEnd();

            Writer.WriteArrayStart("EnvironmentDefinitions");
            foreach (string Definition in GlobalCompileEnvironment.Definitions)
            {
                Writer.WriteValue(Definition);
            }
            Writer.WriteArrayEnd();
        }
        /// <summary>
        /// Write C++ toolchain information to JSON writer
        /// </summary>
        /// <param name="Target"></param>
        /// <param name="Writer"></param>
        private void ExportEnvironmentToJson(UEBuildTarget Target, JsonWriter Writer)
        {
            CppCompileEnvironment GlobalCompileEnvironment = Target.CreateCompileEnvironmentForProjectFiles();

            RootToolchainInfo = GenerateToolchainInfo(GlobalCompileEnvironment);

            Writer.WriteObjectStart("ToolchainInfo");
            foreach (Tuple <string, object> Field in RootToolchainInfo.GetFields())
            {
                WriteField(Target.TargetName, Writer, Field);
            }
            Writer.WriteObjectEnd();

            Writer.WriteArrayStart("EnvironmentIncludePaths");
            foreach (DirectoryReference Path in GlobalCompileEnvironment.UserIncludePaths)
            {
                Writer.WriteValue(Path.FullName);
            }
            foreach (DirectoryReference Path in GlobalCompileEnvironment.SystemIncludePaths)
            {
                Writer.WriteValue(Path.FullName);
            }

            // TODO: get corresponding includes for specific platforms
            if (UEBuildPlatform.IsPlatformInGroup(Target.Platform, UnrealPlatformGroup.Windows))
            {
                foreach (DirectoryReference Path in Target.Rules.WindowsPlatform.Environment.IncludePaths)
                {
                    Writer.WriteValue(Path.FullName);
                }
            }
            Writer.WriteArrayEnd();

            Writer.WriteArrayStart("EnvironmentDefinitions");
            foreach (string Definition in GlobalCompileEnvironment.Definitions)
            {
                Writer.WriteValue(Definition);
            }
            Writer.WriteArrayEnd();
        }