From e6b9622df25380ad07188bff0d3996321d79367b Mon Sep 17 00:00:00 2001 From: intelligide Date: Fri, 3 Jul 2015 16:57:33 +0200 Subject: [PATCH] add Doc --- CMakeLists.txt | 8 +++- doc/CMakeLists.txt | 58 +++++++++++++++++++++++++++ doc/conf.py.in | 74 +++++++++++++++++++++++++++++++++++ doc/index.rst | 10 +++++ doc/manual/binaries.rst | 9 +++++ doc/manual/binaries/mkg1m.rst | 35 +++++++++++++++++ 6 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 doc/CMakeLists.txt create mode 100644 doc/conf.py.in create mode 100644 doc/index.rst create mode 100644 doc/manual/binaries.rst create mode 100644 doc/manual/binaries/mkg1m.rst diff --git a/CMakeLists.txt b/CMakeLists.txt index 46fdf79..2264a42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.6) -project(g1m-assembler) +project(g1m_assembler) if(NOT INSTALL_RUNTIME_DIR) set(INSTALL_RUNTIME_DIR bin) @@ -14,12 +14,18 @@ endif() if(NOT INSTALL_MAN_DIR) set(INSTALL_MAN_DIR /man) endif() +if(NOT INSTALL_CLIB_DIR) + set(INSTALL_CLIB_DIR clib) +endif() add_subdirectory(man) add_subdirectory(src) +add_subdirectory(doc) install(DIRECTORY share/g1m-assembler/ DESTINATION "${INSTALL_DATA_DIR}") +install(DIRECTORY clib/ DESTINATION "${INSTALL_CLIB_DIR}") + install(FILES "LICENSE" "NOTICE" diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..be97812 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,58 @@ +project(G1M-AssemblerDoc NONE) + +option(SPHINX_MAN "Build man pages with Sphinx" OFF) +option(SPHINX_HTML "Build html pages with Sphinx" OFF) +find_program(SPHINX_EXECUTABLE + NAMES sphinx-build + DOC "Sphinx Documentation Builder (sphinx-doc.org)" + ) + +if(NOT SPHINX_MAN AND NOT SPHINX_HTML) + return() +elseif(NOT SPHINX_EXECUTABLE) + message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!") +endif() + +set(conf_path "${CMAKE_CURRENT_SOURCE_DIR}") +configure_file(conf.py.in conf.py @ONLY) + +set(doc_formats "") +if(SPHINX_HTML) + list(APPEND doc_formats html) +endif() +if(SPHINX_MAN) + list(APPEND doc_formats man) +endif() + +set(doc_format_outputs "") +set(doc_format_last "") +foreach(format ${doc_formats}) + set(doc_format_output "doc_format_${format}") + set(doc_format_log "build-${format}.log") + add_custom_command( + OUTPUT ${doc_format_output} + COMMAND ${SPHINX_EXECUTABLE} + -c ${CMAKE_CURRENT_BINARY_DIR} + -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees + -b ${format} + ${g1m_assembler_SOURCE_DIR}/doc/ + ${CMAKE_CURRENT_BINARY_DIR}/${format} + > ${doc_format_log} # log stdout, pass stderr + DEPENDS ${doc_format_last} + COMMENT "sphinx-build ${format}: see doc/${doc_format_log}" + VERBATIM + ) + set_property(SOURCE ${doc_format_output} PROPERTY SYMBOLIC 1) + list(APPEND doc_format_outputs ${doc_format_output}) + set(doc_format_last ${doc_format_output}) +endforeach() + +add_custom_target(documentation ALL DEPENDS ${doc_format_outputs}) + +if(SPHINX_HTML) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html + DESTINATION ${INSTALL_DOC_DIR} + PATTERN .buildinfo EXCLUDE + PATTERN objects.inv EXCLUDE + ) +endif() diff --git a/doc/conf.py.in b/doc/conf.py.in new file mode 100644 index 0000000..40dfe51 --- /dev/null +++ b/doc/conf.py.in @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import sys +import os +import shlex + +sys.path.insert(0, r'@conf_path@') + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.pngmath', +] + +templates_path = ['_templates'] + +source_suffix = '.rst' +master_doc = 'index' + +project = 'g1m-assembler' +copyright = '2015, intelligide' +author = 'intelligide' + +version = '1.0.0' +release = '1.0.0' + +language = None + +exclude_patterns = [] + +pygments_style = 'sphinx' + +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- +html_theme = 'sphinx_rtd_theme' + +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +html_title = 'G1M Assembler %s Documentation' % release +html_short_title = '%s Documentation' % release + +#html_logo = None + +#html_favicon = None + +html_static_path = ['_static'] +#html_extra_path = [] + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} +html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +html_show_sphinx = False + +html_show_copyright = True + +#html_search_language = 'en' + +#html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'g1m-assembler' \ No newline at end of file diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..def71c4 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,10 @@ +Welcome to G1M Assembler's documentation! +============================================= + +Contents: + +.. toctree:: + :maxdepth: 2 + + manual/binaries + diff --git a/doc/manual/binaries.rst b/doc/manual/binaries.rst new file mode 100644 index 0000000..a1326f3 --- /dev/null +++ b/doc/manual/binaries.rst @@ -0,0 +1,9 @@ +Binaries +============================================= + +Contents: + +.. toctree:: + :maxdepth: 2 + + binaries/mkg1m \ No newline at end of file diff --git a/doc/manual/binaries/mkg1m.rst b/doc/manual/binaries/mkg1m.rst new file mode 100644 index 0000000..7424416 --- /dev/null +++ b/doc/manual/binaries/mkg1m.rst @@ -0,0 +1,35 @@ +mkg1m +***** + +Synopsis +======== + +:: + + mkg1m input [-o output][-Ldir][-l cLib] + +Description +=========== + +Convert text file to Casio G1M File + +Options +======= + +``-o input`` + Write output to file. You must use -o + to specify the output file. + +``-llibrary`` +``-l library`` + Search the library named library. + +``-Ldir`` +``-L dir`` + add all the libraries in the folder *dir*. + +``-h`` + Print usage information. + +``-v`` + Print version information. \ No newline at end of file