2 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
3 # UseLATEX.cmake does not work with an in-source build
4 message(STATUS "Cannot build the manual when building in the source directory")
5 set(MANUAL_BUILD_IS_POSSIBLE OFF)
7 INCLUDE(UseLATEX.cmake)
9 if(NOT PDFLATEX_COMPILER OR NOT IMAGEMAGICK_CONVERT)
10 # No pdflatex was found, so don't build the manual.
11 message(STATUS "A required dependency of the manual (pdflatex, ImageMagick's convert) was not found, so the manual build will not be available")
12 set(MANUAL_BUILD_IS_POSSIBLE OFF)
14 # TODO Later, identify other dependencies like bibtex,
15 # make_index, date, some graphics conversion program,
16 # etc. Perhaps patch UseLATEX.cmake and contribute upstream.
18 set(MANUAL_BUILD_IS_POSSIBLE ON)
22 if(MANUAL_BUILD_IS_POSSIBLE)
23 LATEX_GET_OUTPUT_PATH(output_dir)
25 # Avoid generating a global "html" target that clashes with the
26 # html target from program generaion of help text in share/html.
27 set(LATEX2HTML_CONVERTER off)
29 # This helps make the index look decent.
30 set(MAKEINDEX_COMPILER_FLAGS -s ${CMAKE_CURRENT_SOURCE_DIR}/hfill.ist)
31 # UseLATEX.cmake is hacked to call Anton Feenstra's subindex script
32 # to improve the index generation. Don't replace UseLATEX.cmake
33 # blindly from upstream!
35 # Here follows various custom CMake "commands" that call our various
36 # GROMACS helper scripts to make bits of the manual from the installed
37 # binaries and/or source distribution, as appropriate.
39 # Only files that can be built should be listed in DEPENDS. Makefile
40 # rules are generated for those files.
42 # The .mdp options section is now intended to be built directly
43 # from a GROMACS source directory. This facilitates drafting
44 # updates in that HTML file without copying files by hand.
46 ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/mdp_opt.tex
47 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mkmdp ARGS ${CMAKE_SOURCE_DIR}/share/html
48 DEPENDS mkmdp ${CMAKE_SOURCE_DIR}/share/html/online/mdp_opt.html
51 ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/proglist.tex
52 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mkproglist ARGS ${CMAKE_SOURCE_DIR}/admin/programs.txt
53 DEPENDS mkproglist ${CMAKE_SOURCE_DIR}/admin/programs.txt
56 # Finally, the command to build the manual.
58 ADD_LATEX_DOCUMENT(gromacs.tex
59 # Normal LaTeX \included files
60 INPUTS algorithms.tex defunits.tex implement.tex macros.tex special.tex
61 analyse.tex files.tex gmxpar.tex install.tex topology.tex
62 averages.tex forcefield.tex gromacs.tex intro.tex programs.tex
64 # CMake does variable replacement in these files
67 # These files we're responsible for creating in the
68 # add_custom_targets() above. They should not be in the git
69 # repository, or its directory, or the dependencies will not work
71 DEPENDS proglist.tex mdp_opt.tex
73 BIBFILES monster.bib unpubl.bib
80 if(MANUAL_BUILD_IS_POSSIBLE)
81 # An explicit "make manual" will still be required for the manual
83 add_custom_target(manual DEPENDS pdf)
85 # TODO Arrange for the "make manual" target to explain that this can't