Salome HOME
Python3 porting for Examples.
[tools/yacsgen.git] / module_generator / doc_tmpl.py
index 9fccb60bbc1182503f1126f3ffce98753d73856b..1d906e1eec58fea7ec77387f29b0493042bf2cb3 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2009-2012  EDF R&D
+# Copyright (C) 2009-2016  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
+# CMakeLists.txt in doc directory
+# template parameters:
+#   module : module name
+#   files : doc source files (.rst)
 docmakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-salomedoc_DATA=html/index.html
-salomeres_DATA = ${others}
-
-html/index.html:
-       make htm
-
-SPHINXOPTS      =
-SOURCEDIR       = $$(srcdir)
-SPHINXBUILD     = sphinx-build
-PAPEROPT_a4     = -D latex_paper_size=a4
-ALLSPHINXOPTS   = -d doctrees $$(PAPEROPT_a4) $$(SPHINXOPTS) $$(SOURCEDIR)
-
-htm:
-       mkdir -p html doctrees
-       $$(SPHINXBUILD) -b html $$(ALLSPHINXOPTS) html
-       @echo
-       @echo "Build finished. The HTML pages are in html."
-
-install-data-local:
-       $$(INSTALL) -d $$(DESTDIR)$$(salomedocdir)
-       cp -rf html/* $$(DESTDIR)$$(salomedocdir) ;
-
-uninstall-local:
-       chmod -R +w $$(DESTDIR)$$(salomedocdir)
-       rm -rf $$(DESTDIR)$$(salomedocdir)/*
-
-clean-local:
-       -rm -rf html latex doctrees
-       if test -d "html"; then rm -rf html ; fi
+SET(RSTFILES
+  ${files}
+  )
+
+SET(SPHINXOPTS )
+SET(SOURCEDIR $${CMAKE_CURRENT_SOURCE_DIR})
+SET(PAPEROPT_a4 -D latex_paper_size=a4)
+SET(ALLSPHINXOPTS -d doctrees $${PAPEROPT_a4} $${SPHINXOPTS} $${SOURCEDIR})
+
+# install user's documentation
+SALOME_CONFIGURE_FILE(conf.py conf.py)
+
+ADD_CUSTOM_TARGET(htm 
+  COMMAND $${CMAKE_COMMAND} -E make_directory html 
+  COMMAND $${CMAKE_COMMAND} -E make_directory doctrees
+  COMMAND $${SPHINX_EXECUTABLE} -c $${CMAKE_BINARY_DIR}/doc -b html $${ALLSPHINXOPTS} html
+  DEPENDS $${RSTFILES}
+  WORKING_DIRECTORY $${CMAKE_CURRENT_BINARY_DIR}
+  )
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND \\\"$${CMAKE_COMMAND}\\\" --build $${PROJECT_BINARY_DIR} --target htm)")
+INSTALL(DIRECTORY $${CMAKE_CURRENT_BINARY_DIR}/html/ 
+  DESTINATION $${SALOME_INSTALL_DOC}/gui/${module} 
+  USE_SOURCE_PERMISSIONS
+  PATTERN ".buildinfo" EXCLUDE
+  )
+  
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES html)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES doctrees)
+
+#SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES YACS)
 
 """
 docmakefile=Template(docmakefile)
@@ -101,7 +104,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'${module}'
-copyright = u'2010'
+copyright = u'2010-2016'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -278,10 +281,15 @@ man_pages = [
 
 docconf=Template(docconf)
 
+# SalomeApp.xml file for a documentation only module.
+# template parameters:
+#   module : module name
+#   version : version number of the module
 docsalomeapp="""
 <document>
   <section name="${module}">
     <parameter name="name" value="${module}"/>
+    <parameter name="version" value="${version}"/>
   </section>
   <section name="resources">
     <parameter name="${module}" value="$${${module}_ROOT_DIR}/share/salome/resources/${lmodule}"/>