Skip to content

Commit

Permalink
make pdf generation for txt2tags doc optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 27, 2011
1 parent b74a515 commit 32801ed
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 27 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ ENDIF (WITH_GRASS)
# mapserver by us disabled default because it needs FastCGI (which is optional dependency)
SET (WITH_MAPSERVER FALSE CACHE BOOL "Determines whether QGIS mapserver should be built")

# include doxygen documentation
SET (WITH_APIDOC FALSE CACHE BOOL "Determines whether the QGIS API doxygen documentation should be built")

# build our version of astyle
SET (WITH_ASTYLE FALSE CACHE BOOL "If you plan to contribute you should reindent with scripts/prepare-commit.sh (using 'our' astyle)")

Expand Down
57 changes: 33 additions & 24 deletions cmake/Txt2Tags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ MACRO(FIND_TXT2TAGS)
MESSAGE(STATUS "txt2tags not found - disabled")
ENDIF (NOT TXT2TAGS_EXECUTABLE)
ENDIF(NOT TXT2TAGS_EXECUTABLE)
IF (NOT PDFLATEX_EXECUTABLE)
FIND_PROGRAM(PDFLATEX_EXECUTABLE pdflatex)
ENDIF (NOT PDFLATEX_EXECUTABLE)
IF (NOT PDFLATEX_EXECUTABLE)
MESSAGE(STATUS "pdflatex not found - disabled")
ENDIF(NOT PDFLATEX_EXECUTABLE)

IF (WITH_TXT2TAGS_PDF)
IF (NOT PDFLATEX_EXECUTABLE)
FIND_PROGRAM(PDFLATEX_EXECUTABLE pdflatex)
ENDIF (NOT PDFLATEX_EXECUTABLE)
IF (NOT PDFLATEX_EXECUTABLE)
MESSAGE(ERROR "pdflatex not found - txt2tags documention pdf cannot be generated")
ENDIF(NOT PDFLATEX_EXECUTABLE)
ENDIF(WITH_TXT2TAGS_PDF)
ENDMACRO(FIND_TXT2TAGS)

MACRO(ADD_TXT2TAGS_FILES _sources)
Expand All @@ -53,25 +56,31 @@ MACRO(ADD_TXT2TAGS_FILES _sources)
)

SET(${_sources} ${${_sources}} ${_out} ${_out}.html)
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_TXT2TAGS_FILES)

IF (PDFLATEX_EXECUTABLE)
ADD_CUSTOM_COMMAND(
OUTPUT ${_out}.tex
COMMAND ${TXT2TAGS_EXECUTABLE}
ARGS -o${_out}.tex -t tex ${_in}
DEPENDS ${_in}
COMMENT "Building ${_out}.tex from ${_in}"
)
MACRO(ADD_TXT2TAGS_PDFS _sources)
FOREACH (_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)

ADD_CUSTOM_COMMAND(
OUTPUT ${_out}.pdf
COMMAND TEXINPUTS=.:${CMAKE_CURRENT_SOURCE_DIR}: ${PDFLATEX_EXECUTABLE}
ARGS -output-directory=${CMAKE_CURRENT_BINARY_DIR} ${_out}.tex
DEPENDS ${_out}.tex
COMMENT "Building ${_out}.pdf from ${_out}.tex"
)
SET(${_sources} ${${_sources}} ${_out}.pdf)
ENDIF (PDFLATEX_EXECUTABLE)
SET(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename})

ADD_CUSTOM_COMMAND(
OUTPUT ${_out}.tex
COMMAND ${TXT2TAGS_EXECUTABLE}
ARGS -o${_out}.tex -t tex ${_in}
DEPENDS ${_in}
COMMENT "Building ${_out}.tex from ${_in}"
)

ADD_CUSTOM_COMMAND(
OUTPUT ${_out}.pdf
COMMAND TEXINPUTS=.:${CMAKE_CURRENT_SOURCE_DIR}: ${PDFLATEX_EXECUTABLE}
ARGS -output-directory=${CMAKE_CURRENT_BINARY_DIR} ${_out}.tex
DEPENDS ${_out}.tex
COMMENT "Building ${_out}.pdf from ${_out}.tex"
)
SET(${_sources} ${${_sources}} ${_out}.pdf)
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_TXT2TAGS_FILES)
ENDMACRO(ADD_TXT2TAGS_PDFS)
9 changes: 9 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# include doxygen documentation
SET (WITH_APIDOC FALSE CACHE BOOL "Determines whether the QGIS API doxygen documentation should be built")

# include doxygen documentation
SET (WITH_TXT2TAGS_PDF FALSE CACHE BOOL "Determines whether PDF should be generate for the txt2tags documentation")

INCLUDE(Txt2Tags)
FIND_TXT2TAGS()

IF(TXT2TAGS_EXECUTABLE)
ADD_TXT2TAGS_FILES(QGIS_DOC_FILES INSTALL.t2t CODING.t2t)
IF(WITH_TXT2TAGS_PDF)
ADD_TXT2TAGS_PDFS(QGIS_DOC_FILES INSTALL.t2t CODING.t2t)
ENDIF(WITH_TXT2TAGS_PDF)
ADD_CUSTOM_TARGET (t2tdoc ALL DEPENDS ${QGIS_DOC_FILES})
ELSE(TXT2TAGS_EXECUTABLE)
SET(QGIS_DOC_FILES
Expand Down

0 comments on commit 32801ed

Please sign in to comment.