Example #1
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();
    }
Example #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);
 }
Example #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);
      }
    }
Example #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);
    }
Example #5
0
 String getOutputFileName(VirtualFile file, CompileCppOptions compileOptions) {
   final String fileName = compileOptions.getOutputFileName();
   return fileName != null ? fileName : file.getNameWithoutExtension() + ".exe";
 }
Example #6
0
 String getOutputFileName(VirtualFile file, CompileCppOptions compileOptions) {
   final String fileName = compileOptions.getOutputFileName();
   return fileName != null ? fileName : SystemInfo.isWindows ? "a.exe" : "a.out";
 }