Rmk Installation¶ ↑
Preliminaries¶ ↑
-
Install ninja.
-
Install Ruby.
rmkrequires and was tested with Ruby version2.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.
-
Clone the
rmkrepository. -
The executable scripts are located in
rmk/bin/. The most important isrmk/bin/rmk. Place a symbolic link tormkin a directory inPATH(or havermk/bin/inPATH).
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¶ ↑
-
You may want to have the directory
localhost/(or your host name) as a symbolic link to, e.g.,sabayon/. This way can easily switch between configurations. -
The pattern
localhost/is inrmk/.gitignoreto make sure you (or me) don't check in local configuration files. You may want to have your configuration directory in its owngitrepository. -
There is an alternative location for configuration:
rmksearches configuration files first in the installation directoryrmk/config/and then then in~/.rmk/config/if available. -
Note that you can use local settings in
~/.rmk/to override global settings in the installation directory. -
Local settings can be changes to the global settings, e.g., using Rmk#update_package or Rmk#lazy_update_package. (The latter applies updates on use_package).
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.