Package com.github.maven_nar.cpptasks.compiler

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


        AttributesImpl attributes = new AttributesImpl();
        addAttribute(attributes, "Name", "VCLinkerTool");

        ProcessorConfiguration config = linkTarget.getConfiguration();
        if (config instanceof CommandLineLinkerConfiguration) {
            CommandLineLinkerConfiguration linkerConfig =
                    (CommandLineLinkerConfiguration) config;
            if (linkerConfig.getLinker() instanceof MsvcCompatibleLinker) {
                addAttribute(attributes, "LinkIncremental",
                        getLinkIncremental(linkerConfig));
                if (isDebug) {
                    addAttribute(attributes, "GenerateDebugInformation", trueLiteral);
                } else {
View Full Code Here


    baseOptions.append("# ADD BASE LINK32");
    options.append("# ADD LINK32");

    ProcessorConfiguration config = linkTarget.getConfiguration();
    if (config instanceof CommandLineLinkerConfiguration) {
      CommandLineLinkerConfiguration linkConfig =
          (CommandLineLinkerConfiguration) config;

      File[] linkSources = linkTarget.getAllSources();
      for (int i = 0; i < linkSources.length; i++) {
        //
        //   if file was not compiled or otherwise generated
        //
        if (targets.get(linkSources[i].getName()) == null) {
          //
          //   if source appears to be a system library or object file
          //      just output the name of the file (advapi.lib for example)
          //      otherwise construct a relative path.
          //
          String relPath = linkSources[i].getName();
          //
          //   check if file comes from a project dependency
          //       if it does it should not be explicitly linked
          boolean fromDependency = false;
          if (relPath.indexOf(".") > 0) {
              String baseName = relPath.substring(0, relPath.indexOf("."));
              for(Iterator<DependencyDef> iter = dependencies.iterator(); iter.hasNext(); ) {
                DependencyDef depend = iter.next();
                if (baseName.compareToIgnoreCase(depend.getName()) == 0) {
                    fromDependency = true;
                }
            }
          }
          if (!fromDependency) {
            if (!CUtil.isSystemPath(linkSources[i])) {
              relPath = CUtil.getRelativePath(basePath, linkSources[i]);
            }
            //
            //   if path has an embedded space then
            //      must quote
            if (relPath.indexOf(' ') > 0) {
                options.append(" \"");
                options.append(CUtil.toWindowsPath(relPath));
                options.append("\"");
            } else {
                options.append(' ');
                options.append(CUtil.toWindowsPath(relPath));
            }
           }
        }
      }
      String[] preArgs = linkConfig.getPreArguments();
      for (int i = 0; i < preArgs.length; i++) {
        if (isDebug || !preArgs[i].equals("/DEBUG")) {
            options.append(' ');
            options.append(preArgs[i]);
            baseOptions.append(' ');
            baseOptions.append(preArgs[i]);
        }
      }
      String[] endArgs = linkConfig.getEndArguments();
      for (int i = 0; i < endArgs.length; i++) {
        options.append(' ');
        options.append(endArgs[i]);
        baseOptions.append(' ');
        baseOptions.append(endArgs[i]);
View Full Code Here

        baseLinker);
    libset.setProject(baseLinker.getProject());
    CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("advapi32");
    libset.setLibs(libs);
    baseLinker.addLibset(libset);
    CommandLineLinkerConfiguration config = (CommandLineLinkerConfiguration)
        getConfiguration(extendedLinker);
    String[] libnames = config.getLibraryNames();
    assertEquals(1, libnames.length);
    assertEquals("advapi32", libnames[0]);
  }
View Full Code Here

        baseLinker);
    libset.setProject(baseLinker.getProject());
    CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("advapi32");
    libset.setLibs(libs);
    baseLinker.addSyslibset(libset);
    CommandLineLinkerConfiguration config = (CommandLineLinkerConfiguration)
        getConfiguration(extendedLinker);
    String[] libnames = config.getLibraryNames();
    assertEquals(1, libnames.length);
    assertEquals("advapi32", libnames[0]);
  }
View Full Code Here

            throw new BuildException(
                    "Unable to find compilation target using GNU C++ compiler");
        }


        CommandLineLinkerConfiguration linkerConfig = null;
        if (linkTarget.getConfiguration() instanceof CommandLineLinkerConfiguration) {
            linkerConfig = (CommandLineLinkerConfiguration) linkTarget.getConfiguration();
        }

        String projectName = projectDef.getName();
View Full Code Here

                       final PropertyWriter writer,
                       final TargetInfo linkTarget) throws SAXException {
    if (linkTarget != null) {
      ProcessorConfiguration config = linkTarget.getConfiguration();
      if (config instanceof CommandLineLinkerConfiguration) {
        CommandLineLinkerConfiguration linkConfig =
            (CommandLineLinkerConfiguration) config;

        if (linkConfig.getLinker() instanceof BorlandLinker) {
            String linkID = "win32.Debug_Build.win32b.ilink32";
            writeIlinkArgs(writer, linkID, linkConfig.getPreArguments());
            writeIlinkArgs(writer, linkID, linkConfig.getEndArguments());
            writer.write(linkID, "param.libfiles.1", "cw32mt.lib");
            writer.write(linkID, "param.libfiles.2", "import32.lib");
            int libIndex = 3;
            String[] libNames = linkConfig.getLibraryNames();
            for(int i = 0; i < libNames.length; i++) {
                writer.write(linkID, "param.libfiles." + (libIndex++),
                    libNames[i]);
            }
            String startup = linkConfig.getStartupObject();
            if (startup != null) {
                writer.write(linkID, "param.objfiles.1", startup);
            }
        } else {
            String linkID = "linux.Debug_Build.gnuc++.g++link";
            writeLdArgs(writer, linkID, linkConfig.getPreArguments());
            writeLdArgs(writer, linkID, linkConfig.getEndArguments());
        }
      }
    }
  }
