Commit graph

28 commits

Author SHA1 Message Date
Simon McVittie
41c7570e1e cmake: Make intrusive (formerly embedded) tests into a separate option
Previously, the CMake build enabled tests by default, and enabled both
modular and intrusive (embedded) tests with a single option. This is
a really bad idea if anyone is using CMake-built binaries in production.

DBUS_BUILD_TESTS now enables only the modular tests, which are safe to
enable in production builds.

A new DBUS_ENABLE_INTRUSIVE_TESTS option enables the intrusive test
instrumentation.

To preserve existing test coverage, explicitly enable the intrusive
tests in most CMake-based Gitlab-CI jobs (Debian native, openSUSE native,
Windows).

In jobs that have a mirrored pair of production/debug builds (openSUSE
and Debian mingw32/mingw64 cmake), instead we leave the production
build as-is and only build full test coverage in the debug build.

Co-authored-by: Philip Withnall <philip@tecnocode.co.uk>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-10 10:25:51 +00:00
Jordan Williams
ad5836cb0d
Bump CMake version to 3.4
With the minimum version set to 3.4, none of the policies need to be set explicitly to the `NEW` behavior.
Each of the policies removed here was introduced before CMake version 3.4.
By default then, each of them will be set to NEW automatically.
This is part of the behavior of cmake_minimum_required.
The cmake_policy commands are therefore redundant and have been removed.
2022-07-25 14:14:56 -05:00
Alex Richardson
e827309976 cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compiling
Inferring it from the environment is not correct, since the host system
could have a different temporary directory defined. Instead of guessing
based on the host, require the user to pass an explicit directory when
cross-compiling. This is helpful for me since I am cross-compiling for
FreeBSD from macOS and on my host TMPDIR is set to
/var/folders/<random characters>/T/ instead of the expected /tmp.
2022-03-29 11:40:15 +00:00
Simon McVittie
9d60676ae0 Disable the Containers interface
We've had a request for a 1.14.x stable-branch, but the Containers
interface is only partially implemented, not yet described in the
D-Bus Specification, and not ready to be part of our API guarantees.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-12-10 16:48:51 +00:00
Ralf Habacker
77375263f5 cmake: add option ENABLE_VERBOSE_CONFIG
Checking the filenames of generated configuration files is now optionally
possible with this cmake option. They are no longer displayed by default
to avoid unnecessarily flooding the output.
2021-12-10 14:16:52 +00:00
Ralf Habacker
8e2f0f588e cmake: add configure option 'ENABLE_WERROR' to keep in sync with autotools 2021-12-10 13:36:28 +00:00
Ralf Habacker
927a5f4d75 cmake: add support for user session semantic on Linux operating systems
Systemd user support is controlled by the cmake variable ENABLE_USER_SESSION,
which and WITH_SYSTEMD_USERUNITDIR to specify a custom installation
location. If WITH_SYSTEMD_USERUNITDIR is not specified, the related install
path is determined from an installed systemd package, if present.

This was added to the Autotools build system as part of fd.o#61301,
but until now was not possible to enable when building with CMake.
2020-06-10 18:13:47 +00:00
Ralf Habacker
97bdefd4e2 cmake: Add support for systemd integration on Linux operating systems
Previously, only the Autotools build system could do this. This commit
includes most of the same features as in the Autotools build, although
not the user-session semantics, which will be added separately.

Systemd support is controlled by the cmake variable ENABLE_SYSTEMD, which can
have the values OFF, ON and AUTO, the latter enabling support by default if
the required libraries are available.

With WITH_SYSTEMD_SYSTEMUNITDIR a custom installation location can be specified.
If it is not specified, the related install path is determined from the installed
systemd package, if present.
2020-06-10 18:13:47 +00:00
Ralf Habacker
6e8d75834e Add support to generate the api documentation in Qt help format
Qt help files are used by Qt Creator and KDevelop, for example, to support
the development of Qt-based applications and libraries.

Generating api documentation in Qt help format is controlled by two
user specific options named --enable-qt-help and --with-qchdir (autotools)
and -DENABLE_QT_HELP and -DINSTALL_QCH_DIR (cmake).
2020-04-29 15:23:23 +00:00
Ralf Habacker
2a21c7f006 README.cmake: Fix doc for building on linux
Remove -G flag and let user use the default generator.
2019-03-12 12:29:45 +01:00
Ralf Habacker
015ecf15dd README.cmake: Add cross building for Windows 2019-03-12 12:29:45 +01:00
Ralf Habacker
3bf97922bd Move cmake related build system to top level
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-22 09:57:40 +01:00
Ralf Habacker
56171457fb Add new cmake configure option DBUS_USE_WINE
If this variable is set, ctest uses wine to run cross compiled
test applications. Otherwise, they are assumed to run on a native
Windows operating system.

