ENH: Update FreeFOAM contributions to GPL v3
[freefoam.git] / doc / CMakeLists.txt
blobbe6f919989052fafac95b91e13038dc4ba8e4fd1
1 #-------------------------------------------------------------------------------
2 #               ______                _     ____          __  __
3 #              |  ____|             _| |_  / __ \   /\   |  \/  |
4 #              | |__ _ __ ___  ___ /     \| |  | | /  \  | \  / |
5 #              |  __| '__/ _ \/ _ ( (| |) ) |  | |/ /\ \ | |\/| |
6 #              | |  | | |  __/  __/\_   _/| |__| / ____ \| |  | |
7 #              |_|  |_|  \___|\___|  |_|   \____/_/    \_\_|  |_|
9 #                   FreeFOAM: The Cross-Platform CFD Toolkit
11 # Copyright (C) 2008-2012 Michael Wild <themiwi@users.sf.net>
12 #                         Gerber van der Graaf <gerber_graaf@users.sf.net>
13 #-------------------------------------------------------------------------------
14 # License
15 #   This file is part of FreeFOAM.
17 #   FreeFOAM is free software: you can redistribute it and/or modify it
18 #   under the terms of the GNU General Public License as published by the
19 #   Free Software Foundation, either version 3 of the License, or (at your
20 #   option) any later version.
22 #   FreeFOAM is distributed in the hope that it will be useful, but WITHOUT
23 #   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 #   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25 #   for more details.
27 #   You should have received a copy of the GNU General Public License
28 #   along with FreeFOAM.  If not, see <http://www.gnu.org/licenses/>.
29 #-------------------------------------------------------------------------------
31 if(FOAM_ENABLE_XHTML_HELP OR FOAM_ENABLE_DOXYGEN_DOCS
32     OR FOAM_ENABLE_XHTML_GUIDES)
33   foam_configure_files(installImgFiles
34     COPYONLY
35     DESTDIR doc/html
36     img/FreeFOAMLogo.png
37     img/CrossPlatformToolkit.png)
39   install(FILES
40     ${installImgFiles}
41     DESTINATION ${FOAM_INSTALL_DOC_PATH}/img COMPONENT doc)
43   foam_configure_files(installCSSFiles
44     COPYONLY
45     DESTDIR doc/html
46     css/layout.css
47     css/custom.css)
48   if(FOAM_ENABLE_XHTML_HELP OR FOAM_ENABLE_XHTML_GUIDES)
49     # have asciidoc, use xhtml11.css and asciidoc-xhtml12.js from there
50     if(EXISTS "${A2X_CONF_DIR}/stylesheets/xhtml11.css")
51       configure_file("${A2X_CONF_DIR}/stylesheets/xhtml11.css"
52         "${CMAKE_CURRENT_BINARY_DIR}/html/css/xhtml11.css" COPYONLY)
53     elseif(EXISTS "${A2X_CONF_DIR}/stylesheets/asciidoc.css")
54       # newer versions renamed xhtml11.css to asciidoc.css
55       configure_file("${A2X_CONF_DIR}/stylesheets/asciidoc.css"
56         "${CMAKE_CURRENT_BINARY_DIR}/html/css/xhtml11.css" COPYONLY)
57     else()
58       message(SEND_ERROR "Failed to find xhtml11.css or asciidoc.css")
59     endif()
60     configure_file("${A2X_CONF_DIR}/stylesheets/docbook-xsl.css"
61       "${CMAKE_CURRENT_BINARY_DIR}/html/css/docbook-xsl.css" COPYONLY)
62     set(installXHTMLCSSFiles
63       "${CMAKE_CURRENT_BINARY_DIR}/html/css/xhtml11.css"
64       "${CMAKE_CURRENT_BINARY_DIR}/html/css/docbook-xsl.css")
65     if(EXISTS "${A2X_CONF_DIR}/javascripts/asciidoc-xhtml11.js")
66       configure_file("${A2X_CONF_DIR}/javascripts/asciidoc-xhtml11.js"
67         "${CMAKE_CURRENT_BINARY_DIR}/html/js/asciidoc-xhtml11.js" COPYONLY)
68     elseif(EXISTS "${A2X_CONF_DIR}/javascripts/asciidoc.js")
69       # newer versions renamed asciidoc-xhtml11.js to asciidoc.js
70       configure_file("${A2X_CONF_DIR}/javascripts/asciidoc.js"
71         "${CMAKE_CURRENT_BINARY_DIR}/html/js/asciidoc-xhtml11.js" COPYONLY)
72     else()
73       message(SEND_ERROR "Failed to find asciidoc-xhtml11.js or asciidoc.js")
74     endif()
75     set(installXHTMLJavaScriptFiles
76       "${CMAKE_CURRENT_BINARY_DIR}/html/js/asciidoc-xhtml11.js")
77   else()
78     # otherwise use our own
79     foam_configure_files(installXHTMLCSSFiles
80       COPYONLY
81       DESTDIR doc/html
82       css/xhtml11.css
83       css/docbook-xsl.css)
84     foam_configure_files(installXHTMLJavaScriptFiles
85       COPYONLY
86       DESTDIR doc/html
87       js/asciidoc-xhtml11.js)
88   endif()
90   install(FILES ${installCSSFiles} ${installXHTMLCSSFiles}
91     DESTINATION ${FOAM_INSTALL_DOC_PATH}/css COMPONENT doc)
92   install(FILES ${installXHTMLJavaScriptFiles}
93     DESTINATION  ${FOAM_INSTALL_DOC_PATH}/js COMPONENT doc)
94 endif()
96 if(FOAM_ENABLE_XHTML_HELP OR FOAM_ENABLE_XHTML_GUIDES)
97   set(opts
98     -f "${CMAKE_BINARY_DIR}/data/asciidoc/html.conf"
99     -a toc
100     -a linkcss
101     -a "data-uri!"
102     -a stylesdir=css
103     -a foam-stylesdir=css
104     -a scriptsdir=js
105     -a foam-scriptsdir=js
106     -a imagesdir=img
107     -a rel-doc=.
108     -a docs-only)
109   if(FOAM_DOCS_FOR_SF)
110     list(APPEND opts -a foam-doc-for_sf)
111   endif()
112   if(FOAM_ENABLE_XHTML_GUIDES)
113     list(APPEND opts -a foam-have-ug)
114   endif()
115   if(FOAM_ENABLE_XHTML_HELP)
116     list(APPEND opts -a foam-have-man)
117   endif()
118   if(FOAM_ENABLE_DOXYGEN_DOCS)
119     list(APPEND opts -a foam-have-doxy)
120   endif()
121   set(pkgdocs)
122   foreach(f ChangeLog COPYING INSTALL README ReleaseNotes)
123     set(o "${CMAKE_CURRENT_BINARY_DIR}/html/${f}.html")
124     add_custom_command(OUTPUT "${o}"
125       COMMAND "${ASCIIDOC_EXECUTABLE}"
126         ${opts} -o "${o}" "${CMAKE_SOURCE_DIR}/${f}"
127       DEPENDS "${CMAKE_SOURCE_DIR}/${f}"
128         "${CMAKE_BINARY_DIR}/data/asciidoc/html.conf"
129       COMMENT "Generating ${f}.html"
130       VERBATIM)
131     list(APPEND pkgdocs "${o}")
132   endforeach()
133   add_custom_target(pkgdocs DEPENDS ${pkgdocs})
134   add_dependencies(doc pkgdocs)
135   install(FILES ${pkgdocs}
136     DESTINATION ${FOAM_INSTALL_DOC_PATH} COMPONENT doc)
137 endif()
139 add_subdirectory(man/manSource)
141 if(FOAM_ENABLE_DOXYGEN_DOCS)
142   add_subdirectory(Doxygen)
143 endif()
145 if(FOAM_ENABLE_XHTML_GUIDES AND FOAM_ENABLE_MATHJAX)
146   configure_file(js/MathJaxMacros.js
147     "${CMAKE_CURRENT_BINARY_DIR}/html/js/MathJaxMacros.js" COPYONLY)
148   install(FILES "${CMAKE_CURRENT_BINARY_DIR}/html/js/MathJaxMacros.js"
149     DESTINATION "${FOAM_INSTALL_DOC_PATH}/js" COMPONENT doc)
150 endif()
152 if(FOAM_GUIDES_FORMATS)
153   add_subdirectory(UserGuide)
154 endif()
156 # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file