Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: bootstrap on June 19, 2012, 10:18:48 pm

Title: how to execute different targets
Post by: bootstrap on June 19, 2012, 10:18:48 pm
I have four targets for the linux version of my application:

linux32_debug
linux32_release
linux64_debug
linux64_release

I build all four, then run linux32_debug and watch output being printed onto the console, which is the average number of machine cycles per vertex required to transform the vertex from local-to-world coordinates.

Then I stop execution, switch "build target" to linux32_release, run again, and watch similar output.

Then I stop execution, switch "build target" to linux64_debug, run again, and watch similar output.

Then I stop execution, switch "build target" to linux64_release, run again, and watch similar output.

This is wrong.  The 64-bit versions of these routines are much faster.  That can easily be made evident by then selecting "build clean" and "build build", then running again.

Presto-chango... the output shows 35% improvement in speed.

The problem may be one of my not understanding how codeblocks is supposed to work.  I was thinking that switching "build target" would change which executes when I click the red or green "run" arrows on the GUI.  But I don't see any other obvious way to switch which build I execute.

Please explain.  Is this a codeblocks bug, or am I the bug?
Title: Re: how to execute different targets
Post by: oBFusCATed on June 19, 2012, 10:44:50 pm
Hm, what is the output executable for every target? Are they different?
Title: Re: how to execute different targets
Post by: Jenna on June 19, 2012, 11:04:45 pm
You should be able to see in the build log whether the executables are build in the correct place and whether they use the correct settings, libs and object-files.
You need to have full commandline logging enabled, of course, which is the default for new configurations since several revisions.
Title: Re: how to execute different targets
Post by: bootstrap on June 20, 2012, 01:49:18 am
Yup, the bug is me.  Without thinking I just assumed codeblocks did what other IDEs in my experience have done --- create a new directory for everything, not just object files.  So yeah, all 4 builds were saving the executable file in the same place (the base project directory).  So I just changed the "output filenames" fields for the 4 targets from "ig" to:

linux32_debug/bin/ig
linux32_release/bin/ig
linux64_debug/bin/ig
linux64_release/bin/ig

... and the behavior became what I expected.  My intuitive assumption of how things should work just doesn't match how they do work.

My intuition is that any file that's different in different builds should be automatically separated from other builds, so they don't walk all over each other (just like the object files) --- at least by default.

Nonetheless, my mistake for assuming codeblocks corresponds to my assumptions.  :-)
Title: Re: how to execute different targets
Post by: oBFusCATed on June 20, 2012, 09:33:59 am
What template have you used to create your project.
I think the default is to the proper setup, at least for the default targets.
Title: Re: how to execute different targets
Post by: bootstrap on June 21, 2012, 01:10:13 am
I started this project years ago, so I can't actually remember taking the steps.  But I'm sure I started with a simple console project.  Sure, it is a 3D engine and creates its own xlib or win32 windows (to associate with WGL or GLX contexts and render with OpenGL), but ultimately it is a console application (so I can printf() debug and profile information mostly).  When release time finally arrives I'll worry about making the console window not exist or start out hidden (unshown), but for now, it is a console application.