예제 #1
0
        Convert(
            this ITarBallSettings settings,
            Bam.Core.StringArray commandLine)
        {
            switch (settings.CompressionType)
            {
            case ETarCompressionType.None:
                break;

            case ETarCompressionType.gzip:
                commandLine.Add("-z");
                break;

            case ETarCompressionType.bzip:
                commandLine.Add("-j");
                break;

            case ETarCompressionType.lzma:
                commandLine.Add("--lzma");
                break;

            default:
                throw new Bam.Core.Exception("Unknown compression type, {0}", settings.CompressionType.ToString());
            }
        }
예제 #2
0
        Convert(
            this IObjCopyToolSettings settings,
            Bam.Core.StringArray commandLine)
        {
            var objCopy = (settings as Bam.Core.Settings).Module as ObjCopyModule;
            switch (settings.Mode)
            {
            case EObjCopyToolMode.OnlyKeepDebug:
                commandLine.Add(System.String.Format("--only-keep-debug {0} {1}",
                    objCopy.SourceModule.GeneratedPaths[objCopy.SourceKey].Parse(),
                    objCopy.GeneratedPaths[ObjCopyModule.Key].Parse()));
                break;

            case EObjCopyToolMode.AddGNUDebugLink:
                commandLine.Add(System.String.Format("--add-gnu-debuglink={0} {1}",
                    objCopy.GeneratedPaths[ObjCopyModule.Key].Parse(),
                    objCopy.SourceModule.GeneratedPaths[objCopy.SourceKey].Parse()));
                break;

            default:
                throw new Bam.Core.Exception("Unrecognized objcopy mode, {0}", settings.Mode.ToString());
            }
            if (settings.Verbose)
            {
                commandLine.Add("-v");
            }
        }
예제 #3
0
        Convert(
            this IDiskImageSettings settings,
            Bam.Core.StringArray commandLine)
        {
            switch (settings.Verbosity)
            {
            case EDiskImageVerbosity.Default:
                break;

            case EDiskImageVerbosity.Quiet:
                commandLine.Add("-quiet");
                break;

            case EDiskImageVerbosity.Verbose:
                commandLine.Add("-verbose");
                break;

            case EDiskImageVerbosity.Debug:
                commandLine.Add("-debug");
                break;

            default:
                throw new Bam.Core.Exception("Unknown disk image verbosity level, {0}", settings.Verbosity.ToString());
            }

            // Note: intentionally not parsing ImageSize - used later in the builder scripts
        }
 Convert(
     this C.ICxxOnlyCompilerSettings settings,
     Bam.Core.StringArray commandLine)
 {
     if (settings.ExceptionHandler.HasValue)
     {
         switch (settings.ExceptionHandler.Value)
         {
             case C.Cxx.EExceptionHandler.Disabled:
                 // nothing
                 break;
             case C.Cxx.EExceptionHandler.Asynchronous:
                 commandLine.Add("-EHa");
                 break;
             case C.Cxx.EExceptionHandler.Synchronous:
                 commandLine.Add("-EHsc");
                 break;
             case C.Cxx.EExceptionHandler.SyncWithCExternFunctions:
                 commandLine.Add("-EHs");
                 break;
             default:
                 throw new Bam.Core.Exception("Unrecognized exception handler option, {0}", settings.ExceptionHandler.Value.ToString());
         }
     }
 }
        public static void Convert(
            this C.ICOnlyCompilerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            if (settings.LanguageStandard.HasValue)
            {
                switch (settings.LanguageStandard.Value)
                {
                    case C.ELanguageStandard.C89:
                        commandLine.Add("-std=c89");
                        break;

                    case C.ELanguageStandard.GNU89:
                        commandLine.Add("-std=gnu89");
                        break;

                    case C.ELanguageStandard.C99:
                        commandLine.Add("-std=c99");
                        break;

                    case C.ELanguageStandard.GNU99:
                        commandLine.Add("-std=gnu99");
                        break;

                    default:
                        throw new Bam.Core.Exception("Invalid C language standard, '{0}'", settings.LanguageStandard.Value.ToString());
                }
            }
        }
