Skip to content

Commit 5550c46

Browse files
authored
Merge branch 'master' into sfinae_operators
2 parents caae7bf + fe8d7d7 commit 5550c46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+677
-545
lines changed

.github/workflows/tools.yml renamed to .github/workflows/analyzer.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: tools
1+
name: analyzer
22

33
on:
44
push:
55
branches:
6-
- tools
6+
- analyzer
77

88
jobs:
99

@@ -55,7 +55,7 @@ jobs:
5555
-DENTT_BUILD_EXAMPLE=ON \
5656
-DENTT_BUILD_LIB=ON \
5757
-DENTT_BUILD_SNAPSHOT=ON \
58-
-DENTT_BUILD_TOOLS=ON \
58+
-ENTT_BUILD_TESTBED=ON \
5959
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--mapping_file=${GITHUB_WORKSPACE}/entt.imp;-Xiwyu;--no_fwd_decls;-Xiwyu;--verbose=1" \
6060
..
6161
make -j4
@@ -78,7 +78,7 @@ jobs:
7878
-DENTT_BUILD_EXAMPLE=ON \
7979
-DENTT_BUILD_LIB=ON \
8080
-DENTT_BUILD_SNAPSHOT=ON \
81-
-DENTT_BUILD_TOOLS=ON \
81+
-ENTT_BUILD_TESTBED=ON \
8282
-DENTT_USE_CLANG_TIDY=ON \
8383
..
8484
make -j4

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: deploy
22

33
on:
44
release:
5-
types: published
5+
types: [published]
66

77
jobs:
88

.github/workflows/testbed.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: testbed
2+
3+
on: [push]
4+
5+
jobs:
6+
7+
linux:
8+
timeout-minutes: 15
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Install required packages
14+
run: |
15+
sudo apt update
16+
sudo apt install -y \
17+
build-essential \
18+
git \
19+
make \
20+
pkg-config \
21+
cmake \
22+
ninja-build \
23+
gnome-desktop-testing \
24+
libasound2-dev \
25+
libpulse-dev \
26+
libaudio-dev \
27+
libjack-dev \
28+
libsndio-dev \
29+
libx11-dev \
30+
libxext-dev \
31+
libxrandr-dev \
32+
libxcursor-dev \
33+
libxfixes-dev \
34+
libxi-dev \
35+
libxss-dev \
36+
libxtst-dev \
37+
libxkbcommon-dev \
38+
libdrm-dev \
39+
libgbm-dev \
40+
libgl1-mesa-dev \
41+
libgles2-mesa-dev \
42+
libegl1-mesa-dev \
43+
libdbus-1-dev \
44+
libibus-1.0-dev \
45+
libudev-dev \
46+
libpipewire-0.3-dev \
47+
libwayland-dev \
48+
libdecor-0-dev \
49+
liburing-dev
50+
- name: Compile testbed
51+
working-directory: build
52+
run: |
53+
cmake -DENTT_BUILD_TESTBED=ON ..
54+
make -j4
55+
56+
windows:
57+
timeout-minutes: 15
58+
runs-on: windows-latest
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Compile testbed
63+
working-directory: build
64+
run: |
65+
cmake -DENTT_BUILD_TESTBED=ON .. -G Ninja
66+
cmake --build . -j 4
67+
68+
macos:
69+
timeout-minutes: 15
70+
runs-on: macOS-latest
71+
72+
steps:
73+
- uses: actions/checkout@v4
74+
- name: Compile testbed
75+
working-directory: build
76+
run: |
77+
cmake -DENTT_BUILD_TESTBED=ON ..
78+
make -j4

