示例#1
0
        static string GetLinkArguments(LinkEnvironment LinkEnvironment)
        {
            string Result = "";

            // debugging symbols
            if (LinkEnvironment.Config.Target.Configuration < CPPTargetConfiguration.Shipping)
            {
                Result += " -rdynamic";   // needed for backtrace_symbols()...
            }
            else
            {
                Result += " -s"; // Strip binaries in Shipping
            }
            if (LinkEnvironment.Config.bIsBuildingDLL)
            {
                Result += " -shared";
            }
            else
            {
                // ignore unresolved symbols in shared libs
                Result += string.Format(" -Wl,--unresolved-symbols=ignore-in-shared-libs");
            }

            if (UnrealBuildTool.BuildingRocket())
            {
                // strip symbols for Rocket in every configuration
                Result += " -Wl,-s";
            }

            // RPATH for third party libs
            Result += " -Wl,-rpath=${ORIGIN}";
            Result += " -Wl,-rpath-link=${ORIGIN}";
            Result += " -Wl,-rpath=${ORIGIN}/../../../Engine/Binaries/Linux";
            Result += " -Wl,-rpath=${ORIGIN}/..";               // for modules that are in sub-folders of the main Engine/Binary/Linux folder
            // FIXME: really ugly temp solution. Modules need to be able to specify this
            Result += " -Wl,-rpath=${ORIGIN}/../../../Engine/Binaries/ThirdParty/ICU/icu4c-53_1/Linux/x86_64-unknown-linux-gnu";

            if (CrossCompiling())
            {
                if (UsingClang())
                {
                    Result += String.Format(" -target {0}", LinkEnvironment.Config.Target.Architecture);        // Set target triple
                }
                string SysRootPath = BaseLinuxPath.TrimEnd(new char[] { '\\', '/' });
                Result += String.Format(" \"--sysroot={0}\"", SysRootPath);
            }

            return(Result);
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
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);
        }