![]() |
Building with CMake | ![]() |
An out-of-source build, which is the recommended way, looks like
cmake -B build -G Ninja cmake --build build |
run from
src/
. The default SCHEME_IMPL is s7, the S7 interpreter whose sources are in the tree; -DSCHEME_IMPL=embedded18 builds the embedded Guile, whose sources must first be made available as src/tm-guile188/ (from the guile-texmacs repository), and -DSCHEME_IMPL=guile uses an installed Guile. The resulting binary is build/TeXmacs/bin/texmacs.bin (texmacs.exe on Windows, a TeXmacs.app bundle on macOS), and the runtime tree is build/TeXmacs/.
The cache variables and options defined in
CMakeLists.txt
are:
Defaults to Release.
s7 (the default), which compiles the S7 interpreter of
Scheme/S7
and defines USE_S7; embedded18 (or its synonym tm-guile188), which builds tm-guile188/ as a subproject and defines GUILE_C; or anything else, such as guile, in which case pkg-config looks for guile-1.8, guile-3.0, guile-2.2 or guile-2.0 (in this order) and defines GUILE_C for 1.8 and GUILE_D for 2.0 and later. The meaning of these dialect macros is explained in the Scheme interpreter.
One of Qt (the default, which uses Qt 6 if it is found and Qt 5 otherwise), Qt6, Qt5, Qt4, Vue, SDL or X11, as ./configure --with-gui (any other value is an error). Qt6 is treated like Qt: there is no branch which insists on Qt 6. All Qt variants compile the sources of
src/Plugins/Qt/
and define QTTEXMACS; Vue compiles
src/Plugins/Vue/
(in C++20, with Clay), SDL and X11 their directory and
src/Plugins/Widkit/
. The Qtwk and Cocoa ports and the fork
src/Plugins/Qt6/
are only available with configure.
(on for Vue and SDL, which require it, off otherwise, and forced off for X11) Compile
Plugins/MuPDF
and define MUPDF_RENDERER; the library is looked for in MUPDF_DIR.
(empty) For Vue, the prefix of a ThorVG build (include/thorvg-1/thorvg.h and lib/libthorvg-1.a, as made by
misc/thorvg/build-thorvg.sh
): defines USE_THORVG and links OpenGL, for the GPU renderer of Vue, as configure --with-thorvg. Without it Vue draws with MuPDF only.
(on) Use Qt classes instead of Unix pipes for plug-in connections.
(on) Use the resvg library for SVG images if it is found in one of the local prefixes; the option is silently switched off otherwise.
(on) Link the Aspell library if it is found; switched off otherwise.
(on) FreeType is then required.
(on) GnuTLS is then required (it is used by the TeXmacs server and client, see collaboration, remote servers and versioning).
(on) Link SQLite if found, which enables the
Plugins/Sqlite3
back-end of the database.
(off) Compile the experimental style rewriting code in
src/Style/
and define EXPERIMENTAL.
Several settings are not options but fixed: DEBUG_ASSERT is always 1 (so ASSERT and FAILED are active in all builds), PNG and zlib are required, iconv is used if found, the native PDF renderer (Hummus) is compiled for Qt without MuPDF (MuPDF writes the PDF otherwise), and the path of Ghostscript is hard-wired (/usr/bin/gs, or bin/gs.exe on Windows). If ccache is installed, it is used automatically.
Additional prefixes are searched for dependencies: the local/ subdirectory of the environment variable WORKING_DIR_WIN or WORKING_DIR, and a directory ../../local next to the repository, which is how the TeXmacs builder scripts provide their own copies of the libraries.
Scheme/Scheme
and
Scheme/Guile
, System, Typeset, part of Texmacs, the standard plug-ins (Bibtex, Cairo, Imlib2, Database, Freetype, Gnutls, Ghostscript, Ispell, Metafont, LaTeX_Preview, Openssl, Updater, and optionally Pdf, MuPDF, Resvg and Sqlite3), the directories of the chosen port (see TEXMACS_GUI above), and the operating system layer (
Plugins/Unix
on Linux,
Plugins/Windows
or
Plugins/Windows64
on Windows,
Plugins/Unix
and
Plugins/MacOS
on macOS). Since the lists are globbed, a new .cpp file is picked up automatically, but only after CMake is run again; a file in a directory which is not listed (for instance a new plug-in directory) must be added to
CMakeLists.txt
. The
Plugins/Qt6
,
Plugins/Qtwk
and
Plugins/NS
directories are never compiled by CMake.
src/CMakeLists.txt
), with AUTOMOC for the Qt classes and with the generated config.h force-included in every file (-include …/src/System/config.h). The executables are then linked from these objects:
on Linux and other Unix systems, texmacs.bin with
Plugins/Unix/unix_entrypoint.cpp
, written to TeXmacs/bin/ of the build directory;
on Windows, texmacs.exe with the 32 or 64 bit entry point and the resource file packages/windows/resource.rc, and texmacs-open.exe from
src/Launcher/texmacs_open_main.cpp
; both are copied to TeXmacs/bin/ as *.bin and also to the top of the build directory;
on macOS with Qt, a MACOSX_BUNDLE named TeXmacs with
packages/macos/Info.plist.in
; with the other ports, texmacs.bin as on Unix.
The C++ unit tests of
tests/
link against the same object library; see automatic tests.
TeXmacs/
directory is copied into the build directory when CMake runs, and the target deploy_texmacs_to_build (part of ALL) copies it again at every build, so that changes to Scheme files, styles or documentation reach the build tree. The copy only adds and overwrites files: a file deleted in the source tree stays in the build tree until the build directory is cleaned. An in-source build (with a warning) uses
TeXmacs/
directly and writes the generated files into the source tree. In both cases the version string is written to TeXmacs/SVNREV.
src/System/config.h.cmake
and
src/System/tm_configure.hpp.cmake
into build/src/System/. The first one holds the feature macros (QTTEXMACS, USE_FREETYPE, GUILE_C, …), the second the version, the build user and date, and the host description reported by -version and in crash reports. The scripts texmacs and fig2ps and the manual page are generated by
misc/CMakeLists.txt
.
TeXmacs/
tree into share/TeXmacs (or the installation prefix itself on Windows), the plug-ins, and the desktop file, icons and MIME description for Linux desktops.
There is no TEXMACS_GUI value for the Cocoa port: on macOS, CMake builds Qt, Vue, SDL or X11, and the native port needs ./configure --with-gui=cocoa.
On Unix, the executable is installed to ${tmbin}/bin (
src/CMakeLists.txt:157
), but tmbin is only defined in
misc/CMakeLists.txt
, which is a sibling directory processed later; in
src/
the variable is empty and the binary is installed to /bin under the installation root rather than libexec/TeXmacs/bin where the texmacs script looks for it.
The include path lists
src/System
of the source tree before
src/System
of the build tree. If an autotools build has been run in the same source tree, its config.h and tm_configure.hpp (which are not version controlled) are found first by #include "tm_configure.hpp" and by the files which include config.h explicitly, while the force-included config.h is the CMake one. Remove the generated files from
src/System
(or use a separate checkout) before switching build systems.