Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-776

Add CMake build system



    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.11
    • 1.12
    • XalanC
    • Patch



      The attached patch implements a CMake build for Xalan-C++. I have spent significant effort performing a "comprehensive" conversion of the existing GNU autotools and MSVC project file logic to a unified CMake build which supports all platforms with a single set of build files, as well as testing it on several platforms. The existing GNU autotools build and MSVC project builds will continue to function and are unaffected by this addition.

      This is a companion to https://issues.apache.org/jira/browse/XERCESC-2077 which was merged last year and included in Xerces-C++ 3.2.0.  I mentioned this work on the list last year in https://marc.info/?l=xalan-dev&m=149748238016328&w=2


      CMake is a meta-build system which generates the build files for a specified build system, such as make, Visual Studio msbuild, nmake, ninja or a number of other build tools and IDEs. This allows Xalan-C++ to be built on any supported platform with the native tools for that platform. The reason why I originally needed this was due to the large maintenance burden of patching the provided Visual Studio project files, both for fixing bugs in those files and in being able to support versions of Visual Studio which aren't yet supported by the provided project files or for unsupported configurations e.g. Clang/C2, other platforms etc. The lack of an install target also meant that to integrate this with a larger build required manually copying bits out of the build tree. The cost of debugging and patching the existing project files for use in our CI builds was getting too great--maintaining and using this CMake build out of tree will be cheaper and more robust. I thought it might benefit others to have this merged upstream so that it would be available to the benefit of all. I have done a direct conversion of the existing autoconf build logic.  The automake Makefile.am logic is directly represented in the corresponding CMakeLists.txt files.

      Unfortunately, and unlike for Xerces, the Xalan Autoconf build is in a very bad state, and it's become increasingly unusable over time.  It has these major problems:

      • No feature tests.  Platform-specific behaviour is hardcoded in "Include/XXXDefinitions.hpp" files which is inflexible and not future-proof as platforms evolve.  Autoconf feature tests could be used like in Xerces-C++
      • No Autoconf enable/with options.  Configuration is with a hacky and nonportable "runConfigure" script which works around the lack of options.
      • MinGW64 is broken right now because of a lack of feature test for gmtime_r / localtime_r, for example.  The static platform configuration says it doesn't have these functions, but it does and the build breaks because Xalan unnecessarily redefines them.

      The patch included here can't solve all these problems.  But right now I'm finding it extremely hard to build and install Xalan on a range of platforms, and the amount of effort required to patch all of the Project/Solution files, Autoconf/Automake files and platform-specific headers is untenable.  This CMake build will work on every platform.

      Some feature tests do require adding to the CMake build, replacing the Platform-specific headers, but I've not done that in this inital patch, which has a smaller scope of working with the existing headers without making any major changes.

      I'm prepared to do the extra work to bring this up to the equivalent state as already done for Xerces-C++ which will allow these libraries to build on all contemporary platforms.  This includes fixing it to work with C++17 as reported separately by another user.


      Kind regards,





            rleigh Roger Leigh
            rleigh Roger Leigh
            0 Vote for this issue
            1 Start watching this issue



              Time Tracking

                Original Estimate - 504h
                Remaining Estimate - 504h
                Time Spent - Not Specified
                Not Specified