Commit Graph

65 Commits

Author SHA1 Message Date
David Korth
43b9691078 [cmake] 64BitTimeSupportFcntl.cpp: This file was missing...
Copied it from rom-properties.

This broke the Launchpad Ubuntu 20.04 armhf build. Not going to resubmit
it, because I don't think anyone will be using rvthtool on that OS and
platform...

(cherry picked from commit d9f4ec96f1)
2025-06-17 00:43:32 -04:00
David Korth
603243205e [qrvthtool] Set KAboutData.
TODO:
- Use KCrash, but it shows bugs.kde.org as the bug reporting address...
- KIO writes to qrvthtoolrc in ~/.config/, and it doesn't seem like
  there's any way to easily fix this, since KIO uses the default
  path (QStandardPaths::GenericConfigLocation) for KSharedConfig.
2025-06-07 11:21:33 -04:00
David Korth
a823d358d6 NETWORK.md: Add a file to indicate what network access is performed.
rvthtool (and other programs included with rvthtool) does not access the
network directly, but may access the network if you attempt to open files
located on network shares.

Install NETWORK.md in the documents directory.

[cmake] options.cmake: Add OPTION(INSTALL_DOC).
2025-06-01 13:11:52 -04:00
David Korth
71c41db758 Improve Qt version detection.
- Set the default to "AUTO".

- For "AUTO", check for Qt6 first, then Qt5.

- Instead of linking to ${QT_NS}::WinMain, which doesn't exist on Qt6,
  just don't set QtX_NO_LINK_QTMAIN. (This works for Qt5, too.)
  - NOTE: Qt6 has QtEntryPoint instead.
2025-05-21 18:30:00 -04:00
David Korth
27ba56c693 [cmake] Backport more changes from rom-properties.
Changes include:
- Add RelWithDebugInfo flags.
- Add NixOS handling.
- Add ENABLE_WERROR.
- Add more warning flags.
- Add "-fprofile-update=atomic" for code coverage.
- Fix DT_RELR.
- Enable C++ assertions for libstdc++ and libc++.
2025-05-21 18:14:39 -04:00
David Korth
2029a71346 [cmake] CheckNettle2or3.cmake: Also export NETTLE_FOUND in the PARENT_SCOPE.
NETTLE_FOUND may be used to determine if libnettle should be
linked to other libraries and/or executables.

This fixes a regression from commit 03ce73c612.
([cmake] CheckNettle2or3.cmake: Convert the macro to a function.)
2024-05-17 22:42:35 -04:00
David Korth
f86d5c4ad4 [cmake] CheckNettle2or3.cmake: Set HAVE_NETTLE locally *and* in PARENT_SCOPE.
Otherwise, encryption will be disabled, even if Nettle is available.

This fixes a regression from commit 03ce73c612.
([cmake] CheckNettle2or3.cmake: Convert the macro to a function.)

Also, remove the ENABLE_DECRYPTION section. That's a leftover from
rom-properties, and rvthtool *requires* support for decryption.
2024-05-17 22:37:44 -04:00
David Korth
736d626554 [cmake] CPUInstructionSetFlags.cmake: PowerPC should set CPU_ppc64 or CPU_ppc, *not* CPU_arm64 or CPU_arm.
Copy/paste error. Oops.

(copied over from rom-properties)
2024-04-26 21:30:17 -04:00
David Korth
eec1d68907 [cmake] Check64BitTimeSupport.cmake: Don't set TMP_TIME64_FOUND_TIME_BITS if C++ support is broken.
Not sure how I didn't notice this before... (probably because
I don't regularly test the 32-bit i386 version, and Ubuntu
didn't ship glibc-2.34 in any LTS releases.)

(copied over from rom-properties)
2024-04-26 21:29:20 -04:00
David Korth
8ef919bbcb [cmake] cmake_uninstall.cmake.in: Use EXECUTE_PROCESS() instead of EXEC_PROGRAM().
EXECUTE_PROCESS() has been around since at least 3.0, and EXEC_PROGRAM()
is deprecated as of 3.28:

