Menu

Developer's Guide

Dmitri Zoubkov

SubTile Developer's Guide

Pre-Requisites

To build SubTile project the following is required on all platforms

  1. Compiler toolchain with support for min. c++17.
  2. CMake min. version 3.8 (latest is recommended).
  3. Libraries and C headers for target OS (platform SDK).

On all patforms except for Windows libapr and libsvn headers are needed, usually provided with subverion (BSD, Homebrew) or subversion-devel package (Debian).

SubTile build script will search for pre-installed wxWidgets 3.2.5, if no suitable version is found on your system the script will attempt to download and build wxWidgets automatically. In the latter case you would need GTK3 development packages on Linux. If you have wxWidgtes installed but in a unusual location (f.i. because you are using multiple version in parallel), you can set the environment variable WXSTAGE_3_2_5 pointing to your installation prior to calling CMake configure. WXSTAGE_3_2_5 location is expected to contain wxWidgets release build under r-<ARCHITECTURE> and debug build under d-<ARCHITECTURE> (ARCHITECTURE can be amd64, aarch64 etc.), however, contents of both can be identical (i.e. one symlinks to the other) if you don't require debugging for example. It is also possible to compile SubTile with other (older) versions of wxWidgets, for details s. BSD Perculiarities.

MacOS Perculiarities

Apple ships own version of libapr with MacOSX SDK which is not compatible with Subversion which prevents Homebrew from linking APR libraries and headers into /usr/local when installing subverion. SubTile provides a shell script <PROJECT_ROOT>/doc/script/macos-apr-repair.sh which restores the links. Also note that SubTile build script always tries to produce universal binary, thus if your pre-installed wxWidgets is ARM-only, linking to it would fail.

BSD Perculiarities

Building SubTile was only tested on FreeBSD but the process would (hopefully) be similar on other BSD variants. Unfortunately it is impossible to build wxWidgets from original sources on BSD and BSD ports aren't most recent ones, most likely though any 3.2.x version would work (3.2.4 from FreeBSD is tested to do so). In any case you would need to set wxWidgets_TARGET_VERSION CMake variable - either in the configure step or in the CMake GUI afterwards - to the actual version of wxWidgets on your system. Simple make install on your wxWidgets port together with the appropriate value of wxWidgets_TARGET_VERSION may suffice, however, we recommend use wxWidgets linked statically, the steps below describes our own procedure to set up wxWidgets on BSD:

  1. Make copy of the wxWidgets port
    sh cp -rp /usr/ports/x11-toolkits/wxgtk32 /usr/ports/x11-toolkits/wxgtk32_static
  2. Change into the copy directory
    sh cd /usr/ports/x11-toolkits/wxgtk32_static
  3. Open Makefile in a text editor of your choice, find the line starting with CONFIGURE_ARGS and add --disable-shared to the list, alternatively skip this and supply full cofigure list together with --disable-shared in the step 4
  4. Execute make
    sh make PREFIX=/usr/share/wxWidgets-3.2.4/stage/r-`uname -m` <OPTIONAL_CONFIGURE_ARGS> install
  5. Control if wx-config and wxrc exist in <PREFIX>/bin, in case they don't - make them
    sh cd /usr/share/wxWidgets-3.2.4/stage/r-`uname -m`/bin ln -s wxgtk3u-3.2-config wx-config ln -s wxrc-3.2 wxrc
  6. Set WXSTAGE_3_2_4 variable
    sh export WXSTAGE_3_2_4=/usr/share/wxWidgets-3.2.4/stage
  7. Optionally add WXSTAGE_3_2_4 to default environment in /etc/login.conf
    sh default:\ :setenv=WXSTAGE_3_2_4=/usr/share/wxWidgets-3.2.4/stage

Build Envirponment

Project sources incl. CMake scripts are located in <PROJECT_ROOT>/src/exe, all targets can be built via command line from there. Several CMake presets for div. platforms are provided, so you can do for example

cmake -S. --preset=win32-x64-Release
cmake --build ..\..\build\win32-x64-Release

It is of course possible to build without presets, althogh it requires more manual tuning on some platforms

cmake -S. -B../../build/Debug-universal -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -CMAKE_OSX_DEPLOYMENT_TARGET=11 -DMACOS_SDK_VERSION_IGNORE=1
cmake --build ../../build/Debug-universal --config Debug

We recommend using Visual Studio Code along with pre-configured workspace in <PROJECT_ROOT>/buildenv/ for building and debugging the application.


Related

Wiki: SubTile

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.