Please note that these instructions only work when using a Ninja generator from a Windows or Linux operating system.
You will also need to have Visual Studio installed on windows.
If you haven’t installed CLion yet do that now, CLion can be installed from here.
The first time you build from CLion, you will most likely need to launch it from a terminal or command line to make sure you have access to all the relevant tools.
Open any terminal
conda activate mantid-developer
Then launch CLion from this terminal with
Using your search bar, open the
x64 Native Tools Command Prompt for VS 2019command prompt
conda activate mantid-developer
Then launch CLion with
If you get errors about being unable to compile a ‘simple test program’, then doing the above should fix your issue.
Follow these instructions when the CLion IDE has opened:
To set up your toolchain:
File > Settings > Build, Execution, Deployment > Toolchains
Create a new
Systemtoolchain using the
+icon and call it
Edit the CMake field to point to your conda installed
Edit the Build Tool field to point to your conda installed
For the C Compiler and C++ Compiler fields,
On Linux: choose
Let CMake detect
On Windows: direct them both at the same
cl.exein your Visual Studio installation, e.g.
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
To set up CMake:
File > Settings > Build, Execution, Deployment > CMake
Edit the Build type field by either selecting an option, or typing in a string
Set your Toolchain to be the
Defaulttoolchain that you just created
Set your generator to be
Edit your Cmake options to be
Set the build directory to the
builddirectory if it is not the default (you’ll need to use the full path if its outside the source directory)
The configurations drop-down at the top should show all of the build targets. If not, the CMake project is probably not loaded. Go to
File > Reload CMake Project. The configurations should be populated
To build all targets, navigate to
Build > Build All in 'Debug'. Check that the build command displayed in the Messages window is running the correct cmake executable from your conda installation.
To build a specific target, select it in the configurations drop-down menu and click the hammer icon next to it.
If this fails, you may need to open CLion from a terminal with your conda environment activated.
It is also useful to have your terminals in CLion to run with this environment:
homedirectory create a file named
.clionrcand open in your favourite text editor, adding these lines:
source ~/.bashrc source ~/mambaforge/bin/activate mantid-developer
Start CLion using the above steps
File > Settings > Tools > Terminal
To the end of the
Shell pathoption, add
To debug workbench, you’ll need to edit the
workbench CMake Application configuration.
Set the executable to be the
python.exein your conda installation
Set the program arguments
Set the working directory to be the full path to your
--single-process flag is necessary for debugging. See the Running Workbench documentation for more information.
You should now be able to set breakpoints and start debugging by clicking the bug icon.
macOS developers will see the warning from Qt in the terminal:
An OpenGL surfcace format was requested that is either not version 3.2 or higher or a not Core Profile.
Chromium on macOS will fall back to software rendering in this case.
Hardware acceleration and features such as WebGL will not be available.
It can be safely ignored but is present as a reminder of some deprecated OpenGL functionality being used. It is only visible to developers and the spelling mistake is real.