Merge pull request #205 from sp1ritCS/meson

Added meson buildfiles
This commit is contained in:
vaxerski 2022-06-20 13:56:58 +01:00 committed by GitHub
commit f5f531562b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 215 additions and 63 deletions

View file

@ -41,3 +41,35 @@ jobs:
- name: Build Hyprland with LEGACY_RENDERER
run: |
make legacyrenderer
meson:
name: "Build Hyprland with Meson (Arch)"
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Download dependencies
run: |
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers xcb-util-errors xcb-util-renderutil xcb-util-wm xorg-fonts-encodings xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xwayland git go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd
- name: Checkout Hyprland
uses: actions/checkout@v3
with:
submodules: true
- name: Configure
run: |
meson obj-x86_64-pc-linux-gnu \
-Ddefault_library=static
- name: Compile
run: ninja -C obj-x86_64-pc-linux-gnu
- name: Compress artifacts
run: |
mkdir x86_64-pc-linux-gnu
DESTDIR=$PWD/x86_64-pc-linux-gnu meson install -C obj-x86_64-pc-linux-gnu --tags runtime
tar -cvf x86_64-pc-linux-gnu.tar.xz x86_64-pc-linux-gnu
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Build artifacts (x86_64-pc-linux-gnu)
path: x86_64-pc-linux-gnu.tar.xz

2
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "wlroots"]
path = wlroots
path = subprojects/wlroots
url = https://github.com/ThatOneCalculator/wlroots-mirror

View file

@ -35,7 +35,7 @@ execute_process(
#
#
include_directories(.)
include_directories(. PRIVATE "subprojects/wlroots/include/")
add_compile_options(-std=c++20 -DWLR_USE_UNSTABLE )
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing)
find_package(Threads REQUIRED)

View file

@ -129,11 +129,11 @@ protocols: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o wlr-scree
config:
make protocols
sed -i -E 's/(soversion = 11)([^032]|$$)/soversion = 11032/g' ./wlroots/meson.build
sed -i -E 's/(soversion = 11)([^032]|$$)/soversion = 11032/g' subprojects/wlroots/meson.build
rm -rf ./wlroots/build
rm -rf ./subprojects/wlroots/build
cd wlroots && meson ./build --prefix=/usr --buildtype=release
cd wlroots && ninja -C build/
cd subprojects/wlroots && meson ./build --prefix=/usr --buildtype=release
cd subprojects/wlroots && ninja -C build/
cd wlroots && sudo ninja -C build/ install
cd subprojects/wlroots && sudo ninja -C build/ install

5
assets/meson.build Normal file
View file

