Commit Graph

477 Commits

Author SHA1 Message Date
Scott Talbert
df46add116 Add support for building WebView with libwebkit2gtk-4.1
libwebkit2gtk-4.1 has the same API as libwebkit2gtk-4.0, except that the
former links with libsoup-3.0 and the latter links with libsoup-2.4.

Fixes #23630.

(cherry picked from commit 1b8664426603376b68f8ca3c54de97ec630e5940)
2023-07-22 23:46:32 +02:00
Tobias Taschner
77db8b7d54 Fix MSW lib names for ARM64 with CMake build
Any 64 platform had the added _x64 suffix. This will now be _arm64
when building for ARM64.

See #23347, #23355.

(cherry picked from commit 1edb38b54892273f2f932339d49b91f7b60fd3a4)
2023-07-03 02:56:23 +02:00
Maarten Bent
0a2502cfab CMake: Improve finding library name or path of imported targets
Checking LOCATION{_CONFIG} property on interfaces is only supported
since CMake 3.19. Also check the LOCATION and IMPORTED_LIBNAME
properties for possible library locations.

See #23632.

(cherry picked from commit 0f1f61a9c8c9fc8c4cb81a380df157e8171b0712)
2023-06-17 14:32:03 +02:00
Maarten Bent
8437eefbe5 CMake: Check and enable use of libxkbcommon
CMake's has built-in support for checking xkbcommon using FindX11 since
3.18.

But because older CMake versions are supported, add our own module that
checks if the header and library is available.

See #23410, #23613.

(cherry picked from commit a801057f1a7fba8e353be9481c1e621b8bf1dbe2)
2023-06-06 21:28:18 +02:00
PB
de89d40ea8 Copy all data files needed by XRC sample when building with CMake
XPM files demonstrating the use of wxBitmapBundle in the XRC files
were not copied when building the XRC sample with CMake.

This should have been part of eaa769a (Use wxBitmapBundle in
wxBitmapComboBox XRC handler, 2022-02-09).

See #23612.

(cherry picked from commit 241ed70b5bb643ba7c84e420d9cbba7618bed194)
2023-06-06 21:24:54 +02:00
Vadim Zeitlin
1c64bd506c Use grep instead of fgrep and egrep
The latter are deprecated and shouldn't be used any longer.

No real changes.

See #23537.

(cherry picked from commit a0e3f1e1aba5fd7858936773f09d96ae63041381)
2023-05-10 23:48:09 +02:00
Maarten Bent
e1d8bc89ba CMake: Add libraries of imported targets to wx-config
Use the LOCATION_DEBUG or LOCATION_RELEASE property of an imported target (like NanoSVG)
to determine the full library path.

See #23373, #23390.

(cherry picked from commit 81029586653c662d7a6bff3cc2e0e45e417cb248)
2023-03-29 13:27:03 +02:00
Tobias Taschner
96276645ad CMake: silence shorten-64-to-32 warnings on macOS
See #23331.

Closes #23329.

(cherry picked from commit 41194a7b2a90e81f8626d226da650957b616a6b6)
2023-03-13 16:11:39 +01:00
Maarten Bent
6f0ecd48f0 CMake: Apply no-RTTI compile options directly to targets
Don't set global compile options or defines.

(cherry picked from commit 865f7aced21b03fc522b6b62b6f494221fa36cb8)
2023-03-12 21:10:31 +01:00
Maarten Bent
ba6e78ec62 CMake: Enable large file support
Define HAVE_LARGEFILE_SUPPORT and add '_FILE_OFFSET_BITS=64' compile definition.
Make it a PUBLIC definition so it is part of the interface, and defined when importing a target.

Check if fseeko is available, which is used in the large file code.
Also add the compile definition to wxconfig's cppflags, because configure does this too.

Large file support can be disabled with the wxBUILD_LARGEFILE_SUPPORT option, similar to configure's --disable-largefile.

Fixes #22750

(cherry picked from commit 1051dfd1410673a25a767fb3b448c858f493108a)
2023-03-12 21:10:28 +01:00
Maarten Bent
3c18113980 Only build memcheck sample when debugging is enabled
This sample is not useful and doesn't build otherwise.