The new cmake variables Z_DRIVE_IF_WINE and TEST_WRAPPER have been
added to support this function.
2018-12-06 09:18:27 +01:00
Ralf Habacker
a2aecf7d79 Add xsltproc usage to README.cmake 2018-11-20 15:57:21 +01:00
Daniel Wendt
37b6e180e1 Enable "unused result" warning for Visual Studio >= 2012 (MSVC 11.0)
The _Must_inspect_result_ annotation is documented to be used in both
the declaration and implementation, but in testing with the MSVC 2012
compiler it appears to be sufficient to use the annotation only in the
declaration to get a compiler warning, as with the GCC compiler.
So the annotation is not necessary in the C implementation.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105460
[smcv: Rebase dbus-sysdeps.h changes on master]
[smcv: Clarify commit message]
Reviewed-by: Simon McVittie <smcv@collabora.com>
Tested-by: Daniel Wendt <daniel.wendt@linux.com>
2018-03-15 19:53:05 +00:00
Simon McVittie
88b3c31928 driver: Add a stub implementation of the Containers1 interface
For now, this is considered to be a privileged operation, because the
resource-limiting isn't wired up yet. It only contains the bare minimum
of API.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
2017-12-11 15:50:02 +00:00
Simon McVittie
6a6521746b unix: Condition Linux-specific abstract sockets on __linux__
This is nicer for cross-compiling, because AC_RUN_IFELSE can't work
there. In practice abstract sockets are supported on Linux since
2.2 (so, all relevant versions), and on no other platform; so it
seems futile to keep this complexity.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34905
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-09-29 14:04:57 +01:00
Ralf Habacker
d160c1a71a cmake, autotools: Add find package config support for cmake clients
With this support cmake and autotools generates cmake equivalent of
pkgconfig files on configure time named DBus1Config*.cmake. These
files are installed into the related directory where cmake expects
find_package related config files.

For instructions how to use this feature with clients see readme.cmake.

With previous DBus versions each cmake client using DBus as dependency
needed a related FindDBus*.cmake in its source distribution or in
the cmake binary packages. With the 'config' find package style support
provided by this patch this requirement has been removed.

The generated config file uses pkgconfig on unix or autotools to
fetch package build flags, which is the prefered way. On Windows
we do not want to require CMake users to have pkg-config installed
so it uses cmake buildin target export support for exporting all
targets into DBus1ConfigTargets*.cmake.

[smcv: make sure variable substitution works in Autotools too]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99721
Reviewed-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-03-20 14:18:45 +00:00
Simon McVittie
47f14b8e3b Remove leftover declarations for assuming int manipulation is atomic
We never assume this since
<https://bugs.freedesktop.org/show_bug.cgi?id=38005> was fixed, because
it isn't true in modern compilers.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97357
2016-10-13 17:20:36 +01:00
Chengwei Yang
726b28a03e cmake: update README.cmake a bit
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66453
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-11-27 16:37:04 +00:00
Chengwei Yang
1f9e5d70c7 dir-watch: remove dnotify backend
dnotify as a dir watch backend is broken since Jan 2010 (almost 3.5
years). According to fd.o: #33001, it's no harm to remove dnotify from
this project.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33001
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-28 11:53:29 +01:00
Chengwei Yang
2e5eb7d82f cmake: fix a typo DBUS_DISABLE_ASSERTS should be DBUS_DISABLE_ASSERT
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66142
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-25 12:25:51 +01:00
Chengwei Yang
46602768c5 XML: hard depends on expat and delete libxml
[The libxml code path has been broken for at least 2.5 years, and Expat
is tiny, so there seems no point in supporting both. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=20253
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-06 13:02:24 +01:00
Simon McVittie
b5d36dc27d Split DBUS_SESSION_BUS_DEFAULT_ADDRESS into listen, connect addresses and set better defaults
On Unix, the connect address should basically always be "autolaunch:"
but the listen address has to be something you can listen on.

On Windows, you can listen on "autolaunch:" or
"autolaunch:scope=*install-path", for instance, and the dbus-daemon is
involved in the auto-launching process.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38201
Reviewed-by: David Zeuthen <davidz@redhat.com>
[default address changed to autolaunch: for interop with GDBus -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-08-13 19:57:13 +01:00
Simon McVittie
05b0b9e65b cmake: use the same default system bus address as for autotools
The system bus is unsupported (and rather meaningless) on Windows anyway,
so we can use anything. Also, make it clear that it has to be a
"specific" address that can be listened on *and* connected to,
like unix:path=/xxx - a listen-only address like unix:tmpdir=/xxx or
nonce-tcp: would not be suitable.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38201
Reviewed-by: David Zeuthen <davidz@redhat.com>
2012-08-13 19:51:42 +01:00
Ralf Habacker
c4e5c2ec7a added notes about supported compilers 2011-12-21 08:50:08 +01:00
Ralf Habacker
ba9178b153 Visual Studio Professional uses a different ide starter - pointed out by Romain Pokrzywka 2011-07-08 10:53:20 +02:00
Ralf Habacker
6321a98492 Collected cmake doc into README.cmake. 2011-07-02 21:02:46 +02:00