Skip to content

Commit

Permalink
Meson subprojects
Browse files Browse the repository at this point in the history
  • Loading branch information
2hdddg committed Feb 19, 2024
1 parent c2379e1 commit 3af2430
Show file tree
Hide file tree
Showing 40 changed files with 112 additions and 98 deletions.
39 changes: 4 additions & 35 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,13 @@ compiler = meson.get_compiler('cpp')
cpp_args = []
add_global_arguments(cpp_args, language:'cpp')

wayland_client = dependency('wayland-client')
wayland_protocols = dependency('wayland-protocols')
cairo = dependency('cairo')
lua = dependency('lua')
m_dep = meson.get_compiler('c').find_library('m')
xkbcommon = dependency('xkbcommon')
deps = [wayland_client, wayland_protocols, xkbcommon, cairo, dependency('pango'), dependency('pangocairo'), dependency('libpulse'), lua, m_dep]
deps += subproject('spdlog', default_options: 'tests=false').get_variable('spdlog_dep')
deps += subproject('nlohmann_json').get_variable('nlohmann_json_dep')

src = files(
'src/Buffer.cpp',
'src/Configuration.cpp',
'src/DateTimeSources.cpp',
'src/Draw.cpp',
'src/main.cpp',
'src/MainLoop.cpp',
'src/Manager.cpp',
'src/NetworkSource.cpp',
'src/Output.cpp',
'src/PowerSource.cpp',
'src/PulseAudioSource.cpp',
'src/Registry.cpp',
'src/ScriptContext.cpp',
'src/Seat.cpp',
'src/ShellSurface.cpp',
'src/Sources.cpp',
'src/SwayCompositor.cpp',
'src/util.cpp',
)
zenway_src = src

deps = []
src = files()
subdir('protocols')
deps += internal_lib_protocol

subdir('zen')
executable(
'zenway',
src,
dependencies: deps,
include_directories: ['external'],
include_directories: ['../external'],
)
2 changes: 1 addition & 1 deletion src/Buffer.cpp → zen/Buffer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Buffer.h"
#include "zen/Buffer.h"

#include <fcntl.h>
#include <spdlog/spdlog.h>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "src/SwayCompositor.h"
#include "zen/Compositors/Sway/SwayCompositor.h"

#define JSON_USE_IMPLICIT_CONVERSIONS 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <memory>

#include "MainLoop.h"
#include "src/Sources.h"
#include "zen/MainLoop.h"
#include "zen/Sources/Sources.h"

using Visibility = std::function<void(bool visibility)>;
using AlertStates = std::map<std::string, std::set<int>>;
Expand Down
5 changes: 5 additions & 0 deletions zen/Compositors/Sway/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


src += files(
'SwayCompositor.cpp',
)
2 changes: 1 addition & 1 deletion src/Configuration.cpp → zen/Configuration.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Configuration.h"
#include "zen/Configuration.h"