예제 #6
0
        Convert(
            this IStripToolSettings settings,
            Bam.Core.StringArray commandLine)
        {
            var module = (settings as Bam.Core.Settings).Module;
            if (settings.Verbose && !module.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.OSX))
            {
                commandLine.Add("-v");
            }

            if (settings.PreserveTimestamp && !module.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.OSX))
            {
                commandLine.Add("-p");
            }

            if (settings.StripDebugSymbols)
            {
                commandLine.Add("-S");
            }

            if (settings.StripLocalSymbols)
            {
                commandLine.Add("-x");
            }
        }
 VisibilityCommandLineProcessor(
      object sender,
      Bam.Core.StringArray commandLineBuilder,
      Bam.Core.Option option,
      Bam.Core.Target target)
 {
     // requires gcc 4.0
     var enumOption = option as Bam.Core.ValueTypeOption<EVisibility>;
     switch (enumOption.Value)
     {
         case EVisibility.Default:
         commandLineBuilder.Add("-fvisibility=default");
         break;
         case EVisibility.Hidden:
         commandLineBuilder.Add("-fvisibility=hidden");
         break;
         case EVisibility.Internal:
         commandLineBuilder.Add("-fvisibility=internal");
         break;
         case EVisibility.Protected:
         commandLineBuilder.Add("-fvisibility=protected");
         break;
         default:
         throw new Bam.Core.Exception("Unrecognized visibility option");
     }
 }
 Convert(
     this C.ICommonCompilerSettingsOSX settings,
     Bam.Core.StringArray commandLine)
 {
     foreach (var path in settings.FrameworkSearchPaths)
     {
         commandLine.Add(System.String.Format("-F{0}", path.ParseAndQuoteIfNecessary()));
     }
     if (!System.String.IsNullOrEmpty(settings.MinimumVersionSupported))
     {
         var minVersionRegEx = new System.Text.RegularExpressions.Regex("^(?<Type>[a-z]+)(?<Version>[0-9.]+)$");
         var match = minVersionRegEx.Match(settings.MinimumVersionSupported);
         if (!match.Groups["Type"].Success)
         {
             throw new Bam.Core.Exception("Unable to extract SDK type from: '{0}'", settings.MinimumVersionSupported);
         }
         if (!match.Groups["Version"].Success)
         {
             throw new Bam.Core.Exception("Unable to extract SDK version from: '{0}'", settings.MinimumVersionSupported);
         }
         commandLine.Add(System.String.Format("-m{0}-version-min={1}",
             match.Groups["Type"].Value,
             match.Groups["Version"].Value));
     }
 }
        public static void Convert(
            this C.ICommonWinResourceCompilerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            if (settings.Verbose.HasValue && settings.Verbose.Value)
            {
                commandLine.Add("-v");
            }

            var resource = (settings as Bam.Core.Settings).Module as C.WinResource;
            commandLine.Add(System.String.Format("-Fo{0}", resource.GeneratedPaths[C.ObjectFile.Key].ParseAndQuoteIfNecessary()));
        }
        Convert(
            this C.ICommonWinResourceCompilerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            if (settings.Verbose.HasValue && settings.Verbose.Value)
            {
                commandLine.Add("-v");
            }

            var resource = (settings as Bam.Core.Settings).Module as C.WinResource;
            commandLine.Add("--use-temp-file"); // avoiding a popen error, see https://amindlost.wordpress.com/2012/06/09/mingw-windres-exe-cant-popen-error/
            commandLine.Add(System.String.Format("-o {0}", resource.GeneratedPaths[C.ObjectFile.Key].ParseAndQuoteIfNecessary()));
        }
예제 #11
0
 Convert(
     this GccCommon.ICommonCompilerSettings settings,
     Bam.Core.StringArray commandLine)
 {
     if (settings.PositionIndependentCode.HasValue)
     {
         if (settings.PositionIndependentCode.Value)
         {
             commandLine.Add("-fPIC");
         }
     }
     if (settings.AllWarnings.HasValue)
     {
         if (settings.AllWarnings.Value)
         {
             commandLine.Add("-Wall");
         }
     }
     if (settings.ExtraWarnings.HasValue)
     {
         if (settings.ExtraWarnings.Value)
         {
             commandLine.Add("-Wextra");
         }
     }
     if (settings.Pedantic.HasValue)
     {
         if (settings.Pedantic.Value)
         {
             commandLine.Add("-pedantic");
         }
     }
     if (settings.Visibility.HasValue)
     {
         switch (settings.Visibility.Value)
         {
         case EVisibility.Default:
             commandLine.Add("-fvisibility=default");
             break;
         case EVisibility.Hidden:
             commandLine.Add("-fvisibility=hidden");
             break;
         case EVisibility.Internal:
             commandLine.Add("-fvisibility=internal");
             break;
         case EVisibility.Protected:
             commandLine.Add("-fvisibility=protected");
             break;
         default:
             throw new Bam.Core.Exception("Unrecognized visibility, {0}", settings.Visibility.Value.ToString());
         }
     }
     if (settings.StrictAliasing.HasValue)
     {
         if (settings.StrictAliasing.Value)
         {
             commandLine.Add("-fstrict-aliasing");
         }
     }
 }
