コード例 #1
0
        public override void RegisterToolChain()
        {
            if (!CrossCompiling())
            {
                // use native linux toolchain
                ClangPath  = Which("clang++");
                GCCPath    = Which("g++");
                ArPath     = Which("ar");
                RanlibPath = Which("ranlib");

                // if clang is available, zero out gcc (@todo: support runtime switching?)
                if (!String.IsNullOrEmpty(ClangPath))
                {
                    GCCPath = null;
                }
            }
            else
            {
                // use cross linux toolchain if LINUX_ROOT is specified
                BaseLinuxPath = Environment.GetEnvironmentVariable("LINUX_ROOT");

                // don't register if we don't have an LINUX_ROOT specified
                if (String.IsNullOrEmpty(BaseLinuxPath))
                {
                    return;
                }

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

                // set up the path to our toolchains (FIXME: support switching per architecture)
                GCCPath    = "";
                ClangPath  = Path.Combine(BaseLinuxPath, @"bin\Clang++.exe");
                ArPath     = Path.Combine(BaseLinuxPath, @"bin\x86_64-unknown-linux-gnu-ar.exe");
                RanlibPath = Path.Combine(BaseLinuxPath, @"bin\x86_64-unknown-linux-gnu-ranlib.exe");
            }

            if (!DetermineCompilerVersion())
            {
                Console.WriteLine("Could not determine version of the compiler, not registering Linux toolchain");
                return;
            }

            // Register this tool chain for both Linux
            if (BuildConfiguration.bPrintDebugInfo)
            {
                Console.WriteLine("        Registered for {0}", CPPTargetPlatform.Linux.ToString());
            }
            UEToolChain.RegisterPlatformToolChain(CPPTargetPlatform.Linux, this);
        }
コード例 #2
0
        /// <summary>
        /// Whether the required external SDKs are installed for this platform
        /// </summary>
        protected override SDKStatus HasRequiredManualSDKInternal()
        {
            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Linux)
            {
                return(SDKStatus.Valid);
            }

            string MultiArchRoot = Environment.GetEnvironmentVariable("LINUX_MULTIARCH_ROOT");
            string BaseLinuxPath;

            if (MultiArchRoot != null)
            {
                // FIXME: UBT should loop across all the architectures and compile for all the selected ones.
                BaseLinuxPath = Path.Combine(MultiArchRoot, LinuxPlatform.DefaultArchitecture);
            }
            else
            {
                // support the existing, non-multiarch toolchains for continuity
                BaseLinuxPath = Environment.GetEnvironmentVariable("LINUX_ROOT");
            }

            // we don't have an LINUX_ROOT specified
            if (String.IsNullOrEmpty(BaseLinuxPath))
            {
                return(SDKStatus.Invalid);
            }

            // paths to our toolchains
            BaseLinuxPath = BaseLinuxPath.Replace("\"", "");
            string ClangPath = Path.Combine(BaseLinuxPath, @"bin\clang++.exe");

            if (File.Exists(ClangPath))
            {
                return(SDKStatus.Valid);
            }

            return(SDKStatus.Invalid);
        }
コード例 #3
0
        public override void RegisterToolChain()
        {
            if (!CrossCompiling())
            {
                // use native linux toolchain
                string[] ClangNames = { "clang++", "clang++-3.5", "clang++-3.3" };
                foreach (var ClangName in ClangNames)
                {
                    ClangPath = Which(ClangName);
                    if (!String.IsNullOrEmpty(ClangPath))
                    {
                        break;
                    }
                }
                GCCPath    = Which("g++");
                ArPath     = Which("ar");
                RanlibPath = Which("ranlib");

                // if clang is available, zero out gcc (@todo: support runtime switching?)
                if (!String.IsNullOrEmpty(ClangPath))
                {
                    GCCPath = null;
                }
            }
            else
            {
                // use cross linux toolchain if LINUX_ROOT is specified
                BaseLinuxPath = Environment.GetEnvironmentVariable("LINUX_ROOT");

                // don't register if we don't have an LINUX_ROOT specified
                if (String.IsNullOrEmpty(BaseLinuxPath))
                {
                    return;
                }

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

                // set up the path to our toolchains
                GCCPath   = "";
                ClangPath = Path.Combine(BaseLinuxPath, @"bin\clang++.exe");
                // ar and ranlib will be switched later to match the architecture
                ArPath     = "ar.exe";
                RanlibPath = "ranlib.exe";
            }

            if (!DetermineCompilerVersion())
            {
                Console.WriteLine("\n*** Could not determine version of the compiler, not registering Linux toolchain.\n");
                return;
            }

            // refuse to use compilers that we know won't work
            // disable that only if you are a dev and you know what you are doing
            if (!UsingClang())
            {
                Console.WriteLine("\n*** This version of the engine can only be compiled by clang - refusing to register the Linux toolchain.\n");
                return;
            }
            else if (CompilerVersionMajor == 3 && CompilerVersionMinor == 4)
            {
                Console.WriteLine("\n*** clang 3.4.x is known to miscompile the engine - refusing to register the Linux toolchain.\n");
                return;
            }

            // Register this tool chain for both Linux
            if (BuildConfiguration.bPrintDebugInfo)
            {
                Console.WriteLine("        Registered for {0}", CPPTargetPlatform.Linux.ToString());
            }
            UEToolChain.RegisterPlatformToolChain(CPPTargetPlatform.Linux, this);
        }