C++ fast partial compilation

Learn how to quickly debug and compile C++ code.

Often when editing C++ code in cctbx_project one needs to test and fix errors multiple times. It is not efficient to use bootstrap for compiling because it is very slow. There are two ways to that make compilation faster:

Method 1
  1. Go to build directory.
  2. run libtbx.scons. This command is equal to the build flag for bootstrap.
    This command will check all the directories and compile and link modified files only. If there is a compilation error, the build will fail, so you'll need to debug.
  3. The compilation commands are printed to stdout, so they can be copy-pasted and executed when editing the C++ file(s).
Method 2
  1. Go to build directory.
  2. run libtbx.configure --only iotbx.
    This command tells libtbx.scons to build only a specific module, e.g. iotbx
  3. Then libtbx.scons will run only iotbx build. It is important to switch the libtbx.scons behavior back when debugging is finished. To do this, run
    libtbx.configure solve_resolve phaser phenix chem_data