Examples

You find few small example project in rmk-example.

Snippets of use cases

RMakefile.proj

# -*- mode: ruby -*-

# use transitive linking:
# when using another rmk project (use_project), link to all of its
# libraries (recursively).
ld.transitive=true

# force linking required shared libraries to this library:
# usually not recommended but may be required for building a library that is
# not linked by rmk (e.g., shared object that is explicitly loaded by dlopen()
# in a plugin)
ld.lib_in_lib=true

RMakefile

# -*- mode: ruby -*-

# sub-projects in ./me, /.metoo,...
# see RMakefile.priv for "notme" and "meneither"
subproject 'me','metoo', 'notme', 'meneitther'

# link to another rmk project
use_project 'another'

# compiler definitions "-D..."
cxx.define 'MYSWITCH'
cxx.define 'MYOPTION' => 1

# other compiler flags
cxx.flags.add '-Qunused-arguments'

# add a system library
ld.add_library 'gcov'

RMakefile.priv

# -*- mode: ruby -*-

# use ccache (highly recommended)
use_tool ccache

# don't process any subproject that matches regex
exclude_subprojects_matching /^notme|meneither/


# switch compiler
cxx.cxx = 'clang++'

# other compiler flags
cxx.flags.add '-Wextra'

# update a package definition;
# here: use different path for different library version
update_package('mkl') { |p|
  p[:path]='/opt/intel/composerxe-2011.7.256/mkl/lib/intel64/'
}

# do things depending on
only_for_configuration(:default) { |cfg|
  # enable "safe" compiler optimization in debug more:
  #cxx.flags.map_pattern!(/^-O$/) { |f| '-Og' }
  cxx.flags.add('-Og')
}
only_for_configuration(:max) { |cfg|
  # enable profiling by sampling stack trace despite optimization
  cxx.flags.add('-fno-omit-frame-pointer')
}