diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-05-20 17:46:05 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-05-20 17:46:05 +0200 |
| commit | de91a92e67ecc717aec173ec1fb9a2de71959dec (patch) | |
| tree | d926c82c4b1e452cf8de647fa2aeb6f7ad47feed | |
| parent | 9c9ce66d05c23a3f12ce3e28c98564fc2189e2c3 (diff) | |
Wayland under FreeBSD: add support for CMake-based builds.
| -rw-r--r-- | README.Wayland.txt | 13 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 43 |
2 files changed, 42 insertions, 14 deletions
diff --git a/README.Wayland.txt b/README.Wayland.txt index f307cd154..f7c94c935 100644 --- a/README.Wayland.txt +++ b/README.Wayland.txt @@ -176,10 +176,17 @@ The Wayland platform is know to work with FreeBSD version 13.1 and the sway comp These packages are necessary to build the FLTK library and the sway compositor: pkg install git autoconf pkgconf xorg urwfonts gnome seatd sway dmenu-wayland dmenu -The FLTK library should be built, for now, as follows : +The FLTK library can be built using either configure or CMake as follows : -git clone https://github.com/fltk/fltk fltk -cd fltk +1) Using configure + +cd <path-to-FLTK-source-tree> autoconf -f ./configure --enable-localzlib --enable-wayland make + +2) Using CMake + +cmake -S <path-to-source> -B <path-to-build> -DOPTION_USE_WAYLAND=1 + +cd <path-to-build>; make diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 815070c6a..19f659390 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -576,11 +576,32 @@ if (USE_XFT) endif (USE_XFT) if (OPTION_USE_WAYLAND) + if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD") + set(PROTOCOLS /usr/local/share/wayland-protocols) +# create and populate linux/input.h needed by Fl_Wayland_Screen_Driver.cxx and libdecor plugins + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/linux/input.h + COMMAND rm -r -f ${CMAKE_CURRENT_BINARY_DIR}/linux + COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/linux + COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/linux/input.h + COMMAND echo "#define BTN_LEFT 0x110" > ${CMAKE_CURRENT_BINARY_DIR}/linux/input.h + COMMAND echo "#define BTN_RIGHT 0x111" >> ${CMAKE_CURRENT_BINARY_DIR}/linux/input.h + COMMAND echo "#define BTN_MIDDLE 0x112" >> ${CMAKE_CURRENT_BINARY_DIR}/linux/input.h + VERBATIM + ) + SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/../libdecor/build/fl_libdecor_plugins.c + ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx + PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/linux/input.h + ) + else () + set(PROTOCOLS /usr/share/wayland-protocols) + endif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD") add_custom_command( OUTPUT xdg-shell-protocol.c xdg-shell-client-protocol.h - COMMAND wayland-scanner private-code /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.c - COMMAND wayland-scanner client-header /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml xdg-shell-client-protocol.h - DEPENDS /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml + COMMAND wayland-scanner private-code ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.c + COMMAND wayland-scanner client-header ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml xdg-shell-client-protocol.h + DEPENDS ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml VERBATIM ) list (APPEND STATIC_FILES "xdg-shell-protocol.c") @@ -588,9 +609,9 @@ if (OPTION_USE_WAYLAND) if (NOT OPTION_USE_SYSTEM_LIBDECOR) add_custom_command( OUTPUT xdg-decoration-protocol.c xdg-decoration-client-protocol.h - COMMAND wayland-scanner private-code /usr/share/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml xdg-decoration-protocol.c - COMMAND wayland-scanner client-header /usr/share/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml xdg-decoration-client-protocol.h - DEPENDS /usr/share/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml + COMMAND wayland-scanner private-code ${PROTOCOLS}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml xdg-decoration-protocol.c + COMMAND wayland-scanner client-header ${PROTOCOLS}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml xdg-decoration-client-protocol.h + DEPENDS ${PROTOCOLS}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml VERBATIM ) list (APPEND STATIC_FILES "xdg-decoration-protocol.c") @@ -598,9 +619,9 @@ if (OPTION_USE_WAYLAND) endif (NOT OPTION_USE_SYSTEM_LIBDECOR) add_custom_command( OUTPUT text-input-protocol.c text-input-client-protocol.h - COMMAND wayland-scanner private-code /usr/share/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml text-input-protocol.c - COMMAND wayland-scanner client-header /usr/share/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml text-input-client-protocol.h - DEPENDS /usr/share/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml + COMMAND wayland-scanner private-code ${PROTOCOLS}/unstable/text-input/text-input-unstable-v3.xml text-input-protocol.c + COMMAND wayland-scanner client-header ${PROTOCOLS}/unstable/text-input/text-input-unstable-v3.xml text-input-client-protocol.h + DEPENDS ${PROTOCOLS}/unstable/text-input/text-input-unstable-v3.xml VERBATIM ) list (APPEND STATIC_FILES "text-input-protocol.c") @@ -616,9 +637,9 @@ if (OPTION_USE_WAYLAND) if (GTK_FOUND) list (APPEND OPTIONAL_LIBS ${GTK_LDFLAGS} ) endif (GTK_FOUND) - if (NOT OPTION_BUILD_SHARED_LIBS) + if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux" AND NOT OPTION_BUILD_SHARED_LIBS) list (APPEND OPTIONAL_LIBS "-no-pie") - endif (NOT OPTION_BUILD_SHARED_LIBS) + endif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux" AND NOT OPTION_BUILD_SHARED_LIBS) endif (OPTION_USE_WAYLAND) ####################################################################### |
