Building Boost on windows

Recently I need specific boost binary for my code, so I compiled boost. That was my first time and this is short useful note about it.
1. Go to boost\tools\build\v2
2. Run bootstrap.bat
3. Run b2 b2 install –prefix=[directory to install]
4. Add prefix\bin to system environment
5. Go to boost directory and run b2 :
b2 –build-dir=[directory to put intermediate file] toolset=[see below] –build-type=complete stage threading=[sea below] link=[see below]

At step 5 you notice that there are some compile time configurations avalable like build-type, toolset, threading and link. Well there are another option avaible, but I will only introduce you to three important option : toolset, threading and link.
Baca lebih lanjut

Handling Command Line Parameter using Cpp-optparse

Recently I needed to create tool with lots of command line parameters. Since I don’t want to create my own parser and using boost or getopt is too bothersome to do, I need simpler option. I found some option like optionparser , cpp-optparse and some others. I choose cpp-optparse because I like python optparse, although it deprecated from python since 2.7.

It consist of 1 header file and 1 c++ file, (yes! it’s not header only library). Using this one is pretty straight forward and actually you can refer to python’s optparse documentation. However I don’t like the way this library handle error, it just print error message and quit immediately without throwing any exception.

In my case, I modified OptionParser::error() to throw exception instead of exit, this way I can manage what I need to do from main loop.

    void OptionParser::error(const string& msg) const {
        cerr << prog() << ": " << _("error") << ": " << msg << endl;
        throw std::exception(msg.c_str(), 2);

Blanco – My new mate

Tahun lalu alhamdulillah ada rejeki, sehingga bisa membelikan hadiah ulang tahun untuk diri sendiri – Motor Honda New Megapro Fi warna putih keluaran dealer tahun 2014. Bulan Februari lalu motor ini dikirim lewat kereta api ke Jogja, jadi sudah sekitar 3 bulan.


Semoga mendatangkan rejeki puk puk puk

Premake 4 short introduction

Have you ever maintain cross platform project?

Having different build tools to maintain each platforms is troublesome, because naturally we need to synch each other manually. The case can be even worse when we need to upgrade the compiler of one platforms, in most case it means we need to add new build configuration.

With Premake all case above can be handled much easier, virtually premake could generate project for almost all major available build tools, like :

It even has cross compiling support, but it’s still experimental. Baca lebih lanjut