1
0
mirror of https://github.com/Cloudef/bemenu synced 2024-11-23 17:32:11 +01:00

Add options for renderers, make deps required

This commit is contained in:
Danilo Spinella 2019-03-24 14:57:48 +01:00
parent 33e540a2b0
commit 5ca32626dc
6 changed files with 60 additions and 36 deletions

@ -5,6 +5,10 @@ SET(BEMENU_DESCRIPTION "Dynamic menu library and client program inspired by dmen
SET(BEMENU_VERSION "0.1.0")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
OPTION(BEMENU_CURSES_RENDERER "Build curses backend" ON)
OPTION(BEMENU_X11_RENDERER "Build X11 backend" ON)
OPTION(BEMENU_WAYLAND_RENDERER "Build wayland renderer" OFF)
INCLUDE(CTest)
INCLUDE(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)

@ -6,6 +6,20 @@ bemenu
Dynamic menu library and client program inspired by dmenu
## Renderers
bemenu supports three different renderers:
- ncurses
- X11
- Wayland
Enable/disable the renderers by appending these CMake options when executing `cmake <dir>`:
- `-DBEMENU_CURSES_RENDERER=[OFF|ON]`
- `-DBEMENU_X11_RENDERER=[OFF|ON]`
- `-DBEMENU_WAYLAND_RENDERER=[OFF|ON]`
## License
* [GNU GPLv3 (or any later version)](LICENSE-CLIENT) for client program[s] and
other sources except library and bindings

@ -1,8 +1,20 @@
SET(RENDERERS
"curses"
"wayland"
"x11"
)
SET(RENDERERS "")
IF(BEMENU_CURSES_RENDERER)
LIST(APPEND RENDERERS "curses")
ENDIF()
IF(BEMENU_X11_RENDERER)
LIST(APPEND RENDERERS "x11")
ENDIF()
IF(BEMENU_WAYLAND_RENDERER)
LIST(APPEND RENDERERS "wayland")
ENDIF()
IF(NOT RENDERERS)
MESSAGE(FATAL_ERROR "At least one renderer should be enabled")
ENDIF()
ADD_DEFINITIONS(-DPANGO_DISABLE_DEPRECATED)

@ -1,10 +1,8 @@
SET(CURSES_NEED_NCURSES TRUE)
FIND_PACKAGE(Curses)
FIND_PACKAGE(Curses REQUIRED)
if (CURSES_FOUND)
INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIRS})
ADD_LIBRARY(bemenu-renderer-curses SHARED curses.c)
SET_TARGET_PROPERTIES(bemenu-renderer-curses PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(bemenu-renderer-curses ${BEMENU_LIBRARIES} ${CURSES_LIBRARY} m)
INSTALL(TARGETS bemenu-renderer-curses DESTINATION "${CMAKE_INSTALL_LIBDIR}/bemenu")
endif ()
INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIRS})
ADD_LIBRARY(bemenu-renderer-curses SHARED curses.c)
SET_TARGET_PROPERTIES(bemenu-renderer-curses PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(bemenu-renderer-curses ${BEMENU_LIBRARIES} ${CURSES_LIBRARY} m)
INSTALL(TARGETS bemenu-renderer-curses DESTINATION "${CMAKE_INSTALL_LIBDIR}/bemenu")

@ -1,15 +1,13 @@
FIND_PACKAGE(Wayland)
FIND_PACKAGE(Cairo)
FIND_PACKAGE(Pango)
FIND_PACKAGE(XKBCommon)
FIND_PACKAGE(Wayland REQUIRED)
FIND_PACKAGE(Cairo REQUIRED)
FIND_PACKAGE(Pango REQUIRED)
FIND_PACKAGE(XKBCommon REQUIRED)
if (WAYLAND_FOUND AND CAIRO_FOUND AND PANGO_FOUND AND XKBCOMMON_FOUND)
INCLUDE(Wayland)
WAYLAND_ADD_PROTOCOL_CLIENT(proto-layer-shell "wlr-layer-shell-unstable-v1.xml" layer-shell)
WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "xdg-shell.xml" xdg-shell)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${WAYLAND_CLIENT_INCLUDE_DIR} ${XKBCOMMON_INCLUDE_DIR} ${CAIRO_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS})
ADD_LIBRARY(bemenu-renderer-wayland SHARED wayland.c registry.c window.c ${proto-layer-shell} ${proto-xdg-shell})
SET_TARGET_PROPERTIES(bemenu-renderer-wayland PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(bemenu-renderer-wayland ${BEMENU_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${XKBCOMMON_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m)
INSTALL(TARGETS bemenu-renderer-wayland DESTINATION "${CMAKE_INSTALL_LIBDIR}/bemenu")
endif ()
INCLUDE(Wayland)
WAYLAND_ADD_PROTOCOL_CLIENT(proto-layer-shell "wlr-layer-shell-unstable-v1.xml" layer-shell)
WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "xdg-shell.xml" xdg-shell)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${WAYLAND_CLIENT_INCLUDE_DIR} ${XKBCOMMON_INCLUDE_DIR} ${CAIRO_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS})
ADD_LIBRARY(bemenu-renderer-wayland SHARED wayland.c registry.c window.c ${proto-layer-shell} ${proto-xdg-shell})
SET_TARGET_PROPERTIES(bemenu-renderer-wayland PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(bemenu-renderer-wayland ${BEMENU_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${XKBCOMMON_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m)
INSTALL(TARGETS bemenu-renderer-wayland DESTINATION "${CMAKE_INSTALL_LIBDIR}/bemenu")

@ -1,10 +1,8 @@
FIND_PACKAGE(X11)
FIND_PACKAGE(Cairo)
FIND_PACKAGE(X11 REQUIRED)
FIND_PACKAGE(Cairo REQUIRED)
if (X11_FOUND AND X11_Xinerama_FOUND AND CAIRO_FOUND AND PANGO_FOUND)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH} ${CAIRO_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS})
ADD_LIBRARY(bemenu-renderer-x11 SHARED x11.c window.c xkb_unicode.c)
SET_TARGET_PROPERTIES(bemenu-renderer-x11 PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(bemenu-renderer-x11 ${BEMENU_LIBRARIES} ${X11_LIBRARIES} ${X11_Xinerama_LIB} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m)
INSTALL(TARGETS bemenu-renderer-x11 DESTINATION "${CMAKE_INSTALL_LIBDIR}/bemenu")
endif ()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH} ${CAIRO_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS})
ADD_LIBRARY(bemenu-renderer-x11 SHARED x11.c window.c xkb_unicode.c)
SET_TARGET_PROPERTIES(bemenu-renderer-x11 PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(bemenu-renderer-x11 ${BEMENU_LIBRARIES} ${X11_LIBRARIES} ${X11_Xinerama_LIB} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m)
INSTALL(TARGETS bemenu-renderer-x11 DESTINATION "${CMAKE_INSTALL_LIBDIR}/bemenu")