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
-
Go to build directory.
-
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.
-
The compilation commands are printed to stdout, so they can be copy-pasted and executed when editing the C++ file(s).
Method 2
-
Go to build directory.
-
run
libtbx.configure --only iotbx
.
This command tells libtbx.scons to build only a specific module, e.g. iotbx
-
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