There's potential for major ABI mismatches. e.g. if guess_static matches GCC 5.0 and guess_shared 5.1, any libraries produced by one will be incompatible with the other. This is worse on Windows, where it's not uncommon for GCC to match one and VS to match another (mostly if you accidentally screwed up your flags).
Code duplication. I'm constantly writing stuff like kw = {...}; guess_static(**kw); guess_shared(**kw). Needing both builders is really a pretty common requirement.
The new API
It looks kind of like this:
from fbuild.builders.c import guess
def build(ctx):
# Just a static builder.
static = guess.static(ctx, exe='gcc', ...)
# Just a shared builder.
shared = guess.shared(ctx, exe='gcc', ...)
# Both builders.
builders = guess(ctx, static={'exe': 'static options here'}, shared={'exe': 'shared options here'})
# builders is a Record(static=..., shared=...), so you can do:
builders.static.build_exe('foo', ['foo.c'])
When using guess(...), both builders are guaranteed to be the same compiler. Realistically, this is how it should usually be anyway.
Other stuff
This brings in a smaller change from the dev branch, where Windows != MSVC anymore. Instead, {'windows'} just means this compiler is running on windows, and {'msvc', 'msvc++'} are the actual VS compilers. This should make MinGW work again and simplify a lot of config stuff.
TODO
Docs.
Make sure the Windows changes still work under Windows.
Ping @erickt because this is a big change...
Motivation
The current
guess_*
API has some problems:guess_static
matches GCC 5.0 andguess_shared
5.1, any libraries produced by one will be incompatible with the other. This is worse on Windows, where it's not uncommon for GCC to match one and VS to match another (mostly if you accidentally screwed up your flags).kw = {...}; guess_static(**kw); guess_shared(**kw)
. Needing both builders is really a pretty common requirement.The new API
It looks kind of like this:
When using
guess(...)
, both builders are guaranteed to be the same compiler. Realistically, this is how it should usually be anyway.Other stuff
This brings in a smaller change from the
dev
branch, where Windows != MSVC anymore. Instead,{'windows'}
just means this compiler is running on windows, and{'msvc', 'msvc++'}
are the actual VS compilers. This should make MinGW work again and simplify a lot of config stuff.TODO