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 # This helps make the index look decent.
26 set(MAKEINDEX_COMPILER_FLAGS -s ${CMAKE_CURRENT_SOURCE_DIR}/hfill.ist)
27 # UseLATEX.cmake is hacked to call Anton Feenstra's subindex script
28 # to improve the index generation. Don't replace UseLATEX.cmake
29 # blindly from upstream!
31 # Here follows various custom CMake "commands" that call our various
32 # GROMACS helper scripts to make bits of the manual from the installed
33 # binaries and/or source distribution, as appropriate.
35 # Only files that can be built should be listed in DEPENDS. Makefile
36 # rules are generated for those files.
38 # The .mdp options section is now intended to be built directly
39 # from a GROMACS source directory. This facilitates drafting
40 # updates in that HTML file without copying files by hand.
42 ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/mdp_opt.tex
43 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mkmdp ARGS ${CMAKE_SOURCE_DIR}/share/html
44 DEPENDS mkmdp ${CMAKE_SOURCE_DIR}/share/html/online/mdp_opt.html
47 ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/proglist.tex
48 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mkproglist ARGS ${CMAKE_SOURCE_DIR}/admin/programs.txt
49 DEPENDS mkproglist ${CMAKE_SOURCE_DIR}/admin/programs.txt
52 # Finally, the command to build the manual.
54 ADD_LATEX_DOCUMENT(gromacs.tex
55 # Normal LaTeX \included files
56 INPUTS algorithms.tex defunits.tex implement.tex macros.tex special.tex
57 analyse.tex files.tex gmxpar.tex install.tex topology.tex
58 averages.tex forcefield.tex gromacs.tex intro.tex programs.tex
60 # CMake does variable replacement in these files
63 # These files we're responsible for creating in the
64 # add_custom_targets() above. They should not be in the git
65 # repository, or its directory, or the dependencies will not work
67 DEPENDS proglist.tex mdp_opt.tex
69 BIBFILES monster.bib unpubl.bib
76 if(MANUAL_BUILD_IS_POSSIBLE)
77 # An explicit "make manual" will still be required for the manual
79 add_custom_target(manual DEPENDS pdf)
81 # TODO Arrange for the "make manual" target to explain that this can't