[Vm-dev] cmake, unix builds and adding a #define at configure time

David T. Lewis lewis at mail.msen.com
Sat Jun 8 00:08:09 UTC 2013


On Fri, Jun 07, 2013 at 04:06:25PM -0700, tim Rowledge wrote:
> 
> I've been having *ever* so much fun trying to make the unix vm with the fast bitblt enabled. You might have thought there were unusual numbers of earthquakes recently, but that was actually me banging my head against the walls. 
> 
> To build the vm on unix one runs the cmake configure & make programs. They do many magical things and create dozens if not hundreds of files, spend much time doing arcane incantations and eventually pop out a vm. Then, because unix is braindead about handling programs with required libraries and external components (despite the fact that this problem has been solved, without nasty 'resource forks', since *1989*) you have to 'install' with yet another cmake incantation.
> 
> I need to be able to build two versions of the vm for experimenting - one with the fast blt enabled and the other, not. Since I hadn't come across cmake and its world of annoyance previously I simply took at face value the advice I got to run cmake/configure --CFLAGS='-DENABLE_FAST_BLT' for the build directory where I wanted the fast blt. Some annoying times later I eventually discover that the reason the fast bitblt appeared to massively slow down everything wasn't in fact that it had terrible bugs but that said configure option *over rides* the normal cflags and therefore my vms weren't even slightly optimised. Sigh.
> 
> So my question is - aside from "why!!!!!" - how, if indeed it is possible at all, does one add a -D flag when doing the cmake/configure setup for a build directory? I've tried a few things, attempted to make sense of what doc I can find and not had any pleasure.  Over to you folks. Help me moldy wank inobee, you're my only dope.
> 

The quickest way to relieve your headache is specify the CFLAGS explicitly:

 --CFLAGS='-O3 -DENABLE_FAST_BLT'

The -O3 optimization level seems to be the default if you do not specify
CFLAGS yourself, so I think it's a safe optimization level to use. That
said, the gcc optimizer is somewhat shakey so drop it down to -O2 if you
are getting improbable results. If you need to run a gdb debugger, turn off
the optimizer completely, so this would be --CFLAGS='-g -DENABLE_FAST_BLT'.

When you run make to do the compile, you can see more of what is going on
by doing "make VERBOSE=1" instead of just "make". I have no clear recollection
of why I know this, so don't ask.

If you want to compile and install in one step, just do "make install". If
the compile does not succeed, nothing is installed so no harm done.

If I compile a VM and want to review the output for compiler warnings and
such, I typically do "nohup make VERBOSE=1" and then look at the resulting
nohup.out file ("man 1 nohup" for info).

Dave



More information about the Vm-dev mailing list