fortran_pcre
fortran_pcre copied to clipboard
Added build infrastructure, documentation, and installation support
While this is kind of a huge and unsolicited PR, your original source files are actually unchanged.
I added CMake support for building, testing, and packaging, plus Doxygen and LaTeX support for documentation. The script contrib/unixutils/setup_gfortran_build.sh shows the arguments given to CMake (explicitly specifies the Fortran compiler and Release compiler options plus adds verbose Makefile diagnostics). Copy that script to the build directory and run it, then run make to build everything. It should pull a pristine copy of pcre-8.43.zip from ftp.pcre.org, unpack, and build it as a static library, then build the rest of the code. The main source is built into a static library I named fsl_pcre so libfsl_pcre.a should be built, though the test programs build against the source files instead of the library (working on that part).
ctest -C Release will run all the test applications. cpack will build zip, tar, and deb archives. make docs will run Doxygen (if installed) to generate HTML documentation. If you have LaTeX installed, you can build PDF documentation after one manual edit (still working on fixing this). Change line 243 of build/doc/latex/refman.tex from \newcommand{\CODENAME}{fsl_pcre} \newcommand{\CODENAME}{fsl\_pcre} to escape the underscore in the library name, then run make in build/doc/latex; it should grind for a little while and produce refman.pdf.
I've only tested this on Linux (Mint 19.2) with gfortran but with a little modification it should work with Intel Fortran (ifort). I haven't tested it on Windows (yet) but it likely wouldn't take a lot of work to make it work with Visual Studio and ifort (sadly, I no longer have access to ifort on Windows to test it). There's provisions for OSX support as well, but again, I don't have any Apple hardware for testing.
I understand this is a lot to take in all at once. My goal was to make this as self-contained and cross-platform as possible with professional-ish build and developer documentation. Bigger picture: Fortran really needs a decent standard library and IMO a part of that should be a regular expressions engine. My feeling is this could be an start in that direction; I came across your project and just added all the build and documentation support I could.
Let me know if you have any questions or comments, especially if you have any problems building the code.
Wow, thanks for this! I will try and take a look at it this weekend. I'll also try and add some proper tests.
I don't know of a good Fortran unit testing library; I usually use ftncheck which is part of Arjen Markus' FLIBS project. The existing tests run under ctest without error which only means they don't obviously crash (I think) so at the moment ctest isn't as helpful as it could be. I'll take another look at fruit or pfunit to see if they work any better under CMake.