Pārlūkot izejas kodu

build system: test id type std::uint64_t on the CI, all platforms

Michele Caini 4 gadi atpakaļ
vecāks
revīzija
f94b9773da
4 mainītis faili ar 52 papildinājumiem un 32 dzēšanām
  1. 38 31
      .github/workflows/build.yml
  2. 5 1
      .github/workflows/sanitizer.yml
  3. 1 0
      CMakeLists.txt
  4. 8 0
      test/CMakeLists.txt

+ 38 - 31
.github/workflows/build.yml

@@ -9,46 +9,42 @@ jobs:
 
 
     strategy:
     strategy:
       matrix:
       matrix:
-        compiler: [
-            g++-7, g++-8, g++-9, g++,
-            clang++-8, clang++-9, clang++-10, clang++
-        ]
+        compiler:
+          - pkg: g++-7
+            exe: g++-7
+          - pkg: g++-8
+            exe: g++-8
+          - pkg: g++-9
+            exe: g++-9
+          - pkg: g++
+            exe: g++
+          - pkg: clang-8
+            exe: clang++-8
+          - pkg: clang-9
+            exe: clang++-9
+          - pkg: clang-10
+            exe: clang++-10
+          - pkg: clang
+            exe: clang++
+        id_type: [uint32, uint64]
+        include:
+          - id_type: uint64
+            id_type_option: -DENTT_BUILD_UINT64=ON
 
 
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
 
 
     steps:
     steps:
     - uses: actions/checkout@v2
     - uses: actions/checkout@v2
-    - name: Install g++-7
-      if: ${{ matrix.compiler == 'g++-7' }}
-      run: |
-        sudo apt-get update
-        sudo apt-get install g++-7 -y
-    - name: Install g++-8
-      if: ${{ matrix.compiler == 'g++-8' }}
-      run: |
-        sudo apt-get update
-        sudo apt-get install g++-8 -y
-    - name: Install clang-8
-      if: ${{ matrix.compiler == 'clang++-8' }}
-      run: |
-        sudo apt-get update
-        sudo apt-get install clang-8 -y
-    - name: Install clang-9
-      if: ${{ matrix.compiler == 'clang++-9' }}
+    - name: Install compiler
       run: |
       run: |
         sudo apt-get update
         sudo apt-get update
-        sudo apt-get install clang-9 -y
-    - name: Install clang-10
-      if: ${{ matrix.compiler == 'clang++-10' }}
-      run: |
-        sudo apt-get update
-        sudo apt-get install clang-10 -y
+        sudo apt-get install ${{ matrix.compiler.pkg }} -y
     - name: Compile tests
     - name: Compile tests
       working-directory: build
       working-directory: build
       env:
       env:
-        CXX: ${{ matrix.compiler }}
+        CXX: ${{ matrix.compiler.exe }}
       run: |
       run: |
-        cmake -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ..
+        cmake -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ${{ matrix.id_type_option }} ..
         make -j4
         make -j4
     - name: Run tests
     - name: Run tests
       working-directory: build
       working-directory: build
@@ -63,11 +59,14 @@ jobs:
       matrix:
       matrix:
         os: [windows-latest, windows-2016]
         os: [windows-latest, windows-2016]
         toolset: [clang-cl, default, v141]
         toolset: [clang-cl, default, v141]
+        id_type: [uint32, uint64]
         include:
         include:
           - toolset: clang-cl
           - toolset: clang-cl
             toolset_option: -T"ClangCl"
             toolset_option: -T"ClangCl"
           - toolset: v141
           - toolset: v141
             toolset_option: -T"v141"
             toolset_option: -T"v141"
+          - id_type: uint64
+            id_type_option: -DENTT_BUILD_UINT64=ON
         exclude:
         exclude:
           - os: windows-2016
           - os: windows-2016
             toolset: clang-cl
             toolset: clang-cl
@@ -81,7 +80,7 @@ jobs:
     - name: Compile tests
     - name: Compile tests
       working-directory: build
       working-directory: build
       run: |
       run: |
-        cmake -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ${{ matrix.toolset_option }} ..
+        cmake -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ${{ matrix.id_type_option }} ${{ matrix.toolset_option }} ..
         cmake --build . -j 4
         cmake --build . -j 4
     - name: Run tests
     - name: Run tests
       working-directory: build
       working-directory: build
@@ -91,6 +90,14 @@ jobs:
 
 
   macos:
   macos:
     timeout-minutes: 10
     timeout-minutes: 10
+
+    strategy:
+      matrix:
+        id_type: [uint32, uint64]
+        include:
+          - id_type: uint64
+            id_type_option: -DENTT_BUILD_UINT64=ON
+
     runs-on: macOS-latest
     runs-on: macOS-latest
 
 
     steps:
     steps:
@@ -98,7 +105,7 @@ jobs:
     - name: Compile tests
     - name: Compile tests
       working-directory: build
       working-directory: build
       run: |
       run: |
-        cmake -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ..
+        cmake -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ${{ matrix.id_type_option }} ..
         make -j4
         make -j4
     - name: Run tests
     - name: Run tests
       working-directory: build
       working-directory: build

+ 5 - 1
.github/workflows/sanitizer.yml

@@ -10,6 +10,10 @@ jobs:
     strategy:
     strategy:
       matrix:
       matrix:
         compiler: [clang++]
         compiler: [clang++]
+        id_type: [uint32, uint64]
+        include:
+          - id_type: uint64
+            id_type_option: -DENTT_BUILD_UINT64=ON
 
 
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
 
 
@@ -20,7 +24,7 @@ jobs:
       env:
       env:
         CXX: ${{ matrix.compiler }}
         CXX: ${{ matrix.compiler }}
       run: |
       run: |
-        cmake -DENTT_USE_SANITIZER=ON -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ..
+        cmake -DENTT_USE_SANITIZER=ON -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ${{ matrix.id_type_option }} ..
         make -j4
         make -j4
     - name: Run tests
     - name: Run tests
       working-directory: build
       working-directory: build

+ 1 - 0
CMakeLists.txt

@@ -173,6 +173,7 @@ if(ENTT_BUILD_TESTING)
     option(ENTT_BUILD_EXAMPLE "Build examples." OFF)
     option(ENTT_BUILD_EXAMPLE "Build examples." OFF)
     option(ENTT_BUILD_LIB "Build lib tests." OFF)
     option(ENTT_BUILD_LIB "Build lib tests." OFF)
     option(ENTT_BUILD_SNAPSHOT "Build snapshot test with Cereal." OFF)
     option(ENTT_BUILD_SNAPSHOT "Build snapshot test with Cereal." OFF)
+    option(ENTT_BUILD_UINT64 "Build using 64b entity identifiers" OFF)
 
 
     include(CTest)
     include(CTest)
     enable_testing()
     enable_testing()

+ 8 - 0
test/CMakeLists.txt

@@ -65,6 +65,14 @@ function(SETUP_TARGET TARGET_NAME)
             NOMINMAX
             NOMINMAX
             ${ARGN}
             ${ARGN}
     )
     )
+
+    if(ENTT_BUILD_UINT64)
+        target_compile_definitions(
+            ${TARGET_NAME}
+            PRIVATE
+                ENTT_ID_TYPE=std::uint64_t
+        )
+    endif()
 endfunction()
 endfunction()
 
 
 add_library(odr OBJECT odr.cpp)
 add_library(odr OBJECT odr.cpp)