See #23106, #23133.
2023-01-12 17:36:51 +01:00
Vadim Zeitlin
1450e5e158 Define HAVE_SSIZE_T as 1 in CMake builds for consistency
It is defined as 1, and not as nothing, in configure-generated setup.h
and some projects, e.g. wxPython, rely on this, so do it in the same way
when using configure for consistency.

See #23021.

(cherry picked from commit 934fb8c228f8df70eba918fa05e06c5c945b9b22)
2022-12-05 23:23:26 +01:00
PB
92a63f016a Always use vendor in CMake-built DLLs regardless of version
The vendor string was ignored for the stable wxWidgets versions (e.g.,
3.2). However, vendor should be always used when available, regardless
of wxWidgets version. The only case when vendor should not be used is
when creating official builds (currently not done with CMake).

See #22931.

(cherry picked from commit 48434622c6f797f0f54d40da61b327f3dca081c8)
2022-11-12 17:47:15 +01:00
PB
bf2b837fd2 Update comments in setup_inc.h and various wx/setup.h files
Update the outdated or just plain incorrect comments.

See #22857.

(cherry picked from commit c22f6ba4fc0b49631ea85f2566490d1066f23a65)
2022-11-12 17:47:15 +01:00
Vadim Zeitlin
ec7120a1ba CMake: use output directory under wx directory in the build tree
This is a combination of the following commits from master:

85105681d3 Use wxSOURCE_DIR and wxBINARY_DIR in config.cmake for consistency
1212247f3d Download WebView2 under current, and not top level, directory
3dcb7a415f Use output directory under wx directory in the build tree

See #22814.

(cherry picked from commit 359138321eef76af0fc62aeca084af0f940b1e4d)
2022-09-24 15:39:36 +02:00
Vadim Zeitlin
9de789d992 Fix for missing X11 libraries when linking wxGTK2 statically
We must always use them with wxGTK2, so don't check wxHAVE_GDK_X11 for
it, otherwise we're never going to include X11 libraries when using it,
but they are always required.

See #22813.

(cherry picked from commit 3d80c2beee9d5c59c0442c51c2392af669468ee5)
2022-09-24 15:38:52 +02:00
Maarten Bent
418c84d6e3 CMake: Restore wx-config variables
This was erroneously removed in ad75a77bc6 (CMake: Cleanup the
wx_configure_script macro, 2021-10-27).

Fixes #22806.

See #22809.

(cherry picked from commit 49b62441b53d81d4d1dc48438c7b76852fb0fb04)
2022-09-18 17:49:05 +02:00
Vadim Zeitlin
109ae40aed Merge branch 'cmake-gtk-printing' of https://github.com/MaartenBent/wxWidgets
CMake: Add GTK Printing support.

And show the extra toolkit options in the CMake summary, fix using
libnotify and gnomevfs with gtk3 and fix some unused parameter warnings
when using gtk2 or gtk3 on Windows.

See #22745, #22762.

(cherry picked from commit d9a78be16c95ec9b6877cda93d2446b711cc3d4e)
2022-09-03 23:40:00 +02:00
Maarten Bent
c62c7d6728 Use built-in NanoSVG in CMake build by default
Since we do not provide a FindNanoSVG module, we should use the built-in
version of the library by default. And prevent warnings about not being
able to find the package configuration file.

See #22748.

(cherry picked from commit 9b0f715f55169cf983f24d7acc730ea80ba9cbad)
2022-08-29 13:11:30 +02:00
Vadim Zeitlin
be7f1af640 CMake: Improve linking with OpenGL libraries
Don't replace OPENGL_LIBRARIES, but prepend existing targets too it.
Also add OPENGL_EGL_INCLUDE_DIRS to OPENGL_INCLUDE_DIR.

See #22649.

Closes #22677.

(cherry picked from commit 667c5c843b89ed46e3a64242f94487866cb8c3be)
2022-08-18 19:34:13 +02:00
Maarten Bent
a6d05742ac CMake: Disable wxUSE_JOYSTICK by default on non-Linux UNIX systems
(cherry picked from commit ebcec1f8b7941e1808d2713aafd0aac48c75ff7d)
2022-08-14 17:15:51 +02:00
Maarten Bent
739e8c6ede CMake: Don't enable CXX warnings for C files
Move the warning definitions inside the if-statements.
Don't use -Wno-ctor-dtor-privacy and -Woverloaded-virtual for C files, to fix
'is valid for C++/ObjC++ but not for C' warning.

