GNU TeXmacsUser manualReferenceAboutEnglish
Selecting and building a port

1.The port macros

One macro identifies the port in config.h (and on the command line of the make build, through -D@CONFIG_GUI_DEFINE@ in

src/makefile.in

):

QTTEXMACS

Qt port (

Plugins/Qt

or

Plugins/Qt6

).

QTWKTEXMACS

Qtwk (

Plugins/Qtwk

and

Plugins/Widkit

); QTTEXMACS is defined as well, since Qtwk uses the application, fonts, pictures, renderer and pipes of the Qt port.

X11TEXMACS

X11 port (

Plugins/X11

and Widkit).

SDLTEXMACS

SDL port (

Plugins/SDL

and Widkit).

VUETEXMACS

Vue port (

Plugins/Vue

).

AQUATEXMACS

Cocoa port (

Plugins/NS

).

Outside the port directories, many files test these macros, typically to include the header which defines simple_widget_rep. For instance

Texmacs/Window/tm_button.cpp

chooses between

NS/ns_simple_widget.h

(AQUATEXMACS),

Qt/qt_simple_widget.hpp

(QTTEXMACS without QTWKTEXMACS),

Vue/vue_widget.hpp

(VUETEXMACS) and, in the #else branch,

Widkit/simple_wk_widget.hpp

. Other tests enable features which only exist in some ports: the Cocoa port is treated as Qt by the generic code wherever that has Qt specific parts (delayed commands, native pictures, drops, the repainting and the mouse of the editor), and Vue often shares the X11 branch (for instance to center the paper in a wider canvas,

Edit/Interface/edit_interface.cpp

). Because QTTEXMACS holds in Qtwk, code which really needs Qt widgets must test QTWKTEXMACS too. A new port must add its own branches, and the #else branch is usually the Widkit code. Code which depends on the Qt version tests QT_VERSION instead, see the Qt port.

2.configure and make

The autoconf macro TM_GUI (

misc/m4/tm_gui.m4

) reads --with-gui=port:

qt (default)

The Qt port, with the Qt version found by LC_WITH_QT. On macOS it also enables the Objective-C helpers of

Plugins/MacOS

(CONFIG_MACOS).

qtwk

The same Qt setup, but CONFIG_QT= "Qtwk Widkit":

src/makefile.in

then compiles

Plugins/Qtwk

, Widkit and only eight files of Plugins/Qt (

qt_renderer.cpp

,

qt_font.cpp

,

qt_picture.cpp

,

qt_utilities.cpp

, the pipes, the sockets and

qt_http.cpp

), and runs the meta object compiler on three headers of Qtwk.

x11

The X11 port. It looks for the X11 headers and libraries, sets CONFIG_X11= "X11 Widkit" (plus Ghostscript when Ghostscript is not configured otherwise) and defines X11TEXMACS.

sdl

The SDL port: SDL3 (--with-sdl3,

misc/m4/sdl3.m4

), CONFIG_SDL= "SDL Widkit".

vue

The Vue port: SDL3 and, with --with-thorvg=prefix (

misc/m4/thorvg.m4

), the GPU renderer (USE_THORVG; ThorVG is built by

misc/thorvg/build-thorvg.sh

, and OpenGL is linked). The sources of

Plugins/Vue

are compiled with -std=c++20, and

clay.c

as C.

cocoa or aqua

The Cocoa port: defines AQUATEXMACS, sets CONFIG_COCOA= NS and links with -framework Cocoa -framework PDFKit. It needs the macOS extensions (CONFIG_MACOS), so --disable-macosx-extensions is refused. The packaging script

packages/macos/build-ns-app.sh

configures, builds and bundles it.

--enable-qt-new

Compile

Plugins/Qt6

instead of Plugins/Qt (

misc/m4/qt.m4

): the variable QT_PLUGIN_DIR becomes Qt6, which selects both the sources and the include path -IPlugins/Qt6. The option is on by default when CONFIG_OS is ANDROID, and configure stops with an error if the Qt found is older than 6.10. Qtwk always takes its files from Plugins/Qt.

--enable-qtpipes

Use Qt processes instead of Unix pipes for plug-ins (QTPIPES). It is the default of qt and qtwk and refused with the other ports.

