-
-
Notifications
You must be signed in to change notification settings - Fork 944
add module support #1243
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
add module support #1243
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
module; | ||
|
||
#include <entt/entt.hpp> | ||
|
||
export module entt; | ||
|
||
#include "entt/container/dense_map.inc" | ||
#include "entt/container/dense_set.inc" | ||
#include "entt/container/fwd.inc" | ||
#include "entt/container/table.inc" | ||
#include "entt/core/algorithm.inc" | ||
#include "entt/core/any.inc" | ||
#include "entt/core/attribute.inc" | ||
#include "entt/core/bit.inc" | ||
#include "entt/core/compressed_pair.inc" | ||
#include "entt/core/enum.inc" | ||
#include "entt/core/family.inc" | ||
#include "entt/core/fwd.inc" | ||
#include "entt/core/hashed_string.inc" | ||
#include "entt/core/ident.inc" | ||
#include "entt/core/iterator.inc" | ||
#include "entt/core/memory.inc" | ||
#include "entt/core/monostate.inc" | ||
#include "entt/core/ranges.inc" | ||
#include "entt/core/tuple.inc" | ||
#include "entt/core/type_info.inc" | ||
#include "entt/core/type_traits.inc" | ||
#include "entt/core/utility.inc" | ||
#include "entt/entity/component.inc" | ||
#include "entt/entity/entity.inc" | ||
#include "entt/entity/fwd.inc" | ||
#include "entt/entity/group.inc" | ||
#include "entt/entity/handle.inc" | ||
#include "entt/entity/helper.inc" | ||
#include "entt/entity/mixin.inc" | ||
#include "entt/entity/organizer.inc" | ||
#include "entt/entity/ranges.inc" | ||
#include "entt/entity/registry.inc" | ||
#include "entt/entity/runtime_view.inc" | ||
#include "entt/entity/snapshot.inc" | ||
#include "entt/entity/sparse_set.inc" | ||
#include "entt/entity/storage.inc" | ||
#include "entt/entity/view.inc" | ||
#include "entt/graph/adjacency_matrix.inc" | ||
#include "entt/graph/dot.inc" | ||
#include "entt/graph/flow.inc" | ||
#include "entt/graph/fwd.inc" | ||
#include "entt/locator/locator.inc" | ||
#include "entt/meta/adl_pointer.inc" | ||
#include "entt/meta/container.inc" | ||
#include "entt/meta/context.inc" | ||
#include "entt/meta/factory.inc" | ||
#include "entt/meta/fwd.inc" | ||
#include "entt/meta/meta.inc" | ||
#include "entt/meta/node.inc" | ||
#include "entt/meta/pointer.inc" | ||
#include "entt/meta/policy.inc" | ||
#include "entt/meta/range.inc" | ||
#include "entt/meta/resolve.inc" | ||
#include "entt/meta/template.inc" | ||
#include "entt/meta/type_traits.inc" | ||
#include "entt/meta/utility.inc" | ||
#include "entt/poly/fwd.inc" | ||
#include "entt/poly/poly.inc" | ||
#include "entt/process/fwd.inc" | ||
#include "entt/process/process.inc" | ||
#include "entt/process/scheduler.inc" | ||
#include "entt/resource/cache.inc" | ||
#include "entt/resource/fwd.inc" | ||
#include "entt/resource/loader.inc" | ||
#include "entt/resource/resource.inc" | ||
#include "entt/signal/delegate.inc" | ||
#include "entt/signal/dispatcher.inc" | ||
#include "entt/signal/emitter.inc" | ||
#include "entt/signal/fwd.inc" | ||
#include "entt/signal/sigh.inc" | ||
|
||
#include "entt/operators.inc" | ||
#include "entt/std.inc" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export namespace entt { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know what the common approach is for other already existing projects, if any? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://arewemodulesyet.org/
https://github.com/fmtlib/fmt/blob/master/include/fmt/args.h#L11-L15 I looked into what the support looks like awhile ago so I thought I'd share. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw three main approaches for handling modules:
I choosed the 3rd approach only because I wasn't familiar enough with the internal source code of entt. I don't think it's the best. My considerations:
I can try to implement the 1st approach as well for having a better comparison. As a side note, I would avoid to create new file extensions for c++ modules like (.cppm) since doesn't make much sense in my opinion and not all compilers go along with different extensions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't want to waste your time, it's not necessary to implement it for all symbols. However, it would help if you could provide a small example, yeah. Something like for a single subdir or such. Is it something you can do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds like a plan, this Friday I can work on it |
||
using ::entt::dense_map; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export namespace entt { | ||
using ::entt::dense_set; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export namespace entt { | ||
using ::entt::table; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export namespace entt { | ||
using ::entt::basic_table; | ||
} // namespace entt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export namespace entt { | ||
using ::entt::std_sort; | ||
using ::entt::insertion_sort; | ||
using ::entt::radix_sort; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export namespace entt { | ||
using ::entt::basic_any; | ||
using ::entt::any_cast; | ||
using ::entt::make_any; | ||
using ::entt::forward_as_any; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export namespace entt { | ||
using ::entt::popcount; | ||
using ::entt::has_single_bit; | ||
using ::entt::next_power_of_two; | ||
using ::entt::fast_mod; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export namespace entt { | ||
using ::entt::compressed_pair; | ||
using ::entt::swap; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export namespace entt { | ||
using ::entt::enum_as_bitmask; | ||
using ::entt::enum_as_bitmask_v; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export namespace entt { | ||
using ::entt::family; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export namespace entt { | ||
using ::entt::any_policy; | ||
using ::entt::id_type; | ||
using ::entt::any; | ||
using ::entt::hashed_string; | ||
using ::entt::hashed_wstring; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export namespace entt { | ||
using ::entt::basic_hashed_string; | ||
|
||
inline namespace literals { | ||
using ::entt::literals::operator ""_hs; | ||
using ::entt::literals::operator ""_hws; | ||
} // namespace literals | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export namespace entt { | ||
using ::entt::ident; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export namespace entt { | ||
using ::entt::input_iterator_pointer; | ||
using ::entt::iota_iterator; | ||
using ::entt::operator==; | ||
using ::entt::operator!=; | ||
using ::entt::iterable_adaptor; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export namespace entt { | ||
using ::entt::to_address; | ||
using ::entt::propagate_on_container_copy_assignment; | ||
using ::entt::propagate_on_container_move_assignment; | ||
using ::entt::propagate_on_container_swap; | ||
using ::entt::allocation_deleter; | ||
using ::entt::allocate_unique; | ||
using ::entt::uses_allocator_construction_args; | ||
using ::entt::make_obj_using_allocator; | ||
using ::entt::uninitialized_construct_using_allocator; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export namespace entt { | ||
using ::entt::monostate; | ||
using ::entt::monostate_v; | ||
} // namespace entt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export namespace entt { | ||
using ::entt::is_tuple; | ||
using ::entt::is_tuple_v; | ||
using ::entt::unwrap_tuple; | ||
using ::entt::forward_apply; | ||
} // namespace entt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to have a different target?
I mean, I want to compile it as a module library or to import it as a header-only library.
I don't see why I should want both. In this case, why not use the same name? It would also reduce the boilerplate and duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good point, actually I'm not sure how the cmake side is. Works. But definitely it makes sense aim for a single target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a problem. I can merge everything on a branch and fix it on my own eventually. 👍