CMakeLists.txt

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ project(
2222
if(NOT CMAKE_BUILD_TYPE)
2323
set(CMAKE_BUILD_TYPE Debug)
2424
endif()
25-
25+
2626
message(VERBOSE "*")
2727
message(VERBOSE "* ${PROJECT_NAME} v${PROJECT_VERSION} (${CMAKE_BUILD_TYPE})")
2828
message(VERBOSE "* Copyright (c) 2017-2025 Michele Caini <[email protected]>")
@@ -90,6 +90,7 @@ target_include_directories(
9090
EnTT
9191
INTERFACE
9292
$<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src>
93+
$<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/tools>
9394
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
9495
)
9596

@@ -111,19 +112,9 @@ endif()
111112
# Add EnTT goodies
112113

113114
option(ENTT_INCLUDE_HEADERS "Add all EnTT headers to the EnTT target." OFF)
115+
option(ENTT_INCLUDE_TOOLS "Add EnTT tools files to the EnTT target." OFF)
114116
option(ENTT_INCLUDE_NATVIS "Add EnTT natvis files to the EnTT target." OFF)
115117

116-
if(ENTT_INCLUDE_NATVIS)
117-
if(MSVC)
118-
set(ENTT_HAS_NATVIS TRUE CACHE BOOL "" FORCE)
119-
mark_as_advanced(ENTT_HAS_NATVIS)
120-
endif()
121-
122-
if(NOT ENTT_HAS_NATVIS)
123-
message(VERBOSE "The option ENTT_INCLUDE_NATVIS is set but natvis files are not supported. They will not be added to the target.")
124-
endif()
125-
endif()
126-
127118
if(ENTT_INCLUDE_HEADERS)
128119
target_sources(
129120
EnTT
@@ -206,6 +197,25 @@ if(ENTT_INCLUDE_HEADERS)
206197
)
207198
endif()
208199

200+
if(ENTT_INCLUDE_TOOLS)
201+
target_sources(
202+
EnTT
203+
INTERFACE
204+
$<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/tools/entt/davey/davey.hpp>
205+
)
206+
endif()
207+
208+
if(ENTT_INCLUDE_NATVIS)
209+
if(MSVC)
210+
set(ENTT_HAS_NATVIS TRUE CACHE BOOL "" FORCE)
211+
mark_as_advanced(ENTT_HAS_NATVIS)
212+
endif()
213+
214+
if(NOT ENTT_HAS_NATVIS)
215+
message(VERBOSE "The option ENTT_INCLUDE_NATVIS is set but natvis files are not supported. They will not be added to the target.")
216+
endif()
217+
endif()
218+
209219
if(ENTT_HAS_NATVIS)
210220
target_sources(
211221
EnTT
@@ -301,24 +311,32 @@ if(ENTT_INSTALL)
301311
export(PACKAGE EnTT)
302312
endif()
303313

304-
# Tests
314+
# Tests and testbed
305315

316+
option(ENTT_BUILD_TESTBED "Enable building testbed." OFF)
306317
option(ENTT_BUILD_TESTING "Enable building tests." OFF)
307318

308-
if(ENTT_BUILD_TESTING)
309-
option(ENTT_FIND_GTEST_PACKAGE "Enable finding gtest package." OFF)
319+
if(ENTT_BUILD_TESTBED OR ENTT_BUILD_TESTING)
320+
set(ENTT_ID_TYPE std::uint32_t CACHE STRING "Type of identifiers to use for tests and testbed")
321+
set(ENTT_CXX_STD cxx_std_17 CACHE STRING "C++ standard revision to use for tests and testbed")
322+
323+
# Testbed goes first because otherwise SDL gets confused with EnTT tests
324+
if(ENTT_BUILD_TESTBED)
325+
add_subdirectory(testbed)
326+
endif()
310327

311-
option(ENTT_BUILD_BENCHMARK "Build benchmark." OFF)
312-
option(ENTT_BUILD_EXAMPLE "Build examples." OFF)
313-
option(ENTT_BUILD_LIB "Build lib tests." OFF)
314-
option(ENTT_BUILD_SNAPSHOT "Build snapshot test with Cereal." OFF)
328+
if(ENTT_BUILD_TESTING)
329+
option(ENTT_FIND_GTEST_PACKAGE "Enable finding gtest package." OFF)
315330

316-
set(ENTT_ID_TYPE std::uint32_t CACHE STRING "Type of identifiers to use for the tests")
317-
set(ENTT_CXX_STD cxx_std_17 CACHE STRING "C++ standard revision to use for the tests")
331+
option(ENTT_BUILD_BENCHMARK "Build benchmark." OFF)
332+
option(ENTT_BUILD_EXAMPLE "Build examples." OFF)
333+
option(ENTT_BUILD_LIB "Build lib tests." OFF)
334+
option(ENTT_BUILD_SNAPSHOT "Build snapshot test with Cereal." OFF)
318335

319-
include(CTest)
320-
enable_testing()
321-
add_subdirectory(test)
336+
include(CTest)
337+
enable_testing()
338+
add_subdirectory(test)
339+
endif()
322340
endif()
323341

324342
# Documentation

TODO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ TODO:
3434
* doc: IMPLICIT_DIR_DOCS for dir docs or \dir
3535
* meta non-const allow_cast overloads: (const int &) to (int &) is not allowed, but (const int &) to (double &) is allowed (support only for convertibles)
3636
* improve non-const allow cast with in-place switch
37-
* meta fixed_size could return the size directly if present
37+
* review build process for testbed (i.e. tests first due to SDL)

docs/md/entity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ is not known), there is always the possibility of receiving a `type_info` object
15481548
for the type of elements associated with the entities (if any):
15491549

15501550
```cpp
1551-
if(entt::type_id<velocity>() == base.type()) {
1551+
if(entt::type_id<velocity>() == base.info()) {
15521552
// ...
15531553
}
15541554
```

src/entt/config/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// NOLINTBEGIN(cppcoreguidelines-macro-*,modernize-macro-*)
77

88
#define ENTT_VERSION_MAJOR 3
9-
#define ENTT_VERSION_MINOR 15
9+
#define ENTT_VERSION_MINOR 16
1010
#define ENTT_VERSION_PATCH 0
1111

1212
#define ENTT_VERSION \

src/entt/core/any.hpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ class basic_any {
117117
if constexpr(!std::is_void_v<Type>) {
118118
using plain_type = std::remove_cv_t<std::remove_reference_t<Type>>;
119119

120-
info = &type_id<plain_type>();
121120
vtable = basic_vtable<plain_type>;
121+
descriptor = &type_id<plain_type>();
122122

123123
if constexpr(std::is_lvalue_reference_v<Type>) {
124124
static_assert((std::is_lvalue_reference_v<Args> && ...) && (sizeof...(Args) == 1u), "Invalid arguments");
@@ -151,8 +151,8 @@ class basic_any {
151151

152152
basic_any(const basic_any &other, const any_policy pol) noexcept
153153
: instance{other.data()},
154-
info{other.info},
155154
vtable{other.vtable},
155+
descriptor{other.descriptor},
156156
mode{pol} {}
157157

158158
public:
@@ -219,8 +219,8 @@ class basic_any {
219219
*/
220220
basic_any(basic_any &&other) noexcept
221221
: instance{},
222-
info{other.info},
223222
vtable{other.vtable},
223+
descriptor{other.descriptor},
224224
mode{other.mode} {
225225
if(other.mode == any_policy::embedded) {
226226
other.vtable(request::move, other, this);
@@ -271,8 +271,8 @@ class basic_any {
271271
instance = std::exchange(other.instance, nullptr);
272272
}
273273

274-
info = other.info;
275274
vtable = other.vtable;
275+
descriptor = other.descriptor;
276276
mode = other.mode;
277277

278278
return *this;
@@ -291,11 +291,16 @@ class basic_any {
291291
}
292292

293293
/**
294-
* @brief Returns the object type if any, `type_id<void>()` otherwise.
295-
* @return The object type if any, `type_id<void>()` otherwise.
294+
* @brief Returns the object type info if any, `type_id<void>()` otherwise.
295+
* @return The object type info if any, `type_id<void>()` otherwise.
296296
*/
297-
[[nodiscard]] const type_info &type() const noexcept {
298-
return (info == nullptr) ? type_id<void>() : *info;
297+
[[nodiscard]] const type_info &info() const noexcept {
298+
return (descriptor == nullptr) ? type_id<void>() : *descriptor;
299+
}
300+
301+
/*! @copydoc info */
302+
[[deprecated("use ::info instead")]] [[nodiscard]] const type_info &type() const noexcept {
303+
return info();
299304
}
300305

301306
/**
@@ -312,7 +317,7 @@ class basic_any {
312317
* @return An opaque pointer the contained instance, if any.
313318
*/
314319
[[nodiscard]] const void *data(const type_info &req) const noexcept {
315-
return (type() == req) ? data() : nullptr;
320+
return (info() == req) ? data() : nullptr;
316321
}
317322

318323
/**
@@ -350,7 +355,7 @@ class basic_any {
350355
* @return True in case of success, false otherwise.
351356
*/
352357
bool assign(const basic_any &other) {
353-
if(vtable && mode != any_policy::cref && *info == other.type()) {
358+
if(vtable && mode != any_policy::cref && *descriptor == other.info()) {
354359
return (vtable(request::assign, *this, other.data()) != nullptr);
355360
}
356361

@@ -360,7 +365,7 @@ class basic_any {
360365
/*! @copydoc assign */
361366
// NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
362367
bool assign(basic_any &&other) {
363-
if(vtable && mode != any_policy::cref && *info == other.type()) {
368+
if(vtable && mode != any_policy::cref && *descriptor == other.info()) {
364369
if(auto *val = other.data(); val) {
365370
return (vtable(request::transfer, *this, val) != nullptr);
366371
}
@@ -378,8 +383,8 @@ class basic_any {
378383
}
379384

380385
instance = nullptr;
381-
info = nullptr;
382386
vtable = nullptr;
387+
descriptor = nullptr;
383388
mode = any_policy::empty;
384389
}
385390

@@ -397,7 +402,7 @@ class basic_any {
397402
* @return False if the two objects differ in their content, true otherwise.
398403
*/
399404
[[nodiscard]] bool operator==(const basic_any &other) const noexcept {
400-
if(vtable && *info == other.type()) {
405+
if(vtable && *descriptor == other.info()) {
401406
return (vtable(request::compare, *this, other.data()) != nullptr);
402407
}
403408

@@ -447,8 +452,8 @@ class basic_any {
447452
const void *instance;
448453
storage_type storage;
449454
};
450-
const type_info *info{};
451455
vtable_type *vtable{};
456+
const type_info *descriptor{};
452457
any_policy mode{any_policy::empty};
453458
};
454459

src/entt/entity/group.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class group_handler final: public group_descriptor {
151151

152152
[[nodiscard]] bool owned(const id_type hash) const noexcept override {
153153
for(size_type pos{}; pos < Owned; ++pos) {
154-
if(pools[pos]->type().hash() == hash) {
154+
if(pools[pos]->info().hash() == hash) {
155155
return true;
156156
}
157157
}

0 commit comments

Comments
 (0)