Package com.github.maven_nar.cpptasks.compiler

Examples of com.github.maven_nar.cpptasks.compiler.CommandLineCompilerConfiguration


                new String[]{"/Id:/gcc"}, new ProcessorParam[0], false,
                new String[0]);
    }
    public void testConstructorNullCompiler() {
        try {
            new CommandLineCompilerConfiguration(null, "dummy", new File[0],
                    new File[0], new File[0], "", new String[0],
                    new ProcessorParam[0], false, new String[0]);
            fail("Should throw exception for null compiler");
        } catch (NullPointerException ex) {
        }
View Full Code Here


        if (!projectDef.getOverwrite() && xcodeDir.exists()) {
            throw new BuildException("Not allowed to overwrite project file "
                    + xcodeDir.toString());
        }

        CommandLineCompilerConfiguration compilerConfig =
                getBaseCompilerConfiguration(targets);
        if (compilerConfig == null) {
            throw new BuildException(
                    "Unable to find compilation target using GNU C++ compiler");
        }
View Full Code Here

    private CommandLineCompilerConfiguration
    getBaseCompilerConfiguration(Map targets) {
        //
        //   find first target with an GNU C++ compilation
        //
        CommandLineCompilerConfiguration compilerConfig;
        //
        //   get the first target and assume that it is representative
        //
        Iterator targetIter = targets.values().iterator();
        while (targetIter.hasNext()) {
            TargetInfo targetInfo = (TargetInfo) targetIter.next();
            ProcessorConfiguration config = targetInfo.getConfiguration();
            //
            //   for the first cl compiler
            //
            if (config instanceof CommandLineCompilerConfiguration) {
                compilerConfig = (CommandLineCompilerConfiguration) config;
                if (compilerConfig.getCompiler() instanceof GccCCompiler) {
                    return compilerConfig;
                }
            }
        }
        return null;
View Full Code Here

    if (!projectDef.getOverwrite() && projectFile.exists()) {
      throw new BuildException("Not allowed to overwrite project file "
                               + projectFile.toString());
    }

    CommandLineCompilerConfiguration compilerConfig =
        getBaseCompilerConfiguration(targets);
    if (compilerConfig == null) {
      throw new BuildException(
          "Unable to generate C++ BuilderX project when gcc or bcc is not used.");
    }

    OutputStream outStream = new FileOutputStream(projectFile);
    OutputFormat format = new OutputFormat("xml", "UTF-8", true);
    Serializer serializer = new XMLSerializer(outStream, format);
    ContentHandler content = serializer.asContentHandler();
    content.startDocument();
    AttributesImpl emptyAttrs = new AttributesImpl();
    content.startElement(null, "project", "project", emptyAttrs);
    PropertyWriter propertyWriter = new PropertyWriter(content);
    propertyWriter.write("build.config", "active", "0");
    propertyWriter.write("build.config", "count", "0");
    propertyWriter.write("build.config", "excludedefaultforzero", "0");
    propertyWriter.write("build.config.0", "builddir", "Debug");
    propertyWriter.write("build.config.0", "key", "Debug_Build");
    propertyWriter.write("build.config.0", "linux.builddir",
                         "linux/Debug_Build");
    propertyWriter.write("build.config.0", "settings.MinGW",
                         "default;debug");
    propertyWriter.write("build.config.0", "settings.gnuc++",
                         "default;debug");
    propertyWriter.write("build.config.0", "settings.intellinia32",
                         "default;debug");
    propertyWriter.write("build.config.0", "settings.mswin32",
                         "default;debug");
    propertyWriter.write("build.config.0", "type", "Toolset");
    propertyWriter.write("build.config.0", "win32.builddir",
                         "windows/Debug_Build");
    propertyWriter.write("build.node", "name", projectDef.getName());
    final String buildType = getBuildType(task);
    propertyWriter.write("build.node", "type", buildType);
    propertyWriter.write("build.platform", "active",
                         getActivePlatform(task));
    propertyWriter.write("build.platform", "linux.Debug_Build.toolset",
                         "gnuc++");
    propertyWriter.write("build.platform", "linux.Release_Build.toolset",
                         "gnuc++");
    propertyWriter.write("build.platform", "linux.default", "gnuc++");
    propertyWriter.write("build.platform", "linux.gnuc++.enabled", "1");
    propertyWriter.write("build.platform", "linux.mswin32.enabled", "1");
    propertyWriter.write("build.platform", "linux.win32b.enabled", "1");
    propertyWriter.write("build.platform", "solaris.default", "gnuc++");
    propertyWriter.write("build.platform", "solaris.enabled", "1");
    String toolset = getWin32Toolset(compilerConfig);
    propertyWriter.write("build.platform", "win32.default", toolset);
    propertyWriter.write("build.platform", "win32." + toolset + ".enabled", "1");

    propertyWriter.write("cbproject", "version", "X.1.0");
    if ("dllproject".equals(buildType)) {
      propertyWriter.write("gnuc++.g++compile",
                           "option.fpic_using_GOT.enabled", "1");
      propertyWriter.write("gnuc++.g++link", "option.shared.enabled", "1");
      propertyWriter.write("intellinia32.icc", "option.minus_Kpic.enabled",
                           "1");
      propertyWriter.write("intellinia32.icclink",
                           "option.minus_shared.enabled", "1");
    }
    //
    //   assume the first target is representative of all compilation tasks
    //
    writeCompileOptions(basePath, propertyWriter, compilerConfig);
    writeLinkOptions(basePath, propertyWriter, linkTarget);
    propertyWriter.write("linux.gnuc++.Debug_Build", "saved", "1");
    if ("dllproject".equals(buildType)) {
      propertyWriter.write("runtime", "ExcludeDefaultForZero", "1");
      //propertyWriter.write("unique", "id", "852");
    } else if ("exeproject".equals(buildType)) {
      propertyWriter.write("runtime.0", "BuildTargetOnRun",
                           "com.borland.cbuilder.build."
                           + "CBProjectBuilder$ProjectBuildAction;make");
      propertyWriter.write("runtime.0", "ConfigurationName",
                           projectDef.getName());
      propertyWriter.write("runtime.0", "RunnableType",
                           "com.borland.cbuilder.runtime.ExecutableRunner");
    }
    AttributesImpl fileAttributes = new AttributesImpl();
    fileAttributes.addAttribute(null, "path", "path", "#PCDATA", "");
    AttributesImpl gccAttributes = null;
    if (!"g++".equals(compilerConfig.getCommand())) {
      gccAttributes = new AttributesImpl();
      gccAttributes.addAttribute(null, "category", "category", "#PCDATA",
                                 "build.basecmd");
      gccAttributes.addAttribute(null, "name", "name", "#PCDATA",
                                 "linux.gnuc++.Debug_Build.g++_key");
      gccAttributes.addAttribute(null, "value", "value", "#PCDATA",
                                 compilerConfig.getCommand());
    }

    Iterator<TargetInfo> targetIter = targets.values().iterator();
    while (targetIter.hasNext()) {
      TargetInfo info = targetIter.next();
View Full Code Here

  private CommandLineCompilerConfiguration
      getBaseCompilerConfiguration(final Map<String, TargetInfo> targets) {
    //
    //   find first target with an gcc or bcc compilation
    //
    CommandLineCompilerConfiguration compilerConfig = null;
    //
    //   get the first target and assume that it is representative
    //
    Iterator<TargetInfo> targetIter = targets.values().iterator();
    while (targetIter.hasNext()) {
      TargetInfo targetInfo = targetIter.next();
      ProcessorConfiguration config = targetInfo.getConfiguration();
      String identifier = config.getIdentifier();
      //
      //   for the first gcc or bcc compiler
      //
      if (config instanceof CommandLineCompilerConfiguration) {
        compilerConfig = (CommandLineCompilerConfiguration) config;
        if (compilerConfig.getCompiler() instanceof GccCCompiler ||
            compilerConfig.getCompiler() instanceof BorlandCCompiler) {
          return compilerConfig;
        }
      }
    }
    return null;
View Full Code Here

    }
    protected CompilerConfiguration createPrecompileGeneratingConfig(
            CommandLineCompilerConfiguration baseConfig, File prototype,
            String lastInclude) {
        String[] additionalArgs = new String[]{"-H=" + lastInclude, "-Hc"};
        return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
                null, true);
    }
View Full Code Here

    }
    protected CompilerConfiguration createPrecompileUsingConfig(
            CommandLineCompilerConfiguration baseConfig, File prototype,
            String lastInclude, String[] exceptFiles) {
        String[] additionalArgs = new String[]{"-Hu"};
        return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
                exceptFiles, false);
    }
