summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
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)