chore: scaffold CMake build system

Add the CMake build for the Swift + C++ macOS port, mirroring the
refix layout: deps/ modules (Platform, Flags, Sanitizers, FindUnity),
per-module static libraries (usb, auth, mt76, gip, hid, api), a Swift
app entry point with a pure C bridge header, and a Unity test suite
behind BUILD_TESTING.

Swift requires the Ninja or Xcode generator; a guard in
CMakeLists.txt rejects anything else.

Co-Authored-By: qwen (qwen/qwen3.8-27b@q2_k_xl): scaffolded CMake build + tests
This commit is contained in:
portersky
2026-08-17 14:18:03 +02:00
parent 78f042ab84
commit a7d7d0f253
25 changed files with 742 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
set(TEST_TARGETS "")
add_executable(test_version test_version.cpp)
target_include_directories(test_version PRIVATE "${CMAKE_SOURCE_DIR}/include")
target_link_libraries(test_version PRIVATE xone_api Unity::Unity)
target_compile_features(test_version PRIVATE cxx_std_23)
target_compile_definitions(test_version PRIVATE XONE_VERSION="${PROJECT_VERSION}")
add_test(NAME test_version COMMAND test_version)
list(APPEND TEST_TARGETS test_version)
add_executable(test_types test_types.cpp)
target_include_directories(test_types PRIVATE "${CMAKE_SOURCE_DIR}/include")
target_link_libraries(test_types PRIVATE Unity::Unity)
target_compile_features(test_types PRIVATE cxx_std_23)
add_test(NAME test_types COMMAND test_types)
list(APPEND TEST_TARGETS test_types)
add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND}
--test-dir "${CMAKE_BINARY_DIR}"
--output-on-failure
--progress
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
USES_TERMINAL
DEPENDS ${TEST_TARGETS}
)