Commit Graph

139 Commits

Author SHA1 Message Date
David Korth
37dcb72e6b CMakeLists.txt: Use .99 versions for CMake VERSION_GREATER checks. 2025-06-16 21:44:24 -04:00
David Korth
440bb7aeb5 Increase minimum CMake versions to "3.5...3.10".
CMake 4.0 drops compatibility with versions older than 3.5, and warns
that compatibility with < 3.10 will be dropped in a "future version".

CMake 3.30 previously warned about dropping support for older than
3.5, which was changed in 3.31 to older than 3.10.
2025-05-25 15:39:40 -04:00
David Korth
c0c8b2582c CMakeLists.txt: Enable policy CMP0177 if it's available.
This fixes a bunch of warnings similar to the following:

CMake Warning (dev) at src/kde/kf5/CMakeLists.txt:370 (INSTALL):
  Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
  "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.
2025-05-25 15:29:54 -04:00
David Korth
5538794477 Missed a few TinyXML2 remnants. Updated for PugiXML. 2025-04-02 00:19:34 -04:00
David Korth
55f86d1158 Add an internal copy of PugiXML and remove TinyXML2 completely.
TODO:
- Add the 'd' postfix to the debug DLL.
- Configure PugiXML options and hide them from the user, since these are
  configured by rom-properties.
2025-04-01 19:19:20 -04:00
David Korth
a547396dca CMake 3.5: Work around some issues with C_STANDARD and CXX_STANDARD not working properly for C11/C++11.
Needed for Ubuntu 16.04.

