summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-08-08 04:39:20 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-05 14:26:00 +0200
commit1639235a48dbed75c2563c9a497b41c31a2a1bae (patch)
tree18193b72fa47e6bcac1358289ac9c36ed00c70ac /CMakeLists.txt
parent2160d037943ef0a3adbf4c6e30a91ee0f205c3f3 (diff)
downloadxK-1639235a48dbed75c2563c9a497b41c31a2a1bae.tar.gz
xK-1639235a48dbed75c2563c9a497b41c31a2a1bae.tar.xz
xK-1639235a48dbed75c2563c9a497b41c31a2a1bae.zip
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options, it was decided to implement an XDR-like protocol code generator in portable AWK. It now has two backends, per each of: - xF, the X11 frontend, is in C, and is meant to be the primary user interface in the future. - xP, the web frontend, relies on a protocol proxy written in Go, and is meant for use on-the-go (no pun intended). They are very much work-in-progress proofs of concept right now, and the relay protocol is certain to change.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 30 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4de1ad2..f678592 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,12 @@
# Ubuntu 18.04 LTS and OpenBSD 6.4
cmake_minimum_required (VERSION 3.10)
-project (xK VERSION 1.5.0 DESCRIPTION "IRC client, daemon and bot" LANGUAGES C)
+project (xK VERSION 1.5.0
+ DESCRIPTION "IRC daemon, bot, TUI client and X11/web frontends" LANGUAGES C)
# Options
option (WANT_READLINE "Use GNU Readline for the UI (better)" ON)
option (WANT_LIBEDIT "Use BSD libedit for the UI" OFF)
+option (WANT_XF "Build xF" OFF)
# Moar warnings
set (CMAKE_C_STANDARD 99)
@@ -143,7 +145,8 @@ set (HAVE_EDITLINE "${WANT_LIBEDIT}")
set (HAVE_LUA "${WITH_LUA}")
include (GNUInstallDirs)
-configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
+set (project_config ${PROJECT_BINARY_DIR}/config.h)
+configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${project_config})
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
# Generate IRC replies--we need a custom target because of the multiple outputs
@@ -157,17 +160,40 @@ add_custom_command (OUTPUT xD-replies.c xD.msg
COMMENT "Generating files from the list of server numerics")
add_custom_target (replies DEPENDS ${PROJECT_BINARY_DIR}/xD-replies.c)
+add_custom_command (OUTPUT xC-proto.c
+ COMMAND env LC_ALL=C awk
+ -f ${PROJECT_SOURCE_DIR}/xC-gen-proto.awk
+ -f ${PROJECT_SOURCE_DIR}/xC-gen-proto-c.awk
+ ${PROJECT_SOURCE_DIR}/xC-proto > xC-proto.c
+ DEPENDS
+ ${PROJECT_SOURCE_DIR}/xC-gen-proto.awk
+ ${PROJECT_SOURCE_DIR}/xC-gen-proto-c.awk
+ ${PROJECT_SOURCE_DIR}/xC-proto
+ COMMENT "Generating xC relay protocol code")
+add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.c)
+
# Build
foreach (name xB xC xD)
- add_executable (${name} ${name}.c ${PROJECT_BINARY_DIR}/config.h)
+ add_executable (${name} ${name}.c ${project_config})
target_link_libraries (${name} ${project_libraries})
add_threads (${name})
endforeach ()
add_dependencies (xD replies)
-add_dependencies (xC replies)
+add_dependencies (xC replies xC-proto)
target_link_libraries (xC ${xC_libraries})
+if (WANT_XF)
+ pkg_check_modules (x11 REQUIRED x11 xrender xft fontconfig)
+ include_directories (${x11_INCLUDE_DIRS})
+ link_directories (${x11_LIBRARY_DIRS})
+
+ add_executable (xF xF.c ${project_config})
+ add_dependencies (xF xC-proto)
+ target_link_libraries (xF ${x11_LIBRARIES} ${project_libraries})
+ add_threads (xF)
+endif ()
+
# Tests
include (CTest)
if (BUILD_TESTING)