commit b9e55e229e58dce55e332565ace37fe4d6f20be0
Author: deurzen <m.deurzen@tum.de>
Date: Tue, 10 May 2022 15:37:00 +0200
initial commit
Diffstat:
8 files changed, 116 insertions(+), 0 deletions(-)
diff --git a/.ccls b/.ccls
@@ -0,0 +1,3 @@
+clang
+%c
+-Iinclude
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,9 @@
+/release
+/bin
+/obj
+/tags
+/debug
+/test
+/spdlog
+/TODO
+/.ccls-cache
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2022, Max van Deurzen <max@deurzen.net>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
@@ -0,0 +1,35 @@
+include config.mk
+.PHONY: tags bin obj clean install uninstall
+
+CXXFLAGS += ${CXXFLAGS_EXTRA}
+LDFLAGS += ${LDFLAGS_EXTRA}
+
+all: kranewl
+
+server: bin obj ${SERVER_LINK_FILES}
+
+kranewl: bin obj ${COMPOSITOR_LINK_FILES}
+ ${CC} ${CXXFLAGS} ${COMPOSITOR_LINK_FILES} ${LDFLAGS} -o $(BINDIR)/$(PROJECT)
+
+-include $(DEPS)
+
+obj/%.o: src/%.cc
+ ${CC} ${CXXFLAGS} -MMD -c $< -o $@
+
+obj/server/%.o: src/server/%.cc
+ ${CC} ${CXXFLAGS} -MMD -c $< -o $@
+
+xdg-shell-protocol.h:
+ wayland-scanner server-header ${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml ${.TARGET}
+
+bin:
+ @[ -d bin ] || mkdir -p bin
+
+obj:
+ @[ -d obj ] || mkdir -p obj/server
+
+tags:
+ @git ls-files | ctags -R --exclude=.git --c++-kinds=+p --links=no --fields=+iaS --extras=+q -L-
+
+clean:
+ @rm -rf ./bin ./obj
diff --git a/config.mk b/config.mk
@@ -0,0 +1,37 @@
+PROJECT = kranewl
+EXT_DEPS = wlroots pangocairo cairo pixman-1 xkbcommon wayland-server libinput libucl libprocps spdlog
+
+SRCDIR = src
+INCDIR = include
+OBJDIR = obj
+
+BINDIR = bin
+INSTALLDIR = /usr/local/bin
+
+WAYLAND_PROTOCOLS = `pkg-config --variable pkgdatadir wayland-protocols`
+PROTOCOL_HEADERS = xdg-shell-protocol.h
+
+COMPOSITOR_SRC_FILES := $(wildcard src/*.cc)
+COMPOSITOR_OBJ_FILES := $(patsubst src/%.cc,obj/%.o,${COMPOSITOR_SRC_FILES})
+
+SERVER_SRC_FILES := $(wildcard src/server/*.cc)
+SERVER_OBJ_FILES := $(patsubst src/server/%.cc,obj/server/%.o,${SERVER_SRC_FILES})
+
+SERVER_LINK_FILES := ${SERVER_OBJ_FILES}
+COMPOSITOR_LINK_FILES := ${SERVER_OBJ_FILES} ${COMPOSITOR_OBJ_FILES}
+
+H_FILES := $(shell find $(INCDIR) -name '*.hh')
+SRC_FILES := $(shell find $(SRCDIR) -name '*.cc')
+OBJ_FILES := ${SERVER_OBJ_FILES} ${COMPOSITOR_OBJ_FILES}
+DEPS = $(OBJ_FILES:%.o=%.d)
+
+SANFLAGS = -fsanitize=undefined -fsanitize=address -fsanitize-address-use-after-scope
+CXXFLAGS = -Wall -I. -Iinclude -std=c++20 `pkg-config --cflags ${EXT_DEPS}`
+LDFLAGS = `pkg-config --libs ${EXT_DEPS}` -pthread
+
+DEBUG_CXXFLAGS = -Wall -Wpedantic -Wextra -Wold-style-cast -g -DDEBUG ${SANFLAGS}
+DEBUG_LDFLAGS = ${SANFLAGS}
+RELEASE_CXXFLAGS = -march=native -mtune=native -O3 -flto
+RELEASE_LDFLAGS = -flto
+
+CC = g++
diff --git a/include/kranewl/server.hh b/include/kranewl/server.hh
@@ -0,0 +1 @@
+#pragma once
diff --git a/src/main.cc b/src/main.cc
@@ -0,0 +1,3 @@
+int
+main()
+{}
diff --git a/src/server/server.cc b/src/server/server.cc
@@ -0,0 +1 @@
+#include <kranewl/server.hh>