felix-lang / fbuild

A cross platform, high performant caching build system
Other
47 stars 6 forks source link

Rework the guess_* API #28

Closed refi64 closed 6 years ago

refi64 commented 6 years ago

Ping @erickt because this is a big change...

Motivation

The current guess_* API has some problems:

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