Friday, January 29, 2010

Mac OS, Cmake linking troubles

Mac OS.... if you see ld: library not found for -lcrt1.10.6.o, then it may be that  either CMAKE_OSX_ARCHITECTURES or CMAKE_OSX_SYSROOT aren't properly set up. See this link for useful info http://public.kitware.com/Bug/view.php?id=6195

Comment/Uncomment python scripts in Xcode

The default Comment/Uncomment script in Xcode works for python and pearl only if the first line of your scripts is #! /... . However, most of the times this is not what I do for my python scripts. So we can change the default script so that it determines the type of file from the extension .py.  To do so, go to the scripts tab in Xcode -the little icon before help- the select Edit User Scripts. Select the Comment/Uncomment scripts and change it to be:


#! /usr/bin/perl -w
#
# un_commentLines.pl - Comments or uncomments the selected lines
# Uses '# ' for Perl and shell scripts; '// ' otherwise

my $outputString = "";
my $perlCmt = "#";
my $cCmt = "//";

# get path to document
my $headerPath = <<'HEADERPATH';
%%%{PBXFilePath}%%%
HEADERPATH
chomp $headerPath;my $commentString;
if ($headerPath =~m/\.(sh|pl|py)$/) {
    $commentString = $perlCmt;
} else {
    $commentString = $cCmt;
}
my @selection =  ;       # read the selection from standard input

# no chars in selection, so create an empty selection
if (!@selection) {
    push @selection, "";
};

# add or remove comment markers depending on the state of the first line of the selection
# if it is uncommented, comment all lines.  If it is commented, remove comment markers, if present
my $firstLineOfSelection = $selection[0]; #get first line
my $addingCommentsString = 1;
if ($firstLineOfSelection =~ /^$commentString/) { #selection starts with comment
    $addingCommentsString = 0;
}

foreach my $line (@selection) {
    if ($addingCommentsString == 1) {
        $outputString .= $commentString.$line;
    } else {
        $line =~ s/^$commentString//;
        $outputString .= $line;
    }
}

print "%%%{PBXSelection}%%%";
print $outputString;
print "%%%{PBXSelection}%%%";

Saturday, January 23, 2010

Blender: The beginning, fairly simple

So, I was given the task to build a somewhat realistic city scene a produce cameras and rendering for such scene. Initially the task didn't seem bad at all, so I jumped into building a scene right away. The rumors were that Blender was great (and in fact, so it seems ). So I decided to download it, learn how to use it and build a scene.
I downloaded it, things went easy and run across a tutorial that would guide me through how to build an 'impressive'-looking building (for a beginner) http://yorik.uncreated.net/tutorials/architecture-blender.html.

The estimated time to complete the tutorial said it was around 4 hours. Took me a little longer, I had never used Blender so finding the menus and getting used to all the keyboard shortcuts took some time. Manipulating the faces of my building wasn't always easy and some of the settings for the objects seem a bit alien, but after some time the model was done (not to the same level of detail)


Tuesday, December 8, 2009

VXL on Snow Leopard

This is a short entry on getting vxl-libraries working on Snow Leopard. Hopefully an easy task.

In my case I’ve created a folder /projects/vxl, then check out code for developers like this:
svn co https://vxl.svn.sourceforge.net/svnroot/vxl/trunk vxl
Or you can also check out the code anonymously by replacing https with
http:
svn co http://vxl.svn.sourceforge.net/svnroot/vxl/trunk vxl

This will create a folder /projects/vxl/vxl which can be rename to /projects/vxl/src.

At this point you are ready to build your binaries. Create a folder /projects/vxl/bin to place the binaries. Here create a folder bin/debug and bin/release to keep the two configurations separate.
To build the binaries you need cmake, for the mac there is a gui application but you can always use the command line cmake and ccmake utulities. I like gui’s so I usually use the gui.

In Cmake-gui, fill the paths for source and binaries(debug or release). Press configure. It will first ask you hat type of binaries to build. I go for Unix Makefiles. You may need to press configure few times until CMake is done asking you for variables. In this entry I am not gonna cover specifics about which entries you need to build certain projects.

When cmake is done showing variables in red(missing), it will highlight the generate button, press it. The unix make files are all set and you can now go to the terminal cd to your binaries and type make.

Add custom file templates in Xcode

The location is /Library/Application Support/Developer/Shared/Xcode/File Templates

In this location I created /C++.pbfiletemplate and /Header.pbfiletemplate. In the former folder I placed the custom header and source files and a TemplateInfo.plist containing my files description.

Example of default file templates are in /Developer/Library/Xcode/File Templates