From ea168e611b93f25d0c2bdc5d2637c712da4d7b9f Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 6 Jul 2024 17:51:46 +0200 Subject: [PATCH 1/3] Add missing headers for BSDs src/allocator/GBM.cpp:137:17: error: use of undeclared identifier 'close' 137 | close(attrs.fds.at(j)); | ^ src/allocator/GBM.cpp:159:9: error: use of undeclared identifier 'close' 159 | close(attrs.fds.at(i)); | ^ src/backend/Session.cpp:141:5: error: use of undeclared identifier 'close' 141 | close(fd); | ^ src/backend/Wayland.cpp:44:9: error: use of undeclared identifier 'close' 44 | close(fd); | ^ src/backend/Wayland.cpp:63:9: error: use of undeclared identifier 'close' 63 | close(drmState.fd); | ^ src/backend/Wayland.cpp:658:13: error: use of undeclared identifier 'close' 658 | close(fd); | ^ src/backend/Wayland.cpp:668:13: error: use of undeclared identifier 'close' 668 | close(fd); | ^ src/backend/Wayland.cpp:676:9: error: use of undeclared identifier 'close' 676 | close(fd); | ^ --- src/allocator/GBM.cpp | 1 + src/backend/Session.cpp | 1 + src/backend/Wayland.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp index b533e9b..5a3757c 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -5,6 +5,7 @@ #include "Shared.hpp" #include #include +#include using namespace Aquamarine; using namespace Hyprutils::Memory; diff --git a/src/backend/Session.cpp b/src/backend/Session.cpp index 5ec4b48..9bf0fd9 100644 --- a/src/backend/Session.cpp +++ b/src/backend/Session.cpp @@ -9,6 +9,7 @@ extern "C" { #include #include #include +#include } using namespace Aquamarine; diff --git a/src/backend/Wayland.cpp b/src/backend/Wayland.cpp index 399d5a9..537e12b 100644 --- a/src/backend/Wayland.cpp +++ b/src/backend/Wayland.cpp @@ -8,6 +8,7 @@ #include #include #include +#include using namespace Aquamarine; using namespace Hyprutils::Memory; From 18c87a126aadfd452be9fe523dcf85973d57e34a Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 6 Jul 2024 17:59:14 +0200 Subject: [PATCH 2/3] cmake: allow using any build directory $ cmake -B /tmp/aquamarine_build $ cmake --build /tmp/aquamarine_build [...] src/backend/drm/DRM.cpp:25:10: fatal error: 'hwdata.hpp' file not found 25 | #include "hwdata.hpp" | ^~~~~~~~~~~~ --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8e80c0..c9f1eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ file(GLOB_RECURSE PUBLIC_HEADERS CONFIGURE_DEPENDS "include/*.hpp") add_library(aquamarine SHARED ${SRCFILES}) target_include_directories( aquamarine PUBLIC "./include" - PRIVATE "./src" "./src/include" "./protocols" "./build" + PRIVATE "./src" "./src/include" "./protocols" "${CMAKE_BINARY_DIR}" ) set_target_properties(aquamarine PROPERTIES VERSION ${AQUAMARINE_VERSION} From 093b2f4fe7d3a4fe42876f9a12f02239ebbc7769 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sun, 7 Jul 2024 05:44:09 +0200 Subject: [PATCH 3/3] cmake: add epoll-shim for some BSDs ld: error: undefined reference due to --no-allow-shlib-undefined: timerfd_create >>> referenced by libaquamarine.so.0.1.0 --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9f1eb9..81871cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ project(aquamarine ) include(CTest) +include(CheckIncludeFile) include(GNUInstallDirs) set(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -52,6 +53,12 @@ set_target_properties(aquamarine PROPERTIES ) target_link_libraries(aquamarine PkgConfig::deps) +check_include_file("sys/timerfd.h" HAS_TIMERFD) +pkg_check_modules(epoll IMPORTED_TARGET epoll-shim) +if(NOT HAS_TIMERFD AND epoll_FOUND) + target_link_libraries(aquamarine PkgConfig::epoll) +endif() + # Protocols pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")