Build: qualify target support (closes #38)
This commit is contained in:
1 parent
72148da7b2
commit
1335fa86c3
8 files changed
+689
No files matched your search
@@ -0,0 +1,50 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidTargetProfileConsumer LANGUAGES CXX)
|
||||
|
||||
# Records and asserts the target tuple of an installed Void package. The
|
||||
# qualification driver (tests/package/TargetQualification.cmake) passes the
|
||||
# expected target and then checks the emitted profile file. Core is the
|
||||
# always-present leaf module; per-module consumption is covered by the other
|
||||
# tests/package fixtures.
|
||||
if(NOT DEFINED VOID_EXPECTED_TARGET OR VOID_EXPECTED_TARGET STREQUAL "")
|
||||
message(FATAL_ERROR "VOID_EXPECTED_TARGET is required")
|
||||
endif()
|
||||
|
||||
find_package(Void CONFIG REQUIRED COMPONENTS Core)
|
||||
|
||||
include("${Void_DIR}/void-target-manifest.cmake")
|
||||
|
||||
if(NOT VOID_TARGET_MANIFEST_TARGET STREQUAL VOID_EXPECTED_TARGET)
|
||||
message(FATAL_ERROR
|
||||
"[TargetProfile] installed manifest target "
|
||||
"'${VOID_TARGET_MANIFEST_TARGET}' does not match expected "
|
||||
"'${VOID_EXPECTED_TARGET}'")
|
||||
endif()
|
||||
if(NOT Core IN_LIST VOID_TARGET_MANIFEST_MODULES)
|
||||
message(FATAL_ERROR
|
||||
"[TargetProfile] installed manifest does not record module 'Core' "
|
||||
"(modules: ${VOID_TARGET_MANIFEST_MODULES})")
|
||||
endif()
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/target-profile.txt"
|
||||
"target=${VOID_TARGET_MANIFEST_TARGET}\n"
|
||||
"triple=${VOID_TARGET_MANIFEST_TRIPLE}\n"
|
||||
"compiler=${VOID_TARGET_MANIFEST_COMPILER_ID}-${VOID_TARGET_MANIFEST_COMPILER_VERSION}\n"
|
||||
"cxx_standard=${VOID_TARGET_MANIFEST_CXX_STANDARD}\n"
|
||||
"linkage=${VOID_TARGET_MANIFEST_LINKAGE}\n"
|
||||
"reflection=${VOID_TARGET_MANIFEST_REFLECTION}\n"
|
||||
"sanitizers=${VOID_TARGET_MANIFEST_SANITIZERS}\n"
|
||||
"modules=${VOID_TARGET_MANIFEST_MODULES}\n"
|
||||
)
|
||||
message(STATUS
|
||||
"[TargetProfile] target=${VOID_TARGET_MANIFEST_TARGET} "
|
||||
"triple=${VOID_TARGET_MANIFEST_TRIPLE} "
|
||||
"compiler=${VOID_TARGET_MANIFEST_COMPILER_ID}-${VOID_TARGET_MANIFEST_COMPILER_VERSION} "
|
||||
"linkage=${VOID_TARGET_MANIFEST_LINKAGE} "
|
||||
"reflection=${VOID_TARGET_MANIFEST_REFLECTION}")
|
||||
|
||||
add_executable(void_target_profile_consumer main.cpp)
|
||||
target_link_libraries(void_target_profile_consumer PRIVATE Void::Core)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME VoidTargetProfileConsumer COMMAND void_target_profile_consumer)
|
||||
@@ -0,0 +1,28 @@
|
||||
// Isolated consumer fixture for target qualification. Exercises a small
|
||||
// runtime behaviour from the always-present Core module so an install/consume
|
||||
// check covers headers, linkage and the module dependency closure.
|
||||
#include <Void/Core/CheckedBits.hpp>
|
||||
#include <Void/Core/Hash.hpp>
|
||||
#include <Void/Core/Uuid.hpp>
|
||||
|
||||
#include <random>
|
||||
#include <string_view>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::mt19937_64 rng{11};
|
||||
const auto uuid = Void::Uuid::v4(rng);
|
||||
const auto chars = Void::Uuid::format_chars(uuid);
|
||||
const auto reparsed =
|
||||
Void::Uuid::parse(std::string_view{chars.data(), chars.size()});
|
||||
if (!reparsed || *reparsed != uuid) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const auto aligned = Void::Bits::checked_align_up(13u, 8u);
|
||||
if (!aligned || *aligned != 16u) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return Void::Hash::fnv1a64("target-profile") != 0 ? 0 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user