View Full Code Here

        baseCompiler);
    setCompilerName(extendedCompiler, "msvc");
    CCTask cctask = new CCTask();
    LinkType linkType = new LinkType();
    linkType.setStaticRuntime(true);
    CommandLineCompilerConfiguration config = (CommandLineCompilerConfiguration)
        extendedCompiler
        .createConfiguration(cctask, linkType, null, null, null);
    String[] preArgs = config.getPreArguments();
    assertEquals("/ML", preArgs[3]);
  }
View Full Code Here

  /**
   * Test that a target with no existing object file is
   *    returned by getTargetsToBuildByConfiguration.
   */
  public void testGetTargetsToBuildByConfiguration1() {
    CompilerConfiguration config1 = new CommandLineCompilerConfiguration(
        (GccCCompiler) GccCCompiler.getInstance(), "dummy",
        new File[0], new File[0], new File[0], "", new String[0],
        new ProcessorParam[0], true, new String[0]);
    TargetInfo target1 = new TargetInfo(config1, new File[] {new File(
        "src/foo.bar")}
View Full Code Here

   * Test that a target that is up to date is not returned by
   *           getTargetsToBuildByConfiguration.
   *
   */
  public void testGetTargetsToBuildByConfiguration2() {
    CompilerConfiguration config1 = new CommandLineCompilerConfiguration(
        (GccCCompiler) GccCCompiler.getInstance(), "dummy",
        new File[0], new File[0], new File[0], "", new String[0],
        new ProcessorParam[0], false, new String[0]);
    //
    //    target doesn't need to be rebuilt
View Full Code Here

TOP

Related Classes of com.github.maven_nar.cpptasks.compiler.CommandLineCompilerConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.