Please add options /INCLUDE and /RELATIVE to the compiler

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Please add options /INCLUDE and /RELATIVE to the compiler

Post by Mistrel »

Like most traditional compiler/linkers, please add a compiler option /INCLUDE as a search path for IncludeFile/XIncludeFile. Also, please add a compiler option /RELATIVE to resolve IncludeFile/XIncludeFile paths relative to the particular file being examined instead of just the main source file.

Trying to work with PureBasic from the command line is excruciatingly difficult. I already can't split files away from my projects as reusable code because IncludeFile/XIncludeFile is so difficult to work with. I want "one" variant of a particular library on my system which all projects tap into instead of having to copy it into every project.

Relative paths and /INCLUDE is a beautiful solution. When working with C/C++, compiling on -any- system is a complete no brainer. All of my libraries and compilers are stored in a very logical directory structure and commanded by a custom build system that allows me to compile anywhere and everywhere by running one shell file to automatically configure my environment.

For command line compiler's sake, please add these features. I want to compile my entire project from one shell script and not have to worry about whether my relative path hack is going to freak out because the path is too deep or whether I remembered to update my project's libraries with the latest revision.

I am THIS close *makes a suggestively small space between thumb and index finger* to completely abandoning the IDE and hacking together my own completely incompatible compile-time parser to splice out includes on the fly to imitative this behavior. But I like the IDE. I like it a lot. Please add this fundamental feature to the compiler.

Please, please, PLEASE add this!
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Please add options /INCLUDE and /RELATIVE to the compile

Post by blueznl »

Mistrel, perhaps I'm stupid, but...

... here's my PureBasic folder setup:

Code: Select all

  projects
    x_lib
    g_spot
    ...
    ...
    codecaddy
In all my code, my includes point to: "..\x_lib\x_lib.pb" etc. which is a relative path to, for example, the sources of CodeCaddy I tend to keep in the 'codecaddy' folder...

I think I must misunderstand your request :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Please add options /INCLUDE and /RELATIVE to the compile

Post by Mistrel »

Include paths are relative to the main file being compiled. Not to the individual file being evaluated by the compiler.

http://www.purebasic.fr/english/viewtop ... =3&t=43921
http://www.purebasic.fr/english/viewtop ... 13&t=35288
http://www.purebasic.fr/english/viewtopic.php?t=30504

Also for your example:

Code: Select all

  projects
    x_lib
    g_spot
    ...
    ...
    codecaddy
If you compile g_spot and include "..\x_lib\x_lib.pb" which also includes "..\codecaddy\somelib.pb", the path ""..\codecaddy\" is relative to g_spot not x_lib, where the include is declared. But if your includes are very simple like this you won't notice much of a difference.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Please add options /INCLUDE and /RELATIVE to the compile

Post by blueznl »

Ah, I see what you mean. I think the point is that I do not do nested includes, ie. SweetSpot and CodeCaddy both use the same includes and paths:

Code: Select all

  ...
  IncludeFile("..\x_lib\x_lib.pb")
  IncludeFile("..\g_spot\g_spot.pb")
  ..
But then again, I am a simple person :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply