Commit Graph

19 Commits

Author SHA1 Message Date
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
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
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
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
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
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
67c4bd045e [cmake] Copied CMake updates from rom-properties. 2019-12-30 13:10:03 -05: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
6db3029cb1 [librvth] reader.c: #include "reader_plain.h".
Otherwise, it assumes a default return value of 'int' for
reader_plain_open(), which crashes on 64-bit.

[cmake] platform/gcc.cmake: Added -Werror=implicit-function-declaration
to prevent this from happening again.
2018-04-22 16:42:29 -04:00
David Korth
1e55a7e508 [cmake] Check for C11 in addition to C99.
C11 has _Static_assert(), which is needed for ASSERT_STRUCT().
2018-02-17 21:21:19 -05:00
David Korth
3cb37b56f6 [cmake] msvc.cmake: Disable std::tr1 deprecation warnings.
Some MSVC 2017 update added deprecation warnings for std::tr1.
Google Test 1.8.0 still uses it, so disable the warnings for now.
2018-01-26 22:06:35 -05:00
David Korth
fe3cef3991 [librvth] aesw.h: Initial AES wrapper functions.
Currently only supports AES-128-CBC, which is used by Wii discs for the
encrypted title key and encrypted sectors. Backends are the same as for
RSA: GNU Nettle and Microsoft CryptoAPI. (Actually, the RSA signature
decryption uses GMP, but Nettle uses GMP also.)

[cmake] win32-gcc.cmake: Minimum version is now XP due to the use of
CryptoAPI's AES functionality.
2018-01-24 23:50:26 -05:00
David Korth
ac3412b460 [cmake] win32-msvc.cmake: Raise the minimum version of 32-bit Windows to XP.
Needed for CryptoAPI AES. (Not currently used, but will be used later.)
2018-01-20 01:34:09 -05:00
David Korth
f9fc1a0119 Reverted back to the CheckC99CompilerFlag and CheckCXX11CompilerFlag macro files.
c_std_99 was added in CMake 3.8, which is a fairly recent version.
Ubuntu 17.04 has CMake 3.9, but 16.10 has 3.7.2. Hence, we shouldn't
use it in order to remain compatible with at least Ubuntu 16.04 LTS.
2018-01-17 20:53:55 -05:00
David Korth
5af31f1d74 Fixed issues compiling with 32-bit MSVC 2010.
- win32-msvc.cmake: Fix copy/paste errors from GCN MemCard Recover.
- stdbool.h was added in MSVC 2013, so define the boolean types manually
  if it isn't available.
- MSVC 2010 doesn't support C99, so we have to declare variables at the
  beginning of blocks.
- main() needs to be __cdecl. (Or, I could remove the /Gz option I added
  to rom-properties in order to reduce the binary size a bit, but I'd
  rather keep that in.)
2018-01-16 00:33:35 -05:00
David Korth
f321fe5e65 Initial import of RVT-H Tool.
This program will allow for managing Nintendo RVT-H Reader devkits,
including dumping existing images and installing new images.

The current version doesn't actually do anything. It's mostly a copy
of the infrastructure from rom-properties, with some changes. In
particular, we're using CMake's TARGET_COMPILE_FEATURES() instead of
manually detecting C99 support.
2018-01-15 06:58:54 -05:00