-
Notifications
You must be signed in to change notification settings - Fork 134
Development: Getting Started
These notes are written on the assumption that you're developing on Linux. Developing on Windows or Mac should be pretty similar, but a few of the details might differ slightly. See below for a bit more on getting started on Mac and Windows.
To build Brewtarget, you will need a mainstream C++ compiler such as g++ or clang++, and a few other packages (but see below on how to install most of them automatically):
- Python version 3.10 or newer
- CMake version 3.16 or newer
- Meson version 0.63.0 or newer
- Git
- Boost version 1.79 or newer
- Xerces-C++ version 3.2.3 or newer
- Xalan-C++ version 1.12 or newer
- Doxygen to build the HTML documentation from special comments in the source code
- Qt development libraries - version 6.2.4 or newer
Once you have Python installed (eg via sudo apt install python3
on Debian-based systems such as Ubuntu), you can use the bt
script that ships with Brewtarget to install the other required packages (including all the different parts of Qt that we need):
./bt -v setup all
If you are on a non-Debian version of Linux, or would rather install things manually, have a look at the installDependencies()
function in https://github.com/Brewtarget/brewtarget/blob/develop/scripts/buildTool.py, which is the Python script that bt
invokes. This is the most up-to-date info on what we install and how, because it is used in the nightly builds.
(If you want to see everything about how to build, install and package on Linux, Mac or Windows, then have a look at the GitHub Workflows which do the nightly builds.)
The bt
script also sets up the mbuild
directory for building using Meson. So, to build and install, you just need the following commands:
$ cd mbuild
$ meson compile
$ meson test
$ sudo meson install
If you would prefer to build with CMake then you need to do the following instead:
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
On Mac, you first need to install Xcode, Homebrew and MacPorts. You can then install Python via brew install [email protected]
and run ./bt -v setup all
as above.
The supported way to build on Windows is using MSYS2 in the MSYS2 MINGW64 environment. This is one of, typically, four different environments available to you after installing MSYS2. You need to run the build script from the "MSYS2 MinGW 64-bit" shell, and not one of the other ones. (As of 2024-01, we no longer support 32-bit builds because some libraries we rely on are no longer available as 32-bit MSYS2 packages.)
In MSYS2 terminal run:
pacman -S mingw-w64-x86_64-python mingw-w64-x86_64-python-pip
if [[ ! -f $(dirname $(which python))/python3 ]]; then ln -s $(which python) $(dirname $(which python))/python3; fi
export PYTHONIOENCODING=utf8
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
python -m pip install -U --force-reinstall pip
rm get-pip.py
You should now be able to run the bt
script.
All you need for a good development environment is a good text editor (kate, gedit, notepad++, vim, etc.) and a command line to run meson or cmake.
Qt Creator can read the CMakeLists.txt as a project file, but we highly discourage using Qt Creator to create new files to add to the project, because it edits the CMakeLists.txt file in very strange ways. If you must use it, use it only to modify existing files.
You may find it helpful to use Qt Designer for editing the .ui files that describe each GUI element in the project but, again, it does not always do exactly what you'd want to the .ui files, and, in most cases, it is better to edit the XML directly in a text editor.