From: <ai...@us...> - 2012-10-22 22:59:55
|
Revision: 12250 http://plplot.svn.sourceforge.net/plplot/?rev=12250&view=rev Author: airwin Date: 2012-10-22 22:59:48 +0000 (Mon, 22 Oct 2012) Log Message: ----------- Implement a rudimentary but quite useful CMake-based build system for ndiff. Added Paths: ----------- trunk/cmake/external/ndiff/ trunk/cmake/external/ndiff/CMakeLists.txt trunk/cmake/external/ndiff/README.ndiff trunk/cmake/external/ndiff/config.h.cmake Added: trunk/cmake/external/ndiff/CMakeLists.txt =================================================================== --- trunk/cmake/external/ndiff/CMakeLists.txt (rev 0) +++ trunk/cmake/external/ndiff/CMakeLists.txt 2012-10-22 22:59:48 UTC (rev 12250) @@ -0,0 +1,87 @@ +# The autoconf-based build of ndiff is beginning to break down so this +# is the start of the implementation of an equivalent build system +# using CMake. This is just a first proof-of-concept attempt to build +# ndiff and not even bother to test or install it. But at least the +# build appears to work and so does the resulting ndiff executable. + +# Top-level CMakeLists.txt boilerplate. +project(ndiff C) +cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR) + +# Configure everything in config.h which must have +# specific values of 1 or 0 + +set(HAVE_LONG_DOUBLE 0) +find_file(HAVE_CTYPE_H ctype.h) +if(HAVE_CTYPE_H) + set(HAVE_CTYPE_H 1) +else(HAVE_CTYPE_H) + set(HAVE_CTYPE_H 0) +endif(HAVE_CTYPE_H) + +find_file(HAVE_LIMITS_H limits.h) +if(HAVE_LIMITS_H) + set(HAVE_LIMITS_H 1) +else(HAVE_LIMITS_H) + set(HAVE_LIMITS_H 0) +endif(HAVE_LIMITS_H) + +find_file(HAVE_STDDEF_H stddef.h) +if(HAVE_STDDEF_H) + set(HAVE_STDDEF_H 1) +else(HAVE_STDDEF_H) + set(HAVE_STDDEF_H 0) +endif(HAVE_STDDEF_H) + +find_file(HAVE_STDIO_H stdio.h) +if(HAVE_STDIO_H) + set(HAVE_STDIO_H 1) +else(HAVE_STDIO_H) + set(HAVE_STDIO_H 0) +endif(HAVE_STDIO_H) + +find_file(HAVE_STDLIB_H stdlib.h) +if(HAVE_STDLIB_H) + set(HAVE_STDLIB_H 1) +else(HAVE_STDLIB_H) + set(HAVE_STDLIB_H 0) +endif(HAVE_STDLIB_H) + +find_file(HAVE_STRING_H string.h) +if(HAVE_STRING_H) + set(HAVE_STRING_H 1) +else(HAVE_STRING_H) + set(HAVE_STRING_H 0) +endif(HAVE_STRING_H) + +# Code uses HAVE_GMP rather than the expected HAVE_GMP_H +find_file(HAVE_GMP gmp.h) +if(HAVE_GMP) + set(HAVE_GMP 1) +else(HAVE_GMP) + set(HAVE_GMP 0) +endif(HAVE_GMP) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/config.h + @ONLY +) + +# Build the ndiff executable: +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ) + +set(ndiff_SRC + ndiff.c + store.c + awklib.c + regexp/regexp.c + regexp/regerror.c + ) + +add_executable(ndiff ${ndiff_SRC}) + +# That wasn't so hard, was it? \ No newline at end of file Property changes on: trunk/cmake/external/ndiff/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/cmake/external/ndiff/README.ndiff =================================================================== --- trunk/cmake/external/ndiff/README.ndiff (rev 0) +++ trunk/cmake/external/ndiff/README.ndiff 2012-10-22 22:59:48 UTC (rev 12250) @@ -0,0 +1,57 @@ +The ndiff application is a really useful fuzzy diff that can be used +to analyze, say, the most significant differences between the C and +Python PostScript results without having those important differences +obscured by minor numerical difference. + +ndiff was last released in 2000, and its build system is beginning +to show the results of bit-rot. For example, building from a separate build +tree does not work, and you must create _all_ the required subdirectories +of the install tree using repeated runs of mkdir before "make install" +will work. + +I got tired of dealing with these issues so I made a rudimentary +CMake-based build system consisting of the two other files in this +directory whose names are CMakeLists.txt and config.h.cmake. Here +is the recommended way to use these files: + + +download, verify, and signature check +the last (2000) release of ndiff using + +wget ftp://ftp.math.utah.edu/pub/misc/ndiff-2.00.tar.gz +wget ftp://ftp.math.utah.edu/pub/misc/ndiff-2.00.tar.gz.sig +gpg --verify ndiff-2.00.tar.gz.sig + +Copy CMakeLists.txt and config.h.cmake into the top +of the ndiff-2.0.0 source tree then build ndiff using + +mkdir build_dir +cmake ../ndiff-2.0.0 +make + +This creates the newly compiled ndiff executable in the separate build +tree which is really all I needed so I stopped there. + +If you have any CMake skills at all and an interest in ndiff, I +encourage you to expand this build system to allow installation of the +ndiff executable and man page and perhaps even run some of the tests +that are implemented by the traditional ndiff build system. (I +believe those tests compare the C version of the ndiff executable with +an awk-based version that is much slower but thought to be of good +reliability.) + +However, note I have recently been in touch with the ndiff author, and +he appears to be the kind of developer that likes to muck with +machine language because you know exactly what you get than +rather than actually using compilers which might produce obfuscated +machine language. So he has absolutely no use for CMake because +it is difficult to debug the resulting Makefiles (!) To be fair, +he also has some advantages of perfectionism which is why he +goes to the trouble (above) of testing the C ndiff against +an alternative implementation. + +So this CMake-based build system will likely always be external to the ndiff +project. Nevertheless, ndiff is extremely useful to PLplot +developers who are all fairly expert with CMake so I think it is +worthwhile pursuing this CMake-based build system for ndiff a bit +further if someone feels the urge. Added: trunk/cmake/external/ndiff/config.h.cmake =================================================================== --- trunk/cmake/external/ndiff/config.h.cmake (rev 0) +++ trunk/cmake/external/ndiff/config.h.cmake 2012-10-22 22:59:48 UTC (rev 12250) @@ -0,0 +1,32 @@ +// Note that ndiff code uses old-fashioned #defines with values +// which must be either true or false, rather than the #ifdef style. + +// Define if the `long double' type works. +#define HAVE_LONG_DOUBLE @HAVE_LONG_DOUBLE@ + +// Define to `unsigned' if <sys/types.h> doesn't define. +// #define size_t + +// Define if you have the ANSI C header files. +//#define STDC_HEADERS @STDC_HEADERS@ + +// Define if you have the <ctype.h> header file. +#define HAVE_CTYPE_H @HAVE_CTYPE_H@ + +// Define if you have the <limits.h> header file. +#define HAVE_LIMITS_H @HAVE_LIMITS_H@ + +// Define if you have the <stddef.h> header file. +#define HAVE_STDDEF_H @HAVE_STDDEF_H@ + +// Define if you have the <stdio.h> header file. +#define HAVE_STDIO_H @HAVE_STDIO_H@ + +// Define if you have the <stdlib.h> header file. +#define HAVE_STDLIB_H @HAVE_STDLIB_H@ + +// Define if you have the <string.h> header file. +#define HAVE_STRING_H @HAVE_STRING_H@ + +// Define if have the <gmp.h> header file. +#define HAVE_GMP @HAVE_GMP@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |