Rmk Installation

Preliminaries

  1. Install ninja.

  2. Install Ruby. rmk requires and was tested with Ruby version 2.3.

  3. Install Ruby Gems: we require Log4r for logging and RDoc for printing.

gem install log4r
gem install rdoc

or use bundler

bundle install

Installation

rmk

Install the rmk script.

Local package configuration

Setup or update the package configuration in rmk/config/ for your local system. Most packages refer to libraries. Package configuration is placed in rmk/config/{LOCAL}/packages/ where LOCAL is either your host name ($HOST), localhost or default. An example for package configuration is located in rmk/config/sabayon. You may want to adapt this and and place it in rmk/config/localhost.

Example

rmk's DSL provides methods for package definition. Each package has a number of (generally optional) attributes such as :lib, which specifies the names of system libraries (w/o prefix and extension).

Many attributes, including :lib, can be arrays. rmk warns if an attribute is unknown. This is to prevent bugs from misspelled attribute names. You can set the :extra_attributes to include a new attribute.

Here is an example:

# This is part of the package configuration file gl.rb that defined
# the opengl and related packages.

define_package('opengl') { |p|
  p[:description]='OpenGL library'
  p[:url]='http://www.opengl.org/'
  p[:include]='/usr/include/GL'
  p[:lib]='GL'
  p[:requires]='x11'
}

define_package('glew') { |p|
  p[:description]='GLEW library'
  p[:url]='http://glew.sourceforge.net/'
  p[:lib]='GLEW'
  p[:requires]='opengl'
}

define_package('glfw') { |p|
  p[:description]='GLUT library'
  p[:url]='http://www.glfw.org/'
  p[:lib]='glfw'
  p[:requires]=['opengl','glew']
}

You local configuration may differ. In this case modify attributes. In most cases, these are :include, :path (library path), and :lib.

Attributes also specify dependencies such as :requires for required packages and :requires_tools for required tools (e.g., the moc tool for qt package).

Some packages come in different versions (e.g., qt-4 and qt-5) or implementations (e.g., openblas or mkl). It is good practice to define default choice as a package (e.g., qt or blas).

Hints on package configuration

Tools

Tools like cxx are defined in rmk/tools/. Most tools come with predefined configurations (e.g., command line options), and there is one configuration set per build configuration (e.g., for debug vs release build).

Usually, you don't want to change the tools but only adapt their configuration in the project's RMakefile and RMakefile.proj or RMakefile.priv. This includes, e.g., adding definitions for cxx.

Using rmk/config/init.rb

There is an additional configuration script init.rb, which is executed before reading package configuration (and tools). The following example uses init.rb to "patch" the configuration sabayon (shown are the contents of config/localhost/init.rb)

import_files("#{File.dirname(__FILE__)}/../sabayon/packages/*.rb")

#
# local patches (they could go to ./packages/)
#

update_package('mkl') { |p|
  p[:path]='/opt/intel/composerxe-2011.7.256/mkl/lib/intel64/'
}

import_files reads any Ruby file once (require). The script “preloads” the packages assuming that sabayon is the default package source. Then update_package patches the mkl package. As all package files have been read, this effectively concludes the configuration.

First steps

Clone rmk-example repository. This includes a few toy projects with inter-dependencies and sub-projects.