rulururu

post Using CMake with vim

April 13th, 2008

Filed under: C++, Coding — zedr0n @ 3:08 pm

I’ve recently moved from make to CMake which is a cross-platform build system. It’s quite nice if you want to be able to build for mac/win with the same makefile(CMakeLists.txt for CMake). The CMakeLists syntax is quite powerful and I haven’t regretted moving since.

One of the main ideas of CMake is out-of-source build - that is you use cmake like this

cmake directory

where directory contains the CMakeLists.txt and it builds everything in the current directory you are in. This is mostly because CMake is quite messy - it uses lots of files to build.

I use Vim for my development and its awesome ‘make’ compatibility which allows to build programs using make inside vim and view errors with special vim commands. Now as CMake uses unix makefiles on mac, it works quite well from vim. But then you’ll have to first generate makefiles with cmake inside the source directory for that to function. Not a nice idea really…

My solution to this is to use Makeobj. It is a script used to build using normal make outside of source directory. It uses OBJ_SUBDIR environment variable which defines the name of subdirectory where the build will take place.

How can it be used with CMake and vim? Here is the maker script I use

#!/bin/bash

if [ -e makefile ]; then
    make
else
    export OBJ_SUBDIR=build
    if [ -e CMakeLists.txt ]; then
        if [ -d build ]; then
            cd build
            rm CMakeCache.txt
        else
            mkdir build
            cd build
        fi
        cmake ../
        cd ..
        makeobj $1 $2 $3 $4 $5
    fi
fi

Now in vim you just go

:set makeprg=maker

post Par2 on OsX

March 19th, 2008

Filed under: C++, Coding, mac — zedr0n @ 12:08 pm

There’s a handy tool for correcting data errors - Par2

The command line utility for linux is included in most packages, but alas not so on macos. There are still two ways to go - there is a port over at MacPorts but I already have Fink installed and I didn’t really want to get another clutter in the system. So I just found the ALT Linux Source, extracted the rpm and built it.

You can grab the source here Par2.tar.gz
Now just extract it and build it

tar -xvf par2.tar.gz
cd par2cmdline-0.4
chmod +x configure
./configure
make

Now you can just move par2 utility to your path directory of choice.
Just in case you don’t want to bother building it - grab the binary here - par2.bz2

ruldrurd
© quant0r.com , Designed by Stealth Settings
Entries (RSS) and Comments (RSS)