Table Of Contents


The following steps describe the procedure to build and install BrainTumorModeling_CoupledSolver (BTMCS).

Build Dependencies

Before building BTMCS, the following software libraries are required to be installed.

Package Version Description
CMake 2.8.4 or higher To compile and build BTMCS. Use version 2.8.4 or higher.
PETSc 2.2.1 or higher BTMCS is built upon the structure of PETSc. In Windows, use version 3.2 or higher.
ITK 3.14 or higher For ITK 3.x or 4.x, there’s no mandatory option. Required only when BUILD_TESTING is enabled in CMake setting of BTMCS. In Windows, build using CMake GUI with the Win64 (x64) solution platform of Visual Studio.

Build PETSc

BTMCS is built upon the PETSc library. PETSc library could be built as static libraries as follows. The advantage of static libraries is that once the application program is compiled and linked, the PETSc files could be removed as they are not required for the execution of the program. Here, we use the version 3.5.2 by an example (this procedure also works on versions >= 3.2).


To open the shell in Windows, launch the command prompt by executing Visual Studio x64 Win64 Command Prompt in Start > All Programs > Microsoft Visual Studio > Visual Studio Tools. In this prompt, type C:\cygwin\bin\bash --login to open the Cygwin terminal. In the cygwin terminal, execute mv /usr/bin/link.exe /usr/bin/link-cygwin.exe to avoid the confusion with the Visual Studio link program. Alternatively, move /usr/bin folder to the end in the PATH variable so that Visual Studio’s link program could be found first. See the Windows_installation_of_PETSc for further details.

Step 1. Download and extract source files:

tar xvf petsc-3.5.2.tar.gz
cd petsc-3.5.2

Step 2. Configure:

./configure --with-mpi=0 --with-shared-libraries=0 --with-debugging=0


The name of the compiler could be specified by --with-cc= and --with-fc= options. To download LAPACK during building, append --download-fblaslapack. If a fortran compiler is not available, try --with-fc=0 --download-f2cblaslapack. In Windows, append --with-cc='win32fe cl' --with-fc=0 --with-cxx='win32fe cl' --download-f2cblaslapack option.


Although the MPI option is turned off above, it is okay with the MPI option enabled. For the details of the MPI option or other further details, see installation_instructions_of_PETSc.

Step 3. Build:

export PETSC_ARCH=arch-linux2-c-opt


Change arch-linux2-c-opt for PETSC_ARCH to the value corresponding to your system as reported by the configure procedure. For example, use export PETSC_ARCH=arch-mswin-c-opt in Windows.


Please follow commands below in a shell/terminal (e.g., Bash). They will configure and build BTMCS using GNU Make. The main CMake configuration file (CMakeLists.txt) is located in the root directory of the package. This CMake installation is supported on BTMCS version 1.2.1 of higher.


To build in Windows, use CMake GUI with the Win64 (x64) solution platform of Visual Studio. The selected solution platform is needed to match with dependent libraries.

Step 1. Extract source files and create the build directory:

tar xvf braintumormodeling_coupledsolver-${version}-source.tar.gz
mkdir braintumormodeling_coupledsolver-${version}-build
cd braintumormodeling_coupledsolver-${version}-build


In Windows, use the appropriate zip program (e.g., 7-zip) to extract.

Step 2. Run CMake to configure the build tree:

ccmake ../braintumormodeling_coupledsolver-${version}-source

In the CMake interface, follow these steps:

2.1. Change CMAKE_INSTALL_PREFIX to the folder you want to install BTMCS into. This folder should be outside the braintumormodeling_coupledsolver-${version}-source folder. Make sure you have the write access to this folder. Change CMAKE_BUILD_TYPE (or CMAKE_CONFIGURATION_TYPES) to Release. Change PETSC_DIR and PETSC_ARCH to appropriate values. Locate ITK_DIR to the appropriate folder if BUILD_TESTING set ON.

2.2. Keep pressing letter c on your keyboard until option g is available/displayed on the screen.

2.3. Then press g on your keyboard to generate the makefiles and to quit this ccmake window.


In the CMake GUI, c and g correspond to Configure and Generate buttons. In Windows, use / for the directory seperator in PETSC_DIR. Also, set C:/cygwin/bin/make.exe for MAKE_EXECUTABLE if it could not be found automatically.

Step 3. Build:



In Windows, launch the solution file of Visual Studio, select Release in the solution configurations (and confirm x64 in the soultion platforms), and then perform the rebuild solution.

Step 4. Test (optional):

make test


In Windows, build the RUN_TESTS project. To perform tests, the BUILD_TESTING option in the CMake configuration is required to set ON.

In case of failing tests, re-run the tests, but this time by executing CTest directly with the -V option to enable verbose output and redirect the output to a text file:

ctest -V >& btmcs-test.log

And send the file btmcs-test.log as attachment of the issue report to sbia-software at

Step 5. Install:

make install


In Windows, build the INSTALL project.

Upon the success of the above compilation and build process, BTMCS is installed into the directory specified by the CMAKE_INSTALL_PREFIX (set during build configuration in step 3).