build: new build option BUILD_X11 to control building of X11 backend

This commit is contained in:
sithlord48
2025-11-13 11:48:30 -05:00
committed by Nick Bolton
parent f45df39032
commit 4a67694676
7 changed files with 48 additions and 37 deletions

View File

@ -156,6 +156,12 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
# Instead use Q_SIGNAL, Q_SLOT and Q_EMIT
# prevents issues when used with glib for libportal
add_definitions(-DQT_NO_KEYWORDS)
#Options for Linux platform support
if(UNIX AND NOT APPLE)
option(BUILD_X11_SUPPORT "Build with x11 support" ON)
endif()
include(cmake/Libraries.cmake)
configure_libs()

View File

@ -145,7 +145,9 @@ macro(configure_unix_libs)
add_definitions(-DWINAPI_CARBON=1)
else()
configure_xorg_libs()
if (BUILD_X11_SUPPORT)
configure_xorg_libs()
endif()
include(FindPkgConfig)
find_package(PkgConfig)

View File

@ -26,6 +26,7 @@ CMake options:
| BUILD_DEV_DOCS | Build development documentation | OFF | `Doxygen` |
| BUILD_INSTALLER | Build installers/packages | ON | |
| BUILD_TESTS | Build unit tests and legacy tests | ON | `gtest`|
| BUILD_X11_SUPPORT | Build X11 backend (linux and bsd only) | ON | `x11 libs`|
| ENABLE_COVERAGE | Enable test coverage | OFF | `gcov` |
| SKIP_BUILD_TESTS | Skip running of tests at build time | OFF | |
| VCPKG_QT | Build Qt w/ vcpkg (windows only) | OFF | |

View File

@ -15,8 +15,6 @@
#elif WINAPI_CARBON
#include <Carbon/Carbon.h>
#include <platform/OSXAutoTypes.h>
#else
#error Platform not supported.
#endif
#include <filesystem>

View File

@ -99,31 +99,35 @@ elseif(UNIX)
XDGPowerManager.h
XDGKeyUtil.h
XDGKeyUtil.cpp
XWindowsClipboard.cpp
XWindowsClipboard.h
XWindowsClipboardAnyBitmapConverter.cpp
XWindowsClipboardAnyBitmapConverter.h
XWindowsClipboardBMPConverter.cpp
XWindowsClipboardBMPConverter.h
XWindowsClipboardHTMLConverter.cpp
XWindowsClipboardHTMLConverter.h
XWindowsClipboardTextConverter.cpp
XWindowsClipboardTextConverter.h
XWindowsClipboardUCS2Converter.cpp
XWindowsClipboardUCS2Converter.h
XWindowsClipboardUTF8Converter.cpp
XWindowsClipboardUTF8Converter.h
XWindowsEventQueueBuffer.cpp
XWindowsEventQueueBuffer.h
XWindowsKeyState.cpp
XWindowsKeyState.h
XWindowsScreen.cpp
XWindowsScreen.h
XWindowsScreenSaver.cpp
XWindowsScreenSaver.h
XWindowsUtil.cpp
XWindowsUtil.h
)
if (BUILD_X11_SUPPORT)
list(APPEND PLATFORM_SOURCES
XWindowsClipboard.cpp
XWindowsClipboard.h
XWindowsClipboardAnyBitmapConverter.cpp
XWindowsClipboardAnyBitmapConverter.h
XWindowsClipboardBMPConverter.cpp
XWindowsClipboardBMPConverter.h
XWindowsClipboardHTMLConverter.cpp
XWindowsClipboardHTMLConverter.h
XWindowsClipboardTextConverter.cpp
XWindowsClipboardTextConverter.h
XWindowsClipboardUCS2Converter.cpp
XWindowsClipboardUCS2Converter.h
XWindowsClipboardUTF8Converter.cpp
XWindowsClipboardUTF8Converter.h
XWindowsEventQueueBuffer.cpp
XWindowsEventQueueBuffer.h
XWindowsKeyState.cpp
XWindowsKeyState.h
XWindowsScreen.cpp
XWindowsScreen.h
XWindowsScreenSaver.cpp
XWindowsScreenSaver.h
XWindowsUtil.cpp
XWindowsUtil.h
)
endif()
if(LIBEI_FOUND)
list(APPEND PLATFORM_SOURCES

View File

@ -45,9 +45,7 @@ create_test(
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/deskflow"
)
if(UNIX AND NOT APPLE)
#this test does not work properly on windows / mac os
if(BUILD_X11_SUPPORT)
create_test(
NAME X11LayoutParserTests
DEPENDS app

View File

@ -25,11 +25,13 @@ elseif(APPLE)
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/platform"
)
elseif(UNIX)
create_test(
NAME XWindowsClipboardTests
DEPENDS platform
LIBS base arch
SOURCE XWindowsClipboardTests.cpp
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/platform"
)
if (BUILD_X11_SUPPORT)
create_test(
NAME XWindowsClipboardTests
DEPENDS platform
LIBS base arch
SOURCE XWindowsClipboardTests.cpp
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/platform"
)
endif()
endif()