From c2b16d3c1868eac6055426ce0c5d25896b00e6ae Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Thu, 30 Jul 2026 22:55:18 -0400 Subject: [PATCH] Upgrade to libakstdlib 0.1.0 Bump deps/libakstdlib five commits to 95e5002, which versions the library at 0.1.0 with an soname and a ConfigVersion file, upgrades its own libakerror to 1.0.0, namespaces its coverage target when embedded, and raises its libc-wrapper coverage. The public header diff is purely additive -- nothing removed, no signature changed -- so libakgl's nine aksl_* call sites needed no edits. What broke was the build. A default `cmake -S . -B build` stopped configuring: add_executable cannot create target "test_version" because another target with the same name already exists. The existing target is an executable created in source directory ".../deps/libakstdlib" The versioning commit added tests/test_version.c to libakstdlib. EXCLUDE_FROM_ALL keeps that target from being built, but add_subdirectory still creates it, so it collided with the version suite added in the preceding commit. Build libakgl's test programs as akgl_test_ instead. The CTest names are unchanged -- ctest -R version still selects it -- and a dependency is now free to ship a test of any name. Ask find_package for libakstdlib 0.1 rather than any version. 0.1.0 ships akstdlibConfigVersion.cmake with SameMinorVersion compatibility, mirroring its libakstdlib.so.0.1 soname, so this accepts any 0.1.x and refuses 0.2 and 1.0. Unversioned, the non-embedded path would have taken an ABI-incompatible libakstdlib without complaint. libakerror is deliberately left unversioned in find_package. It installs akerrorConfig.cmake and akerrorTargets.cmake but no akerrorConfigVersion.cmake, so find_package(akerror 1.0) fails against a correct install rather than a stale one. Its floor stays with the #error in include/akgl/error.h. Worth fixing upstream. Verified: clean configure, build and 16/16 ctest; a -DAKGL_COVERAGE=ON tree configures, builds and passes 18/18, so libakstdlib's embedded coverage-target rename does not collide here. Against a temp-prefix install of 95e5002, find_package(akstdlib) accepts 0.1 and 0.1.0 and refuses 0.2 and 1.0, and find_package(akerror 1.0) fails for the missing version file as described. Co-Authored-By: Claude Opus 5 (1M context) --- CMakeLists.txt | 30 +++++++++++++++++++++--------- deps/libakstdlib | 2 +- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c451616..4dd7596 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,11 +63,19 @@ else() if(NOT TARGET SDL3_ttf::SDL3_ttf) find_package(SDL3_ttf REQUIRED) endif() + # No version here: libakerror ships no akerrorConfigVersion.cmake, so asking + # for one makes find_package reject every install. The floor is enforced by + # the #error in include/akgl/error.h instead, which feature-tests + # AKERR_FIRST_CONSUMER_STATUS. if(NOT TARGET akerror::akerror) find_package(akerror REQUIRED) endif() + # 0.1 rather than bare: libakstdlib 0.1.0 ships an akstdlibConfigVersion.cmake + # with SameMinorVersion compatibility, mirroring its soname, so this accepts + # any 0.1.x and refuses 0.2 and 1.0. Unversioned, this path would silently + # accept an ABI-incompatible libakstdlib. if(NOT TARGET akstdlib::akstdlib) - find_package(akstdlib REQUIRED) + find_package(akstdlib 0.1 REQUIRED) endif() if(NOT TARGET jansson::jansson) find_package(jansson) @@ -140,10 +148,10 @@ set_target_properties(akgl PROPERTIES add_library(akgl::akgl ALIAS akgl) add_executable(charviewer util/charviewer.c) -add_executable(test_semver_unit deps/semver/semver_unit.c) +add_executable(akgl_test_semver_unit deps/semver/semver_unit.c) # Every suite here is a standalone C program named tests/.c, built as -# test_ and registered with CTest under . +# akgl_test_ and registered with CTest under . set(AKGL_TEST_SUITES actor bitmasks @@ -162,12 +170,16 @@ set(AKGL_TEST_SUITES version ) +# The executables carry an akgl_ prefix but the CTest names do not: a vendored +# dependency is free to ship its own tests/version.c, and libakstdlib now does. +# Its target is created by add_subdirectory even though EXCLUDE_FROM_ALL keeps +# it from being built, so an unprefixed test_version here is a configure error. foreach(suite IN LISTS AKGL_TEST_SUITES) - add_executable(test_${suite} tests/${suite}.c) - add_test(NAME ${suite} COMMAND test_${suite}) + add_executable(akgl_test_${suite} tests/${suite}.c) + add_test(NAME ${suite} COMMAND akgl_test_${suite}) endforeach() -add_test(NAME semver_unit COMMAND test_semver_unit) +add_test(NAME semver_unit COMMAND akgl_test_semver_unit) set_tests_properties( ${AKGL_TEST_SUITES} semver_unit @@ -235,8 +247,8 @@ target_link_libraries(akgl ) foreach(suite IN LISTS AKGL_TEST_SUITES) - target_link_libraries(test_${suite} PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm) - target_include_directories(test_${suite} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/tests") + target_link_libraries(akgl_test_${suite} PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm) + target_include_directories(akgl_test_${suite} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/tests") endforeach() target_link_libraries(charviewer PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm) @@ -256,7 +268,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) "$" ) foreach(suite IN LISTS AKGL_TEST_SUITES) - set_target_properties(test_${suite} PROPERTIES BUILD_RPATH "${AKGL_VENDORED_RPATH}") + set_target_properties(akgl_test_${suite} PROPERTIES BUILD_RPATH "${AKGL_VENDORED_RPATH}") endforeach() set_target_properties(charviewer akgl PROPERTIES BUILD_RPATH "${AKGL_VENDORED_RPATH}") diff --git a/deps/libakstdlib b/deps/libakstdlib index a87cbfb..95e5002 160000 --- a/deps/libakstdlib +++ b/deps/libakstdlib @@ -1 +1 @@ -Subproject commit a87cbfb26dce716e263c918908b2039741ff1aff +Subproject commit 95e500251260e2ce5984226aa12079969bffd873