Просмотр исходного кода

build_system: make ENTT_ID_TYPE a cached string variable

Michele Caini 4 лет назад
Родитель
Сommit
461865bf3b
4 измененных файлов с 7 добавлено и 13 удалено
  1. 3 3
      .github/workflows/build.yml
  2. 1 1
      .github/workflows/sanitizer.yml
  3. 2 1
      CMakeLists.txt
  4. 1 8
      test/CMakeLists.txt

+ 3 - 3
.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
 

+ 1 - 1
.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
 

+ 2 - 1
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()

+ 1 - 8
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)