core: add build skeleton and provisional test harness

Self-contained core/CMakeLists.txt (veloxcore STATIC + velox::core alias),
warnings at target scope so the sanitizer presets' CMAKE_CXX_FLAGS override
doesn't drop -Werror. vtest: ~150-line header-only harness (VT_TEST /
VT_CHECK / VT_REQUIRE / VT_CHECK_EQ) behind a one-function vdm_add_test(),
so the swap to a real framework once PKG picks one is mechanical.

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:03:00 +04:00
co-authored by Claude Sonnet 5
parent 910ce4a638
commit 5ac74ecbd9
5 changed files with 226 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
# libveloxcore — the download engine. Lane CORE.
#
# No JSON, no SQL, no Qt, no RPC in this tree (CLAUDE.md §3, AGENT-CORE brief).
# This file is self-contained; it is wired into the build by PKG uncommenting
# `add_subdirectory(core)` in the root CMakeLists.txt (see core/docs/pkg-requests-m1.md).
find_package(Threads REQUIRED)
add_library(veloxcore STATIC
src/util/error.cpp
src/util/log.cpp
src/util/thread_pool.cpp
)
add_library(velox::core ALIAS veloxcore)
target_include_directories(veloxcore PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_compile_features(veloxcore PUBLIC cxx_std_23)
# Warnings are set at target scope, not via CMAKE_CXX_FLAGS: the dev/tsan presets
# overwrite that cache variable wholesale (see core/docs/pkg-requests-m1.md P4).
target_compile_options(veloxcore PRIVATE
-Wall -Wextra -Wpedantic -Werror
)
target_link_libraries(veloxcore PUBLIC Threads::Threads)
# Later stages add: find_package(CURL 8.0) for net/, find_package(OpenSSL) for meta/.
if(VELOX_BUILD_TESTS)
add_subdirectory(tests)
endif()
# libFuzzer is clang-only; a GCC configure with -DVELOX_BUILD_FUZZ=ON (the `ci` preset)
# must not hard-fail. No fuzz targets exist yet — they arrive with net/probe (stage 3)
# and meta/veloxpart (stage 5).
if(VELOX_BUILD_FUZZ AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "veloxcore: VELOX_BUILD_FUZZ set but compiler is "
"${CMAKE_CXX_COMPILER_ID}; fuzz targets need Clang and will be skipped.")
endif()
# When fuzz targets land (stage 3: Content-Disposition, URL; stage 5: .veloxpart.meta),
# they are added here under `if(VELOX_BUILD_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")`
# and live in ${CMAKE_SOURCE_DIR}/tools/fuzz (owned by lane CORE).