This reduces the size of pugixml.dll to within range of what
tinyxml-10.dll was in previous versions.
Size comparisons: (amd64 release build, with LTO, MSVC 2022 17.6.5)
tinyxml-10.dll in rom-properties 2.4.1: 105,472
pugixml.dll:
- With all enabled: 222,208
- Disable XPATH: 142,336
- + disable STL: 121,856
- + disable exceptions: 121,856
NOTE: Disabling exceptions doesn't seem to change the code size at all,
even if STL is left enabled.
We're setting these using SET() in extlib/CMakeLists.txt, so having them
as actual options causes CMake to print a bunch of warnings like this:
CMake Warning (dev) at extlib/zlib-ng/CMakeLists.txt:133 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'WITH_SSE2'.
This warning is for project developers. Use -Wno-dev to suppress it.
[extlib] CMakeLists.txt: SET(WITH_VPCLMULQDQ ON)
A change in 4.0.8 results in ZEXPORT defaulting to nothing, which breaks
dllexports in the Windows version (and results in no import library
being generated).
Define ZEXPORT=__declspec(dllexport) to have the same behavior as 4.0.7.
pugixml uses "_d" instead of "d".
[pugixml] CMakeLists.txt: Disable options. The cmake_dependent_option()
setup for PUGIXML_USE_POSTFIX prevented the postfix from working because
the top-level source directory is not the same as PugiXML's directory.
[libwin32common] DelayLoadHelper: Handle PugiXML's "_d" postfix.
DelayLoadHelper.cmake has new variables for debug/release only DLLs,
which is used for PugiXML due to the different debug postfix.
This significantly reduces the total size. fmt-11.dll's Release build
size is 128 KiB, and it cuts between 16-64 KiB from binaries that use it.
Total size of EXEs and DLLs, with amiiboc.exe and libgnuintl-8.dll,
but without test executables or PDBs:
[MSVC 2022 v17.6.5, Release build]
- Total size of EXEs and DLLs with header-only: 4,332,032
- Total size of EXEs and DLLs with fmt-11.dll: 4,161,536
- Difference: -170,496
With test executables:
- Total size of EXEs and DLLs with header-only: 9,716,224
- Total size of EXEs and DLLs with fmt-11.dll: 7,907,840
- Difference: -1,808,384
TODO: Add Delay-Load checks for fmt-11.dll to e.g. rpcli and the
Win32 UI frontend. (amiiboc and unit tests don't need it.)
CMake 3.16.2 on AppVeyor (Win32) shows this error:
CMake Error in extlib/libfmt/CMakeLists.txt:
INTERFACE_LIBRARY targets may only have whitelisted properties. The
property "POSITION_INDEPENDENT_CODE" is not allowed.
CMake 3.31.0 on my Windows 7 VM didn't show this error...
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?
The recent PIC changes for the internal TinyXML2 somehow broke compiling
gtest_main on Windows:
extlib\googletest\googletest\src\gtest_main.cc(48): error C2491: 'main':
definition of dllimport function not allowed
Also disable gmock_main, since it depends on gtest_main.
We aren't actually using these, so it's not an issue.
(We implement our own main() in gtest_init.cpp.)
[extlib] CMakeLists.txt: Rename SET_EXTLIB_PROPERTIES_PIC() to
SET_EXTLIB_PROPERTIES_PIC_ONLY(), since SET_EXTLIB_PROPERTIES()
also sets POSITION_INDEPENDENT_CODE=TRUE.
Also use SET_EXTLIB_PROPERTIES_PIC_ONLY() for shared libraries that
may be installed, since we can't use SET_EXTLIB_PROPERTIES().
Adjusted SET_EXTLIB_PROPERTIES() to skip EXCLUDE_FROM_ALL if they're
being installed (i.e. SKIP_INSTALL_ALL is set when the function is
called).
This should fix a PIC issue when building the internal copy of
TinyXML2 on Linux, and possibly other libraries too:
/usr/bin/ld: lib/../extlib/tinyxml2/CMakeFiles/tinyxml2.dir/tinyxml2.cpp.o: warning: relocation against `stdout@@GLIBC_2.2.5' in read-only section `.text'
/usr/bin/ld: lib/../extlib/tinyxml2/CMakeFiles/tinyxml2.dir/tinyxml2.cpp.o: relocation R_X86_64_PC32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
Something changed that caused the build on Xubuntu 16.04 (32-bit) to fail:
[ 63%] Linking CXX shared library ../../lib/libromdata.so
/usr/bin/ld: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
src/libromdata/CMakeFiles/romdata.dir/build.make:3614: recipe for target 'lib/libromdata.so.6.0' failed
make[2]: *** [lib/libromdata.so.6.0] Error 1
Setting POSITION_INDEPENDENT_CODE instead of "-fpic -fPIC" fixes this.
[extlib] Correctly set properties on the 'mspack' target instead of
'libmspack'. Otherwise, libmspack won't have either EXCLUDE_FROM_ALL
or POSITION_INDEPENDENT_CODE.
- Don't install binaries. minigzip and minizip aren't compiled by
default, so attempting to install them will fail.
- Set SKIP_INSTALL_LIBRARIES to OFF when building DLLs.
- Disable installation of headers, import libraries, and .cmake files.
- Install PDB files.
Since we're now using MiniZip in the J2ME parser, it should be compiled
as a DLL instead of statically linked.
Disable zstd support. It's causing issues with DelayLoad, since we're not
loading zstd in the J2ME parser. I originally enabled this to potentially
improve compression for test cases, but I ended up using .tar.zst instead
of zstd-compressed .zip files.
[libwin32common] Add MiniZip DLL information.
[libromdata] J2ME: Add MiniZip delay-load handling.
[libromdata] GczReader: Improve delay-load handling a bit.
Without this renaming, these binaries are built automatically, even
though we don't need them most of the time.
With this renaming, they'll only be built if the user explicitly
specifies that they should be built.
This regressed when updating from minizip-ng v4.0.6 to v4.0.7 in
commit 3c90ea3d26.
Windows 2000 support only partially worked in rp-config. The actual
shell extension component didn't work.
Support for ANSI Windows was mostly just compile-tested, and it was
becoming a burden to support something almost no one will use.
Removed most `#ifdef UNICODE` and `#ifdef _UNICODE` branches in
favor of using the Unicode path exclusively.
Removed oldwincompat, which was an attempt to get things working
properly on Windows 9x and 2000 with the MSVC 2010 runtime.
rom-properties doesn't compile with MSVC 2010 anymore, so this
probably wasn't very useful anyways.
Consolidated tstring macros in tcharx.h.
Removed GUID_fns.c since it was only useful in ANSI builds.
zlib-ng v2.1 has significant performance improvements compared to v2.0.
In particular, decompression can be up to 56% faster on amd64 when
using AVX2 instructions.
FIXME: RomHeaderTest infinite-loops on Xubuntu 16.04 32-bit with 1.5 GB
RAM due to memory allocation issues. microtar_zstd.c doesn't ever receive
an "out of memory" error...
uniwidth provides a uc_width() function, which is similar to wcwidth().
Our version removes the 'encoding' parameter, which isn't needed because
we're always using UTF-8.
Fixes#353: rpcli: bad table alignment on multibyte characters
Reported by @DankRank.
https://github.com/nmoinvaz/minizip
NOTE: iconv support is disabled for now, since it isn't needed by any
of the test cases. It may be re-enabled later if minizip is needed for
the main program.
The JSON output code will be rewritten to use rapidjson, which will allow
us to add more stuff without having to worry if the resulting text has
the correct formatting.
This adds around 20 KB to the compiled binary.
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.
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.
It seems that the R and B channels are backwards, so we'll need to fix
that next. Other than that, both 2bpp and 4bpp decoding seems to work.
(A lot better than my terrible attempt, at least.)
[cmake] options.cmake: Added an option for PVRTC. The code is licensed
under the MIT license, but we might as well provide an option for it
because it's third-party code instead of my own code.
TODO:
- Fix R/B channel ordering.
- PVRTC-II decoding?
- Add PVRTC decoding to KTX and DDS.