Confused about overriding configs

Added by Anonymous about 7 years ago

Hi,

I'm just getting started with JamPlus, so sorry if I'm missing something obvious here. I'm trying to override the compiler configs so I can define all my own flags, and ideally override everything.

I'm created my own c-compilers folder, and have put some test files in there containing Echo statements to ensure they are getting called. From what I can tell, $(PLATFORM)-$(CONFIG).jam always called first, and the rest of the files are included from there. Is that correct? If that's the case, Win32 seems to be going through a toolchain helper, which I can't find in the docs. Is there any explanation on how that searches through all of these files, or would you recommend not invoking the toolchain helper and setting things up the same as simpler platforms, like Xbox360?

Thanks!


Replies (6)

RE: Confused about overriding configs - Added by Joshua Jensen about 7 years ago

Are you using the nextgen branch?

-Josh

RE: Confused about overriding configs - Added by Anonymous about 7 years ago

Yes I am. Just grabbed it a couple days ago, so should be pretty recent.

I was trying to make it a point to mention that in my post, guess I didn't do so hot :)

RE: Confused about overriding configs - Added by Joshua Jensen about 7 years ago

The biggest problem in the nextgen branch is lack of documentation. I want to get it documented, but I haven't had any time.

There is a bunch of useful information in this thread: http://jamplus.org/boards/1/topics/327. I'll repost some of it here:

The C.Toolchain rule can be given any number of arguments. The arguments given to the C.Toolchain rule are translated into the filename c-compilers/configs/ARG1-ARG2-ARG3.jam. In the default case, the arguments are the specified PLATFORM and CONFIG passed into the jam executable and are translated into a filename such as c-compilers/configs/win32-debug.jam.

The first thing a c-compilers/configs/ file must do is call the C.ToolchainSpecKeys rule. This informs the toolchain system what the Jam variable names should be for each of the passed arguments to the C.Toolchain rule. In this way, the toolchain system remains generic. In the default case, the C.ToolchainSpecKeys rule looks like:

# Call the first argument to C.Toolchain C.PLATFORM and the second argument C.CONFIG.
# Therefore, for "C.Toolchain win32 debug", C.PLATFORM=win32 and C.CONFIG=debug.
C.ToolchainSpecKeys C.PLATFORM C.CONFIG ;

If you can assume that Visual C++ is always the compiler for PLATFORM win32, then a file called c-compilers/configs/win32-debug.jam may have contents similar to this:

C.ToolchainSpecKeys C.PLATFORM C.CONFIG ;
IncludeModule c-compilers/c-vc-autodetect ;
C.AutoDetect ;

C.CFlags * : /Od /EHsc /MDd /W3 /Z7 ;
C.C++Flags * : /Od /EHsc /MDd /W3 /Z7 ;
C.LinkFlags * : /INCREMENTAL /DEBUG /MACHINE:X86 ;

C.Defines * : WIN32 WINDOWS ;

C.LINKER_CONFIG on $(C.COMPILER_SUITE_SYMBOL) = debug ;

A simple example is in c-compilers/configs/tcc-debug.jam and c-compilers/c-tcc.jam.

Anyway, I will answer any questions you might have. Just fire away.

-Josh

RE: Confused about overriding configs - Added by Joshua Jensen about 7 years ago

I should also add that if you have your own c-compilers/ hierarchy, that one will be searched first. You could just override c-compilers/configs/_vc-win32-debug.jam with your own compiler settings.

This thread may also be of assistance: http://jamplus.org/boards/1/topics/280

-Josh

RE: Confused about overriding configs - Added by Anonymous about 7 years ago

I appreciate taking the time to provide the explanation. So the reason the Xbox 360 files were simpler is because the platform only supports one compiler? Seems like the toolchain enables using different compilers for the same platform. Is my understanding of that correct?

I'll let you know if I have any more questions. So far I've copied all of the files into my own c-compilers folder, and I've stuck Echo statements at the top of each one. Helping me figure out the flow of all these things.

RE: Confused about overriding configs - Added by Joshua Jensen about 7 years ago

Yes, the reason the Xbox 360 platform is simpler is because there is only one compiler.

Likewise, assuming Visual C++ is the compiler, this win32-debug.jam is "simpler", too (or, at least, resides within a single file):

C.ToolchainSpecKeys C.PLATFORM C.CONFIG ;
IncludeModule c-compilers/c-vc-autodetect ;
C.AutoDetect ;

C.CFlags * : /Od /EHsc /MDd /W3 /Z7 ;
C.C++Flags * : /Od /EHsc /MDd /W3 /Z7 ;
C.LinkFlags * : /INCREMENTAL /DEBUG /MACHINE:X86 ;

C.Defines * : WIN32 WINDOWS ;

C.LINKER_CONFIG on $(C.COMPILER_SUITE_SYMBOL) = debug ;

(1-6/6)