Author Topic: controlling testing environment?  (Read 4575 times)

BentFX

  • Guest
controlling testing environment?
« on: September 03, 2006, 11:14:16 am »
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!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: controlling testing environment?
« Reply #1 on: September 03, 2006, 11:54:27 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

BentFX

  • Guest
Re: controlling testing environment?
« Reply #2 on: September 03, 2006, 12:16:39 pm »
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...
Code
#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

  • Guest
Re: controlling testing environment?
« Reply #3 on: September 03, 2006, 12:31:42 pm »
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
« Last Edit: September 03, 2006, 12:35:01 pm by BentFX »