diff --git a/docs/conf_to_copy.py b/docs/conf_to_copy.py new file mode 100644 index 0000000000..b2f26ae6b9 --- /dev/null +++ b/docs/conf_to_copy.py @@ -0,0 +1,48 @@ +import textwrap +# The `extensions` list should already be in here from `sphinx-quickstart` +extensions = [ + # there may be others here already, e.g. 'sphinx.ext.mathjax' + 'breathe', + 'exhale', + 'sphinx.ext.intersphinx' +] + +project = u'IfcOpenShell' +copyright = u'2020, IfcOpenShell' +author = u'Johan Luttun' + +# Setup the breathe extension +breathe_projects = { + "My Project": "./output/doxygen/xml" +} +breathe_default_project = "My Project" + +# Setup the exhale extension +exhale_args = { + # These arguments are required + "containmentFolder": "./rst_files", + "rootFileName": "library_root.rst", + "rootFileTitle": "IfcOpenShell", + "doxygenStripFromPath": "..", + # Suggested optional arguments + "createTreeView": True, + # TIP: if using the sphinx-bootstrap-theme, you need + # "treeViewIsBootstrap": True, + "exhaleExecutesDoxygen": True, + # "exhaleDoxygenStdin": "INPUT = ../src/serializers/ ../src/ifcgeom", + "exhaleUseDoxyfile": True + +} + + + +# html_theme = 'sphinx_rtd_theme' + +# # Tell sphinx what the primary language being documented is. +# primary_domain = 'cpp' + +# # Tell sphinx what the pygments highlight language should be. +# highlight_language = 'cpp' + + + diff --git a/docs/generate_docs.py b/docs/generate_docs.py new file mode 100644 index 0000000000..69ce239a6c --- /dev/null +++ b/docs/generate_docs.py @@ -0,0 +1,52 @@ +# This program requires doxygen, sphinx, breathe and exhale. + +import os +import os.path +import subprocess + +from sys import platform + + +def copy_content(content, container): + with open(content) as f: + with open(container, "w") as f1: + for line in f: + f1.write(line) + + +conf_path = "./conf.py" +index_path = "./index.rst" + + +if not os.path.isdir("./output/doxygen/xml"): + os.makedirs("output/doxygen/xml") + +if os.path.isfile(conf_path) and not os.path.isfile(index_path): + os.remove(conf_path) +if os.path.isfile(index_path) and not os.path.isfile(conf_path): + os.remove(index_path) + +if not (os.path.isfile(conf_path) and os.path.isfile(index_path)): + subprocess.run(["sphinx-quickstart", "-q", "-p", "IfcOpenShell", "-a", "Johan Luttun"]) + +conf_copy = ["./conf_to_copy.py", "./conf.py"] +index_copy = ["./index_to_copy.rst", "./index.rst"] + +copy_content(conf_copy[0], conf_copy[1]) +copy_content(index_copy[0], index_copy[1]) + +if platform == "linux" or platform == "linux2": + subprocess.run(["make", "html"]) + if not os.path.isdir("/output/_build"): + subprocess.run(["cd","../src/ifcblenderexport/docs"]) + subprocess.run(["make", "html"]) + subprocess.run(["cd", "../../../docs"]) + + subprocess.run(["sudo", "mv" "../src/ifcblenderexport/docs/_build", "./output"]) + + +elif platform == "win32" or platform == "win64": + subprocess.run(["make.bat", "html"]) + + + diff --git a/docs/index_to_copy.rst b/docs/index_to_copy.rst new file mode 100644 index 0000000000..eac477b203 --- /dev/null +++ b/docs/index_to_copy.rst @@ -0,0 +1,10 @@ +IfcOpenShell +============ + +.. toctree:: + :maxdepth: 3 + + rst_files/library_root + + +`ifcopenshell-python documentation <_build/html/index.html>`_ \ No newline at end of file