From 461865bf3be4b863856b52bf4b3a1e17f3d7ff3e Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 1 Aug 2021 10:36:37 +0200 Subject: [PATCH] build_system: make ENTT_ID_TYPE a cached string variable --- .github/workflows/build.yml | 6 +++--- .github/workflows/sanitizer.yml | 2 +- CMakeLists.txt | 3 ++- test/CMakeLists.txt | 9 +-------- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c33a3adc9..68ab79b5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: id_type: [uint32, uint64] include: - id_type: uint64 - id_type_option: -DENTT_BUILD_UINT64=ON + id_type_option: -DENTT_ID_TYPE=std::uint64_t runs-on: ubuntu-latest @@ -66,7 +66,7 @@ jobs: - toolset: v141 toolset_option: -T"v141" - id_type: uint64 - id_type_option: -DENTT_BUILD_UINT64=ON + id_type_option: -DENTT_ID_TYPE=std::uint64_t exclude: - os: windows-2016 toolset: clang-cl @@ -96,7 +96,7 @@ jobs: id_type: [uint32, uint64] include: - id_type: uint64 - id_type_option: -DENTT_BUILD_UINT64=ON + id_type_option: -DENTT_ID_TYPE=std::uint64_t runs-on: macOS-latest diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml index e1191aca7..4a60128e0 100644 --- a/.github/workflows/sanitizer.yml +++ b/.github/workflows/sanitizer.yml @@ -13,7 +13,7 @@ jobs: id_type: [uint32, uint64] include: - id_type: uint64 - id_type_option: -DENTT_BUILD_UINT64=ON + id_type_option: -DENTT_ID_TYPE=std::uint64_t runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c4a90dee..7ad620789 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,8 @@ if(ENTT_BUILD_TESTING) option(ENTT_BUILD_EXAMPLE "Build examples." OFF) option(ENTT_BUILD_LIB "Build lib tests." OFF) option(ENTT_BUILD_SNAPSHOT "Build snapshot test with Cereal." OFF) - option(ENTT_BUILD_UINT64 "Build using 64b entity identifiers" OFF) + + set(ENTT_ID_TYPE std::uint32_t CACHE STRING "Type of identifiers to use for the tests") include(CTest) enable_testing() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2cf262640..4bb320977 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -61,18 +61,11 @@ function(SETUP_TARGET TARGET_NAME) target_compile_definitions( ${TARGET_NAME} PRIVATE + ENTT_ID_TYPE=${ENTT_ID_TYPE} _ENABLE_EXTENDED_ALIGNED_STORAGE NOMINMAX ${ARGN} ) - - if(ENTT_BUILD_UINT64) - target_compile_definitions( - ${TARGET_NAME} - PRIVATE - ENTT_ID_TYPE=std::uint64_t - ) - endif() endfunction() add_library(odr OBJECT odr.cpp)