See #22696

(cherry picked from commit 9861386fef6d1eb5f1a523712cd5712e0f3cd627)
2022-08-14 17:15:51 +02:00
Maarten Bent
f2c75c2264 CMake: Check if joystick is supported
Disable wxUSE_JOYSTICK if linux/joystick.h is not found on Linux systems.

See #22646

(cherry picked from commit 97a787a1eeb42b3fa739faa44a627c8f5dc66083)
2022-08-14 17:15:51 +02:00
Vadim Zeitlin
664d1617be Fix problems with CMake install target
Handle DESDIR and spaces in the installation path correctly.

Closes #22610.

(cherry picked from commit 43d0eb48c15ab87ecb8d20a145f9f374f4ff745e)
2022-07-24 18:31:00 +02:00
Thomas Klausner
ad239fd80e Fix dlopen() detection in CMake under non-Linux systems.
Linux (until recently) defined dlopen() in libdl, but some other
operating systems (such as NetBSD) have it in libc.

Use CMake-provided variable for the name of the library to use for
dlopen() to fix NetBSD build.

Closes #22644.

(cherry picked from commit 9efe21b55a162f970bbbc187c2127068fef5bd74)
2022-07-24 18:31:00 +02:00
Thomas Klausner
1fc52bd453 Detect statvfs in CMake builds too
This is a combination of 1b1155305601f2198383188a621255c6837fab9d from
master and minimal changes to make the code compile when both statvfs()
and statfs() are available.

This commit is best viewed with Git --color-moved
--color-moved-ws=ignore-all-space -w options.
2022-07-24 18:29:43 +02:00
Maarten Bent
978271ee81 CMake: Support target files of multiple builds
For example vc_lib, vc_x64_lib, vc_dll, vc_x64_dll, gcc_lib and gcc_dll all in
the same installation location. Disable the architecture (32 vs 64 bit)
compatibility check in the version file.
2022-06-18 17:06:16 +02:00
Maarten Bent
f6631a3d6a CMake: Create a config file for use with find_package
The config file uses the wxWidgetsTargets file to find all the libraries that
can be linked to.

It supports checking for components (e.g. base, core, aui, gl) and fails if a
requested component is not found.

Set the version compatibility to SameMinorVersion (when CMake supports this),
because different minor wxWidgets versions (3.0 and 3.1/3.2) are expected to
break API.

Because the default libraries are named like wx::wxname, create an alias that
is just called wx::name. CMake older than 3.18 does not support creating an
alias to non-global imported targets, so manually create a library with the
same properties.

The wxWidgets CMake build only builds the Release and Debug configurations, but
when creating a (MSVC) CMake project it also contains MinSizeRel and
RelWithDebInfo configurations. By default these seems to use the Debug
libraries, causing build errors. Map them to the Release libraries instead.

Also create a wxWidgets_LIBRARIES variable that can be used to link with, so
users can keep using the same variables from FindwxWidgets.
2022-06-18 17:06:15 +02:00
Maarten Bent
ef29f744bf CMake: Allow to use wxLIB_TARGETS in install.cmake
Move include of install.cmake below library inclusions, so wxLIB_TARGETS will
be filled with all the built libraries once install.cmake is executed.
2022-06-18 16:08:35 +02:00
Maarten Bent
9ffe6f5575 CMake: Use correct INSTALL_INTERFACE include directory on Linux
The headers are installed in 'include/wx-3.1/', so also use this in the INSTALL_INTERFACE.
Determine wxINSTALL_INCLUDE_DIR only once and reuse it in install.cmake.
2022-06-18 16:08:35 +02:00
Maarten Bent
9d7577677e CMake: Consistent [wx_]install usage
Use wx_install macro so install is only used when wxBUILD_INSTALL is set.
The install.cmake script has a check for wxBUILD_INSTALL, so don't use it there.
2022-06-18 16:08:35 +02:00
Maarten Bent
2e2e96f8aa CMake: Don't use Windows path separators in install prefix
Sometimes CMake complains that the backslash is interpreted as unknown escape symbol.
2022-06-18 16:08:29 +02:00
Maarten Bent
efa5cfcaa9 CMake: Prevent double directory separators 2022-06-18 15:37:52 +02:00
Maarten Bent
40847aef4b CMake: Fix building with wxUSE_WEBVIEW_EDGE_STATIC
Add the directory only to the build interface, not to the install
interface. INTERFACE_LINK_DIRECTORIES can't use paths that are prefixed
in the source (or build) directory.