View Full Code Here

        baseLinker);
    libset.setProject(baseLinker.getProject());
    CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("advapi32");
    libset.setLibs(libs);
    baseLinker.addLibset(libset);
    CommandLineLinkerConfiguration config = (CommandLineLinkerConfiguration)
        getConfiguration(extendedLinker);
    String[] libnames = config.getLibraryNames();
    assertEquals(1, libnames.length);
    assertEquals("advapi32", libnames[0]);
  }
View Full Code Here

        baseLinker);
    libset.setProject(baseLinker.getProject());
    CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("advapi32");
    libset.setLibs(libs);
    baseLinker.addSyslibset(libset);
    CommandLineLinkerConfiguration config = (CommandLineLinkerConfiguration)
        getConfiguration(extendedLinker);
    String[] libnames = config.getLibraryNames();
    assertEquals(1, libnames.length);
    assertEquals("advapi32", libnames[0]);
  }
View Full Code Here

    baseOptions.append("# ADD BASE LINK32");
    options.append("# ADD LINK32");

    ProcessorConfiguration config = linkTarget.getConfiguration();
    if (config instanceof CommandLineLinkerConfiguration) {
      CommandLineLinkerConfiguration linkConfig =
          (CommandLineLinkerConfiguration) config;

      File[] linkSources = linkTarget.getAllSources();
      for (int i = 0; i < linkSources.length; i++) {
        //
        //   if file was not compiled or otherwise generated
        //
        if (targets.get(linkSources[i].getName()) == null) {
          //
          //   if source appears to be a system library or object file
          //      just output the name of the file (advapi.lib for example)
          //      otherwise construct a relative path.
          //
          String relPath = linkSources[i].getName();
          //
          //   check if file comes from a project dependency
          //       if it does it should not be explicitly linked
          boolean fromDependency = false;
          if (relPath.indexOf(".") > 0) {
              String baseName = relPath.substring(0, relPath.indexOf("."));
              for(Iterator iter = dependencies.iterator(); iter.hasNext(); ) {
                DependencyDef depend = (DependencyDef) iter.next();
                if (baseName.compareToIgnoreCase(depend.getName()) == 0) {
                    fromDependency = true;
                }
            }
          }
          if (!fromDependency) {
            if (!CUtil.isSystemPath(linkSources[i])) {
              relPath = CUtil.getRelativePath(basePath, linkSources[i]);
            }
            //
            //   if path has an embedded space then
            //      must quote
            if (relPath.indexOf(' ') > 0) {
                options.append(" \"");
                options.append(CUtil.toWindowsPath(relPath));
                options.append("\"");
            } else {
                options.append(' ');
                options.append(CUtil.toWindowsPath(relPath));
            }
           }
        }
      }
      String[] preArgs = linkConfig.getPreArguments();
      for (int i = 0; i < preArgs.length; i++) {
        if (isDebug || !preArgs[i].equals("/DEBUG")) {
            options.append(' ');
            options.append(preArgs[i]);
            baseOptions.append(' ');
            baseOptions.append(preArgs[i]);
        }
      }
      String[] endArgs = linkConfig.getEndArguments();
      for (int i = 0; i < endArgs.length; i++) {
        options.append(' ');
        options.append(endArgs[i]);
        baseOptions.append(' ');
        baseOptions.append(endArgs[i]);
View Full Code Here

                       final PropertyWriter writer,
                       final TargetInfo linkTarget) throws SAXException {
    if (linkTarget != null) {
      ProcessorConfiguration config = linkTarget.getConfiguration();
      if (config instanceof CommandLineLinkerConfiguration) {
        CommandLineLinkerConfiguration linkConfig =
            (CommandLineLinkerConfiguration) config;

        if (linkConfig.getLinker() instanceof BorlandLinker) {
            String linkID = "win32.Debug_Build.win32b.ilink32";
            writeIlinkArgs(writer, linkID, linkConfig.getPreArguments());
            writeIlinkArgs(writer, linkID, linkConfig.getEndArguments());
            writer.write(linkID, "param.libfiles.1", "cw32mt.lib");
            writer.write(linkID, "param.libfiles.2", "import32.lib");
            int libIndex = 3;
            String[] libNames = linkConfig.getLibraryNames();
            for(int i = 0; i < libNames.length; i++) {
                writer.write(linkID, "param.libfiles." + (libIndex++),
                    libNames[i]);
            }
            String startup = linkConfig.getStartupObject();
            if (startup != null) {
                writer.write(linkID, "param.objfiles.1", startup);
            }
        } else {
            String linkID = "linux.Debug_Build.gnuc++.g++link";
            writeLdArgs(writer, linkID, linkConfig.getPreArguments());
            writeLdArgs(writer, linkID, linkConfig.getEndArguments());
        }
      }
    }
  }
View Full Code Here

TOP

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

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.