Salome HOME
Doc fix.
[tools/yacsgen.git] / module_generator / doc_tmpl.py
index 78ce863de7f5ac35bf5b293a0d55d4ac96adeb71..e758ed90efd86cf44c346e8e2e523737a04e0853 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2009-2013  EDF R&D
+# Copyright (C) 2009-2015  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
@@ -22,38 +22,43 @@ try:
 except:
   from 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
+INCLUDE($${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
+
+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 +106,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'${module}'
-copyright = u'2010'
+copyright = u'2010-2015'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the