Browsing the archives for the xCode tag.


MPI on xCode

Geeky Stuff

I am currently working on a small MPI project, and I had one hell of a time getting MPI up and running, specifically the MPICC (compiler) to work in xCode.

So here it is if you were wondering how to get it to work:

Put the following into a file called MPICC.pbcompspec

/**
Xcode Compiler Specification for MPICC
*/
{   Type = Compiler;
Identifier = com.apple.compilers.mpicc;
BasedOn = com.apple.compilers.gcc.4_2;
Name = “MPICC”;
Version = “Default”;
Description = “MPI GNU C/C++ Compiler 4.0″;
ExecPath = “/usr/bin/mpicc”;      // This gets converted to the g++ variant automatically
PrecompStyle = pch;
}

Note: ExecPath should be set to your mpicc path, find this by typing which mpicc in terminal. BasedOn should be set to whatever the system GCC is (4.2 for snow leopard).

Save this file to the following directory: /Developer/Library/Xcode/Specifications/, if the directory does not exist, create it, restart xCode.

Finally in your project, open the build targets and select the one you want to build with MPICC, get info on it, and add a custom rule for c source, MPICC should be in the list somewhere, if it is not then you messed up somewhere above.

Setting a custom C xCode target rule

Setting a custom C xCode target rule

The file: mpicc.pbcompspec

Sources:

http://lists.apple.com/archives/xcode-users/2008/Apr/msg00104.html

http://www.open-mpi.org/community/lists/devel/2007/02/1313.php

2 Comments

Making xCode Behave like eclipse (sort of)

Uncategorized

So I do a lot of java development, but for my project work I am looking to do a whole whack of C and possibly Objective-C. So this means xCode and I must become friends. My problem with this is I really like the eclipse text shortcuts for deleting / moving / duplicating lines. Also I am just used to control + space for my auto complete, and option + shift + r for refactoring.

Having encountered this problem before in TextMate doing ruby stuff I assumed there would be a handy macro solution, this was not the case. So after some serious web searching I found several articles on how to solve a few of these problems. Some suggested I use ruby, other showed some neat hacking tricks with some keyboard plists, at any rate I won’t go into the how, you can find those (here, and here ).

I am simply providing my key bindings file for anyone who cares to use it.

What it does:

  • move line up: alt + up arrow
  • move line down: alt + down arrow
  • duplicate line down: alt + command + down arrow
  • delete current line: command + d
  • refactor current selection: option + shift + r
  • show auto complete: control + space

These function quite a bit more responsively than applescripts (based on my observations), however it will clear out your clip board so be warned, if anyone has any idea about that lemme know.

To install it simply place eclipse-style.pbxkeys in ~/Library/Application Support/Xcode/Key Bindings/ reboot xCode and you should be able to select the key binding file as shown in the screen shot below.

xCode Key Binding Prefs witth Eclipse-Style

xCode Key Binding Prefs witth Eclipse-Style

Hope this helps, sure makes coding in xCode more fun for me, and helps with the context switching between Eclipse and TextMate and xCode.

.joe

No Comments