[mapguide-commits] r9464 - in trunk/MgDev: . Common/MdfModel Oem/DWFTK/develop/global/src/dwf/package/writer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jan 24 23:02:39 PST 2019


Author: jng
Date: 2019-01-24 23:02:39 -0800 (Thu, 24 Jan 2019)
New Revision: 9464

Modified:
   trunk/MgDev/CMakeLists.txt
   trunk/MgDev/Common/MdfModel/UnicodeString.h
   trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWF6PackageVersionExtension.h
   trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWFXPackageVersionExtension.h
Log:
#2791: Xerces on Ubuntu 18.04 defines XMLCh as char16_t. This breaks our MdfModel build as we are 'forward-declaring' XMLCh based on the pre-3.2 definition. This commit adds a CMake compilation check for this typedef and flips a new _XERCES_USES_CHAR16_T_ symbol which UnicodeString.h will use to set the appropriate XMLCh typedef. Also fix some DWF Toolkit warnings

Modified: trunk/MgDev/CMakeLists.txt
===================================================================
--- trunk/MgDev/CMakeLists.txt	2019-01-23 14:38:17 UTC (rev 9463)
+++ trunk/MgDev/CMakeLists.txt	2019-01-25 07:02:39 UTC (rev 9464)
@@ -201,6 +201,22 @@
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${linkname} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${component})
 endmacro(install_symlink)
 
+# See if Xerces typedefs XMLCh to char16_t
+# This would be the case on Ubuntu 18.04 for its version of xerces-c (3.2.0)
+check_cxx_source_compiles(
+    "#include <xercesc/util/Xerces_autoconf_config.hpp>
+    #include <type_traits>
+    int main() {
+        static_assert(std::is_same<XMLCh, char16_t>::value, \"Xerces XMLCh is not char16_t\");
+    }" 
+XERCES_USES_CHAR16_T)
+if (XERCES_USES_CHAR16_T)
+    add_definitions(-D_XERCES_USES_CHAR16_T_)
+    message(STATUS "Xerces typedefs XMLCh to char16_t")
+else (XERCES_USES_CHAR16_T)
+    message(STATUS "Xerces does not appear to typedef XMLCh to char16_t")
+endif (XERCES_USES_CHAR16_T)
+
 add_subdirectory(BuildTools)
 add_subdirectory(Oem)
 add_subdirectory(Common)

Modified: trunk/MgDev/Common/MdfModel/UnicodeString.h
===================================================================
--- trunk/MgDev/Common/MdfModel/UnicodeString.h	2019-01-23 14:38:17 UTC (rev 9463)
+++ trunk/MgDev/Common/MdfModel/UnicodeString.h	2019-01-25 07:02:39 UTC (rev 9464)
@@ -26,10 +26,14 @@
 using namespace std;
 
 // Define character type for UTF-16.  This is used by Xerces C++.
-#ifdef _NATIVE_WCHAR_T_DEFINED
-    typedef wchar_t  XMLCh;
+#ifdef _XERCES_USES_CHAR16_T_
+    typedef char16_t XMLCh;
 #else
-    typedef unsigned short  XMLCh;
+    #ifdef _NATIVE_WCHAR_T_DEFINED
+        typedef wchar_t  XMLCh;
+    #else
+        typedef unsigned short  XMLCh;
+    #endif
 #endif
 
 // Define character type for UTF-32.  This is the same as the wchar_t type

Modified: trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWF6PackageVersionExtension.h
===================================================================
--- trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWF6PackageVersionExtension.h	2019-01-23 14:38:17 UTC (rev 9463)
+++ trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWF6PackageVersionExtension.h	2019-01-25 07:02:39 UTC (rev 9464)
@@ -20,6 +20,18 @@
 #ifndef _DWFTK_DWF6_PACKAGE_VERSION_EXTENSION_H
 #define _DWFTK_DWF6_PACKAGE_VERSION_EXTENSION_H
 
+// These are new warnings raised by g++ on Ubuntu 18.04, it thinks major and minor
+// are symbols defined through including sys/types.h, this is not the case for us
+// so #undef them
+#ifndef _WIN32
+#ifdef major
+#undef major
+#endif
+#ifdef minor
+#undef minor
+#endif
+#endif
+
 ///
 ///\file        dwf/package/writer/DWF6PackageVersionExtension.h
 ///\brief       This file contains the DWF6PackageVersionExtension interface declaration.

Modified: trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWFXPackageVersionExtension.h
===================================================================
--- trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWFXPackageVersionExtension.h	2019-01-23 14:38:17 UTC (rev 9463)
+++ trunk/MgDev/Oem/DWFTK/develop/global/src/dwf/package/writer/DWFXPackageVersionExtension.h	2019-01-25 07:02:39 UTC (rev 9464)
@@ -20,6 +20,18 @@
 #ifndef _DWFTK_DWFX_PACKAGE_VERSION_EXTENSION_H
 #define _DWFTK_DWFX_PACKAGE_VERSION_EXTENSION_H
 
+// These are new warnings raised by g++ on Ubuntu 18.04, it thinks major and minor
+// are symbols defined through including sys/types.h, this is not the case for us
+// so #undef them
+#ifndef _WIN32
+#ifdef major
+#undef major
+#endif
+#ifdef minor
+#undef minor
+#endif
+#endif
+
 ///
 ///\file        dwf/package/writer/DWFXPackageVersionExtension.h
 ///\brief       This file contains the DWFXPackageVersionExtension interface declaration.



More information about the mapguide-commits mailing list