예제 #12
0
        Convert(
            this C.ICommonLinkerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            var module = (settings as Bam.Core.Settings).Module;
            switch (settings.Bits)
            {
            case C.EBit.SixtyFour:
                commandLine.Add("-arch x86_64");
                break;

            case C.EBit.ThirtyTwo:
                commandLine.Add("-arch i386");
                break;

            default:
                throw new Bam.Core.Exception("Unknown bit depth, {0}", settings.Bits.ToString());
            }
            switch (settings.OutputType)
            {
                case C.ELinkerOutput.Executable:
                    commandLine.Add(System.String.Format("-o {0}", module.GeneratedPaths[C.ConsoleApplication.Key].ToString()));
                    break;

            case C.ELinkerOutput.DynamicLibrary:
                {
                    commandLine.Add("-dynamiclib");
                    commandLine.Add(System.String.Format("-o {0}", module.GeneratedPaths[C.ConsoleApplication.Key].ToString()));

                    var versionString = module.CreateTokenizedString("$(MajorVersion).$(MinorVersion)#valid(.$(PatchVersion))").Parse();
                    commandLine.Add(System.String.Format("-current_version {0}", versionString));
                    // TODO: offer an option of setting the compatibility version differently
                    commandLine.Add(System.String.Format("-compatibility_version {0}", versionString));
                }
                break;
            }
            foreach (var path in settings.LibraryPaths)
            {
                commandLine.Add(System.String.Format("-L{0}", path.ParseAndQuoteIfNecessary()));
            }
            foreach (var path in settings.Libraries)
            {
                commandLine.Add(path);
            }
            if (settings.DebugSymbols)
            {
                commandLine.Add("-g");
            }
        }
        Convert(
            this IInstallNameToolSettings settings,
            Bam.Core.StringArray commandLine)
        {
            switch (settings.Mode)
            {
            case EInstallNameToolMode.UpdateIDName:
                commandLine.Add("-id");
                break;

            case EInstallNameToolMode.ChangeIDName:
                commandLine.Add("-change");
                break;
            }
        }
 private static void CheckedCommandLineProcessor(
      object sender,
      Bam.Core.StringArray commandLineBuilder,
      Bam.Core.Option option,
      Bam.Core.Target target)
 {
     var boolOption = option as Bam.Core.ValueTypeOption<bool>;
     if (boolOption.Value)
     {
         commandLineBuilder.Add("/checked+");
     }
     else
     {
         commandLineBuilder.Add("/checked-");
     }
 }
예제 #15
0
 Convert(
     this GccCommon.ICommonLinkerSettings settings,
     Bam.Core.StringArray commandLine)
 {
     if (settings.CanUseOrigin)
     {
         commandLine.Add("-Wl,-z,origin");
     }
     foreach (var rpath in settings.RPath)
     {
         commandLine.Add(System.String.Format("-Wl,-rpath,{0}", rpath));
     }
     foreach (var rpath in settings.RPathLink)
     {
         commandLine.Add(System.String.Format("-Wl,-rpath-link,{0}", rpath));
     }
 }
예제 #16
0
        Convert(
            this C.ICommonLinkerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            var module = (settings as Bam.Core.Settings).Module;
            switch (settings.Bits)
            {
            case C.EBit.SixtyFour:
                commandLine.Add("-m64");
                break;

            case C.EBit.ThirtyTwo:
                commandLine.Add("-m32");
                break;

            default:
                throw new Bam.Core.Exception("Unknown machine bit size, {0}", settings.Bits.ToString());
            }
            switch (settings.OutputType)
            {
                case C.ELinkerOutput.Executable:
                    commandLine.Add(System.String.Format("-o {0}", module.GeneratedPaths[C.ConsoleApplication.Key].Parse()));
                    break;

                case C.ELinkerOutput.DynamicLibrary:
                    {
                        commandLine.Add("-shared");
                        var outputName = module.GeneratedPaths[C.ConsoleApplication.Key].Parse();
                        commandLine.Add(System.String.Format("-o {0}", outputName));
                        if (module.Macros.Contains("SOName"))
                        {
                            var soName = module.Macros["SOName"].Parse();
                            commandLine.Add(System.String.Format("-Wl,-soname,{0}", soName));
                        }
                    }
                    break;
            }
            foreach (var path in settings.LibraryPaths)
            {
                commandLine.Add(System.String.Format("-L{0}", path.ParseAndQuoteIfNecessary()));
            }
            foreach (var path in settings.Libraries)
            {
                commandLine.Add(path);
            }
            if (settings.DebugSymbols)
            {
                commandLine.Add("-g");
            }
        }