CMake Warning (dev) at cmake/cmake_uninstall.cmake:12 (EXEC_PROGRAM):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.

(copied over from rom-properties)
2024-04-26 21:26:51 -04:00
David Korth
e3f6c26281 [cmake] SplitDebugInformation.cmake: Add --strip-all to the second objcopy command.
Combining the removal of .gnu_debuglink into the objcopy command had the
effect of losing `strip`'s usual stripping functionality. Add the
`--strip-all` parameter to restore it.

Copied over from rom-properties.

This fixes a regression from commit 43372103cb.
(Port over CMake changes from rom-properties.)
2024-02-20 23:44:36 -05:00
David Korth
03ce73c612 [cmake] CheckNettle2or3.cmake: Convert the macro to a function.
Set HAVE_NETTLE in PARENT_SCOPE.
2024-02-20 23:43:07 -05:00
David Korth
43372103cb Port over CMake changes from rom-properties.
- CPUInstructionSetFlags.cmake: Add more CPU architectures.

- DirInstallPaths.cmake: Set ${TARGET_CPU_ARCH} and add more
  CPU architectures.

- FindNETTLE.cmake: Use ${TARGET_CPU_ARCH}.

- SplitDebugInformation.cmake: Add the `mold` workaround.

- options.cmake: Disable split debug by default on macOS.

- platform.cmake: Minor cleanups.

- gcc.cmake: Code coverage cleanup, check for "--no-undefined" and
  "--no-allow-shlib-undefined" (but only allow them on Linux),
  and check for "-ftree-vectorize".

- msvc.cmake:
  - Add: /we4477 /MP /guard:cf /guard:ehcont /permissive-
  - On i386 only: /SAFESEH
  - Disable /Zc:externC /Zc:noexceptTypes on Clang.
  - Disable thread-safe statics only on i386 and amd64.

- win32-gcc.cmake, win32-msvc.cmake:
  - Various flag changes.
2023-11-25 10:09:48 -05:00
David Korth
af560c4ee9 Use CMAKE_<LANG>_STANDARD instead of custom macros.
CMake 3.1 added CMAKE_<LANG>_STANDARD, which allows CMake to determine
what flags are needed to select a particular language version.

Set it to C17 and C++17. Previously, we were using C11 and C++11,
though gcc11 switched the default C++ version to C++17. The custom
macro handled this by not adding flags for C++, but it still added
the C11 flag, which prevented use of C17.

Ported over from rom-properties.
2023-11-25 09:43:53 -05:00
David Korth
011e261972 [cmake] FindNETTLE.cmake: Set NETTLE_FOUND and HAVE_NETTLE on Windows.
Otherwise, the include paths aren't set correctly, and the AppVeyor
build fails.
2022-08-07 21:33:31 -04:00
David Korth
994ae2046b [qrvthtool] AboutDialog: Display the GNU Nettle version.
[libwiicrypto] config.libwiicrypto.h.in: Nettle version macros.

[cmake] CheckNettle2or3.cmake: Check if it's Nettle 3.x.

TODO: The Libraries tab needs to be RichText now.
2022-08-07 19:33:45 -04:00
David Korth
fa08e296c8 [cmake] FindNETTLE.cmake: s/Nettle/NETTLE/
This fixes a CMake warning:

CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (Nettle)
  does not match the name of the calling package (NETTLE).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/libs/FindNETTLE.cmake:22 (find_package_handle_standard_args)
  src/CMakeLists.txt:74 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.
2022-08-07 19:15:00 -04:00
David Korth
31ee8efcfb [cmake] Renamed 'modules' to 'libs'. 2022-08-07 19:13:14 -04:00
David Korth
41977b819b [cmake] DirInstallPaths.cmake: Don't install to architecture-specific subdirectories.
This is needed for rom-properties, since we have to provide both
32-bit and 64-bit DLLs for proper shell integration, but rvthtool
is only packaged for a single architecture.
2022-08-07 18:02:01 -04:00
David Korth
9fcc17d6bf [qrvthtool] Add an AppStream metainfo XML.
Unlike rom-properties, this is only installed as part of qrvthtool.