Closes #22524.
2022-06-16 13:02:15 +01:00
Vadim Zeitlin
96cb1b5d7d Add new wx/filedlgcustomize.h to the list of files
Notably install it together with the other headers.

Closes #22516.
2022-06-11 15:13:38 +02:00
Vadim Zeitlin
3ffc739e0e Only read BMP pixel data from stream in LoadBMPData()
This makes the code much more clear: LoadDib() now reads all the header
data while LoadBMPData() reads bitmap data only and doesn't read any
header values any more, unlike before.

It also allows not to have to pass neither bmpOffset nor IsBmp
parameters to LoadBMPData(), making its argument list much more
reasonable.

Finally, and, most importantly, it fixes loading bitmaps using
BI_BITFIELDS that was broken back in cccda9ef6b (Fix loading colour
palette from BMP file, 2019-12-28).

This commit also adds a unit test checking that this doesn't get broken
again without anyone noticing.

See #18634.

Closes #22499.
2022-06-08 23:49:18 +01:00
Vadim Zeitlin
2373b4ca24 Construct the test bitmaps directly in wxImageList test code
Don't use external image files, this makes it simpler to run the test
(it can be now done from any directory) and also experiment with it
(e.g. by making the test image fully transparent or fully opaque).

Remove the now unneeded .ico file but keep the .png one still used by
another test.
2022-05-23 15:05:47 +01:00
Maarten Bent
86b33600bc CMake: Check all known NanoSVG target names 2022-05-11 01:55:19 +02:00
Maarten Bent
138d1ab021 CMake: Support header-only NanoSVG library
Check if the NanoSVG target defines any library locations.
Add a private compile definition to wxcore, instead of adding another setup.h option.
2022-05-11 01:55:19 +02:00
Maarten Bent
603c13aaba CMake: Add support for external NanoSVG library 2022-05-11 01:54:03 +02:00
Maarten Bent
931370f0ad Add NanoSVG setup options
An option to enable or disable using NanoSVG for rasterizing SVG files.
And an option to indicate an external NanoSVG library is used.
2022-05-05 22:15:49 +02:00
Maarten Bent
c8bfd53d13 CMake: Fix using Windows path separator in wxINSTALL_PREFIX 2022-05-05 22:07:52 +02:00
Maarten Bent
fb8e860c05 CMake: Include third-party library directories when they are defined
Recent versions of CMake's FindJPEG also has the _DIRS variant.
2022-05-05 22:07:52 +02:00
Maarten Bent
fed52eb716 CMake: Mark Cairo and other module variables as advanced 2022-04-26 21:25:56 +02:00
Maarten Bent
deaa43e32d CMake: Remove workaround for removing png headers from cairo
CAIRO_INCLUDE_DIRS does not include them with the current FindCairo.cmake.
2022-04-24 18:47:43 +02:00
Maarten Bent
a2ddfcf80b CMake: Fix warning when copying inplace config
Quote all parameters to ensure paths are handled properly.
2022-04-20 20:33:28 +02:00
Maarten Bent
24e20d80e3 CMake: Enable building with Cairo renderer on MSW without GTK 2022-04-20 20:33:18 +02:00
kkocdko
02741a6c92 CMake: Fix build with wxBUILD_MONOLITHIC
Add wxUSE_WEBVIEW test before using wx_webview_copy_webview2_loader.

Closes #22315, #22316.
2022-04-16 15:38:44 +02:00
Maarten Bent
4fa3b8c276 CMake: Fix the minimum supported version
Change the minimum version to 3.0. Version 2.8.12 has never worked,
because it does not support the VERSION parameter in project().

Replace GREATER_EQUAL comparisons, these are only supported since 3.7.

Move PCH related code to a separate file, and include it after
options.cmake and init.cmake. Because only then the wxBUILD_PRECOMP
variable is fully initialized.

Closes #22312.
2022-04-16 15:35:49 +02:00
Vadim Zeitlin
105e81a4b0 Merge branch 'cmake-gtk2' of github.com:MaartenBent/wxWidgets
Fix some CMake and build warnings with GTK2.

See #22305.
2022-04-14 23:19:54 +02:00