[Omake] Re: Building in subdirectories and variant builds
revisited
Jesper Eskilson
jesper at eskilson.se
Fri Jun 8 05:20:44 PDT 2007
2007/6/8, David Kågedal <davidk at lysator.liu.se>:
>
> "Jesper Eskilson" <jesper at eskilson.se> writes:
>
> > Hi all,
> >
> > I'm really having trouble in getting variant builds to work nicely
> > with subdirectory builds. The setup is as follows:
> >
> > - At the toplevel there are a bunch of project, each one builds a
> > shared or static library.
> > - Each project is located in a subdirectory.
> > - The source code for each project is spread out over several
> > subdirectories under the project's directory.
> >
> > I want to be able to do "variant builds" (i.e. Debug, Release, etc.).
> > Ideally I would like to be able to parametrize the build directory
> > (i.e. where all compiled stuff is placed).
> >
> > What is the "canonical" way of doing this? My main problems at the
> moment are:
>
> Can't you do something like this:
>
> .SUBDIR: builds
> .SUBDIR: Debug
> BUILDTYPE = debug
> include Buildtree.om
> .SUBDIR: Release
> BUILDTYPE = release
> include Buildtree.om
>
> and then write a Buildtree.om that creates all the vmounts etc and
> that uses $(BUILDTYPE) to set compiler options etc
Ok, I try that.
> > - vmount is not transparent; I need to explicitly use $(file ...) in
> > order for files to be translated properly, and even that causes
> > problems.
>
> Many omake functions (CProgram etc) makes you specify the file names
> without suffix (files = foo bar), and then you can make that into file
> names
> using something like "src = $(file $(addsuffix $(files), .c))".
>
> > - vmount requires that the target directory exists, this means that I
> > must manually create the entire build directory.
>
> Yeah. This is hard to get around since omake needs to scan everything
> before it even starts to consider what to actually build. This means
> that you cannot have e.g. build directories created depending on which
> targets you give on the command line.
But the build directory itself is not part of the build; its just a
convenient way of separating different build types.
SCons has an excellent solution to this, where you specify the build
directory as a parameter to the SConscript function (corresponding to the
.SUBDIRS command in OMake).
config = "Debug"
SConscript("my-project", build_dir = "build/my-project/%s" % config)
Very simple and direct, no vmount needed. It would be great if something
similar was possible to do with OMake.
(I get the feeling that variant builds wasn't considered when OMake was
designed, and has been glued on afterwards in the form of vmount.)
--
/Jesper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.metaprl.org/pipermail/omake/attachments/20070608/c9b9f8fe/attachment.html
More information about the Omake
mailing list