Making C++ slightly less painful.
R++ aims to being a collection of command-line utilities and magical fairy dust to make all the C++ monsters go away and let you, as the awesome programmer, get to what's important.
$ gem install rplusplus
Create a new Project
Make a new C++ app, with a Rakefile, gitignore, and some skeleton source files:
$ r++ new MyApp
This creates a folder called
MyApp with a main source file called
my_app.cpp as well as accompanying
.gitignore files to get you going.
Generate header and source file skeletons for a class:
$ r++ generate class MyClass
This generates a
my_class.cpp file in the current directory.
In your Rakefile
NOTE: You still have to do some work yourself in the Rakefile at this point. Grab the example Rakefile in
examples/Rakefile and modify it to your needs.
At the moment, all R++ can do is calculate the dependencies for you, a la
g++ -MM. Just add this to your Rakefile:
require 'rplusplus' env = RPlusPlus::Environment.new
env has some useful properties which you can make use of in your Rake tasks:
env.objectsis a hash of
*.ofiles to dependencies: e.g.
'foo.o' => ['foo.cpp', 'foo.h', ...]
env.buildsis a hash of executables to dependencies: e.g.
'main' => ['main.o', 'foo.o', ...]
env.erbsis a hash of
*.erbfiles to dependencies: e.g.
'foo.cpp' => ['foo.cpp.erb']
env.builds hashes magically take into account any
*.erb files in existence so you can just code away without any funny business.
How does it work?
Object-file dependencies are calculated by going through each cpp file and reading each #include and following it recursively.
The builds are discovered by finding each cpp file with a main function, and then going through each of it's dependencies to build a list of o-files to link.
The ERB dependencies are simply computed by finding each erb file and then removing the erb extention.
Go ahead and crack open that codebase and see for yourself!
Generate a basic Rakefile, etc. for an existing C++ project:
$ r++ init
- Move all the boilerplate from the example Rakefile into R++ so there is less for developers to do to get started.
- Add support for a C++ test framework and add a
- Do some kind of caching for the dependencies. I'm suspecting the Rakefile will take really long on a larger project.
- Add some magical C++ code generating libraries to use with ERB.
- Make it easy for people to package their library or app or whatever into a deb or an rpm or a pkg or a whatever using a config file called a "libspec" or something (a-la "gemspec").
- On that note, make it easy for people to publish to a package repository (apt, yum, aur, etc).
r++act as a wrapper or superset of
g++to allow users to drop
r++straight into an existing project.
This has absolutely nothing to do with Bell labs R++.
Help make R++ better for everyone :)
The easiest way to contribute is to try this thing out and submit an issue when it breaks.
Otherwise if you want to help me implement a super awesome idea then pull requests are easy, fun, and beneficial to all of society:
- Fork it ( https://github.com/[my-github-username]/rplusplus/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request