예제 #17
0
        public static void Convert(
            this C.ICommonLinkerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            var module = (settings as Bam.Core.Settings).Module;
            switch (settings.OutputType)
            {
                case C.ELinkerOutput.Executable:
                    commandLine.Add(System.String.Format("-OUT:{0}", module.GeneratedPaths[C.ConsoleApplication.Key].ToString()));
                    break;

                case C.ELinkerOutput.DynamicLibrary:
                    commandLine.Add("-DLL");
                    commandLine.Add(System.String.Format("-OUT:{0}", module.GeneratedPaths[C.ConsoleApplication.Key].ToString()));
                    break;
            }
            foreach (var path in settings.LibraryPaths)
            {
                commandLine.Add(System.String.Format("-LIBPATH:{0}", path.ParseAndQuoteIfNecessary()));
            }
            foreach (var path in settings.Libraries)
            {
                commandLine.Add(path);
            }
            if (settings.DebugSymbols)
            {
                commandLine.Add("-DEBUG");
                if (null != module.GeneratedPaths[C.ConsoleApplication.PDBKey])
                {
                    commandLine.Add(System.String.Format("-PDB:{0}", module.GeneratedPaths[C.ConsoleApplication.PDBKey].Parse()));
                }
            }
        }
예제 #18
0
 Convert(
     this C.IAdditionalSettings settings,
     Bam.Core.StringArray commandLine)
 {
     foreach (var extra in settings.AdditionalSettings)
     {
         commandLine.Add(extra);
     }
 }
예제 #19
0
 Convert(
     this ICommonArchiverSettings settings,
     Bam.Core.StringArray commandLine)
 {
     if (settings.NoLogo)
     {
         commandLine.Add("-NOLOGO");
     }
 }
예제 #20
0
        public static void Convert(
            this C.ICommonLinkerSettingsWin settings,
            Bam.Core.StringArray commandLine)
        {
            switch (settings.SubSystem.Value)
            {
                case C.ESubsystem.Console:
                    commandLine.Add("-SUBSYSTEM:CONSOLE");
                    break;

                case C.ESubsystem.Windows:
                    commandLine.Add("-SUBSYSTEM:WINDOWS");
                    break;

                default:
                    throw new Bam.Core.Exception("Unrecognized subsystem: {0}", settings.SubSystem.Value.ToString());
            }
        }
예제 #21
0
 Convert(
     this ICommonLinkerSettings settings,
     Bam.Core.StringArray commandLine)
 {
     foreach (var rpath in settings.RPath)
     {
         commandLine.Add(System.String.Format("-Wl,-rpath,{0}", rpath));
     }
 }
 public static void Convert(
     this ICommonWinResourceCompilerSettings settings,
     Bam.Core.StringArray commandLine)
 {
     if (settings.NoLogo.HasValue && settings.NoLogo.Value)
     {
         commandLine.Add("-NOLOGO");
     }
 }
 private static void OutputSourceDirectoryCommandLineProcessor(
      object sender,
      Bam.Core.StringArray commandLineBuilder,
      Bam.Core.Option option,
      Bam.Core.Target target)
 {
     Bam.Core.ReferenceTypeOption<string> stringOption = option as Bam.Core.ReferenceTypeOption<string>;
     commandLineBuilder.Add(stringOption.Value);
 }