Whether MuPDF is used depends on the port (TM_MUPDF_FOR_GUI in

misc/m4/mupdf.m4

): SDL and Vue draw with it and need --with-mupdf, Qt uses it for pictures when it is found, and X11 and Cocoa, whose pictures clash with those of MuPDF at link time, refuse it.

src/makefile.in

then compiles the port directories through the substituted variables: @CONFIG_X11@, @CONFIG_SDL@ and @CONFIG_VUE@ for the C++ sources, @CONFIG_COCOA@ @CONFIG_MACOS@ for the Objective-C sources, and, for Qt, the directory Plugins/$(QT_PLUGIN_DIR) (with the Qt meta object compiler run on its headers when @CONFIG_QT@ is not empty).

3.CMake

The top level

CMakeLists.txt

declares

set (TEXMACS_GUI "Qt" CACHE STRING "TeXmacs Gui (Qt, Qt6, Qt5, Qt4, Vue, SDL, X11)")
option (QTPIPES "use Qt pipes" ON)

and stops with an error for any other value.

Qt, Qt6, Qt5, Qt4

Qt4 and Qt5 force the corresponding major version; Qt and Qt6 look for Qt 6 first and fall back to Qt 5. The components used are Core, Gui, Widgets, PrintSupport, Svg and Network. The sources are Plugins/Qt/*.cpp and *.hpp, without the moc_*.cpp left by a make build, since CMake runs its own AUTOMOC. Qt6 does not select

Plugins/Qt6

.

Vue, SDL

SDL3 and SDL3_ttf through pkg-config, and MuPDF (USE_MUPDF, on by default for these two, with MUPDF_DIR as a hint), without which the configuration stops. The Vue sources are compiled as C++20 in an object library of their own (texmacs_cxx20 in

src/CMakeLists.txt

). For Vue, THORVG_DIR (empty by default) names the prefix of a ThorVG build made by

misc/thorvg/build-thorvg.sh

: it defines USE_THORVG and links OpenGL, for the GPU renderer, as --with-thorvg does; without it the CMake build of Vue draws with MuPDF only.

X11

find_package (X11), X11 and Widkit sources, MuPDF off.

CMake cannot build the

Plugins/Qt6

fork, Qtwk or Cocoa.

4.Android

The Android launcher in

src/packages/android/launcher

is a separate CMake project which links a prebuilt libtexmacs.a with Qt 6 or 5 (find_package (QT NAMES Qt6 Qt5 …)). The library itself is configured with configure, where --enable-qt-new is the default for Android, so a library configured for Android uses

Plugins/Qt6

unless --disable-qt-new is given. The operating system side of Android is described in platform support.

5.Headless mode

Headless mode is not a separate port but a run-time mode, selected by -headless (and implied by the conversion and web site options, see the main program); is_headless () in

Texmacs/Texmacs/texmacs.cpp

tells whether it is on. Two ports make no windows at all in this mode:

Qt

A QTMCoreApplication replaces the QTMApplication, no window is shown, and the interpose handler skips the screen updates; see also the section on headless mode in the Qt implementation. Qtwk creates a QTWKCoreApplication in the same way, but its windows do not test is_headless.

Vue

gui_open opens no display at all, the windows are virtual windows without an SDL window, and the event loop is replaced by headless_loop (

vue_gui.cpp

), which runs the queued commands and the interpose handler every 10 ms until a command quits. This is what the documentation checks of this tree use (with SDL_VIDEO_DRIVER=dummy and TEXMACS_VUE_GPU=0 as a precaution).

SDL, X11 and Cocoa make their windows as usual, but never show them:

SDL

The constructor of sdl_gui_rep (

sdl_gui.cpp

) selects the dummy video driver, which opens no display, and sdl_window_rep::set_visibility (

sdl_window.cpp

) shows no window.

X11

The windows are never mapped (x_window_rep::set_visibility in

x_window.cpp

), but a display is still needed: without one, x_gui_rep (

x_init.cpp

) fails with a message which suggests xvfb-run or a virtual DISPLAY.

Cocoa

The application gets no icon in the Dock and no menu bar (activation policy Prohibited in gui_open,

ns_gui.mm

), no window is ordered front (

ns_widget.mm

) and the wait window is not shown.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".