From bc2d690ad4f84fa19f8959e8e9dea038523da551 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sat, 30 Jul 2022 20:43:35 +0200 Subject: cmake|windows: Render .def file from a template to fix linking .. with -DEXPAT_DTD=OFF and/or -DEXPAT_ATTR_INFO=ON . --- expat/CMakeLists.txt | 14 +++++++- expat/Changes | 2 ++ expat/lib/Makefile.am | 3 +- expat/lib/libexpat.def | 79 -------------------------------------------- expat/lib/libexpat.def.cmake | 79 ++++++++++++++++++++++++++++++++++++++++++++ expat/lib/libexpatw.def | 79 -------------------------------------------- expat/win32/expat.iss | 2 +- 7 files changed, 96 insertions(+), 162 deletions(-) delete mode 100644 expat/lib/libexpat.def create mode 100644 expat/lib/libexpat.def.cmake delete mode 100644 expat/lib/libexpatw.def diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index 0e7e4fe6..2e9bac6b 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -363,7 +363,19 @@ set(_EXPAT_C_SOURCES if(EXPAT_SHARED_LIBS) set(_SHARED SHARED) if(MSVC) - set(_EXPAT_EXTRA_SOURCES ${_EXPAT_EXTRA_SOURCES} lib/libexpat.def) + macro(_expat_def_file_toggle source_var target_var) + if(${source_var}) + set(${target_var} " ") # i.e. not commented out, a single space + else() + set(${target_var} ";") # i.e. commented out + endif() + endmacro() + + _expat_def_file_toggle(EXPAT_DTD _EXPAT_COMMENT_DTD) + _expat_def_file_toggle(EXPAT_ATTR_INFO _EXPAT_COMMENT_ATTR_INFO) + + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lib/libexpat.def.cmake" "${CMAKE_CURRENT_BINARY_DIR}/lib/libexpat.def") + set(_EXPAT_EXTRA_SOURCES ${_EXPAT_EXTRA_SOURCES} "${CMAKE_CURRENT_BINARY_DIR}/lib/libexpat.def") endif() if(WIN32) # Add DLL version diff --git a/expat/Changes b/expat/Changes index a3dd3a76..2baea5f5 100644 --- a/expat/Changes +++ b/expat/Changes @@ -9,6 +9,8 @@ Release x.x.x xxx xxxxx xx xxxx other projects #597 #599 Windows|CMake: Add missing -DXML_STATIC to test runners and fuzzers + #512 #621 Windows|CMake: Render .def file from a template to fix + linking with -DEXPAT_DTD=OFF and/or -DEXPAT_ATTR_INFO=ON #620 CMake: Make documentation on variables a bit more consistent #610 Address Cppcheck 2.8.1 warning diff --git a/expat/lib/Makefile.am b/expat/lib/Makefile.am index d5402496..822a1389 100644 --- a/expat/lib/Makefile.am +++ b/expat/lib/Makefile.am @@ -74,8 +74,7 @@ EXTRA_DIST = \ iasciitab.h \ internal.h \ latin1tab.h \ - libexpat.def \ - libexpatw.def \ + libexpat.def.cmake \ nametab.h \ siphash.h \ utf8tab.h \ diff --git a/expat/lib/libexpat.def b/expat/lib/libexpat.def deleted file mode 100644 index 6d8acc96..00000000 --- a/expat/lib/libexpat.def +++ /dev/null @@ -1,79 +0,0 @@ -; DEF file for MS VC++ - -EXPORTS - XML_DefaultCurrent @1 - XML_ErrorString @2 - XML_ExpatVersion @3 - XML_ExpatVersionInfo @4 - XML_ExternalEntityParserCreate @5 - XML_GetBase @6 - XML_GetBuffer @7 - XML_GetCurrentByteCount @8 - XML_GetCurrentByteIndex @9 - XML_GetCurrentColumnNumber @10 - XML_GetCurrentLineNumber @11 - XML_GetErrorCode @12 - XML_GetIdAttributeIndex @13 - XML_GetInputContext @14 - XML_GetSpecifiedAttributeCount @15 - XML_Parse @16 - XML_ParseBuffer @17 - XML_ParserCreate @18 - XML_ParserCreateNS @19 - XML_ParserCreate_MM @20 - XML_ParserFree @21 - XML_SetAttlistDeclHandler @22 - XML_SetBase @23 - XML_SetCdataSectionHandler @24 - XML_SetCharacterDataHandler @25 - XML_SetCommentHandler @26 - XML_SetDefaultHandler @27 - XML_SetDefaultHandlerExpand @28 - XML_SetDoctypeDeclHandler @29 - XML_SetElementDeclHandler @30 - XML_SetElementHandler @31 - XML_SetEncoding @32 - XML_SetEndCdataSectionHandler @33 - XML_SetEndDoctypeDeclHandler @34 - XML_SetEndElementHandler @35 - XML_SetEndNamespaceDeclHandler @36 - XML_SetEntityDeclHandler @37 - XML_SetExternalEntityRefHandler @38 - XML_SetExternalEntityRefHandlerArg @39 - XML_SetNamespaceDeclHandler @40 - XML_SetNotStandaloneHandler @41 - XML_SetNotationDeclHandler @42 - XML_SetParamEntityParsing @43 - XML_SetProcessingInstructionHandler @44 - XML_SetReturnNSTriplet @45 - XML_SetStartCdataSectionHandler @46 - XML_SetStartDoctypeDeclHandler @47 - XML_SetStartElementHandler @48 - XML_SetStartNamespaceDeclHandler @49 - XML_SetUnknownEncodingHandler @50 - XML_SetUnparsedEntityDeclHandler @51 - XML_SetUserData @52 - XML_SetXmlDeclHandler @53 - XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - XML_ParserReset @55 - XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - XML_GetFeatureList @57 - XML_UseForeignDTD @58 -; added with version 1.95.6 - XML_FreeContentModel @59 - XML_MemMalloc @60 - XML_MemRealloc @61 - XML_MemFree @62 -; added with version 1.95.8 - XML_StopParser @63 - XML_ResumeParser @64 - XML_GetParsingStatus @65 -; added with version 2.1.1 -; XML_GetAttributeInfo @66 - XML_SetHashSalt @67 -; internal @68 removed with version 2.3.1 -; added with version 2.4.0 - XML_SetBillionLaughsAttackProtectionActivationThreshold @69 - XML_SetBillionLaughsAttackProtectionMaximumAmplification @70 diff --git a/expat/lib/libexpat.def.cmake b/expat/lib/libexpat.def.cmake new file mode 100644 index 00000000..cf434a22 --- /dev/null +++ b/expat/lib/libexpat.def.cmake @@ -0,0 +1,79 @@ +; DEF file for MS VC++ + +EXPORTS + XML_DefaultCurrent @1 + XML_ErrorString @2 + XML_ExpatVersion @3 + XML_ExpatVersionInfo @4 + XML_ExternalEntityParserCreate @5 + XML_GetBase @6 + XML_GetBuffer @7 + XML_GetCurrentByteCount @8 + XML_GetCurrentByteIndex @9 + XML_GetCurrentColumnNumber @10 + XML_GetCurrentLineNumber @11 + XML_GetErrorCode @12 + XML_GetIdAttributeIndex @13 + XML_GetInputContext @14 + XML_GetSpecifiedAttributeCount @15 + XML_Parse @16 + XML_ParseBuffer @17 + XML_ParserCreate @18 + XML_ParserCreateNS @19 + XML_ParserCreate_MM @20 + XML_ParserFree @21 + XML_SetAttlistDeclHandler @22 + XML_SetBase @23 + XML_SetCdataSectionHandler @24 + XML_SetCharacterDataHandler @25 + XML_SetCommentHandler @26 + XML_SetDefaultHandler @27 + XML_SetDefaultHandlerExpand @28 + XML_SetDoctypeDeclHandler @29 + XML_SetElementDeclHandler @30 + XML_SetElementHandler @31 + XML_SetEncoding @32 + XML_SetEndCdataSectionHandler @33 + XML_SetEndDoctypeDeclHandler @34 + XML_SetEndElementHandler @35 + XML_SetEndNamespaceDeclHandler @36 + XML_SetEntityDeclHandler @37 + XML_SetExternalEntityRefHandler @38 + XML_SetExternalEntityRefHandlerArg @39 + XML_SetNamespaceDeclHandler @40 + XML_SetNotStandaloneHandler @41 + XML_SetNotationDeclHandler @42 + XML_SetParamEntityParsing @43 + XML_SetProcessingInstructionHandler @44 + XML_SetReturnNSTriplet @45 + XML_SetStartCdataSectionHandler @46 + XML_SetStartDoctypeDeclHandler @47 + XML_SetStartElementHandler @48 + XML_SetStartNamespaceDeclHandler @49 + XML_SetUnknownEncodingHandler @50 + XML_SetUnparsedEntityDeclHandler @51 + XML_SetUserData @52 + XML_SetXmlDeclHandler @53 + XML_UseParserAsHandlerArg @54 +; added with version 1.95.3 + XML_ParserReset @55 + XML_SetSkippedEntityHandler @56 +; added with version 1.95.5 + XML_GetFeatureList @57 + XML_UseForeignDTD @58 +; added with version 1.95.6 + XML_FreeContentModel @59 + XML_MemMalloc @60 + XML_MemRealloc @61 + XML_MemFree @62 +; added with version 1.95.8 + XML_StopParser @63 + XML_ResumeParser @64 + XML_GetParsingStatus @65 +; added with version 2.1.1 +@_EXPAT_COMMENT_ATTR_INFO@ XML_GetAttributeInfo @66 + XML_SetHashSalt @67 +; internal @68 removed with version 2.3.1 +; added with version 2.4.0 +@_EXPAT_COMMENT_DTD@ XML_SetBillionLaughsAttackProtectionActivationThreshold @69 +@_EXPAT_COMMENT_DTD@ XML_SetBillionLaughsAttackProtectionMaximumAmplification @70 diff --git a/expat/lib/libexpatw.def b/expat/lib/libexpatw.def deleted file mode 100644 index 6d8acc96..00000000 --- a/expat/lib/libexpatw.def +++ /dev/null @@ -1,79 +0,0 @@ -; DEF file for MS VC++ - -EXPORTS - XML_DefaultCurrent @1 - XML_ErrorString @2 - XML_ExpatVersion @3 - XML_ExpatVersionInfo @4 - XML_ExternalEntityParserCreate @5 - XML_GetBase @6 - XML_GetBuffer @7 - XML_GetCurrentByteCount @8 - XML_GetCurrentByteIndex @9 - XML_GetCurrentColumnNumber @10 - XML_GetCurrentLineNumber @11 - XML_GetErrorCode @12 - XML_GetIdAttributeIndex @13 - XML_GetInputContext @14 - XML_GetSpecifiedAttributeCount @15 - XML_Parse @16 - XML_ParseBuffer @17 - XML_ParserCreate @18 - XML_ParserCreateNS @19 - XML_ParserCreate_MM @20 - XML_ParserFree @21 - XML_SetAttlistDeclHandler @22 - XML_SetBase @23 - XML_SetCdataSectionHandler @24 - XML_SetCharacterDataHandler @25 - XML_SetCommentHandler @26 - XML_SetDefaultHandler @27 - XML_SetDefaultHandlerExpand @28 - XML_SetDoctypeDeclHandler @29 - XML_SetElementDeclHandler @30 - XML_SetElementHandler @31 - XML_SetEncoding @32 - XML_SetEndCdataSectionHandler @33 - XML_SetEndDoctypeDeclHandler @34 - XML_SetEndElementHandler @35 - XML_SetEndNamespaceDeclHandler @36 - XML_SetEntityDeclHandler @37 - XML_SetExternalEntityRefHandler @38 - XML_SetExternalEntityRefHandlerArg @39 - XML_SetNamespaceDeclHandler @40 - XML_SetNotStandaloneHandler @41 - XML_SetNotationDeclHandler @42 - XML_SetParamEntityParsing @43 - XML_SetProcessingInstructionHandler @44 - XML_SetReturnNSTriplet @45 - XML_SetStartCdataSectionHandler @46 - XML_SetStartDoctypeDeclHandler @47 - XML_SetStartElementHandler @48 - XML_SetStartNamespaceDeclHandler @49 - XML_SetUnknownEncodingHandler @50 - XML_SetUnparsedEntityDeclHandler @51 - XML_SetUserData @52 - XML_SetXmlDeclHandler @53 - XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - XML_ParserReset @55 - XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - XML_GetFeatureList @57 - XML_UseForeignDTD @58 -; added with version 1.95.6 - XML_FreeContentModel @59 - XML_MemMalloc @60 - XML_MemRealloc @61 - XML_MemFree @62 -; added with version 1.95.8 - XML_StopParser @63 - XML_ResumeParser @64 - XML_GetParsingStatus @65 -; added with version 2.1.1 -; XML_GetAttributeInfo @66 - XML_SetHashSalt @67 -; internal @68 removed with version 2.3.1 -; added with version 2.4.0 - XML_SetBillionLaughsAttackProtectionActivationThreshold @69 - XML_SetBillionLaughsAttackProtectionMaximumAmplification @70 diff --git a/expat/win32/expat.iss b/expat/win32/expat.iss index 0cbfbc75..d57fd777 100644 --- a/expat/win32/expat.iss +++ b/expat/win32/expat.iss @@ -91,7 +91,7 @@ Flags: ignoreversion; Source: cmake\expat-config.cmake.in; DestDir: "{app}\Sour Flags: ignoreversion; Source: fuzz\*.c; DestDir: "{app}\Source\fuzz" Flags: ignoreversion; Source: lib\*.c; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.h; DestDir: "{app}\Source\lib" -Flags: ignoreversion; Source: lib\*.def; DestDir: "{app}\Source\lib" +Flags: ignoreversion; Source: lib\*.def.cmake; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: examples\*.c; DestDir: "{app}\Source\examples" Flags: ignoreversion; Source: tests\*.c; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.cpp; DestDir: "{app}\Source\tests" -- cgit v1.2.1