@ -0,0 +1,5 @@
wallpapers = ['wall_2K.png', 'wall_4K.png', 'wall_8K.png']
foreach wallpaper : wallpapers
install_data(wallpapers, install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime')
endforeach

2
example/meson.build Normal file
View file

@ -0,0 +1,2 @@
install_data('hyprland.conf', install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime')
install_data('hyprland.desktop', install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), install_tag: 'runtime')

3
hyprctl/meson.build Normal file
View file

@ -0,0 +1,3 @@
executable('hyprctl', 'main.cpp',
install: true
)

26
meson.build Normal file
View file

@ -0,0 +1,26 @@
project('Hyprland', 'cpp', 'c',
version : '0.1',
default_options : ['warning_level=3', 'cpp_std=c++20', 'default_library=static'])
wlroots = subproject('wlroots', default_options: ['examples=false'])
have_xwlr = wlroots.get_variable('features').get('xwayland')
xcb_dep = dependency('xcb', required: get_option('xwayland'))
if get_option('xwayland').enabled() and not have_xwlr
error('Cannot enable Xwayland in Hyprland: wlroots has been built without Xwayland support')
endif
have_xwayland = xcb_dep.found() and have_xwlr
if not have_xwayland
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
endif
if get_option('buildtype') == 'debug'
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
endif
subdir('protocols')
subdir('src')
subdir('hyprctl')
subdir('assets')
subdir('example')

1
meson_options.txt Normal file
View file

@ -0,0 +1 @@
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')

51
protocols/meson.build Normal file
View file

@ -0,0 +1,51 @@
wayland_protos = dependency('wayland-protocols',
version: '>=1.25',
fallback: 'wayland-protocols',
default_options: ['tests=false'],
)
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
wayland_scanner_dep = dependency('wayland-scanner', native: true)
wayland_scanner = find_program(
wayland_scanner_dep.get_variable('wayland_scanner'),
native: true,
)
protocols = [
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
['wlr-layer-shell-unstable-v1.xml'],
['ext-workspace-unstable-v1.xml'],
['pointer-constraints-unstable-v1.xml'],
['tablet-unstable-v2.xml'],
['idle.xml']
]
wl_protos_src = []
wl_protos_headers = []
foreach p : protocols
xml = join_paths(p)
wl_protos_src += custom_target(
xml.underscorify() + '_server_c',
input: xml,
output: '@BASENAME@-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
)
wl_protos_headers += custom_target(
xml.underscorify() + '_server_h',
input: xml,
output: '@BASENAME@-protocol.h',
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
)
endforeach
wayland_server = dependency('wayland-server', version: '>=1.20.0')
lib_server_protos = static_library(
'server_protos',
wl_protos_src + wl_protos_headers,
dependencies: wayland_server.partial_dependency(compile_args: true),
)
server_protos = declare_dependency(
link_with: lib_server_protos,
sources: wl_protos_headers,
)

View file

@ -114,6 +114,9 @@ std::string versionRequest() {
#ifndef NDEBUG
result += "debug\n";
#endif
#ifdef HYPRLAND_DEBUG
result += "debug\n";
#endif
#ifdef NO_XWAYLAND
result += "no xwayland\n";
#endif

View file

@ -7,10 +7,14 @@
#include "wlrunstable/wlr_ext_workspace_v1.hpp"
#ifndef NDEBUG
#ifdef HYPRLAND_DEBUG
#define ISDEBUG true
#else
#define ISDEBUG false
#endif
#else
#define ISDEBUG false
#endif
#define RIP(format, ... ) { fprintf(stderr, format "\n", ##__VA_ARGS__); exit(EXIT_FAILURE); }

View file

@ -2,7 +2,7 @@
#include "../events/Events.hpp"
#include "../defines.hpp"
#include "../../wlr-layer-shell-unstable-v1-protocol.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
#include "../Window.hpp"
#include "SubsurfaceTree.hpp"
#include "AnimatedVariable.hpp"

View file

@ -34,60 +34,60 @@
#define static
extern "C" {
#include "../wlroots/include/wlr/backend.h"
#include "../wlroots/include/wlr/backend/libinput.h"
#include "../wlroots/include/wlr/render/allocator.h"
#include "../wlroots/include/wlr/render/wlr_renderer.h"
#include "../wlroots/include/wlr/types/wlr_compositor.h"
#include "../wlroots/include/wlr/types/wlr_cursor.h"
#include "../wlroots/include/wlr/types/wlr_data_control_v1.h"
#include "../wlroots/include/wlr/types/wlr_data_device.h"
#include "../wlroots/include/wlr/types/wlr_export_dmabuf_v1.h"
#include "../wlroots/include/wlr/types/wlr_linux_dmabuf_v1.h"
#include "../wlroots/include/wlr/types/wlr_gamma_control_v1.h"
#include "../wlroots/include/wlr/types/wlr_idle.h"
#include "../wlroots/include/wlr/types/wlr_input_device.h"
#include "../wlroots/include/wlr/types/wlr_keyboard.h"
#include "../wlroots/include/wlr/types/wlr_layer_shell_v1.h"
#include "../wlroots/include/wlr/types/wlr_matrix.h"
#include "../wlroots/include/wlr/types/wlr_output.h"
#include "../wlroots/include/wlr/types/wlr_output_layout.h"
#include "../wlroots/include/wlr/types/wlr_output_management_v1.h"
#include "../wlroots/include/wlr/types/wlr_pointer.h"
#include "../wlroots/include/wlr/types/wlr_presentation_time.h"
#include "../wlroots/include/wlr/types/wlr_primary_selection.h"
#include "../wlroots/include/wlr/types/wlr_primary_selection_v1.h"
#include "../wlroots/include/wlr/types/wlr_screencopy_v1.h"
#include "../wlroots/include/wlr/types/wlr_seat.h"
#include "../wlroots/include/wlr/types/wlr_server_decoration.h"
#include "../wlroots/include/wlr/types/wlr_viewporter.h"
#include "../wlroots/include/wlr/types/wlr_virtual_keyboard_v1.h"
#include "../wlroots/include/wlr/types/wlr_xcursor_manager.h"
#include "../wlroots/include/wlr/types/wlr_xdg_activation_v1.h"
#include "../wlroots/include/wlr/types/wlr_xdg_decoration_v1.h"
#include "../wlroots/include/wlr/types/wlr_xdg_output_v1.h"
#include "../wlroots/include/wlr/types/wlr_xdg_shell.h"
#include "../wlroots/include/wlr/types/wlr_subcompositor.h"
#include "../wlroots/include/wlr/types/wlr_scene.h"
#include "../wlroots/include/wlr/types/wlr_output_damage.h"
#include "../wlroots/include/wlr/types/wlr_input_inhibitor.h"
#include "../wlroots/include/wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h"
#include "../wlroots/include/wlr/types/wlr_virtual_pointer_v1.h"
#include "../wlroots/include/wlr/types/wlr_foreign_toplevel_management_v1.h"
#include "../wlroots/include/wlr/util/log.h"
#include "../wlroots/include/wlr/xwayland.h"
#include "../wlroots/include/wlr/util/region.h"
#include "../wlroots/include/wlr/types/wlr_tablet_pad.h"
#include "../wlroots/include/wlr/types/wlr_tablet_tool.h"
#include "../wlroots/include/wlr/types/wlr_tablet_v2.h"
#include <wlr/backend.h>
#include <wlr/backend/libinput.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output_management_v1.h>
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_presentation_time.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_primary_selection_v1.h>
#include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_viewporter.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_xdg_activation_v1.h>
#include <wlr/types/wlr_xdg_decoration_v1.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/types/wlr_subcompositor.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_output_damage.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include <wlr/types/wlr_virtual_pointer_v1.h>
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
#include <wlr/util/log.h>
#include <wlr/xwayland.h>
#include <wlr/util/region.h>
#include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <xkbcommon/xkbcommon.h>
#include <X11/Xproto.h>
#include "../wlroots/include/wlr/render/egl.h"
#include "../wlroots/include/wlr/render/gles2.h"
#include "../wlroots/include/wlr/render/wlr_texture.h"
#include "../wlroots/include/wlr/types/wlr_pointer_constraints_v1.h"
#include "../wlroots/include/wlr/types/wlr_relative_pointer_v1.h"
#include "../wlroots/include/wlr/interfaces/wlr_keyboard.h"
#include <wlr/render/egl.h>
#include <wlr/render/gles2.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_relative_pointer_v1.h>
#include <wlr/interfaces/wlr_keyboard.h>
}
#undef class
@ -113,4 +113,4 @@ extern "C" {
#include "helpers/Vector2D.hpp"
#include "../ext-workspace-unstable-v1-protocol.h"
#include "ext-workspace-unstable-v1-protocol.h"

25
src/meson.build Normal file
View file

@ -0,0 +1,25 @@
globber = run_command('find', '-name', '*.cpp', check: true)
src = globber.stdout().strip().split('\n')
executable('Hyprland', src,
cpp_args: ['-DWLR_USE_UNSTABLE'],
dependencies: [
server_protos,
dependency('wayland-server'),
dependency('wayland-client'),
wlroots.get_variable('wlroots'),
dependency('cairo'),
dependency('pango'),
dependency('pangocairo'),
dependency('libdrm'),
dependency('egl'),
dependency('xkbcommon'),
dependency('libinput'),
xcb_dep,
dependency('pixman-1'),
dependency('GL'),
dependency('threads')
],
install : true
)

View file

@ -2,7 +2,7 @@
#include "../includes.hpp"
#include "../helpers/MiscFunctions.hpp"
#include "../../ext-workspace-unstable-v1-protocol.h"
#include "ext-workspace-unstable-v1-protocol.h"
#include <assert.h>
#include <string.h>