From 87f390f288e359d5d9dccc1cd4a06050242bdb27 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Fri, 31 May 2013 14:22:36 -0400 Subject: [PATCH] CMake: handle doc/ --- CMakeLists.txt | 5 +++++ INSTALL.t2t | 3 ++- TODO.t2t | 5 +++-- doc/CMakeLists.txt | 49 ++++++++++++++++++++++++++++++++++++++++++++++ doc/Makefile | 16 --------------- 5 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 doc/CMakeLists.txt delete mode 100644 doc/Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 53d12ea..670949a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,6 +207,11 @@ else() # Warn the user about missing dependencies endif() +### Documentation ### + +add_subdirectory(doc) + + ### Meta-targets ### # The OWLPS_SEMISTATIC_TARGET is defined in subdirectories diff --git a/INSTALL.t2t b/INSTALL.t2t index 015e5a0..40cd21a 100644 --- a/INSTALL.t2t +++ b/INSTALL.t2t @@ -45,7 +45,8 @@ successfully), or re-run ``cmake``. Once you have all the required libraries installed, the easy way is to just call ``make`` to build all the modules. The built executables and libraries will be put in the ``bin`` and ``lib`` directories under the -build directory's root. +build directory's root; the manual pages will be generated in the +``man`` directory. You can then type ``make install`` to install everything (the default is to install to ``/usr/local``, so you will need to type this as root). diff --git a/TODO.t2t b/TODO.t2t index d53b069..e7cba69 100644 --- a/TODO.t2t +++ b/TODO.t2t @@ -53,10 +53,11 @@ Work to do in OwlPS - Add option dump-configuration (displays the config & exits). - CMake: - - handle doc/ and logo/ + - handle logo/ - use the installation prefix as search prefix for configuration files in Listener, Aggregator and Positioner - - make sure doxygen is available + - make sure doxygen is available (the FindDoxygen module exists) + - make sure txt2tags is available - Support string-based positioning requests diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..c205e97 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,49 @@ +# This file is part of the Owl Positioning System (OwlPS) project. +# It is subject to the copyright notice and license terms in the +# COPYRIGHT.t2t file found in the top-level directory of this +# distribution and at +# http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t +# No part of the OwlPS Project, including this file, may be copied, +# modified, propagated, or distributed except according to the terms +# contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be +# distributed along with this file, either separately or by replacing +# this notice by the COPYRIGHT.t2t file's contents. + + +### Man pages ### + +set(MAN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/man") +set(PREPROC_MAN ./preproc-man.sh) + +add_custom_target(doc ALL true) + +function(add_manpage PAGENAME SECTION) + set(OUTPUT_DIRECTORY "${MAN_OUTPUT_DIRECTORY}/man${SECTION}") + set(SOURCE ${PAGENAME}.t2t) + set(TARGETNAME ${PAGENAME}.${SECTION}) + set(TARGET "${OUTPUT_DIRECTORY}/${TARGETNAME}") + + # Create the output directory + # Note: this is done only when first calling cmake and when rebuilding + # cache; it would be nice if it could be called every time, but there + # doesn't seem to be any simple solution. + file(MAKE_DIRECTORY "${OUTPUT_DIRECTORY}") + + # Command to generate the man page + add_custom_command( + OUTPUT "${TARGET}" + COMMAND "${PREPROC_MAN}" "${SOURCE}" | txt2tags -q --infile=- --outfile="${TARGET}" -t man + DEPENDS "${SOURCE}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Generating ${TARGETNAME}") + + # Set up the target + add_custom_target(${TARGETNAME} true DEPENDS "${TARGET}") + + # Add the target to the "doc" meta-target + add_dependencies(doc "${TARGETNAME}") +endfunction() + +add_manpage(owlps 7) +add_manpage(owlps-architecture 7) +add_manpage(owlps-client 1) diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index ac06bd6..0000000 --- a/doc/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -all: \ - owlps.7 \ - owlps-architecture.7 \ - owlps-client.1 - -%.1: %.man - mv $< $@ - -%.7: %.man - mv $< $@ - -%.man: %.t2t - ./preproc-man.sh $< | txt2tags --infile=- --outfile=$@ -t man - -clean: - rm -f *~ *.html *.man *.7 *.1