diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index ea92a18..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,130 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -project(f00bar C) - -set(CORE_PLUGINS_AS_SHARED_LIBRARIES 0 CACHE BOOL - "Compiles modules, particles and decorations as shared libraries, which are loaded on-demand") - -set(ENABLE_X11 1 CACHE BOOL "Enables support for the XCB (X11) backend") -set_property(DIRECTORY . APPEND PROPERTY - COMPILE_DEFINITIONS $<$:ENABLE_X11>) - -set(ENABLE_WAYLAND 1 CACHE BOOL "Enables support for the wayland backend") -set_property(DIRECTORY . APPEND PROPERTY - COMPILE_DEFINITIONS $<$:ENABLE_WAYLAND>) - -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_C_EXTENSIONS OFF) -set(CMAKE_C_STANDARD 11) - -set_property(DIRECTORY . APPEND PROPERTY COMPILE_DEFINITIONS - $<$:_DEBUG> - _GNU_SOURCE - ) - -if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - set_property(DIRECTORY . APPEND PROPERTY COMPILE_DEFINITIONS - CORE_PLUGINS_AS_SHARED_LIBRARIES) -endif () - -set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") - -find_package(Threads REQUIRED) -find_package(PkgConfig REQUIRED) - -pkg_check_modules(fontconfig REQUIRED IMPORTED_TARGET fontconfig) -pkg_check_modules(cairo REQUIRED IMPORTED_TARGET cairo cairo-ft) -pkg_check_modules(yaml REQUIRED IMPORTED_TARGET yaml-0.1) - -if (ENABLE_X11) - pkg_check_modules(xcb REQUIRED IMPORTED_TARGET - xcb xcb-aux xcb-cursor xcb-event xcb-ewmh xcb-randr xcb-render cairo-xcb) - pkg_check_modules(xcb-errors IMPORTED_TARGET xcb-errors) - - add_library(xcb-stuff STATIC EXCLUDE_FROM_ALL xcb.c xcb.h) - target_link_libraries(xcb-stuff PkgConfig::xcb) - if (XCB_ERRORS_FOUND) - target_compile_definitions(xcb-stuff PRIVATE HAVE_XCB_ERRORS) - target_link_libraries(xcb-stuff PkgConfig::xcb-errors) - endif () - - # Since there are plugins linking against xcb-stuff, we need to - # ensure it's compiled with -fPIC when the plugins are compiled as - # shared libraries. - if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - set_property(TARGET xcb-stuff PROPERTY POSITION_INDEPENDENT_CODE 1) - endif () - - install(FILES xcb.h DESTINATION include/f00bar) -endif () - -if (ENABLE_WAYLAND) - pkg_check_modules(wayland REQUIRED IMPORTED_TARGET - wayland-client wayland-cursor wlroots) -endif () - -add_subdirectory(bar) - -add_executable(f00bar - color.h - config-verify.c config-verify.h - config.c config.h - decoration.h - font.c font.h - log.c log.h - main.c - module.c module.h - particle.c particle.h - plugin.c plugin.h - tag.c tag.h - tllist.h - yml.c yml.h - ) - -target_link_libraries(f00bar - bar - PkgConfig::cairo PkgConfig::fontconfig PkgConfig::yaml - ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) - -# Make global symbols in f00bar visible to dlopen:ed plugins -target_link_options(f00bar PRIVATE -rdynamic) - -set_property(TARGET f00bar PROPERTY INSTALL_RPATH \$ORIGIN/../lib/f00bar) -set_property(TARGET f00bar PROPERTY - BUILD_RPATH "\$ORIGIN/modules;\$ORIGIN/particles;\$ORIGIN/decorations") - -install(TARGETS f00bar DESTINATION bin) -install(FILES - color.h - config.h - config-verify.h - decoration.h - font.h - log.h - module.h - particle.h - tag.h - tllist.h - yml.h - - DESTINATION include/f00bar -) - -set(enabled_modules "") -set(enabled_particles "") -set(enabled_decorations "") - -add_subdirectory(doc) -add_subdirectory(modules) -add_subdirectory(particles) -add_subdirectory(decorations) - -if (NOT CORE_PLUGINS_AS_SHARED_LIBRARIES) - target_link_libraries(f00bar ${enabled_decorations}) - target_link_libraries(f00bar ${enabled_particles}) - target_link_libraries(f00bar ${enabled_modules}) - - foreach (plug ${enabled_decorations} ${enabled_particles} ${enabled_modules}) - string(REPLACE "-" "_" fixed "${plug}") - target_compile_definitions(f00bar PRIVATE "HAVE_PLUGIN_${fixed}") - endforeach () -endif () diff --git a/bar/CMakeLists.txt b/bar/CMakeLists.txt deleted file mode 100644 index ffa2893..0000000 --- a/bar/CMakeLists.txt +++ /dev/null @@ -1,73 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -# X11/XCB bar backend -if (ENABLE_X11) - add_library(bar-xcb STATIC EXCLUDE_FROM_ALL xcb.c xcb.h) - target_link_libraries(bar-xcb xcb-stuff PkgConfig::cairo) -endif () - -# Wayland/wlroots bar backend -if (ENABLE_WAYLAND) - find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner) - if (WAYLAND_SCANNER_EXECUTABLE-NOTFOUND) - message(FATAL_ERROR "could not find wayland-scanner") - endif () - - function (wayland_protocol _deps) - set(deps "") - foreach (xml_file ${ARGN}) - get_filename_component(base ${xml_file} NAME_WE) - set(out_c ${base}.c) - set(out_h ${base}.h) - - add_custom_command( - OUTPUT ${out_h} - COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${xml_file} > ${out_h} - VERBATIM - MAIN_DEPENDENCY ${xml_file} - ) - add_custom_command( - OUTPUT ${out_c} - COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code < ${xml_file} > ${out_c} - VERBATIM - MAIN_DEPENDENCY ${xml_file} - ) - - list(APPEND deps ${out_h}) - list(APPEND deps ${out_c}) - endforeach () - - set(${_deps} ${deps} PARENT_SCOPE) - endfunction () - - pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols) - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols - OUTPUT_VARIABLE WAYLAND_PROTOCOLS - OUTPUT_STRIP_TRAILING_WHITESPACE) - - wayland_protocol( - wayland_protos - ${PROJECT_SOURCE_DIR}/external/wlr-protocols/unstable/wlr-layer-shell-unstable-v1.xml - ${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml - ${WAYLAND_PROTOCOLS}/unstable/xdg-output/xdg-output-unstable-v1.xml - ) - - add_library(wayland-protocols STATIC EXCLUDE_FROM_ALL ${wayland_protos}) - target_include_directories(wayland-protocols PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) - - add_library(bar-wayland STATIC EXCLUDE_FROM_ALL wayland.c wayland.h) - target_compile_definitions(bar-wayland PRIVATE _GNU_SOURCE) - target_link_libraries( - bar-wayland wayland-protocols PkgConfig::wayland PkgConfig::cairo) -endif () - -add_library(bar STATIC EXCLUDE_FROM_ALL bar.c bar.h private.h backend.h) - -target_link_libraries(bar - $<$:bar-xcb> - $<$:bar-wayland> - ${CMAKE_THREAD_LIBS_INIT} -) - -install(FILES bar.h DESTINATION include/f00bar/bar) diff --git a/decorations/CMakeLists.txt b/decorations/CMakeLists.txt deleted file mode 100644 index 414d0d1..0000000 --- a/decorations/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -add_library(decoration-sdk INTERFACE) -target_link_libraries(decoration-sdk INTERFACE PkgConfig::cairo) - -set(CMAKE_SHARED_MODULE_PREFIX decoration_) - -set(decorations background stack underline) - -if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - set(lib_type MODULE) -else() - set(lib_type STATIC) -endif () - -foreach (deco ${decorations}) - add_library(${deco} ${lib_type} ${deco}.c) - target_link_libraries(${deco} decoration-sdk) -endforeach () - -if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - install(TARGETS ${decorations} DESTINATION lib/f00bar) -endif () - -set(enabled_decorations ${decorations} PARENT_SCOPE) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt deleted file mode 100644 index d3872d2..0000000 --- a/doc/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -find_program(SCDOC_EXECUTABLE scdoc) -find_program(GZIP_EXECUTABLE gzip) - -if (SCDOC_EXECUTABLE STREQUAL "SCDOC_EXECUTABLE-NOTFOUND") - message(FATAL_ERROR "scdoc not found; required to build man pages") -endif () -if (GZIP_EXECUTABLE STREQUAL "GZIP_EXECUTABLE-NOTFOUND") - message(FATAL_ERROR "gzip not found; required to build man pages") -endif () - -function(add_man_pages) - foreach (src ${ARGN}) - string(REPLACE ".scd" ".gz" man "${src}") - string(REGEX MATCH "\.[0-9]+\.scd" man_target "${src}") - string(REGEX MATCH "[0-9]+" man_target "${man_target}") - - add_custom_command( - OUTPUT ${man} - COMMENT "Generating man page ${man}" - COMMAND ${SCDOC_EXECUTABLE} < ${CMAKE_CURRENT_SOURCE_DIR}/${src} | - ${GZIP_EXECUTABLE} > ${man} - VERBATIM - MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${src} - ) - - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${man} - DESTINATION share/man/man${man_target}) - endforeach() - - string(REPLACE ".scd" ".gz" out "${ARGN}") - list(TRANSFORM out PREPEND "${CMAKE_CURRENT_BINARY_DIR}/") - add_custom_target(man-pages ALL SOURCES ${ARGN} DEPENDS ${out}) -endfunction() - -add_man_pages( - f00bar.1.scd - f00bar.5.scd - - f00bar-modules.5.scd - - f00bar-decorations.5.scd - f00bar-particles.5.scd - f00bar-tags.5.scd - ) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt deleted file mode 100644 index c3aa40d..0000000 --- a/modules/CMakeLists.txt +++ /dev/null @@ -1,80 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -add_library(module-sdk INTERFACE) -target_link_libraries( - module-sdk INTERFACE PkgConfig::cairo ${CMAKE_THREAD_LIBS_INIT}) - -if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - set(lib_type MODULE) -else () - set(lib_type STATIC) -endif () - -set(CMAKE_SHARED_${lib_type}_PREFIX module_) - -set(enabled "") - -pkg_check_modules(alsa REQUIRED IMPORTED_TARGET alsa) -add_library(alsa ${lib_type} alsa.c) -target_link_libraries(alsa module-sdk PkgConfig::alsa) -list(APPEND enabled alsa) - -pkg_check_modules(udev REQUIRED IMPORTED_TARGET libudev) -add_library(backlight ${lib_type} backlight.c) -target_link_libraries(backlight module-sdk PkgConfig::udev) -list(APPEND enabled backlight) - -add_library(battery ${lib_type} battery.c) -target_link_libraries(battery module-sdk PkgConfig::udev) -list(APPEND enabled battery) - -add_library(clock ${lib_type} clock.c) -target_link_libraries(clock module-sdk) -list(APPEND enabled clock) - -pkg_check_modules(json REQUIRED IMPORTED_TARGET json-c) -add_library(i3-common STATIC EXCLUDE_FROM_ALL i3-common.c i3-common.h) -target_link_libraries(i3-common PkgConfig::json) -if (ENABLE_X11) - target_link_libraries(i3-common xcb-stuff) -endif () - -add_library(i3 ${lib_type} i3.c) -target_link_libraries(i3 module-sdk i3-common dynlist) -list(APPEND enabled i3) - -add_library(label ${lib_type} label.c) -target_link_libraries(label module-sdk) -list(APPEND enabled label) - -pkg_check_modules(mpd REQUIRED IMPORTED_TARGET libmpdclient) -add_library(mpd ${lib_type} mpd.c) -target_link_libraries(mpd module-sdk PkgConfig::mpd) -list(APPEND enabled mpd) - -add_library(network ${lib_type} network.c) -target_link_libraries(network module-sdk) -list(APPEND enabled network) - -add_library(removables ${lib_type} removables.c) -target_link_libraries(removables module-sdk dynlist PkgConfig::udev) -list(APPEND enabled removables) - -if (ENABLE_X11) - pkg_check_modules(xkb REQUIRED IMPORTED_TARGET xcb-xkb) - add_library(xkb ${lib_type} xkb.c) - target_link_libraries(xkb module-sdk PkgConfig::xcb PkgConfig::xkb) - list(APPEND enabled xkb) -endif () - -if (ENABLE_X11) - add_library(xwindow ${lib_type} xwindow.c) - target_link_libraries(xwindow module-sdk xcb-stuff) - list(APPEND enabled xwindow) -endif () - -if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - install(TARGETS ${enabled} DESTINATION lib/f00bar) -endif () - -set(enabled_modules ${enabled} PARENT_SCOPE) diff --git a/particles/CMakeLists.txt b/particles/CMakeLists.txt deleted file mode 100644 index 6fd211c..0000000 --- a/particles/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -add_library(particle-sdk INTERFACE) -target_link_libraries(particle-sdk INTERFACE PkgConfig::cairo) - -if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - set(lib_type MODULE) - set(dynlist_lib_type SHARED) -else () - set(lib_type STATIC) - set(dynlist_lib_type STATIC) -endif () - -# Only an exposable, not a particle. Used by a couple of modules -add_library(dynlist ${dynlist_lib_type} dynlist.c dynlist.h) -target_link_libraries(dynlist PRIVATE particle-sdk) - -set(CMAKE_SHARED_MODULE_PREFIX particle_) - -set(particles empty list map progress-bar ramp string) - -foreach (particle ${particles}) - add_library(${particle} ${lib_type} ${particle}.c) - target_link_libraries(${particle} particle-sdk) -endforeach () - -target_link_libraries(string ${CAIRO_LIBRARIES}) - -if (CORE_PLUGINS_AS_SHARED_LIBRARIES) - install(TARGETS ${particles} dynlist DESTINATION lib/f00bar) -endif () - -set(enabled_particles "dynlist;${particles}" PARENT_SCOPE)