jjacksonRIAB
jjacksonRIAB

Reputation: 127

C++-based make system

Are there any build systems that don't use a DSL but actually use C++ as the build language?

Upvotes: 4

Views: 684

Answers (6)

Matt Joiner
Matt Joiner

Reputation: 118470

I've written a build system that I use in my projects in Python called pybake. It's designed to be a bit smarter than make, with less magic. The build is also defined in Python, thereby reusing an existing language, rather than generating a new DSL for that purpose. Here's an example of it in use.

Upvotes: 3

Matt Joiner
Matt Joiner

Reputation: 118470

Yo Dawg, I heard you like C++, so I added C++ to your build system, so you have to compile before you compile.

Upvotes: 11

CashCow
CashCow

Reputation: 31425

There is probably C++ code in there somewhere but if you mean you would have to write a C++ program and compile it then run it to build a different source tree, I don't think that would really work in the scheme of things. What would you build your build script with? It goes on and on.

Compilers and the commands behind the scripting languages are often written in C or C++.

Upvotes: 1

Michael Aaron Safyan
Michael Aaron Safyan

Reputation: 95449

Since C++ is compiled, this would give you the problem of needing a build system for your C++-based build system. I am not aware of any C++-based build system and would be surprised to find one. For interpreted languages like Python, bootstrapping isn't an issue (and so you will find scons, for example).

If you are looking for something better than Make, though, check out CMake. Though somewhat out-of-date, you may find the C++ Project Template helpful as an example for creating CMake-based projects.

Upvotes: 0

Steve Rowe
Steve Rowe

Reputation: 19423

Are you asking if there are any build systems, like Make or Ant that use C++ code as the directives rather than specialized commands? While many higher level languages have such a system, there aren't any in C++ that I am aware of. Certainly not the popular ones. This is probably because C++ is a compiled language and not one that is trivial to parse. This makes it less suitable for what is essentially a lightweight scripting task.

Upvotes: 2

Fred Nurk
Fred Nurk

Reputation: 14212

None that are popular, if anyone was crazy enough to even write one. C++ would be an incredibly clumsy language for that.

If you're looking to create one, instead pick a language such as Python or Lua in order to use something popular and not invent a new DSL.

Upvotes: 3

Related Questions