The metainfo XML lists all of the installed executables, not just
qrvthtool.
2022-08-06 11:05:16 -04:00
David Korth
01334c3a97 [cmake] gcc.cmake: Reorder DT_RELR detection to show the status message before checking ld. 2022-08-06 02:05:28 -04:00
David Korth
420fa1bc31 [cmake] platform/gcc.cmake: Initial support for detecting DT_RELR.
Currently only supported if using glibc-2.36 and binutils-2.38.

TODO:
- Detect more systems with DT_RELR.
- Handle cross-compiling better?
2022-08-05 00:43:45 -04:00
David Korth
1a992e41ff [qrvthtool] CMakeLists.txt: Use macros for the XDG paths.
Rename the .desktop file to com.gerbilsoft.qrvthtool.desktop.

TODO: Maybe com.gerbilsoft.rvthtool.qrvthtool.desktop? Not that
I'd be making a GTK+ UI frontend anytime soon...
2022-08-03 18:44:01 -04:00
David Korth
2a5e19ac43 Rename FindNettle and FindSeccomp to FindNETTLE and FindSECCOMP.
CMake 3.17's FIND_PACKAGE() is complaining that the package name
doesn't match the filename. Rename the filenames to match.
2022-07-12 18:33:18 -04:00
David Korth
c13e700bfd [cmake] Backport more CMake changes from rom-properties.
This includes string format strictness, so update stuff to handle
those changes correctly.

[qrvthtool] BankEntryView: Mark changeEvent() as final.
2022-07-12 18:29:44 -04:00
David Korth
17f03eb4a8 [cmake] FindNettle.cmake: DirInstallPaths is still needed for installation on Windows. 2022-07-12 18:28:11 -04:00
David Korth
425db80b54 [cmake] INCLUDE(CPUInstructionSetFlags) where necessary.
Needed as part of the previous rom-properties backport.
2022-07-12 18:10:55 -04:00
David Korth
67de549aff [cmake] Backported a lot of CMake changes from rom-properties. 2022-07-12 18:04:42 -04:00
David Korth
4e5d89ed35 Use reentrant time functions if available.
Copied the following from rom-properties:
- time_r.h
- config.libc.h.in
- CheckSymbolExistsOrInline.cmake
2022-02-14 21:36:32 -05:00
David Korth
0d3b555cad Initial support for compiling with Qt6.
TODO:
- Toolbar icons aren't showing up.
- BankEntryView: Qt::DefaultLocaleShortDate was removed in Qt6,
  so using QLocale instead. Cache the QLocale?
- viewOptions() is final in most widgets, so it's disabled in Qt6 builds.
  See if we can reimplement this better.
- Qt6's moc doesn't like incomplete structs.
2022-02-12 11:20:27 -05:00
David Korth
0800b93156 [cmake] FindNettle.cmake: s/NETTLE_/Nettle_/g
CMake was complaining about this:

CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (NETTLE)
  does not match the name of the calling package (Nettle).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/modules/FindNettle.cmake:22 (find_package_handle_standard_args)
  src/CMakeLists.txt:22 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.
