[extlib] Enable pugixml's built-in DLL postfix option.

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 commit is contained in:
David Korth 2025-04-01 03:07:44 -04:00
parent 55f86d1158
commit 95e1b19473
4 changed files with 38 additions and 4 deletions

14
extlib/CMakeLists.txt vendored
View File

@ -254,6 +254,20 @@ IF(USE_INTERNAL_XML)
SET(BUILD_SHARED_LIBS OFF)
ENDIF()
SET(PUGIXML_USE_VERSIONED_LIBDIR OFF)
SET(PUGIXML_USE_POSTFIX ON)
SET(PUGIXML_STATIC_CRT OFF)
SET(PUGIXML_BUILD_TESTS OFF)
SET(PUGIXML_WCHAR_MODE OFF)
SET(PUGIXML_COMPACT OFF)
SET(PUGIXML_INSTALL ON)
# TODO: Investigate these.
SET(PUGIXML_NO_XPATH OFF)
SET(PUGIXML_NO_STL OFF)
SET(PUGIXML_NO_EXCEPTIONS OFF)
# Build PugiXML.
ADD_SUBDIRECTORY(pugixml)
SET_EXTLIB_PROPERTIES(pugixml-shared)

View File

@ -11,6 +11,7 @@ include(CMakePackageConfigHelpers)
include(CMakeDependentOption)
include(GNUInstallDirs)
IF(0) # rom-properties
cmake_dependent_option(PUGIXML_USE_VERSIONED_LIBDIR
"Use a private subdirectory to install the headers and libraries" OFF
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
@ -26,6 +27,7 @@ cmake_dependent_option(PUGIXML_STATIC_CRT
cmake_dependent_option(PUGIXML_BUILD_TESTS
"Build pugixml tests" OFF
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
ENDIF(0) # rom-properties
# Custom build defines
set(PUGIXML_BUILD_DEFINES CACHE STRING "Build defines for custom options")
@ -35,20 +37,27 @@ separate_arguments(PUGIXML_BUILD_DEFINES)
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
# Expose option to build PUGIXML as static as well when the global BUILD_SHARED_LIBS variable is set
IF(0) # rom-properties
cmake_dependent_option(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS
"Build both shared and static libraries" OFF
"BUILD_SHARED_LIBS" OFF)
ENDIF(0) # rom-properties
SET(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS OFF)
IF(0) # rom-properties
# Expose options from the pugiconfig.hpp
option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
option(PUGIXML_COMPACT "Enable compact mode" OFF)
option(PUGIXML_INSTALL "Enable installation rules" ON)
ENDIF(0) # rom-properties
IF(0) # rom-properties
# Advanced options from pugiconfig.hpp
option(PUGIXML_NO_XPATH "Disable XPath" OFF)
option(PUGIXML_NO_STL "Disable STL" OFF)
option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
mark_as_advanced(PUGIXML_NO_XPATH PUGIXML_NO_STL PUGIXML_NO_EXCEPTIONS)
ENDIF(0) # rom-properties
if (APPLE)
option(PUGIXML_BUILD_APPLE_FRAMEWORK "Build as Apple Frameworks" OFF)

View File

@ -55,8 +55,10 @@ static const TCHAR rp_subdir[] = _T("riscv64\\");
# define ROMDATA_PREFIX
# ifdef NDEBUG
# define DEBUG_SUFFIX ""
# define PUGI_DEBUG_SUFFIX ""
# else
# define DEBUG_SUFFIX "d"
# define PUGI_DEBUG_SUFFIX "_d"
# endif
#else
# define ROMDATA_PREFIX "lib"
@ -69,7 +71,7 @@ static const char *const dll_whitelist[] = {
#endif /* RP_LIBROMDATA_IS_DLL */
"zlib1" DEBUG_SUFFIX ".dll",
"libpng16" DEBUG_SUFFIX ".dll",
"pugixml.dll", // FIXME: pugixml needs a 'd' suffix for debug builds.
"pugixml" PUGI_DEBUG_SUFFIX "dll",
"zstd" DEBUG_SUFFIX ".dll",
"lz4" DEBUG_SUFFIX ".dll",
"minilzo" DEBUG_SUFFIX ".dll",

View File

@ -2,6 +2,9 @@
MACRO(SET_DELAYLOAD_EXTLIB_FLAGS)
IF(MSVC)
UNSET(DL_DLLS)
UNSET(DL_DEBUG_DLLS)
UNSET(DL_RELEASE_DLLS)
IF(NOT USE_INTERNAL_ZLIB OR USE_INTERNAL_ZLIB_DLL)
SET(DL_DLLS ${DL_DLLS} zlib1)
ENDIF(NOT USE_INTERNAL_ZLIB OR USE_INTERNAL_ZLIB_DLL)
@ -9,7 +12,9 @@ IF(MSVC)
SET(DL_DLLS ${DL_DLLS} libpng16)
ENDIF(NOT USE_INTERNAL_PNG OR USE_INTERNAL_PNG_DLL)
IF(NOT USE_INTERNAL_XML OR USE_INTERNAL_XML_DLL)
SET(DL_DLLS ${DL_DLLS} pugixml)
# PugiXML uses a different postfix scheme.
SET(DL_DEBUG_DLLS ${DL_DLLS} pugixml_d)
SET(DL_RELEASE_DLLS ${DL_DLLS} pugixml)
ENDIF(NOT USE_INTERNAL_XML OR USE_INTERNAL_XML_DLL)
IF(NOT USE_INTERNAL_ZSTD OR USE_INTERNAL_ZSTD_DLL)
SET(DL_DLLS ${DL_DLLS} zstd)
@ -33,8 +38,12 @@ IF(MSVC)
SET(DL_DEBUG_FLAGS "${DL_DEBUG_FLAGS} /DELAYLOAD:${_dll}d.dll")
SET(DL_RELEASE_FLAGS "${DL_RELEASE_FLAGS} /DELAYLOAD:${_dll}.dll")
ENDFOREACH()
# FIXME: pugixml needs a 'd' suffix for debug builds.
SET(DL_DEBUG_FLAGS "${DL_DEBUG_FLAGS} /DELAYLOAD:pugixml.dll")
FOREACH(_dll ${DL_DEBUG_DLLS})
SET(DL_DEBUG_FLAGS "${DL_DEBUG_FLAGS} /DELAYLOAD:${_dll}.dll")
ENDFOREACH()
FOREACH(_dll ${DL_RELEASE_DLLS})
SET(DL_RELEASE_FLAGS "${DL_RELEASE_FLAGS} /DELAYLOAD:${_dll}.dll")
ENDFOREACH()
# libgnuintl-8.dll is precompiled. (Release build only)
IF(ENABLE_NLS)