pkg: cmake/platform.cmake; gate libsecret and Qt6::DBus to Linux
Root build infra, per ADR 0020 as amended in 9624e68: PORT owns the per-OS
backend directories and macOS/Windows packaging, but cmake/platform*.cmake stays
PKG/QA's — the amendment exists because Phase 0 (CORE's and DAEMON's own seams,
on Linux) needs velox_platform_sources() to select platform/linux/*.cpp, and PORT
can't start until Phase 0 lands. Landing it as PORT-owned would have deadlocked
both lanes waiting on each other.
cmake/platform.cmake sets exactly one of VELOX_OS_LINUX/VELOX_OS_MACOS/
VELOX_OS_WINDOWS from CMAKE_SYSTEM_NAME and exposes velox_platform_sources(target
dir), which globs dir/platform/<os>/*.cpp. No seam consumes it yet (Phase 0 hasn't
landed), so on Ubuntu this changes nothing observable — VELOX_OS_LINUX is simply
true and no lane calls the new function.
pkg_check_modules(LIBSECRET ...) was unconditional in the root CMakeLists.txt,
so macOS could not configure at all (docs/08-porting.md's stated blocker); it's
now gated on VELOX_OS_LINUX, same as the Qt6::DBus component this also adds
(gui/docs/pkg-qa-requests-m1.md R4 — backs the org.freedesktop.portal
GlobalShortcuts path, which is Linux/portal-only same as libsecret). Both are
still REQUIRED on Linux; PORT adds the macOS sides (Keychain, and no DBus
equivalent needed) behind their own seams, not by touching this find.
Verified: fresh configure + build of veloxd/velox/velox-gui/velox-nmhost still
green (libsecret-1 and Qt6::DBus both found), the .deb from the previous commit
still builds and installs.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0176u3fTrxegrGNm2yC7r69W
This commit is contained in:
@@ -29,6 +29,10 @@ option(VELOX_BUILD_FUZZ "Build libFuzzer targets (clang only)" OFF)
|
|||||||
option(VELOX_ENABLE_MEDIA "Build the HLS/DASH media grabber (M4)" OFF)
|
option(VELOX_ENABLE_MEDIA "Build the HLS/DASH media grabber (M4)" OFF)
|
||||||
option(VELOX_WERROR "Treat warnings as errors" ON)
|
option(VELOX_WERROR "Treat warnings as errors" ON)
|
||||||
|
|
||||||
|
# Central OS detection (docs/adr/0020-cross-platform-strategy.md). Included early: the
|
||||||
|
# dependency finds below gate Linux-only libraries on VELOX_OS_LINUX.
|
||||||
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/platform.cmake)
|
||||||
|
|
||||||
# Project-wide warning flags. Set via add_compile_options (a directory property), not the
|
# Project-wide warning flags. Set via add_compile_options (a directory property), not the
|
||||||
# CMAKE_CXX_FLAGS cache variable, because the dev/tsan presets overwrite that cache var
|
# CMAKE_CXX_FLAGS cache variable, because the dev/tsan presets overwrite that cache var
|
||||||
# wholesale for sanitizer flags — a target's warnings must not ride on it.
|
# wholesale for sanitizer flags — a target's warnings must not ride on it.
|
||||||
@@ -55,12 +59,24 @@ endif()
|
|||||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/daemon/CMakeLists.txt)
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/daemon/CMakeLists.txt)
|
||||||
find_package(SQLite3 REQUIRED)
|
find_package(SQLite3 REQUIRED)
|
||||||
find_package(nlohmann_json 3.11 REQUIRED)
|
find_package(nlohmann_json 3.11 REQUIRED)
|
||||||
|
# libsecret / Secret Service is Linux-only (docs/adr/0020-cross-platform-strategy.md,
|
||||||
|
# docs/08-porting.md): macOS uses Keychain behind the same credential-store seam, so
|
||||||
|
# this stays REQUIRED on Linux and simply absent elsewhere — PORT's job is to add the
|
||||||
|
# macOS side of that seam, not to touch this find.
|
||||||
|
if(VELOX_OS_LINUX)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(LIBSECRET REQUIRED IMPORTED_TARGET libsecret-1)
|
pkg_check_modules(LIBSECRET REQUIRED IMPORTED_TARGET libsecret-1)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(VELOX_BUILD_GUI AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gui/CMakeLists.txt)
|
if(VELOX_BUILD_GUI AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gui/CMakeLists.txt)
|
||||||
|
# DBus (gui/docs/pkg-qa-requests-m1.md R4) backs the org.freedesktop.portal
|
||||||
|
# GlobalShortcuts path — Linux/portal-only, same reasoning as libsecret above.
|
||||||
|
if(VELOX_OS_LINUX)
|
||||||
|
find_package(Qt6 6.6 REQUIRED COMPONENTS Widgets Svg Network DBus LinguistTools)
|
||||||
|
else()
|
||||||
find_package(Qt6 6.6 REQUIRED COMPONENTS Widgets Svg Network LinguistTools)
|
find_package(Qt6 6.6 REQUIRED COMPONENTS Widgets Svg Network LinguistTools)
|
||||||
|
endif()
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# cmake/platform.cmake — central OS detection and per-OS source selection.
|
||||||
|
#
|
||||||
|
# Owned by PKG/QA (docs/adr/0020-cross-platform-strategy.md §4-5, amended: PORT owns
|
||||||
|
# **/platform/<os>/** and the macOS/Windows packaging trees, but this file is root build
|
||||||
|
# infrastructure and lands in Phase 0 — CORE's and DAEMON's own seams need
|
||||||
|
# velox_platform_sources() to select their platform/linux/*.cpp before PORT ever starts).
|
||||||
|
#
|
||||||
|
# Sets exactly one of VELOX_OS_LINUX / VELOX_OS_MACOS / VELOX_OS_WINDOWS. Selection lives
|
||||||
|
# here and nowhere else — no lane's own CMakeLists.txt should reimplement this check.
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set(VELOX_OS_LINUX TRUE)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
set(VELOX_OS_MACOS TRUE)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
set(VELOX_OS_WINDOWS TRUE)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "velox: unsupported CMAKE_SYSTEM_NAME '${CMAKE_SYSTEM_NAME}' — "
|
||||||
|
"expected Linux, Darwin or Windows.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# velox_platform_sources(<target> <dir>) adds <dir>/platform/<os>/*.cpp to <target>, where
|
||||||
|
# <os> is linux, macos or windows to match this file's VELOX_OS_* selection. <dir> is
|
||||||
|
# relative to the calling lane's own CMakeLists.txt (e.g. src/io, src/rpc) — the seam
|
||||||
|
# headers themselves (<dir>/platform/*.hpp) are not globbed here, they're ordinary sources
|
||||||
|
# the owning lane already lists.
|
||||||
|
function(velox_platform_sources target dir)
|
||||||
|
if(VELOX_OS_LINUX)
|
||||||
|
set(os_dir "linux")
|
||||||
|
elseif(VELOX_OS_MACOS)
|
||||||
|
set(os_dir "macos")
|
||||||
|
elseif(VELOX_OS_WINDOWS)
|
||||||
|
set(os_dir "windows")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(GLOB platform_sources CONFIGURE_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/${dir}/platform/${os_dir}/*.cpp")
|
||||||
|
|
||||||
|
if(NOT platform_sources)
|
||||||
|
message(WARNING "velox: velox_platform_sources(${target} ${dir}) found no "
|
||||||
|
"sources under ${dir}/platform/${os_dir}/ — is the seam missing "
|
||||||
|
"its ${os_dir} backend?")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_sources(${target} PRIVATE ${platform_sources})
|
||||||
|
endfunction()
|
||||||
Reference in New Issue
Block a user