2022-02-12 00:42:25 -05:00
David Korth
4798c01548 [cmake] platform.cmake: Fix ARM CPU detection. 2021-05-19 18:15:20 -04:00
David Korth
3b4181c5f2 [nettle] Updated the Win32 precompiled build of Nettle from 3.5.1 to 3.7.2. 2021-04-03 04:14:29 -04:00
David Korth
0d98bea72a [cmake] platform.cmake: Detect other 32-bit ARM variants. 2021-03-07 12:21:53 -05:00
David Korth
ef9dada963 cmake/platform.cmake: Fix 32-bit ARM platform detection.
Reported by @vaguerant.
2021-03-03 20:43:10 -05:00
David Korth
6ca6180f43 Copied various CMake module updates from rom-properties.
- Changed several macros to functions, e.g. C/C++ language version checks.
- Improved CPU architecture detection.
- Improved LFS detection on some *BSD platforms.
- Preliminary support for Windows on ARM.
- Added toolchain files for i686 and x86_64 MinGW-w64.
2020-06-20 14:01:52 -04:00
David Korth
1245d127b7 [cmake] FindNettle.cmake: Use CPU_* instead of CMAKE_SYSTEM_PROCESSOR.
The 32-bit AppVeyor build ended up using lib.amd64, which failed.
2019-12-30 14:29:02 -05:00
David Korth
36aaca94aa [nettle] Updated the Win32 precompiled build of Nettle from 3.4 to 3.5.1.
Reorganized directories to match rom-properties' gettext.win32 layout.
- Single include directory.
- lib.i386 and lib.amd64 library directories.
2019-12-30 14:16:18 -05:00
David Korth
feda58ac7e [extlib] Moved the precompiled Win32 Nettle from win32/ to extlib/nettle.win32/. 2019-12-30 13:33:07 -05:00
David Korth
2716a4eee1 [cmake] FindNettle.cmake: DirInstallPaths is still needed for the install destinations. 2019-12-30 13:17:41 -05:00
David Korth
5f7d92636e [cmake] FindNettle.cmake: ${arch} isn't set by DirInstallPaths anymore. 2019-12-30 13:13:57 -05:00
David Korth
67c4bd045e [cmake] Copied CMake updates from rom-properties. 2019-12-30 13:10:03 -05:00
David Korth
2255359dea [qrvthtool] Copied over TaskbarButtonManager from mcrecover.
It doesn't seem to work on KDE5. Apparently, the standard task manager
in Plasma 5 uses Unity's protocol, but we don't have libunity on all
systems.

Unity has a D-Bus protocol, but it's supposedly not guaranteed to be
stable. In practice, it is.

QtCreator added support for the D-Bus protocol a while back:
https://codereview.qt-project.org/#/c/33051/2/src/plugins/coreplugin/progressmanager/progressmanager_x11.cpp
2019-03-16 02:01:28 -04:00
David Korth
56929bf421 [locale] Added localization files.
Based on similar files from mcrecover.

[qrvthtool] TranslationManager: Search for rvthtool_*.qm,
not mcrecover_*.qm.
2018-09-30 21:48:58 -04:00
David Korth
6404db3781 [qrvthtool] Added LanguageMenu and TranslationManager.
Based on the same classes from mcrecover.

TODO:
- Add some translations.
- Persistent configuration. I don't think porting mcrecover's ConfigStore
  is the right thing to do here.
2018-09-30 21:24:22 -04:00
David Korth
7708203283 [cmake] DirInstallPaths.cmake: Added Mac OS X install paths. 2018-09-23 15:35:56 -04:00
David Korth
2343a0eb75 Split Wii encryption code from librvth into libwiicrypto.
This will allow us to reuse the encryption code for the new wadtool,
which will allow converting debug WADs to retail and vice-versa.

This also moves common.h, byteorder.h, byteswap.h, gcn_structs.h,
and win32/.

Moved nettle detection to src/CMakeLists.txt and a separate config file.
2018-09-23 10:48:42 -04:00
David Korth
cf281ba7f7 [cmake] FindNettle.cmake: Set NETTLE_LIBRARY and HOGWEED_LIBRARY on Windows.
Otherwise, it won't find nettle_version_major.

NOTE: This symbol isn't actually used right now...
(It's used on rom-properties to display the version number in AboutTab.)
2018-06-07 00:20:42 -04:00
David Korth
e103237897 [cmake] platform/win32.cmake: Fix the manifest processor architecture on i386.
We need to check CMAKE_CL_64, not just ${CMAKE_SYSTEM_PROCESSOR}, since
that variable indicates the host system, which is always 64-bit
regardless of the target architecture.

Copied from rom-properties commit 7a6793922a5da7a404ecd9ddc128eeb7c7d69b46.
2018-06-07 00:09:00 -04:00
David Korth
cb0cbbc692 Install documentation; remove architecture from Windows install paths.
The architecture was needed for rom-properties, but we're only going to
distribute single-arch ZIPs for rvthtool.
2018-04-25 23:23:13 -04:00