예제 #24
0
 public static void Convert(
     this ICommonLinkerSettings settings,
     Bam.Core.StringArray commandLine)
 {
     if (settings.NoLogo)
     {
         commandLine.Add("-NOLOGO");
     }
 }
 Convert(
     this C.IObjectiveCOnlyCompilerSettings settings,
     Bam.Core.StringArray commandLine)
 {
     if (!System.String.IsNullOrEmpty(settings.ConstantStringClass))
     {
         commandLine.Add(System.String.Format("-fconstant-string-class={0}", settings.ConstantStringClass));
     }
 }
        Convert(
            this ICommonWinResourceCompilerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            if (settings.UseTempFile.HasValue)
            {
                if (settings.UseTempFile.Value)
                {
                    commandLine.Add("--use-temp-file");
                }
                else
                {
                    commandLine.Add("--no-use-temp-file");
                }
            }

            var resource = (settings as Bam.Core.Settings).Module as C.WinResource;
            commandLine.Add(System.String.Format("-o {0}", resource.GeneratedPaths[C.ObjectFile.Key].ParseAndQuoteIfNecessary()));
        }
        Convert(
            this C.ICxxOnlyCompilerSettings settings,
            Bam.Core.StringArray commandLine)
        {
            if (settings.ExceptionHandler.HasValue)
            {
                switch (settings.ExceptionHandler.Value)
                {
                case C.Cxx.EExceptionHandler.Disabled:
                    commandLine.Add("-fno-exceptions");
                    break;

                case C.Cxx.EExceptionHandler.Asynchronous:
                case C.Cxx.EExceptionHandler.Synchronous:
                    commandLine.Add("-fexceptions");
                    break;

                default:
                    throw new Bam.Core.Exception("Unrecognized exception handler option, {0}", settings.ExceptionHandler.Value.ToString());
                }
            }
            if (settings.LanguageStandard.HasValue)
            {
                switch (settings.LanguageStandard.Value)
                {
                    case C.Cxx.ELanguageStandard.Cxx98:
                        commandLine.Add("-std=c++98");
                        break;

                    case C.Cxx.ELanguageStandard.GnuCxx98:
                        commandLine.Add("-std=gnu++98");
                        break;

                    case C.Cxx.ELanguageStandard.Cxx11:
                        commandLine.Add("-std=c++11");
                        break;

                    default:
                        throw new Bam.Core.Exception("Invalid C++ language standard, '{0}'", settings.LanguageStandard.Value.ToString());
                }
            }
        }
예제 #28
0
 Convert(
     this ICopyFileSettings settings,
     Bam.Core.StringArray commandLine)
 {
     var module = (settings as Bam.Core.Settings).Module;
     if (module.BuildEnvironment.Platform.Includes(Bam.Core.EPlatform.Windows))
     {
         if (settings.Force)
         {
             commandLine.Add("/Y");
         }
         if (settings.Verbose)
         {
             commandLine.Add("/F");
         }
         if (settings.Recursive)
         {
             commandLine.Add("/S");
         }
         if (settings.PreserveAllAttributes)
         {
             commandLine.Add("/K"); // copy attributes
             // TODO: this causes 'access denied' errors, although not clear why
             //commandLine.Add("/O"); // copy ownership and ACL
             commandLine.Add("/B"); // copy symbolic link itself, not the target
         }
     }
     else
     {
         if (settings.Force)
         {
             commandLine.Add("-f");
         }
         if (settings.Verbose)
         {
             commandLine.Add("-v");
         }
         if (settings.Recursive)
         {
             commandLine.Add("-R");
         }
         if (settings.PreserveAllAttributes)
         {
             commandLine.Add("-a");
         }
     }
 }
 ExceptionHandlerCommandLineProcessor(
      object sender,
      Bam.Core.StringArray commandLineBuilder,
      Bam.Core.Option option,
      Bam.Core.Target target)
 {
     var exceptionHandlerOption = option as Bam.Core.ValueTypeOption<C.Cxx.EExceptionHandler>;
     switch (exceptionHandlerOption.Value)
     {
         case C.Cxx.EExceptionHandler.Disabled:
             commandLineBuilder.Add("-fno-exceptions");
             break;
         case C.Cxx.EExceptionHandler.Asynchronous:
         case C.Cxx.EExceptionHandler.Synchronous:
             commandLineBuilder.Add("-fexceptions");
             break;
         default:
             throw new Bam.Core.Exception("Unrecognized exception handler option");
     }
 }
 DefinesCommandLineProcessor(
      object sender,
      Bam.Core.StringArray commandLineBuilder,
      Bam.Core.Option option,
      Bam.Core.Target target)
 {
     var definesOption = option as Bam.Core.ReferenceTypeOption<C.DefineCollection>;
     foreach (var define in definesOption.Value)
     {
         commandLineBuilder.Add(System.String.Format("-D{0}", define));
     }
 }