static bool FromChar(const char c, uint8_t& n) {
if (c >= '0' && c <= '9') {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Draw.cpp → zen/Draw.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Draw.h"
#include "zen/Draw.h"

#include "pango/pango-layout.h"
#include "pango/pangocairo.h"
Expand Down
4 changes: 2 additions & 2 deletions src/Draw.h → zen/Draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "cairo.h"
#include "pango/pango-layout.h"
#include "src/Buffer.h"
#include "src/Configuration.h"
#include "zen/Buffer.h"
#include "zen/Configuration.h"

// This file and corresponding .cpp handles drawing of all configurable panels and
// their widgets.
Expand Down
2 changes: 1 addition & 1 deletion src/MainLoop.cpp → zen/MainLoop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MainLoop.h"
#include "zen/MainLoop.h"

#include <spdlog/spdlog.h>
#include <sys/eventfd.h>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/Manager.cpp → zen/Manager.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Manager.h"
#include "zen/Manager.h"

#include "spdlog/spdlog.h"
#include "src/Registry.h"
#include "zen/Registry.h"

std::shared_ptr<Manager> Manager::Create(std::shared_ptr<Registry> registry) {
auto manager = std::shared_ptr<Manager>(new Manager(registry));
Expand Down
8 changes: 4 additions & 4 deletions src/Manager.h → zen/Manager.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "src/MainLoop.h"
#include "src/Output.h"
#include "src/ScriptContext.h"
#include "src/Sources.h"
#include "zen/MainLoop.h"
#include "zen/Output.h"
#include "zen/ScriptContext.h"
#include "zen/Sources/Sources.h"

class Manager : public NotificationHandler {
public:
Expand Down
4 changes: 2 additions & 2 deletions src/Output.cpp → zen/Output.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "Output.h"

#include "Registry.h"
#include "ShellSurface.h"
#include "spdlog/spdlog.h"
#include "src/Registry.h"
#include "src/ShellSurface.h"

class Output {
using OnNamedCallback = std::function<void(Output *output, const std::string &name)>;
Expand Down
6 changes: 3 additions & 3 deletions src/Output.h → zen/Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <memory>
#include <string>

#include "src/Buffer.h"
#include "src/Configuration.h"
#include "src/Sources.h"
#include "zen/Buffer.h"
#include "zen/Configuration.h"
#include "zen/Sources/Sources.h"

class Output;
class Registry;
Expand Down
2 changes: 1 addition & 1 deletion src/Registry.cpp → zen/Registry.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Registry.h"
#include "zen/Registry.h"

#include <spdlog/spdlog.h>
#include <wayland-client-core.h>
Expand Down
8 changes: 4 additions & 4 deletions src/Registry.h → zen/Registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <list>
#include <memory>

#include "MainLoop.h"
#include "Output.h"
#include "Seat.h"
#include "ShellSurface.h"
#include "zen/MainLoop.h"
#include "zen/Output.h"
#include "zen/Seat.h"
#include "zen/ShellSurface.h"

class Registry : public IoHandler {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/ScriptContext.cpp → zen/ScriptContext.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include "src/ScriptContext.h"
#include "zen/ScriptContext.h"

#include "sol/sol.hpp"
#include "spdlog/spdlog.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ScriptContext.h → zen/ScriptContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <map>
#include <memory>

#include "src/Configuration.h"
#include "zen/Configuration.h"

// DO NOT expose sol2 types here, they should be kept in .cpp file
// Reason for above is that sol2 sometimes messes with code formatter/LSP in
Expand Down
2 changes: 1 addition & 1 deletion src/Seat.cpp → zen/Seat.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Seat.h"
#include "zen/Seat.h"

#include <linux/input-event-codes.h>
#include <sys/mman.h>
Expand Down
6 changes: 3 additions & 3 deletions src/Seat.h → zen/Seat.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <memory>
#include <vector>

#include "src/MainLoop.h"
#include "src/ScriptContext.h"
#include "src/Sources.h"
#include "zen/MainLoop.h"
#include "zen/ScriptContext.h"
#include "zen/Sources/Sources.h"

using ClickHandler = std::function<void(wl_surface*, int, int)>;
using WheelHandler = std::function<void(wl_surface*, int, int, int)>;
Expand Down
4 changes: 2 additions & 2 deletions src/ShellSurface.cpp → zen/ShellSurface.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "ShellSurface.h"
#include "zen/ShellSurface.h"

#include <spdlog/spdlog.h>
#include <wayland-client-protocol.h>

#include "src/Registry.h"
#include "wlr-layer-shell-unstable-v1.h"
#include "zen/Registry.h"

static void on_configure(void *data, struct zwlr_layer_surface_v1 *layer, uint32_t serial,
uint32_t cx, uint32_t cy) {
Expand Down
4 changes: 2 additions & 2 deletions src/ShellSurface.h → zen/ShellSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include <memory>

#include "Configuration.h"
#include "Draw.h"
#include "zen/Configuration.h"
#include "zen/Draw.h"

class Registry;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "DateTimeSources.h"
#include "zen/Sources/DateTimeSources.h"

#include <spdlog/spdlog.h>
#include <sys/timerfd.h>
Expand Down
4 changes: 2 additions & 2 deletions src/DateTimeSources.h → zen/Sources/DateTimeSources.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "MainLoop.h"
#include "Sources.h"
#include "zen/MainLoop.h"
#include "zen/Sources/Sources.h"

class DateSource : public Source {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/NetworkSource.cpp → zen/Sources/NetworkSource.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "NetworkSource.h"
#include "zen/Sources/NetworkSource.h"

#include <arpa/inet.h>
#include <net/if.h>
Expand Down
6 changes: 3 additions & 3 deletions src/NetworkSource.h → zen/Sources/NetworkSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <memory>

#include "src/MainLoop.h"
#include "src/ScriptContext.h"
#include "src/Sources.h"
#include "zen/MainLoop.h"
#include "zen/ScriptContext.h"
#include "zen/Sources/Sources.h"

class NetworkSource : public Source, public IoHandler {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/PowerSource.cpp → zen/Sources/PowerSource.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PowerSource.h"
#include "zen/Sources/PowerSource.h"

#include <fcntl.h>
#include <spdlog/spdlog.h>
Expand Down
6 changes: 3 additions & 3 deletions src/PowerSource.h → zen/Sources/PowerSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <filesystem>

#include "src/MainLoop.h"
#include "src/ScriptContext.h"
#include "src/Sources.h"
#include "zen/MainLoop.h"
#include "zen/ScriptContext.h"
#include "zen/Sources/Sources.h"

class PowerSource : public Source, public IoHandler {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "PulseAudioSource.h"
#include "zen/Sources/PulseAudio/PulseAudioSource.h"

#include <pulse/def.h>
#include <pulse/pulseaudio.h>
#include <pulse/volume.h>
#include <spdlog/spdlog.h>

#include "src/ScriptContext.h"
#include "zen/ScriptContext.h"

static void on_state(pa_context*, void* data) {
static_cast<PulseAudioSource*>(data)->OnStateChange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <memory>

#include "MainLoop.h"
#include "Sources.h"
#include "src/ScriptContext.h"
#include "zen/MainLoop.h"
#include "zen/ScriptContext.h"
#include "zen/Sources/Sources.h"

struct pa_context;
struct pa_threaded_mainloop;
Expand Down
4 changes: 4 additions & 0 deletions zen/Sources/PulseAudio/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

src += files(
'PulseAudioSource.cpp',
)
2 changes: 1 addition & 1 deletion src/Sources.cpp → zen/Sources/Sources.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Sources.h"
#include "zen/Sources/Sources.h"

#include "spdlog/spdlog.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Sources.h → zen/Sources/Sources.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <set>
#include <string>

#include "src/ScriptContext.h"
#include "zen/ScriptContext.h"

class Source {
public:
Expand Down
9 changes: 9 additions & 0 deletions zen/Sources/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

src += files(
'DateTimeSources.cpp',
'NetworkSource.cpp',
'PowerSource.cpp',
'Sources.cpp',
)
deps += dependency('libpulse')
subdir('PulseAudio')
18 changes: 9 additions & 9 deletions src/main.cpp → zen/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
#include <filesystem>
#include <optional>

#include "DateTimeSources.h"
#include "MainLoop.h"
#include "Manager.h"
#include "NetworkSource.h"
#include "PowerSource.h"
#include "PulseAudioSource.h"
#include "Registry.h"
#include "Sources.h"
#include "SwayCompositor.h"
#include "zen/Compositors/Sway/SwayCompositor.h"
#include "zen/MainLoop.h"
#include "zen/Manager.h"
#include "zen/Registry.h"
#include "zen/Sources/DateTimeSources.h"
#include "zen/Sources/NetworkSource.h"
#include "zen/Sources/PowerSource.h"
#include "zen/Sources/PulseAudio/PulseAudioSource.h"
#include "zen/Sources/Sources.h"

static const std::optional<std::filesystem::path> ProbeForConfig(int argc, char* argv[]) {
// Explicit config
Expand Down
27 changes: 27 additions & 0 deletions zen/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
src += files(
'Buffer.cpp',
'Configuration.cpp',
'Draw.cpp',
'main.cpp',
'MainLoop.cpp',
'Manager.cpp',
'Output.cpp',
'Registry.cpp',
'ScriptContext.cpp',
'Seat.cpp',
'ShellSurface.cpp',
'util.cpp',
)
deps += dependency('wayland-client')
deps += dependency('wayland-protocols')
deps += dependency('cairo')
deps += dependency('lua')
deps += meson.get_compiler('c').find_library('m')
deps += dependency('xkbcommon')
deps += dependency('pango')
deps += dependency('pangocairo')
deps += subproject('spdlog', default_options: 'tests=false').get_variable('spdlog_dep')
deps += subproject('nlohmann_json').get_variable('nlohmann_json_dep')
deps += internal_lib_protocol
subdir('Sources')
subdir('Compositors/Sway')
Loading

0 comments on commit 3af2430

Please sign in to comment.