Uses find_package_handle_standard_args to handle the find_package call
from the root CMakeLists. Removes all the unnecessary logic after the
find_package and just sets it to REQUIRED.
This PR rearranges things in the CMake system to make compiling with Qt6 possible
1. Camera API has changed in Qt6, so the camera feature is disabled
2. A previous fix involving QLocale is now version gated.
3. QRegExp replaced with QRegularExpression, see #5343
4. Qt6_LOCATION option added to specify a location to search for Qt6
(see examples below)
5. windeployqt is used to copy Qt6 files into the build directory on Windows
Notes for Arch Linux
Arch install happened to have qt6-base qt6-declarative qt6-translations installed
mkdir build && cd build
cmake .. -GNinja -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF -DENABLE_QT6=YES -DYUZU_USE_BUNDLED_QT=NO
Windows (MSVC)
Qt wants users to download precompiled libraries via an online installer,
it is worth noting that the GPL/LGPL takes precendence over any ...
In the Qt Maintenance tool, under a version, such as 6.3.1
Select "MSVC 2019 64-bit"
Under Additional Libraries Qt Multimedia may be of use for Camera support
For the Web Applet I had to select the following:
PDF Positioning WebChannel WebEngine
mkdir build && cd build
cmake -G "Visual Studio 16 2019" -DQt6_LOCATION=C:/Qt/6.4.0/msvc2019_64/ \
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=YES -DYUZU_USE_BUNDLED_QT=NO \
-DENABLE_QT_TRANSLATION=YES -DENABLE_QT6=YES ..
Some numbers for reference (msvc2019_64)
Qt5 (slimmed down) 508 MB
Qt5.15.2 all in 929 MB
Qt6.3.1 1.71 GB
Qt6.3.2 1.73 GB
Qt6.4.0-beta3 1.83 GB
Qt6.4.0 1.67 GB
- Prevent sleep via xdg-desktop-portal after fa7abafa5f
- Pause on suspend after b7642cff36
- Exit on SIGINT/SIGTERM after 9479940a1f
- Improve dark themes after b51db12567
vcpkg: Add Catch2 2.13.9
Catch2 >= 3.0 is not compatible with earlier versions, and for now we
must override the desired version in our vcpkg manifest. We can do this
programmatically by using VCPKG_MANIFEST_FEATURES.
CMakeLists: Search for lz4 CONFIG mode first
vcpkg's lz4 CONFIG cmake script works in Release mode but not in Debug
mode, failing to copy the correct DLLs at compile time.
We still need to search for the regular mode for system-installed
versions.
CMakeLists: Clean up boost exports
Remove some Conan-specific workarounds.
CMakeLists: Use vcpkg for MSVC by default
Not enabling it generally since it's much easier to have system
dependencies installed for Linux and MinGW.
[REUSE] is a specification that aims at making file copyright
information consistent, so that it can be both human and machine
readable. It basically requires that all files have a header containing
copyright and licensing information. When this isn't possible, like
when dealing with binary assets, generated files or embedded third-party
dependencies, it is permitted to insert copyright information in the
`.reuse/dep5` file.
Oh, and it also requires that all the licenses used in the project are
present in the `LICENSES` folder, that's why the diff is so huge.
This can be done automatically with `reuse download --all`.
The `reuse` tool also contains a handy subcommand that analyzes the
project and tells whether or not the project is (still) compliant,
`reuse lint`.
Following REUSE has a few advantages over the current approach:
- Copyright information is easy to access for users / downstream
- Files like `dist/license.md` do not need to exist anymore, as
`.reuse/dep5` is used instead
- `reuse lint` makes it easy to ensure that copyright information of
files like binary assets / images is always accurate and up to date
To add copyright information of files that didn't have it I looked up
who committed what and when, for each file. As yuzu contributors do not
have to sign a CLA or similar I couldn't assume that copyright ownership
was of the "yuzu Emulator Project", so I used the name and/or email of
the commit author instead.
[REUSE]: https://reuse.software
Follow-up to 01cf05bc75
Between packages breaking, Conan always being a moving target for
minimum required CMake support, and now their moves to Conan 2.0 causing
existing packages to break, I suppose this was a long time coming. vcpkg
isn't without its drawbacks, but at the moment it seems easier on the
project to use for external packages.
Mostly removes the logic for Conan from the root CMakeLists file,
leaving basic find_package()'s in its place. Sets only the
find_package()'s that require CONFIG mode as necessary. clang and linux
CI now use the vcpkg toolchain file configured in the Docker container
when possible.
mingw CI turns off YUZU_TESTS because there's no way on the container to
run Windows executables on a Linux host anyway, and it's not easy to get
Catch2 there.
The AppStream file is mostly copied from the one already used by the
Flatpak yuzu build:
62fc225acf/org.yuzu_emu.yuzu.metainfo.xml
As it already defines the application id as org.yuzu_emu.yuzu I renamed
the yuzu.desktop and yuzu.xml files so that they match.
I've also made some minor tweaks to it, like fixing the capitalization
of "yuzu", adding a few keys and sorting them as presented in the
documentation.
Lastly, I added PrefersNonDefaultGPU=true to the .desktop file so that
yuzu is launched with the dedicated graphics card on Linux.
The premise behind ad55faaa3 was due to an issue between Conan's
libiconv package and compiling SDL2 from our externals. Since none of
our Conan externals require libiconv any longer, though, we can remove
downloading our own Boost package and just rely on Conan again.
Additionally, removing CONFIG from the find_package(boost) call fixes
issues with finding Boost on Fedora and MSYS2, which was the main
motivation for this.
Also, remove QUIET since if something goes wrong finding Boost, this
makes it harder to tell what went wrong.
* this resolves the todo items in the CMakeLists.txt
* a version requirement check for ffmpeg is added to catch issues early
* for future-proof reasons, nasm/yasm is now only required when build on
x86/AMD64 systems
Presently, if you forget to initialize the git submodules before
running cmake, there'll be a helpful message that reminds you to do so.
However, on narrow terminals (e.g. 80 wide) there's a word wrap that
includes a new line in the middle of the git command, precluding easy
copy-paste. This moves the entire git command to its own line to avoid
such tragedies.
Before:
```
CMake Error at CMakeLists.txt:59 (message):
Git submodule externals/inih/inih not found. Please run: git submodule
update --init --recursive
```
After:
```
CMake Error at CMakeLists.txt:59 (message):
Git submodule externals/inih/inih not found. Please run:
git submodule update --init --recursive
```
This commit renames the "Services" tab to "Network" and adds a combobox that allows the user to select the network interface that yuzu should use. This new setting is now used to get the local IP address in Network::GetHostIPv4Address. This prevents yuzu from selecting the wrong network interface and thus using the wrong IP address. The return type of Network::GetHostIPv4Adress has also been changed.
On Linux, due to the way we include SDL2 as a submodule, it makes it
difficult for us to specify which SDL_config.h we intended to include.
Before, CMake would default to the dummy one included with SDL and
ignore the generated one.
This tells CMake to use the generated one. In addition, we define
USING_GENERATED_CONFIG_H to throw an error in case the dummy config is
used by accident. Fixes Vulkan not working on Linux yuzu-cmd.
When YUZU_USE_BUNDLED_QT was specified on a system with a compliant Qt
version installed, CMake configuration would cause an error due to
mixing YUZU_USE_BUNDLED_QT with the system Qt.
Solution is to only search for Qt when YUZU_USE_BUNDLED_QT is disabled.
As-is causes issues with building yuzu using MinGW GCC on Linux-based
machines. Only set the variable when needed. (I'm not quite sure how
this was working before.)
Drops usage of CMAKE_DEPENDENT_OPTION to allow using
YUZU_USE_BUNDLED_FFMPEG as an option on any platform. CI then now builds
FFmpeg always, netting about 10 MB less used on the AppImage.
Also somewhat fixes YUZU_USE_BUNDLED_QT so that it can be used even if
CMake doesn't clean up its state after running the first find_package.
Currently Qt will download whether or not the target system supports the
package. Normally this isn't an issue since the package manager would
work out the dependencies for us, but in this case we must make sure
everything is in place before downloading the package.
This checks for the package's requirements, as well as tries to provides
hints as to what is required on some of the more cryptic dependencies.
yuzu requires CMake 3.15 yet find_program was using REQUIRED, which is
only available on 3.18 and later. Instead, we check for
"<VAR>-NOTFOUND".
In addition, check for additional requirements before building libusb or
FFmpeg with autotools. Otherwise, CMake configuration will pass yet
compilation will fail.
Delegates libusb external communication to externals/CMakeLists.txt
Ensures an interface library `usb` for every pathway
input_common just links to the `usb` library now
externals/libusb/CMakeLists.txt sets variables to override SDL2's libusb
finding
Other minor cleanup
Building libusb was also broken on GCC (and maybe Clang) on our
CMakeLists after upgrading to 1.0.24, but it was not being checked
because our 18.04 container had libusb installed on it.
This builds on the MinGW work from earlier and extends it to the rest of
the GNU toolchains. In addition we make use of pkg-config when present
to find libusb. pkg-config is preferrable because we can specify a
minimum required version.
After updating to 1.0.24, MinGW fails to build libusb as a result of
numerous errors. So we build libusb their way and let them update the
nontrivial stuff.
This only applies to MinGW: the old path is still in use for Linux
toolchains as well as MSVC.
This will dynamically link libusb, since I hit build errors with the old
way we used to resolve the conflict with SDL2.
CMAKE_DEPENDENT_OPTION takes a value argument, but as a macro function
it will read a variable name as the name and not the value. For
YUZU_USE_BUNDLED_QT, ensure that we are reading the value of MSVC. For
YUZU_ALLOW_SYSTEM_SDL2, CMAKE_DEPENDENT_OPTION is redundant here anyway
as we don't use that path on any toolchain by default.
If the local version of Qt is older than the minimum version required by
yuzu, download a pre-built binary package from yuzu-emu/ext-linux-bin
and build yuzu with it, instead.
This also requires linking yuzu to the correct libraries after building
it, and copying over the required binaries when building yuzu.
This sets the Qt requirement to 5.12, which is intentionally behind the
versions used by our toolchains since they are not all updated yet to
5.15.
Without the CONFIG option, find_package will perform Module search. On
at least Linux Mint 20 (I'm unable to reproduce this on CentOS and Arch
Linux), my guess is that this causes CMake to find "dirty" modules that
modify the configuration state despite the Boost version being too
low/absent.
Use CONFIG to put CMake into pure Config mode and avoid Module search.
Building SDL2 from externals is incompatible with Conan's version of
libiconv, a requirement of Conan's Boost package. Solution is to use the
same Boost package in use by the linux-fresh container. This tells CMake
to download boost_1_75_0.tar.xz from yuzu-emu/ext-linux-bin at CMake's
configuration step, much the same way Qt and FFmpeg are downloaded for
Windows.
Also makes DownloadExternals.cmake cross-platform. Although the CMake
code is not entirely specific to Linux, only Linux has Boost libraries
available at ext-linux-bin, whereas there is no equivalent Boost package
for Windows at ext-windows-bin. caveat emptor
If SDL2 is not found, the error is handled by falling back to externals.
No need spill the full warning at the find_package if it's going to be
handled later, so add QUIET to it.
Sets find_package(FFmpeg) to QUIET instead of REQUIRED. This allows
using the FFmpeg external in cases where there is no suitable installed
version of FFmpeg.
Also fixes a bug where multiple CMake configures causes FFmpeg_LIBRARIES
to concatenate on itself, producing cyclical dependencies. Unsets the
variable before building it in the foreach loop.
Fixes FFmpeg_INCLUDE_DIR not including the headers generated at run
time.
Forces using SDL 2.0.14. Upgrades the SDL external to that version. Adds
a message when switching to the external.
Fixes an error where input_common only links to SDL when SDL2_FOUND is
set, but externals/CMakeLists cannot set that variable to the required
scope. Switch to using ENABLE_SDL2, which we can use since we now
include the SDL source.
Since Bintray is (soon to be) no more, there needs to be a way to
acquire SDL2. Since 20.04's version is older than our minimum required
version (2.0.12), add it as an external.
- Bintray will be deprecated on May 1st 2021 (https://bintray.com/)
- We were previously using this for Qt (non-Windows) and SDL.
- I've moved to bundled SDL on Windows.
We had used conan for opus before, but there was a bug in the AVX detection.
However we still had the Findopus.cmake file within the repository, but not used.
This patch reenables the Findopus helper and prefer the system wide installation of opus.