This *might* be related to commit af0e29f7eb.
(CMakeLists.txt: Use C++20 if it's available.)
2025-03-23 15:25:36 -04:00
David Korth
c482059c27 CMakeLists.txt: s/libfmt/fmt/ 2025-03-21 18:23:31 -04:00
David Korth
840844930d CMakeLists.txt: Fix ENDIF() for the MSVC version check for C99.
CMAKE_SYSTEM_VERSION returns 10.0 on my Win7 VM because I'm manually
specifying that version.

On Win10 with VS2022, it returns 10.0.22621.

On both systems, CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION returns
10.0.22621.0, regardless of whether or not CMAKE_SYSTEM_VERSION is
manually set.
2025-03-20 23:20:01 -04:00
David Korth
69c2083baf CMakeLists.txt: Only disable C99 if using MSVC with a Windows SDK older than 10.0.18362.0. 2025-03-20 23:10:52 -04:00
David Korth
af0e29f7eb CMakeLists.txt: Use C++20 if it's available.
rp-libfmt.h:

- Make FSTR() a no-op if building as C++20, since fmt::format() can do
  its own compile-time checking using `consteval` without FMT_STRING().

- Add FRUN() annotations to all gettext-translated strings. This is
  needed in order to bypass the automatic compile-time format checking
  when using C++20.

- Add FSTR() annotations to some format strings where it was missing.

WiiUFstPrint: Change some fmt::print() that don't actually use formatting
back to fputs().
2025-03-20 23:06:34 -04:00
David Korth
33f5725781 CMakeLists.txt: Fix the closing block for IF(POLICY CMP0151).
CMake Warning (dev) in CMakeLists.txt:
  A logical block opening on the line

    /home/david/programming/rom-properties/CMakeLists.txt:6 (IF)

  closes on the line

    /home/david/programming/rom-properties/CMakeLists.txt:8 (ENDIF)

  with mis-matching arguments.
This warning is for project developers.  Use -Wno-dev to suppress it.
2025-01-26 19:49:26 -05:00
David Korth
1f8dc86386 CMakeLists.txt: Set policy CMP0151. (introduced in CMake-3.27)
clang complains about namespace pollution in generated moc_*.cpp files:

In file included from src/kde/kf5/kfilemetadata_rom-properties-kf5_autogen/mocs_compilation.cpp:2:
src/kde/kf5/kfilemetadata_rom-properties-kf5_autogen/BKZOEHIFDQ/moc_ExtractorPluginKF5.cpp:1082:17:
    warning: using namespace directive in global context in header [-Wheader-hygiene]
 1082 | using namespace RomPropertiesKF5;
      |                 ^

Setting CMP0151 tells AUTOGEN to add the include paths using -isystem,
which tells clang it shouldn't print warnings about these files.
2025-01-25 15:57:13 -05:00
David Korth
fa932de93f [libfmt] Add an internal copy of libfmt-11.1.2.
Currently used as a header-only build. Will eventually be changed to
build a DLL for Windows and Mac OS X.

Other changes needed to get the Windows version to build with libfmt:

Add #include <fmt/xchar.h> to some files for full wchar_t support
in libfmt. Otherwise, errors like this appear:

src\amiibo-data\amiiboc.cpp(175,8): error C2665: 'fmt::v11::print': no overloaded function could convert all the argument types
extlib\libfmt\include\fmt\base.h(2925,17): message : could be 'void fmt::v11::print<TCHAR*&>(FILE *,fmt::v11::fstring<TCHAR *&>,TCHAR *&)'
src\amiibo-data\amiiboc.cpp(175,8): message : 'void fmt::v11::print<TCHAR*&>(FILE *,fmt::v11::fstring<TCHAR *&>,TCHAR *&)': cannot convert argument 2 from 'wmain::<lambda_1>::()::FMT_COMPILE_STRING' to 'fmt::v11::fstring<TCHAR *&>'
src\amiibo-data\amiiboc.cpp(175,22): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
extlib\libfmt\include\fmt\base.h(2908,17): message : or       'void fmt::v11::print<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR*&>(fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>,wmain::<lambda_1>::()::FMT_COMPILE_STRING &&,TCHAR *&)'
src\amiibo-data\amiiboc.cpp(175,8): message : 'void fmt::v11::print<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR*&>(fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>,wmain::<lambda_1>::()::FMT_COMPILE_STRING &&,TCHAR *&)': cannot convert argument 1 from 'FILE *' to 'fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>'
src\amiibo-data\amiiboc.cpp(175,14): message : No constructor could take the source type, or constructor overload resolution was ambiguous
src\amiibo-data\amiiboc.cpp(175,8): message : while trying to match the argument list '(FILE *, wmain::<lambda_1>::()::FMT_COMPILE_STRING, TCHAR *)' [build.vc17_64\src\amiibo-data\amiiboc.vcxproj]

Files modified for xchar.h:
- amiibo-data/amiiboc.cpp
- libromdata/stdafx.h (needed by WiiUPackage)
- libromdata/tests/RomHeaderTest.cpp

NOTE: Only included on Windows. xchar.h was added in libfmt-8.0.0,
which was first added (in Ubuntu LTS releases) in Ubuntu 20.04.
It's not needed on Linux, anyway.

New option USE_INTERNAL_FMT to force the use of the internal copy of
libfmt on Linux, for testing purposes. (...and also for Ubuntu 16.04)
- TODO: Maybe use it on 18.04, etc. for improved performance?
2025-01-21 23:59:20 -05:00
David Korth
64e860f545 [librpbase] Initial switch to libfmt for string formatting.
This will replace printf()-style functions in most cases, and will
replace all uses of rp_sprintf() and related.

NOTE: We need to use FMT_STRING() [which we're abbreviating FSTR] if
compiling without C++20 support; otherwise, string format checking won't
be done. We're not targetting C++20 at the moment.

Also, string format checking can't be done when using gettext. This also
applied to printf(), so it's not a big deal per se.

NOTE: Support for C++-style format strings (std::print) was added in
gettext-0.22, so gettext-0.22 will be required in order to update the
.pot and .po files.

FIXME: libfmt has its own "PACKED" definition, which conflicts with our
own. We should rename our "PACKED" to "RP_PACKED".

TODO: Add an internal copy of libfmt for Windows.
2025-01-21 00:55:40 -05:00
David Korth
ee2ae12571 CMakeLists.txt: Indicate if APNG support is available.
Note that APNG s loaded using dlopen(), so even if it isn't available
at compile-time, it might be available at runtime.
2025-01-10 23:55:55 -05:00
David Korth
4e5ce09a05 [tracker] Enable the INSTALL rules.
While the code itself supports all three API versions, we're only
supporting installing into a single version directory. Added
auto-detection to detect what version is installed, plus a manual
override using TRACKER_INSTALL_API_VERSION to explicitly specify
which version to use.

Ubuntu versions and Tracker API versions:
- 16.04: v1
- 18.04: v2
- 20.04: v2
- 22.04: v3
- 24.04: v3

[debian] rules: Explicitly specify the API version so we don't need to
install the Tracker packages when building.
2024-03-30 10:55:41 -04:00
David Korth
dfe25bb3df Increase minimum CMake version to 3.5; move CMP0048/CMP0063 settings to the top-level CMakeLists.txt file.
Ubuntu 16.04 has CMake 3.5, so we can target that as the minimum
version. Also, recent CMake versions (3.27+) have started printing
warnings if the minimum is less than 3.5.

CMake Deprecation Warning at CMakeLists.txt:2 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
2024-02-20 19:18:19 -05:00
David Korth
b9cace109d CMakeLists.txt: VERSION_GREATER_EQUAL was added in CMake 3.7.
Xubuntu 16.04 has CMake 3.5, so use VERSION_GREATER instead.
2024-01-08 20:26:13 -05:00
David Korth
d7c6362b50 CMakeLists.txt: FIXME: Windows SDK prior to 10.0.18362.0 has issues when compiling as either C11 or C17.
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winbase.h(8816,5): warning C5105: macro expansion producing 'defined' has undefined behavior
C:\Program Files (x86)\Windows Kits\8.1\Include\um\oaidl.h(473,17): warning C5103: pasting '/' and '/' does not result in a valid preprocessing token
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\wtypes.h(742,1): message : in expansion of macro '_VARIANT_BOOL'
C:\Program Files (x86)\Windows Kits\8.1\Include\um\oaidl.h(473,17): error C2059: syntax error: '/'

Force C99 when compiling with MSVC for now.
2023-10-21 13:00:23 -04:00
David Korth
6ab2951d89 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.

No code size differences were observed when compiling on gcc-13.2.0
with CMAKE_<LANG>_STANDARD.
2023-10-21 11:44:35 -04:00
David Korth
e405aed196 [kde] Enable KF6 builds.
With the previous minor changes, the KF6 build seems to be working
exactly like the KF5 build in KDE Neon.
2023-08-04 22:41:57 -04:00
David Korth
16554a91aa Fix some issues causing XFCE to be incorrectly enabled if GTK2 is missing.
BUILD_XFCE is an option; BUILD_GTK2 is not.

We should probably get rid of BUILD_GTK2 entirely, since I'm not planning
on adding support for GNOME 2 Nautilus anytime soon.

Also, don't attempt to build rom-properties-glib if none of the GTK UI
frontends are being built.

Fixes CMake issues when building on KDE Neon. (KF6 testing)
2023-08-04 21:54:03 -04:00
David Korth
9c9dd100c4 Add some more ARM64EC checks and print the target CPU architecture in the summary.
ARM64EC is always checked before ARM64 (in case both are defined for
some reason) and AMD64 (because MSVC defines _M_AMD64 on ARM64EC builds).

CPUInstructionSetFlags.cmake: Set both CPU_arm64 and CPU_arm64ec.
TODO: Does the Win32 manifest processor architecture change for ARM64EC?

DirInstallPaths.cmake: Set TARGET_CPU_ARCH. This is now used by the
summary at the end of the root CMakeLists.txt.

i18n.c, DelayLoadHelper.c: Add ARM64EC.

CMakeLists.txt: Print ${TARGET_CPU_ARCH}.
2023-07-16 13:47:45 -04:00
David Korth
f8a291ca96 CMakeLists.txt: Set CMAKE_LINK_DEPENDS_NO_SHARED=ON.
This tells CMake to not re-link executables if a shared library's
implementation has changed but its headers haven't changed.

Should improve build performance when modifying a .cpp file in
libromdata, since it won't have to re-link all of the UI frontends
and unit tests.
2023-02-24 23:53:10 -05:00
David Korth
e7867b7d21 [cmake] options.cmake: Add an option to disable installation of documentation.
Some distributions install documentation using distro-specific build
scripts, so add an option to allow our documentation install to be
disabled.

Specify -DINSTALL_DOC=OFF on the CMake command line.
2023-02-10 18:49:46 -05:00
David Korth
56a52f779c CMakeLists.txt: Disable libromdata.so when using afl; print the libromdata library type in Build Summary.
afl-fuzz crashes when trying to load libromdata.so for some reason.
2022-09-24 16:49:39 -04:00
David Korth
e0c1e78635 Merge remote-tracking branch 'Clownacy/master'
This removes the default "Release" build type, as per Arch requirements.
2022-07-17 14:17:54 -04:00
David Korth
8cc29bda90 Increase the minimum CMake version to 3.4.
CMake 3.2 added FindIntl.cmake for gettext.
CMake 3.4 added STRING(APPEND), which is used by Qt5's CMake files.

Update the toplevel project's CMake requirement and remove the
requirements on all lower-level projects, except for third-party
libraries.

Reported by @DankRank.
2022-07-14 19:37:36 -04:00
David Korth
350b5c98b4 CMakeLists.txt: Move the program name display to the build summary.
It previously got lost in the cruft of all the other CMake messages.
2022-07-04 05:18:00 -04:00
David Korth
b67b89607e [xdg] rp-config.desktop.in: Added an XDG desktop file for rp-config.
This will add a "ROM Properties configurator" entry to the applications
menu on most Linux desktop environments.

TODO:
- Custom rom-properties icon instead of "media-flash".
- GTK+ rp-config implementation.

Fixes #295: [Feature Request] rp-config launcher
Reported by @Amnesia1000.
2022-05-21 13:42:41 -04:00
David Korth
38fd0352d2 CMakeLists.txt: Indicate GTK4 if it's enabled. 2021-07-30 20:53:42 -04:00
David Korth
d89550e587 Install NETWORK.md in the Windows ZIPs and Debian packages.
It turns out we never actually included it in distribution packages,
though it was always included in the source packages.
2021-07-28 22:13:09 -04:00
Clownacy
568b4fd52c
Remove forcing Release build in CMake
Forcing the Release build type when `CMAKE_BUILD_TYPE` is undefined or set to 'None' is annoying for Arch package maintainers and general users who just want to provide their own compiler flags without CMake interfering.

https://wiki.archlinux.org/title/CMake_package_guidelines#CMake_can_automatically_override_the_default_compiler_optimization_flag
2021-07-20 11:11:16 +01:00
David Korth
c3f4db832c [zlib] Updated from v1.2.11 to zlib-ng v2.0.0-RC2.
https://github.com/zlib-ng/zlib-ng
2021-02-18 23:50:27 -05:00
David Korth
7d302b51c9 [minizip] Updated from v2.10.5 to minizip-ng 3.0.0.
As of 3.0.0, the minizip fork is now called minizip-ng.

https://github.com/zlib-ng/minizip-ng
2021-02-17 18:38:19 -05:00
David Korth
567af35525 CMakeLists.txt: Use version.txt in CONFIGURE_FILE().
This isn't actually used as a configuration file, but it forces CMake to
rerun if the file is changed.
2020-09-20 15:05:30 -04:00
David Korth
a3a1b6e1af CMakeLists.txt: Moved the version number into a file version.txt.
This will allow us to retrieve version.txt from GitHub to determine if
an update is available.
2020-09-20 00:45:11 -04:00
David Korth
7b282f5d81 [minilzo] Added an internal copy of MiniLZO.
I chose MiniLZO instead of regular LZO because we only need to be able to
decompress LZO1X blocks.

[libromdata] CisoPspReader: Don't call lzo_init() if this JISO isn't
actually using LZO. Otherwise, if the DLL is missing on Windows, the
program will crash.
2020-09-05 11:05:12 -04:00
David Korth
640cb2bf8a [libromdata] CisoPspReader: Added initial support for JISO.
It has a unique header, but the index entries table is similar to the
other formats. It does *not* set the high bit to indicate NC; instead,
it uses the same method as CISOv2, where the compressed block size
matches the uncompressed block size.

Compression algorithm is lzo1x.

TODO:
- JISO supports NC areas. Figure this part out.
- Add LZO to extlib.
2020-09-05 05:03:29 -04:00
David Korth
d5d38f67a6 [libromdata] CisoPspReader: Added LZ4 decompression for CISO and ZISO.
ZISO is basically CISO v0/v1 but with LZ4 instead of zlib.

CISO v2 can use either zlib or LZ4 on a per-block basis.

[cmake] Added LZ4 checks.
- TODO: Add an internal copy of LZ4.
2020-09-05 01:27:59 -04:00
David Korth
3370832b21 Change USE_SECCOMP to ENABLE_EXTRA_SECURITY and use it for Windows and OpenBSD, too.
This option now controls seccomp(), Win32 low integrity processes,
and OpenBSD pledge() and tame(). It's recommended to keep it enabled
everywhere, though on Linux it may need to be disabled if a glibc
update breaks things due to new syscalls.

appveyor.cmd, travis.sh: Set ENABLE_EXTRA_SECURITY.
2020-08-20 19:05:01 -04:00
David Korth
5645e9f9b5 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.
2020-07-17 18:43:00 -04:00
Cameron Cawley
a600b119ef Remove leftover references to OpenGL 2020-07-13 14:06:44 +01:00
David Korth
6418f99bab Version bump for development. (v1.6.1+) 2020-07-13 00:22:15 -04:00
David Korth
d793703740 rom-properties 1.6.1 2020-07-12 23:57:27 -04:00
David Korth
1bb267ff7d Version bump for development. (v1.6+) 2020-07-12 17:23:43 -04:00
David Korth
4c39562f85 rom-properties 1.6 2020-07-12 15:00:26 -04:00
David Korth
f8fdaa7ae8 Allow disabling ZSTD entirely using ENABLE_ZSTD.
Similar to ENABLE_XML.

Print ZSTD status in the build summary.
2020-06-27 03:09:19 -04:00
David Korth
dc587561b4 [zstd] Added zstd for use with MiniZip.
MiniZip 2.10.0 added support for zstd as a compression method, so we
should support it.

Note that a system version of zstd is preferred on Linux systems.

Enabled the MiniZip test tools for manual builds only. Info-ZIP hasn't
been updated in a while, so I'm going to use the MiniZip test tools to
compress ZIP archives using zstd.

Enabled MiniZip compression in order to compress stuff using the minizip
test program.

mz_strm_zstd.c: FIXME: Compression level doesn't work. Hard-coded the
maximum compression level for now.
2020-06-27 03:09:15 -04:00
David Korth
6ab0fc824a CMakeLists.txt: Print the security mechanism in use.
travis-ci still isn't using seccomp for some reason...
2020-06-25 23:30:51 -04:00