News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

controlling testing environment?

Started by BentFX, September 03, 2006, 11:14:16 AM

Previous topic - Next topic

BentFX

I've got a graphics program I'm working on... I've also got a buggy vid card... While testing and debugging I need to set or optionally unset an environment variable (LIBGL_ALWAYS_INDIRECT) to control whether DRI or indirect rendering is used.

From within C::B how do I control the environment that my program executes in?

Thanx!

MortenMacFly

There is a plugin that does allow you to setup the environment of C::B as you like. Go to Settings -> Environment -> Environment variables.
Please notice that these environement variables are only applied within the focus of C::B. Thus if you don't launch your application from C::B the environment may be different (just ad the "usual" on on your system). Anyway, they are being saved accross C::B session and don't get lost. ;-)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

BentFX

Thanx Morten,

I worked around it in my own way :)

I duplicated the 'Debug' target as 'Debug(indirect)' and added 'LIBGL_ALWAYS_INDIRECT' as a compiler define.

and at the begining of my 'OnInit' I added...

#ifdef LIBGL_ALWAYS_INDIRECT
    setenv("LIBGL_ALWAYS_INDIRECT","1",1);
#endif


It seams to work fine... I just need to ensure that file is rebuilt when I change targets.

I'll probably check out the plugin also, yet I think I'll leave this in to allow a build which will always run in indirect mode. (It's a feature!!!) :D

Thanx again,
Skip


BentFX

#3
Now it's a feature!!!

I parse for '-indirect' on the command line, and set the env var accordingly.
Then I change my 'Debug(indirect)' to be the same as 'Debug', yet I add the -indirect argument in 'Project->Set Program Arguments...->Debug(indirect)". Now nothing needs to be rebuilt, just change the target... and it will always be a runtime option!

I guess all roads lead to Rome, but some of us can afford to fly :D