Age | Commit message (Collapse) | Author |
|
Those DESTINATION specifications match precisely what CMake does by
default (on Linux at least); what's worse is that they prevent CMake
to install the DLL file on Windows.
|
|
|
|
On Windows QUOTIENT_API expands to different things depending on whether
the library is built or used. This results in confusing statements (and
MSVC erroring out on them, in some cases - see below - quite
legitimately) not only when the application includes Quotient headers
but also when the application defines custom events and uses
REGISTER_EVENT_TYPE to make them creatable from /sync responses.
To avoid repeated registration when dynamic linking is involved,
EventFactory<>::addMethod() now bluntly looks up the method for this
type in the vector of already registered methods. It would surely be
quicker to use a static variable instead; but since the refreshed API
for addMethod returns a reference to the factory method it's necessary
to do this lookup anyway. Once the primary goal of this branch is
achieved across platforms I might experiment with lighter ways to
register factory methods; for now here's a minimal change to make
the code build on Windows.
|
|
Thanks to Sonar for reminding that constexpr implies inline.
|
|
Once visibility kicks in, MSVC changes its ways and tries to instantiate
Private classes wrapped in smart pointers upon their occurence in the
header file - which leads to build breakage because of a missing
destructor. Usually making the outer class destructor out-of-line helps
to fix this (see RoomEvent, for one example).
|
|
MSVC is quite picky to redeclaration with __declspec(dllexport), judging
it as changing the class of storage. This commit tries to reorder
declarations so that MSVC is made aware of dllexport attribute on the
first encounter rather than the second one.
|
|
|
|
|
|
Before all, this fixes the problem with double-initialising of type ids;
it could have been fixed with a smaller change but EventTypeRegistry
is fairly superfluous now when inline variables are a thing and it's
possible to have an extensible registry system using literally pointers
to the memory that are guaranteed to be unique. That being said,
event_type_t is still QLatin1String and not a bare const char* (or
void*), mostly to stay on the safe side when it comes to type
identities: unlike const char*, QLatin1String's are deep-compared,
meaning that matching for switchOnType (former visit) occurs a bit
slower now. This may change in the future; but this is the first step
in getting rid of EventTypeRegistry.
This change means that initializeTypeId is no more needed; also, two
static member functions, typeId() and matrixTypeId(), are being replaced
with a single inline static member variable, TypeId. This commit doesn't
apply that transition across the event types, meaning that you'll get
a pile of warnings when compiling the library. These warnings will be
tackled in further commits within this branch.
|
|
For now on Linux with GCC only, with a plan to add Windows eventually.
|
|
Also, -fvisibility-inlines-hidden is applied in a CMake-native way now.
As can be expected, BUILDING_SHARED_QUOTIENT is set when a dynamic
library is built while QUOTIENT_STATIC is set whenever static
libQuotient is around (both for building it and for building with it).
|
|
Strictly speaking, EventFactory can be further instantiated if any
client application figures they need a whole new base class for events
and respectively a separate EventFactory specialisation for it.
Where this whole commit started though was a linkage error because I
did not plan to expose Quotient-specific logging categories for linkage
(effectively, usage) from the client code - meanwhile the inline code
of EventFactory uses qDebug(EVENTS), meaning I had to either add
QUOTIENT_API to EVENTS or hide those invocations. This in turn led
to trimming the EventFactory constructor back to trivial implementation
and dropping the guard variable that was supposed to trace duplicate
EventFactory<BaseEventT> objects for the same BaseEventT - with the
reasoning that such situation is not really dangerous (unlike
EventTypeRegistry double-initialisation fiasco, see #413), and at the
same time it can be easily detected in the logs by duplicated factory
method registration messages. And while I was at it, I replaced the
meaningless bool in the return type of EventFactory<>::addMethod with
the slightly more (but still barely) useful reference to the inserted
factory method. One can (in theory) use it now if they need to turn
some event JSON into an object of some specific event type or nullptr
if the event type in the JSON payload doesn't match - but at the same
rate (for now at least) one can call makeIfMatches<EventT>() directly.
With this commit, both Quotest and Quaternion build and link using
either Clang or GCC even under -fvisibility=hidden. However, running
quotest now reproduces #413, which is a matter of event typeId
infrastructure refactoring, coming in further commits.
|
|
|
|
|
|
This include all (hopefully) classes/structures and functions that have
non-inline definitions, as well as namespaces with Q_NAMESPACE since
those have non-inline (as of Qt 5.15) QMetaObject - for that a new
macro, QUO_NAMESPACE, has been devised to accommodate the lack of
Q_NAMESPACE_EXPORT in Qt before 5.14.
|
|
This seems to be the crux of #413.
|
|
Instead of using CMake's generate_export_header macro, it's a bit easier
to maintain a static file (that is not supposed to ever change) with
necessary export/import/hidden visibility macros.
|
|
|
|
There's no need to return lambdas where pointers to specialised function
templates would work just fine.
|
|
|
|
|
|
|
|
|
|
It's been alright with the comment inside the script.
|
|
Comments inside shell scripts apparently break the flimsy GHA machinery.
|
|
|
|
|
|
|
|
That apparently confuses Sonar as it fails to match the source files.
|
|
|
|
...instead of hoping the thing will sort itself out because CLion does.
|
|
For coverage analysis to work, a test run is needed, making the overlap
between ci.yaml and sonar.yml quite significant again.
Note: 'update-api' option is temporarily dropped from the matrix
to speed up the check. If things run fine, 'update-api' will come back.
|
|
|
|
There's not much value in analysing the code without E2EE and with E2EE
because E2EE is additive; and there's no plan to look close into
the generated API code apart from what already ends up being committed.
|
|
Simplify event factories
|
|
|
|
The former code assumed that EventFactory<> is just a class-level shell
for a bunch of functions and a static data member that only exists to
allow specialisations to occur for the whole group together. On top of
that, setupFactory() and registerEventType() strived to protect this
group from double registration coming from static variables in an
anonymous namespace produced by REGISTER_EVENT_TYPE.
The whole thing is now de-static-ed: resolving the factory now relies
on class-static Event/RoomEvent/StateEventBase::factory variables
instead of factory_t type aliases; and REGISTER_EVENT_TYPE produces
non-static inline variables instead, obviating the need of
registerEventType/setupFactory kludge.
|
|
Objects derived from Event are not room events (in the spec sense) and
never occur in the same arrays as room events; therefore this chaining
has always been superfluous.
|
|
Another forgotten header file.
|
|
|
|
Also: extended quotest to cover member renames, not just user profile renames.
|
|
Add autotests to CI
|
|
CMAKE_INSTALL_RPATH_USE_LINK_PATH is more universal than setting LD_LIBRARY_PATH
Also: drop an extra slash in the path to installed quotest.
|
|
This covers Quotient_INSTALL_TESTS setting.
|
|
|
|
It turned out that, confusingly, ${{ runner.workspace }} refers to
the directory above $GITHUB_WORKSPACE, which is why the previous commit
ended up with valgrind not finding its suppressions.
|
|
|
|
Those tests don't even need an event loop.
|
|
|
|
|