Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update

Added by Ben Hymers over 7 years ago

I've just updated the version of JamPlus I'm using after quite a long while, and there are a couple of problems I've not been able to fix.

First is that the workspace generator seems to be picking up my .config file, but ignoring the contents of the config directory I specify - I have defined a 'development' config but it complains about "win32-development.jam" being missing, which it isn't! The path it gives seems to be relative to jam's version of the file though, not mine.

Second is that the Visual Studio compiler is spewing out lots of warnings about ignoring a compile flag that should only be specified for linux. My Jamfile contains this kind of thing:

C.C++Flags myapp : -std=c++0x : : linux32 ;

... and that's the option that the warning is about. This is a pretty benign case but it makes me wonder if there's anything more nasty going on under the hood if it thinks I'm both on win32 and linux at the same time!

Any ideas?

By the way, cheers for keeping up development of this project! I may be about to add VC11 support if all goes well.


Replies (10)

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Joshua Jensen over 7 years ago

Hi, Ben.

Are you using the (undocumented) nextgen branch? If so, a lot of things were changed to support multiple toolchains within the same Jam invocation.

The .config file should still be working, but I will test that out shortly. I do know that this one is working for me:

Config =
{
    Platforms = { 'iphone', 'iphonesimulator', 'ipad', 'ipadsimulator' }
}

If you could email me your .config and win32-development.jam, I would be happy to help.

Within the nextgen branch, the notion of PLATFORM and CONFIG is user-definable and may also have ARCHITECTURE or PPU or SPU or whatever you would like. With that in mind, your C.C++Flags must now be specified like:

# Or a switch statement.
if $(PLATFORM) = linux32 {
    C.C++Flags myapp : -std=c++0x ;
}

I have not yet downloaded Visual Studio 11, but any contributions are indeed welcome!

Finally, I use JamPlus for builds nearly every day, so I really need to keep it running! ;)

-Josh

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Ben Hymers over 7 years ago

Yes, sorry, I should have mentioned I'm using the nextgen branch, that's pretty important :)

My .config file looks like this:

Config =

{
    Configurations = { 'release', 'debug', 'development' },

    JamModulesUserPath = "$(sourceRootPath)/config" ;
}

And within that directory I have my Jamfile.jam and a batch file (which I run to generate project files) that looks like this:

@"path/to/jam.exe" --workspace --gen=vs2010 --config=%~dp0.config "%~dp0Jamfile.jam" "%~dp0/vs2010generated" 

I also have a directory alongside those files called 'config' that is laid out like this:

config/
  c-compilers/
    global-debug.jam
    global-development.jam
    global-release.jam
    win32-debug.jam
    win32-development.jam
    win32-release.jam

The win32-* files used to be called win32-vc-* but it looks like Jam is now expecting the 'vc' part to be removed. Each of them just contains a bunch of compiler flags and defines along these lines:

C.C++Flags *    : /Od /EHsc /Gy /MD /W4 /Zi : development : win32 ;

... which I guess are now incorrect given what you just said, but presumably that shouldn't be causing the files to just get ignored?

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Joshua Jensen over 7 years ago

Ah, okay. Here is a brief rundown of how things work in the nextgen branch.

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 ;

C.ToolchainHelper global-debug ;

C.ToolchainHelper global-debug loads a file called c-compilers/configs/_global-debug.jam.

With regard to your layout above, you need to move all of your config/c-compilers/* files to config/c-compilers/configs/*. You should rename your global-*.jam files to _global-*.jam. Your win32-*.jam files should be refined to be similar to what I have above.

The : development : win32 part of C.C++Flags is no longer relevant.

Ask away if you have further questions!

-Josh

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Ben Hymers over 7 years ago

Excellent, thank you! That seems to have done the trick and everything is working nicely!

One quick (off-topic) question to help me with the VC11 work; what is the "win32custom-debug.jam" file for? It doesn't fit in with all the other files in the same directory (bin/modules/c-compilers/configs) - is it supposed to be a sample of a custom platform? I ask because I'm wondering whether it needs to allow for VC11 too.

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Joshua Jensen over 7 years ago

Unless Microsoft made major changes to the way Visual Studio 11 works, there are only a few changes needed.

For compiler support:

  • bin/modules/c-compilers/c-vc-autodetect.jam - Note how the 2010 support was set up and do something similar.
  • bin/modules/c-compilers/c-vc.jam - Search for vs2010. Add vs11.
  • bin/modules/c-compilers/win32-vc.jam - Search for vs2010.
  • bin/modules/c-compilers/win64-vc.jam - Search for vs2010.

For bootstrapping Jam:

  • src/jmake.cmd - Search for 2010.

For building Jam:

  • src/jam.VS2010.sln and src/jam.VS2010.vcxproj

For C# support:

  • bin/modules/csharp.jam - Search for vs2010.

For various helper modules:

  • bin/modules/c/dotnet.jam - Search for vs2010.
  • bin/modules/c/midl.jam - Search for vs2010.
  • bin/modules/c/wxwidgets.jam - Search for vs2010.

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Ben Hymers over 7 years ago

Yep, it's pretty straightforward and I've done those already. The biggest change was that the Windows SDK lives elsewhere now and has a slightly different structure to its include, lib and bin directories, which meant replacing "$(MSSDK)/bin" with a new "$(MSSDK_BINDIR)". Also the project files needed a few extra bits of XML to get VS to stop labelling them as "2010" projects (quite how it can tell when they're makefile projects I don't know!).

Thanks for your help again :)

Oh, sorry, I should just ask about that win32custom-debug.jam file again - is that file meant to be there?

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Joshua Jensen over 7 years ago

The win32custom-debug.jam file is an example. It probably doesn't belong there.

-Josh

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Joshua Jensen about 7 years ago

FWIW, there is now official Visual Studio 2012 support in the latest nextgen branch code.

-Josh

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Ben Hymers about 7 years ago

I saw that! The day you pushed that, I had planned to fork from you on github and open a proper pull request with my changes, but you beat me to it :) I'll have a look and see if I did anything different - I think it's just in the C# stuff which I didn't actually test though so it's probably not worth taking.

RE: Workspace generation ignoring local config files, C.C++Flags confused about platform after JamPlus update - Added by Joshua Jensen about 7 years ago

I haven't done much testing of the VS2012 support, so if you see anything needing updating, I'll be happy to change it.

(1-10/10)