Author Topic: Compiler Installation directory as C::B Variable  (Read 8413 times)

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 41
Compiler Installation directory as C::B Variable
« on: November 30, 2009, 11:11:33 am »
Hi,

Does anybody know, if there is a Code::Blocks variable (like e.g. $(PROJECT_NAME)) for the Compiler Installation Directory? I could of course create a custom variable for that, but the downside would be that my projects won't be compileable on other machines.


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Compiler Installation directory as C::B Variable
« Reply #1 on: November 30, 2009, 04:09:13 pm »
Hi,

Does anybody know, if there is a Code::Blocks variable (like e.g. $(PROJECT_NAME)) for the Compiler Installation Directory? I could of course create a custom variable for that, but the downside would be that my projects won't be compileable on other machines.



I just do a quick search about "PROJECT_NAME" in the codeblocks source code
 "sdk\macrosmanager.cpp" will do the whole job, but I can't find a Code::Blocks variable of compiler installation path, so, I think you can add one in that file.  :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compiler Installation directory as C::B Variable
« Reply #2 on: November 30, 2009, 05:07:02 pm »
christobal: Why do you need it?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Compiler Installation directory as C::B Variable
« Reply #3 on: December 01, 2009, 11:05:38 am »
Quote
christobal: Why do you need it?
I need to run some scripts in the post-build steps, which need the compiler path (basically extracting object files from one lib and putting them into another).

Quote
"sdk\macrosmanager.cpp" will do the whole job, but I can't find a Code::Blocks variable of compiler installation path, so, I think you can add one in that file.
Adding that variable to the macrosmanager is an easy task, but since I will share my projects with others, it will fail for everyone who has the "official" Code::Blocks installed.

Maybe I should file a feature request...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compiler Installation directory as C::B Variable
« Reply #4 on: December 01, 2009, 04:02:05 pm »
I've expected the answer to be weird, but that weird  :lol:  :shock:

Adding that variable to the macrosmanager is an easy task, but since I will share my projects with others, it will fail for everyone who has the "official" Code::Blocks installed.

Maybe I should file a feature request...
Better route for you is to upload a patch to berlios.de
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Compiler Installation directory as C::B Variable
« Reply #5 on: December 01, 2009, 04:27:06 pm »
I've expected the answer to be weird, but that weird  :lol:  :shock:

My build target is a static library. Some of the object files are generated from the sources and some are copied from another library. I wouldn't say that it's weird... But if you know a better way to move object files from one lib to another, please tell me  :wink:.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Compiler Installation directory as C::B Variable
« Reply #6 on: December 01, 2009, 08:06:52 pm »
I suggest using an environmental/system variable if it is just Windows; not sure if this would work with Linux.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Compiler Installation directory as C::B Variable
« Reply #7 on: December 01, 2009, 08:16:24 pm »
Global variables is what you are looking for. Once defined if you open the project file on another computer C::B will query (once) for the location of the compiler. This way you can assure that the setup is correct on the target platform. This works cross-platform, of course.

Same applies to e.g. libraries like boost. Just define a global variable and it'll be qeried on another compuert (even another account) if not defined there.
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Compiler Installation directory as C::B Variable
« Reply #8 on: December 01, 2009, 08:21:46 pm »
My build target is a static library. Some of the object files are generated from the sources and some are copied from another library. I wouldn't say that it's weird... But if you know a better way to move object files from one lib to another, please tell me  :wink:.
If the object files from the other library are propriatary you won't have any other chance most likely. However, if you have access to the sources I'd rather compile them (another time) to avoid e.g. ABI incompatibilities. It always shiffers me if I have to use object files I can't compile myself. I even had to abandon a whole project back in the days because the provided object files were not compatible with new kernel versions and were not updated anymore. When we bought the 3rd party stuff (for tons of money, of course) it was said "life-time support".... Tssss. Life-time assholes probably, but that's it. You see: This can be mission-critical.
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

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Compiler Installation directory as C::B Variable
« Reply #9 on: December 02, 2009, 07:57:51 am »
Global variables is what you are looking for. Once defined if you open the project file on another computer C::B will query (once) for the location of the compiler. This way you can assure that the setup is correct on the target platform. This works cross-platform, of course.

Same applies to e.g. libraries like boost. Just define a global variable and it'll be qeried on another compuert (even another account) if not defined there.


The Global Variables are a good solution. I will use them, thanks!