예제 #1
0
 protected List<String> defaultAppendOptions(
     CompileCppOptions options, List<String> command, VirtualFile file) {
   command = BuildUtils.appendAllOptions(command, options.getProjectCompilerOptions());
   command =
       BuildUtils.appendAllOptions(
           command,
           options.getCompilerOptions().replace(MARKER, getEscapedPathToFile(file.getPath())));
   return command;
 }
예제 #2
0
 @Nullable
 List<String> buildCommand(VirtualFile file, CompileCppOptions options) {
   List<String> commandLine = new ArrayList<String>(4);
   if (!options.doRun()) {
     commandLine = BuildUtils.appendOptions(commandLine, "-S");
   } else {
     final String fileName = options.getOutputFileName();
     if (fileName != null) {
       commandLine = BuildUtils.appendOptions(commandLine, "-o");
       commandLine = BuildUtils.appendOptions(commandLine, fileName);
     }
   }
   commandLine = defaultAppendOptions(options, commandLine, file);
   myItems = BuildUtils.buildEnvironmentMap(options.getProject(), file);
   return BuildUtils.buildClangToolCall(
       CppSupportSettings.getInstance().getClangPath(), commandLine);
 }
예제 #3
0
    @Nullable
    List<String> buildCommand(VirtualFile file, CompileCppOptions options) {
      try {
        List<String> commandLine = Arrays.asList("cl.exe");
        if (!options.doRun()) commandLine = BuildUtils.appendOptions(commandLine, "/c");
        else {
          final String fileName = options.getOutputFileName();
          if (fileName != null) {
            commandLine = BuildUtils.appendOptions(commandLine, "/Fe" + fileName);
          }
        }

        commandLine = defaultAppendOptions(options, commandLine, file);
        return BuildUtils.buildVCToolInvokation(commandLine);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
예제 #4
0
    @Nullable
    List<String> buildCommand(VirtualFile file, CompileCppOptions options) {
      List<String> command = new ArrayList<String>(4);
      if (!options.doRun()) command = BuildUtils.appendOptions(command, "-c");
      else {
        final String fileName = options.getOutputFileName();
        if (fileName != null) {
          command = BuildUtils.appendOptions(command, "-o");
          command = BuildUtils.appendOptions(command, fileName);
        }
      }
      command = defaultAppendOptions(options, command, file);
      myItems = BuildUtils.buildEnvironmentMap(options.getProject(), file);
      String gccPath =
          CppSupportSettings.getInstance()
              .getGccPath()
              .replaceAll("gcc", options.isCppFile() ? "g++" : "gcc");

      return BuildUtils.buildGccToolCall(gccPath, command);
    }
예제 #5
0
    protected CompileCppDialog(
        Project _project, CompileHandler compilerHandler, CompileCppOptions options) {
      super(_project, false);

      project = _project;
      setModal(true);

      doRun.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              final boolean b = doRun.isSelected();
              executableFileName.setEnabled(b);
              executableFileName.setEditable(b);
            }
          });

      executableFileName.getEditor().setItem(options != null ? options.getOutputFileName() : "");
      doRun.setSelected(lastRunStatus);

      final CppSupportLoader loader = CppSupportLoader.getInstance(project);
      final String compileParameters = loader.getAdditionalCompileParameters();

      compileProperties.setText(
          (compileParameters != null && compileParameters.length() > 0
                  ? compileParameters + " "
                  : "")
              + CompileHandler.MARKER);

      setTitle(CppBundle.message("compile.cpp.file.dialog.title"));

      compilerSelector.setModel(
          new DefaultComboBoxModel(CppSupportSettings.CompilerSelectOptions.values()));
      compilerSelector.setSelectedItem(getCurrentCompilerOption(project));

      setSelectedProjectCompile();

      includeProjectCompileParametersCheckBox.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              setSelectedProjectCompile();
            }
          });

      includeProjectCompileParametersCheckBox.setSelected(loader.isIncludeProjectSettings());
      final String compileParametersText = compilerHandler.buildProjectCompileOptions(project);
      projectCompileParameters.setText(compileParametersText != null ? compileParametersText : "");

      init();
    }
예제 #6
0
 String getOutputFileName(VirtualFile file, CompileCppOptions compileOptions) {
   final String fileName = compileOptions.getOutputFileName();
   return fileName != null ? fileName : file.getNameWithoutExtension() + ".exe";
 }
예제 #7
0
 @Nullable
 Filter getCompileLogFilter(VirtualFile file, CompileCppOptions options) {
   return new VisualStudioBuildHandler.VCFormatFilter(file, options.getProject());
 }
예제 #8
0
 String getOutputFileName(VirtualFile file, CompileCppOptions compileOptions) {
   final String fileName = compileOptions.getOutputFileName();
   return fileName != null ? fileName : SystemInfo.isWindows ? "a.exe" : "a.out";
 }
예제 #9
0
 @Nullable
 Filter getCompileLogFilter(VirtualFile file, CompileCppOptions options) {
   return new MakeBuildHandler.MakeFormatFilter(file, options.getProject());
 }
예제 #10
0
 @Nullable
 Filter getCompileLogFilter(VirtualFile file, CompileCppOptions options) {
   return new BasicFormatFilter(file, options.getProject(), getMatchingPattern());
 }