Creator - meta build system for ninja

126 views
Skip to first unread message

Niklas Rosenstein

unread,
Jun 22, 2015, 7:05:44 PM6/22/15
to ninja...@googlegroups.com
Hi folks!

I quickly wanted to share this with you. I've created a small meta build system in Python that generates
ninja build files. Creator is a bit like make in that it doesn't make assumptions on your environment etc.
and gives you all the freedom to specify the actually commands to build your software, but is more
powerful than Make in many aspects.

Creator is based on "Unit Scripts" which are just pure Python code with some additional flavour to get
things running. You can find everything about Creator on the GitHub repository. Also make sure to
check out the Wiki, it contains some extensive information about how Creator works and the built-in
functions available to you in Unit Scripst and during macro evaluation.


Here's a small example script to build a C program with Creator.

# fooproject.crunit

load('platform', 'p')
load('compiler', 'c')

C['dir.build']  = '$ProjectPath/build'
C['dir.source'] = '$ProjectPath/src'
C['sources'] = '$(wildcard $dir.source/*.cpp)'
C['objects'] = '$(p:obj $(move $sources,$dir.source,$dir.build))'
C['program'] = '$(p:bin $dir.build/main)'

@target
def objects():
  for fin, fout in foreach_split('$sources', '$objects'):
    objects.add('$fin', '$fout', '$c:cpp $c:wall $c:compileonly $< $(c:objout $@)')

@target
def program():
  program.dependencies.append(objects)
  program.add('$objects', '$program', '$c:cpp $(quotesplit $<) $(c:binout $@)')

And this is how you would build the project.

creator ninja -f && ninja

Thanks for checking it out. :)

-Niklas 

Nico Weber

unread,
Jun 23, 2015, 12:21:19 AM6/23/15
to Niklas Rosenstein, ninja-build

--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages