pkg: wire top-level CMake, clang-format/tidy, editorconfig

CMakeLists.txt: every lane's add_subdirectory() is now guarded by EXISTS
on that lane's CMakeLists.txt, so main configures no matter which lanes
have merged and a lane lights up its targets on merge with no edit here.
Dependencies are found at top level (gated on the consuming lane) so a
missing -dev package fails fast with a clear name. Warnings via
add_compile_options (survives the presets' CMAKE_CXX_FLAGS override);
VELOX_WERROR escape hatch. Verified end to end: `cmake --preset dev`
against a merged lane/core builds libveloxcore + tests, `ctest --preset
dev` green.

.clang-format: Google base, 4-space indent, 100 cols, right-aligned
pointers. .clang-tidy: small high-signal set (bugprone/performance/
concurrency/portability + selected modernize/readability). .editorconfig
mirrors both. .gitignore: build-*/ , CMakeUserPresets.json, profiling
and editor droppings.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HPPSGhiArbvQgwC2DNiURS
This commit is contained in:
2026-09-09 19:22:36 +04:00
co-authored by Claude Sonnet 5
parent fd70c3b595
commit 81dba88362
5 changed files with 229 additions and 33 deletions
+29
View File
@@ -0,0 +1,29 @@
# Velox C++ style. Owned by lane PKG/QA; CLAUDE.md §6 makes this authoritative.
# `clang-format --dry-run -Werror` runs on every PR.
---
Language: Cpp
BasedOnStyle: Google
IndentWidth: 4
ContinuationIndentWidth: 4
ColumnLimit: 100
AccessModifierOffset: -2
NamespaceIndentation: None
DerivePointerAlignment: false
PointerAlignment: Right
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
IndentCaseLabels: true
IncludeBlocks: Preserve
SortIncludes: CaseSensitive
# Keep the "} // namespace vdm" trailer style Google uses.
FixNamespaceComments: true
ShortNamespaceLines: 0
---
+45
View File
@@ -0,0 +1,45 @@
# Velox clang-tidy config. Owned by lane PKG/QA. Runs on every PR (non-fatal advisory in
# M0M1, a required check from M2). Keep the enabled set small and high-signal; add checks
# when they catch a real bug, not for completeness.
---
Checks: >
-*,
bugprone-*,
cert-err34-c,
cert-err58-cpp,
concurrency-*,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-slicing,
cppcoreguidelines-virtual-class-destructor,
misc-definitions-in-headers,
misc-misplaced-const,
misc-unused-using-decls,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
modernize-use-emplace,
modernize-loop-convert,
modernize-make-unique,
modernize-make-shared,
performance-*,
portability-*,
readability-container-size-empty,
readability-duplicate-include,
readability-misleading-indentation,
readability-redundant-*,
readability-simplify-boolean-expr,
readability-static-definition-in-anonymous-namespace,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
-performance-avoid-endl,
-readability-redundant-access-specifiers
WarningsAsErrors: ''
HeaderFilterRegex: '(core|daemon|cli|nmhost|tools)/.*\.(hpp|h)$'
FormatStyle: file
CheckOptions:
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: 'false'
- key: bugprone-argument-comment.StrictMode
value: 'true'
+39
View File
@@ -0,0 +1,39 @@
# Velox editor defaults. Owned by lane PKG/QA. Mirrors .clang-format for C++ and the
# prevailing conventions for everything else.
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
[*.{cpp,cc,hpp,h}]
indent_size = 4
max_line_length = 100
[*.{ts,tsx,js,jsx,json,mjs}]
indent_size = 2
[*.{py}]
indent_size = 4
max_line_length = 100
[*.{cmake,txt}]
indent_size = 4
[CMakeLists.txt]
indent_size = 4
[*.{yml,yaml}]
indent_size = 2
[*.sh]
indent_size = 4
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
+28 -4
View File
@@ -1,15 +1,39 @@
# Build output
build/
.cache/
build-*/
/out/
compile_commands.json
CMakeUserPresets.json
.cache/
.ccls-cache/
# Language / tooling
node_modules/
dist/
web-ext-artifacts/
.venv/
__pycache__/
*.pyc
# Compiled objects
*.o
*.so
*.a
*.log
.venv/
__pycache__/
# Editor / OS
.idea/
.vscode/
*.user
*.orig
*.swp
.DS_Store
# Profiling
perf.data*
callgrind.out.*
massif.out.*
# Runtime / logs / partial downloads
*.log
*.veloxpart
*.veloxpart.meta
+88 -29
View File
@@ -1,6 +1,11 @@
# Velox Download Manager — top-level build
# SCAFFOLDING ONLY. Lane PKG/QA owns this file; each add_subdirectory() is enabled by the
# owning lane when it lands its first target. Nothing here builds yet by design.
# Velox Download Manager — top-level build. Owned by lane PKG/QA.
#
# Lanes land in parallel and merge to main independently, so every add_subdirectory()
# here is guarded by EXISTS on the lane's own CMakeLists.txt: main always configures,
# and a lane's targets light up the moment that lane merges — no coordinated edit here.
#
# cmake --preset dev && cmake --build --preset dev
# ctest --preset dev
cmake_minimum_required(VERSION 3.28)
@@ -14,35 +19,89 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(VELOX_BUILD_GUI "Build the Qt 6 GUI client" ON)
option(VELOX_BUILD_TESTS "Build unit and integration tests" ON)
option(VELOX_BUILD_FUZZ "Build libFuzzer targets (clang only)" OFF)
option(VELOX_ENABLE_MEDIA "Build the HLS/DASH media grabber (M4)" OFF)
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif()
option(VELOX_BUILD_GUI "Build the Qt 6 GUI client" ON)
option(VELOX_BUILD_TESTS "Build unit and integration tests" ON)
option(VELOX_BUILD_FUZZ "Build libFuzzer targets (clang only)" OFF)
option(VELOX_ENABLE_MEDIA "Build the HLS/DASH media grabber (M4)" OFF)
option(VELOX_WERROR "Treat warnings as errors" ON)
# 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
# wholesale for sanitizer flags — a target's warnings must not ride on it.
add_compile_options(-Wall -Wextra -Wpedantic)
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
if(VELOX_WERROR)
add_compile_options(-Werror)
endif()
# --- Dependencies (see README bootstrap; none are vendored) --------------------
# find_package(CURL 8.0 REQUIRED)
# find_package(SQLite3 REQUIRED)
# find_package(nlohmann_json 3.11 REQUIRED)
# find_package(OpenSSL REQUIRED)
# if(VELOX_BUILD_GUI)
# find_package(Qt6 6.6 REQUIRED COMPONENTS Widgets Svg Network LinguistTools)
# qt_standard_project_setup()
# endif()
if(VELOX_BUILD_FUZZ AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(WARNING "VELOX_BUILD_FUZZ is ON but the compiler is ${CMAKE_CXX_COMPILER_ID}; "
"libFuzzer needs Clang. Fuzz targets will be skipped.")
endif()
# --- Targets: each lane enables its own line ----------------------------------
# add_subdirectory(core) # lane CORE → libveloxcore
# add_subdirectory(daemon) # lane DAEMON → veloxd
# add_subdirectory(cli) # lane DAEMON → velox
# add_subdirectory(nmhost) # lane DAEMON → velox-nmhost
# if(VELOX_BUILD_GUI)
# add_subdirectory(gui) # lane GUI → velox-gui
# endif()
# if(VELOX_BUILD_TESTS)
# enable_testing()
# add_subdirectory(tests)
# endif()
# --- Dependencies -------------------------------------------------------------------
# Found once here so a missing -dev package fails at configure with a clear name, rather
# than deep in a lane. Each find is gated on the lane that needs it being present.
find_package(Threads REQUIRED)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/core/CMakeLists.txt)
find_package(CURL 8.0 REQUIRED)
find_package(OpenSSL REQUIRED)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/daemon/CMakeLists.txt)
find_package(SQLite3 REQUIRED)
find_package(nlohmann_json 3.11 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBSECRET REQUIRED IMPORTED_TARGET libsecret-1)
endif()
if(VELOX_BUILD_GUI AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gui/CMakeLists.txt)
find_package(Qt6 6.6 REQUIRED COMPONENTS Widgets Svg Network LinguistTools)
qt_standard_project_setup()
endif()
if(VELOX_ENABLE_MEDIA)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
libavformat libavcodec libavutil)
endif()
# --- Tests --------------------------------------------------------------------------
if(VELOX_BUILD_TESTS)
enable_testing()
endif()
# --- Lane targets (guarded; see header) -------------------------------------------
foreach(lane IN ITEMS core daemon cli nmhost)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${lane}/CMakeLists.txt)
add_subdirectory(${lane})
else()
message(STATUS "velox: lane '${lane}' has not landed a CMakeLists yet — skipping.")
endif()
endforeach()
if(VELOX_BUILD_GUI)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gui/CMakeLists.txt)
add_subdirectory(gui)
else()
message(STATUS "velox: lane 'gui' has not landed a CMakeLists yet — skipping.")
endif()
endif()
foreach(toolset tools/testserver tools/bench tools/fuzz tools/mockd)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${toolset}/CMakeLists.txt)
add_subdirectory(${toolset})
endif()
endforeach()
if(VELOX_BUILD_TESTS)
foreach(suite tests/conformance tests/integration tests/e2e)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${suite}/CMakeLists.txt)
add_subdirectory(${suite})
endif()
endforeach()
endif()