QtCreator is one among the IDEs which is recommended by ClickHouse. The below steps were tried out on Mac by myself and on Ubuntu by my colleague. Please note that if you are trying to build ClickHouse on Windows you have to use WSL (https://chistadata.com/building-clickhouse-on-windows/).
Install all the build tools, including cmake, necessary for building ClickHouse mentioned in the documentation https://clickhouse.com/docs/en/development/build-osx.
Download and install QtCreator from https://www.qt.io/download.
Check if the auto detected cmake path in QtCreator is correct and set it correctly if needed.
Kits -> CMake -> Add a manual cmake configuration
Project Import and setup
- Open Project -> and open CMakeLists.txt.
Parsing of code will commence immediately and will run in the background.
- Import existing build and import the /build folder (result of command line build)
You confirm whether the build has been correctly imported by checking whether QtCreator recognises all the conditional compilation flags as follows:
- Adding/editing build step: You might already have a build step configured with –target all
Select ‘clickhouse’ by scrolling down and then unselect ‘all’
- You may change the Build Type to ‘Debug’ like I did to turn off optimizations.
- Adding Run configuration: We must tell QtCreator which of the binaries are to be run for Debugging.
- Choose Run
- If everything has worked correctly you should be able to select ‘clickhouse’ from the below menu.
But alternatively you can choose your own binary as well.
- Provide the command line arguments and the working directory.
- Choose Run
Checking your setup
Your ClickHouse local setup should now be functional. Try adding something into one of the files and then start the program on debug.
You can see that a partial build is taking place here. It builds just the object file connected to the file I have edited (src/Interpreters/executeQuery.cpp) and links it with existing object files from the full build.