Building XPCE for SDL3 and Cairo - SWI-Prolog/packages-xpce GitHub Wiki
General
- Checkout the packages/xpce directory of the Prolog tree to the branch
sdl
- Install the dependencies, notably SDL3 and Cairo
- Configure using
cmake -DSDL=ON ...
Using the default setup, thus should work for first installation:
git clone https://github.com/SWI-Prolog/swipl-devel.git
cd swipl-devel
git submodule update --init
cd packages/xpce
git checkout sdl
cd ../..
mkdir build.sdl
cd build.sdl
../scripts/configure
ninja
To update
cd /path/to/swipl-devel
git pull
git submodule update
git packages/xpce
git checkout sdl
git pull
cd ../../build.sdl
ninja
Platform notes
Linux
Fedora 42 is the main development environment.
Dependencies for linux distros with SDL3
- Fedora (42)
dnf install SDL3-devel SDL3_image-devel cairo-devel pango-devel
Porting to linux distros without SDL3
According to ChatGPT, sdl3-headers
may allow us to compile against SDL2.
find_package(SDL3 REQUIRED COMPONENTS Headers)
target_link_libraries(my_app PUBLIC SDL3::Headers)
- Try this route
- Find list of distros that support this.
MacOS
Compilation works on MacOS. There are several problems
- Resizing the epilog terminal terminal sometimes causes memory errors. This is a bit weird as the Fedora version passes with ASAN enabled.
- The terminal content writes over the scrollbar
- The fonts look rather rough.
- Color glyphs such as emoji are not yet supported. Cairo does not seem to support these using Quartz as backend.
Dependencies
- Macports
port install SDL3 SDL3_image cairo pango
Windows
MinGW64 provides packages for SDL3, Cairo and Pango, both static and dynamic. Note that XPCE no longer supports 32 bit platforms due to the switch to doubles as primary representation for numbers.
- Build XPCE for Windows
- Replace POSIX Pty by Windows pseudo consoles
- Replace poll()-based I/O stream handling