Compare commits

...

12 Commits

Author SHA1 Message Date
a52e38cfad
💥 Removed pipfile 2022-10-26 15:27:02 +02:00
d734efee26
🔧 Added sphinx to requirements.txt 2022-10-26 15:16:59 +02:00
1ad82d5c4b
🎨 Fixed formating 2022-10-24 15:57:34 +02:00
9d2c6f31db
🔧 Replaced deprecated FancyURLopener 2022-10-24 15:52:56 +02:00
b5218d50f6
🎉 Added sccache.cmake 2022-10-24 15:16:28 +02:00
fc5ab3f9c6
🔨 Updated Sphinx config 2022-10-24 14:53:39 +02:00
901c3e55cd
🔧 Update min cmake version to 3.1 2022-10-24 14:14:14 +02:00
a2037a5341
🐛 Fixed compatibility with python 3.10 2022-10-21 10:33:48 +02:00
Roberto Di Remigio
85a4d068b7
Merge pull request #264 from bast/radovan/quotes-workaround
preserve quotes in setup_command; closes #169
2020-04-08 09:21:02 +02:00
Radovan Bast
32f4562704 preserve quotes in setup_command; closes #169 2020-04-07 19:56:57 +02:00
Radovan Bast
09b2ebf8db add DOI badge 2020-02-03 21:21:23 +01:00
Radovan Bast
7f674e7892 simplify 2020-02-03 21:21:07 +01:00
33 changed files with 195 additions and 504 deletions

3
.gitignore vendored
View File

@ -14,3 +14,6 @@ test/*/cmake_output
# generated by doc/extract_rst.py # generated by doc/extract_rst.py
doc/module-reference.rst doc/module-reference.rst
.idea/
/tmp/
_build

16
Pipfile
View File

@ -1,16 +0,0 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pycodestyle = "*"
pytest = "*"
PyYAML = "==4.2b4"
[dev-packages]

89
Pipfile.lock generated
View File

@ -1,89 +0,0 @@
{
"_meta": {
"hash": {
"sha256": "f86826fa4239dea24ceb6dbac0dd68caeb99b9c982dc6ace46ea32fbd09ab747"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"atomicwrites": {
"hashes": [
"sha256:0312ad34fcad8fac3704d441f7b317e50af620823353ec657a53e981f92920c0",
"sha256:ec9ae8adaae229e4f8446952d204a3e4b5fdd2d099f9be3aaf556120135fb3ee"
],
"version": "==1.2.1"
},
"attrs": {
"hashes": [
"sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69",
"sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb"
],
"version": "==18.2.0"
},
"more-itertools": {
"hashes": [
"sha256:38a936c0a6d98a38bcc2d03fdaaedaba9f412879461dd2ceff8d37564d6522e4",
"sha256:c0a5785b1109a6bd7fac76d6837fd1feca158e54e521ccd2ae8bfe393cc9d4fc",
"sha256:fe7a7cae1ccb57d33952113ff4fa1bc5f879963600ed74918f1236e212ee50b9"
],
"version": "==5.0.0"
},
"pluggy": {
"hashes": [
"sha256:8ddc32f03971bfdf900a81961a48ccf2fb677cf7715108f85295c67405798616",
"sha256:980710797ff6a041e9a73a5787804f848996ecaa6f8a1b1e08224a5894f2074a"
],
"version": "==0.8.1"
},
"py": {
"hashes": [
"sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694",
"sha256:e76826342cefe3c3d5f7e8ee4316b80d1dd8a300781612ddbc765c17ba25a6c6"
],
"version": "==1.7.0"
},
"pycodestyle": {
"hashes": [
"sha256:cbc619d09254895b0d12c2c691e237b2e91e9b2ecf5e84c26b35400f93dcfb83",
"sha256:cbfca99bd594a10f674d0cd97a3d802a1fdef635d4361e1a2658de47ed261e3a"
],
"index": "pypi",
"version": "==2.4.0"
},
"pytest": {
"hashes": [
"sha256:41568ea7ecb4a68d7f63837cf65b92ce8d0105e43196ff2b26622995bb3dc4b2",
"sha256:c3c573a29d7c9547fb90217ece8a8843aa0c1328a797e200290dc3d0b4b823be"
],
"index": "pypi",
"version": "==4.1.1"
},
"pyyaml": {
"hashes": [
"sha256:254bf6fda2b7c651837acb2c718e213df29d531eebf00edb54743d10bcb694eb",
"sha256:3108529b78577327d15eec243f0ff348a0640b0c3478d67ad7f5648f93bac3e2",
"sha256:3c17fb92c8ba2f525e4b5f7941d850e7a48c3a59b32d331e2502a3cdc6648e76",
"sha256:8d6d96001aa7f0a6a4a95e8143225b5d06e41b1131044913fecb8f85a125714b",
"sha256:c8a88edd93ee29ede719080b2be6cb2333dfee1dccba213b422a9c8e97f2967b"
],
"index": "pypi",
"version": "==4.2b4"
},
"six": {
"hashes": [
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
"sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
],
"version": "==1.12.0"
}
},
"develop": {}
}

View File

@ -1,11 +1,12 @@
[![Build Status](https://travis-ci.org/dev-cafe/autocmake.svg?branch=master)](https://travis-ci.org/dev-cafe/autocmake/builds) [![Build Status](https://travis-ci.org/dev-cafe/autocmake.svg?branch=master)](https://travis-ci.org/dev-cafe/autocmake/builds)
[![Documentation Status](https://readthedocs.org/projects/autocmake/badge/?version=latest)](http://autocmake.readthedocs.org) [![Documentation Status](https://readthedocs.org/projects/autocmake/badge/?version=latest)](http://autocmake.readthedocs.org)
[![License](https://img.shields.io/badge/license-%20BSD--3-blue.svg)](../master/LICENSE) [![License](https://img.shields.io/badge/license-%20BSD--3-blue.svg)](LICENSE)
[![DOI](https://zenodo.org/badge/36069881.svg)](https://zenodo.org/badge/latestdoi/36069881)
![alt text](https://github.com/dev-cafe/autocmake/raw/master/img/autocmake.png "Autocmake") ![alt text](https://github.com/dev-cafe/autocmake/raw/master/img/autocmake.png "Autocmake")
A CMake plugin composer. A CMake plugin composer.
Licensed under [BSD-3](../master/LICENSE). Licensed under [BSD-3](LICENSE).
See http://autocmake.org. See http://autocmake.org.

View File

@ -52,7 +52,29 @@ def setup_build_path(build_path):
os.makedirs(build_path, 0o755) os.makedirs(build_path, 0o755)
def run_cmake(command, build_path, default_build_path): def add_quotes_to_argv(argv, arguments):
"""
This function tries to solve this problem:
https://stackoverflow.com/questions/19120247/python-sys-argv-to-preserve-or
The problem is that sys.argv has been stripped of quotes by the shell but
docopt's arguments contains quotes.
So what we do is cycle through all docopt arguments: if they are also
present in sys.argv and contain spaces, we add quotes.
"""
setup_command = ' '.join(argv[:])
for k, v in arguments.items():
if isinstance(v, str):
if ' ' in v:
if v in setup_command:
setup_command = setup_command.replace(v, '"{}"'.format(v))
return setup_command
def run_cmake(command, build_path, default_build_path, arguments):
""" """
Execute CMake command. Execute CMake command.
""" """
@ -88,7 +110,8 @@ def run_cmake(command, build_path, default_build_path):
configuration_successful = configuring_done and generating_done and build_files_written configuration_successful = configuring_done and generating_done and build_files_written
if configuration_successful: if configuration_successful:
save_setup_command(sys.argv, build_path) setup_command = add_quotes_to_argv(sys.argv, arguments)
save_setup_command(setup_command, build_path)
print_build_help(build_path, default_build_path) print_build_help(build_path, default_build_path)
@ -105,16 +128,16 @@ def print_build_help(build_path, default_build_path):
print(' $ make') print(' $ make')
def save_setup_command(argv, build_path): def save_setup_command(setup_command, build_path):
""" """
Save setup command to a file. Save setup command to a file.
""" """
file_name = os.path.join(build_path, 'setup_command') file_name = os.path.join(build_path, 'setup_command')
with open(file_name, 'w') as f: with open(file_name, 'w') as f:
f.write(' '.join(argv[:]) + '\n') f.write(setup_command + '\n')
def configure(root_directory, build_path, cmake_command, only_show): def configure(root_directory, build_path, cmake_command, arguments):
""" """
Main configure function. Main configure function.
""" """
@ -126,12 +149,12 @@ def configure(root_directory, build_path, cmake_command, only_show):
# deal with build path # deal with build path
if build_path is None: if build_path is None:
build_path = default_build_path build_path = default_build_path
if not only_show: if not arguments['--show']:
setup_build_path(build_path) setup_build_path(build_path)
cmake_command += ' -B' + build_path cmake_command += ' -B' + build_path
print('{0}\n'.format(cmake_command)) print('{0}\n'.format(cmake_command))
if only_show: if arguments['--show']:
sys.exit(0) sys.exit(0)
run_cmake(cmake_command, build_path, default_build_path) run_cmake(cmake_command, build_path, default_build_path, arguments)

View File

@ -1,5 +1,5 @@
def extract_list(config, section): def extract_list(config, section):
from collections import Iterable from collections.abc import Iterable
l = [] l = []
if 'modules' in config: if 'modules' in config:
for module in config['modules']: for module in config['modules']:

View File

@ -150,7 +150,7 @@ def gen_setup(config, default_build_type, relative_path, setup_script_name):
s.append("cmake_command = '{0} -H{1}'.format(gen_cmake_command(options, arguments), root_directory)") s.append("cmake_command = '{0} -H{1}'.format(gen_cmake_command(options, arguments), root_directory)")
s.append("\n") s.append("\n")
s.append("# run cmake") s.append("# run cmake")
s.append("configure.configure(root_directory, build_path, cmake_command, arguments['--show'])") s.append("configure.configure(root_directory, build_path, cmake_command, arguments)")
return s return s

View File

@ -13,7 +13,7 @@ def test_replace():
def interpolate(d, d_map): def interpolate(d, d_map):
from collections import Mapping, Iterable from collections.abc import Mapping, Iterable
from copy import copy from copy import copy
for k, v in d.items(): for k, v in d.items():

View File

@ -1,14 +1,9 @@
def parse_cmake_module(s_in, overrides={}): def parse_cmake_module(s_in, overrides={}):
import sys import sys
from collections import Mapping, Iterable, defaultdict from collections.abc import Mapping, Iterable
from collections import defaultdict
from autocmake.parse_yaml import parse_yaml from autocmake.parse_yaml import parse_yaml
from io import StringIO
# we do not use the nicer sys.version_info.major
# for compatibility with Python < 2.7
if sys.version_info[0] > 2:
from io import StringIO
else:
from StringIO import StringIO
parsed_config = defaultdict(lambda: None) parsed_config = defaultdict(lambda: None)

20
doc/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -1,345 +1,48 @@
#!/usr/bin/env python3 # Configuration file for the Sphinx documentation builder.
# -*- coding: utf-8 -*-
# #
# Autocmake documentation build configuration file, created by # For the full list of built-in configuration values, see the documentation:
# sphinx-quickstart on Mon Jun 1 16:41:30 2015. # https://www.sphinx-doc.org/en/master/usage/configuration.html
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys import sys
import os import os
import time
# If extensions (or modules to document with autodoc) are in another directory, sys.path.insert(0, os.path.abspath("."))
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('.'))
import extract_rst import extract_rst
sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath(".."))
from autocmake import __version__ as _version from autocmake import __version__ as _version
# -- General configuration ------------------------------------------------ # -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
# If your documentation needs a minimal Sphinx version, state it here. project = "Autocmake"
# copyright = f'2015-{time.strftime("%Y")}, Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors'
# needs_sphinx = '1.0' author = "Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors"
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.todo',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Autocmake'
copyright = u'2015-2017, Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors'
author = u'Radovan Bast, Roberto Di Remigio, Jonas Juselius, and contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = _version release = _version
# The short X.Y version. # The short X.Y version.
version = '.'.join(release.split('.')[0:2]) version = ".".join(release.split(".")[0:2])
# The language for content autogenerated by Sphinx. Refer to documentation # -- General configuration ---------------------------------------------------
# for a list of supported languages. # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some extensions = [
# non-false value, then it is used: "sphinx.ext.todo",
# ]
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True todo_include_todos = True
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# -- Options for HTML output ---------------------------------------------- root_doc = "index"
pygments_style = "sphinx"
# The theme to use for HTML and HTML Help pages. See the documentation for # -- Options for HTML output -------------------------------------------------
# a list of builtin themes. # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
#
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme html_theme = "classic"
# further. For a list of options available for each theme, see the html_theme_options = {"body_max_width": "none", "sidebarwidth": "16%"}
# documentation. html_static_path = ["_static"]
# html_sidebars = {"**": ["globaltoc.html", "sourcelink.html", "searchbox.html"]}
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = None
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
# html_last_updated_fmt = None
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}
# If false, no module index is generated.
#
# html_domain_indices = True
# If false, no index is generated.
#
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'Autocmakedoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Autocmake.tex', u'Autocmake Documentation',
author, 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#
# latex_use_parts = False
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# It false, will not define \strong, \code, itleref, \crossref ... but only
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
# packages.
#
# latex_keep_old_macro_names = True
# If false, no module index is generated.
#
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'autocmake', u'Autocmake Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Autocmake', u'Autocmake Documentation',
author, 'Autocmake', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#
# texinfo_appendices = []
# If false, no module index is generated.
#
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#
# texinfo_no_detailmenu = False

View File

@ -10,7 +10,7 @@ below::
name: numgrid name: numgrid
min_cmake_version: 2.8 min_cmake_version: 3.1
default_build_type: release default_build_type: release
@ -75,7 +75,7 @@ Minimal example
As a minimal example we take an ``autocmake.yml`` which only contains:: As a minimal example we take an ``autocmake.yml`` which only contains::
name: minime name: minime
min_cmake_version: 2.8 min_cmake_version: 3.1
language: C language: C
If you don't have the ``update.py`` script yet, you need to fetch it from the web:: If you don't have the ``update.py`` script yet, you need to fetch it from the web::

View File

@ -54,7 +54,7 @@ Now we edit ``cmake/autocmake.yml`` to look like this::
name: hello name: hello
min_cmake_version: 2.8 min_cmake_version: 3.1
language: language:
- Fortran - Fortran

View File

@ -73,7 +73,7 @@ Yes you can do that in ``autocmake.yml``. Here we for instance change the name t
:emphasize-lines: 4 :emphasize-lines: 4
name: myproject name: myproject
min_cmake_version: 2.8 min_cmake_version: 3.1
default_build_type: release default_build_type: release
setup_script: configure setup_script: configure
language: language:

35
doc/make.bat Normal file
View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

View File

@ -4,4 +4,4 @@
name: myproject name: myproject
min_cmake_version: 2.8 min_cmake_version: 3.1

30
modules/sccache.cmake Normal file
View File

@ -0,0 +1,30 @@
# (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md
# licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE
#.rst:
#
# Adds sccache support.
# The user should export the appropriate environment variables to
# tweak the program's behaviour, as described in its manpage.
# Notice that some additional compiler flags might be needed in order
# to avoid unnecessary warnings.
#
# Variables defined::
#
# SCCACHE_FOUND
#
# autocmake.yml configuration::
#
# docopt: "--sccache=<USE_SCCACHE> Toggle use of sccache <ON/OFF> [default: ON]."
# define: "'-DUSE_SCCACHE={0}'.format(arguments['--sccache'])"
if(USE_SCCACHE)
find_program(SCCACHE_FOUND sccache)
if(SCCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE sccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK sccache)
message(STATUS "Compiling with sccache")
else()
message(STATUS "sccache not available")
endif()
endif()

View File

@ -1,3 +1,4 @@
pycodestyle pycodestyle
pytest pytest
pyyaml pyyaml
sphinx

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: CXX language: CXX
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: language:
- CXX - CXX
- C - C

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: language:
- C - C
- CXX - CXX

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: CXX language: CXX
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: Fortran language: Fortran
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: language:
- Fortran - Fortran
- C - C

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: Fortran language: Fortran
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: Fortran language: Fortran
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: language:
- Fortran - Fortran
- C - C

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: Fortran language: Fortran
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: CXX language: CXX
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: language:
- CXX - CXX
default_build_type: debug default_build_type: debug

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: CXX language: CXX
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,5 +1,5 @@
name: example name: example
min_cmake_version: 2.8 min_cmake_version: 3.1
language: CXX language: CXX
default_build_type: debug default_build_type: debug
modules: modules:

View File

@ -1,15 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python3
import os import os
import sys import sys
AUTOCMAKE_GITHUB_URL = 'https://github.com/AnotherFoxGuy/autocmake/raw/master/'
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
sys.stderr.write("ERROR: update.py requires at least Python 2.7\n")
sys.exit(-1)
AUTOCMAKE_GITHUB_URL = 'https://github.com/dev-cafe/autocmake/raw/master/'
def licensing_info(): def licensing_info():
@ -40,15 +34,15 @@ def print_progress_bar(text, done, total, width):
sys.stdout.flush() sys.stdout.flush()
def flat_add(l, x): def flat_add(lst, x):
if isinstance(x, int): if isinstance(x, int):
l.append(x) lst.append(x)
return l return lst
elif isinstance(x, str): elif isinstance(x, str):
l.append(x) lst.append(x)
return l return lst
else: else:
return l + x return lst + x
def fetch_modules(config, relative_path, download_directory): def fetch_modules(config, relative_path, download_directory):
@ -56,7 +50,7 @@ def fetch_modules(config, relative_path, download_directory):
Assemble modules which will Assemble modules which will
be included in CMakeLists.txt. be included in CMakeLists.txt.
""" """
from collections import Iterable, namedtuple, defaultdict from collections import namedtuple, defaultdict
from autocmake.extract import extract_list, to_d, to_l from autocmake.extract import extract_list, to_d, to_l
from autocmake.parse_rst import parse_cmake_module from autocmake.parse_rst import parse_cmake_module
@ -130,7 +124,6 @@ def fetch_modules(config, relative_path, download_directory):
def process_yaml(argv): def process_yaml(argv):
from autocmake.parse_yaml import parse_yaml from autocmake.parse_yaml import parse_yaml
from autocmake.generate import gen_cmakelists, gen_setup from autocmake.generate import gen_cmakelists, gen_setup
from autocmake.extract import extract_list
project_root = argv[1] project_root = argv[1]
if not os.path.isdir(project_root): if not os.path.isdir(project_root):
@ -287,30 +280,22 @@ def fetch_url(src, dst):
""" """
Fetch file from URL src and save it to dst. Fetch file from URL src and save it to dst.
""" """
# we do not use the nicer sys.version_info.major import urllib.request
# for compatibility with Python < 2.7 import shutil
if sys.version_info[0] > 2:
import urllib.request
class URLopener(urllib.request.FancyURLopener):
def http_error_default(self, url, fp, errcode, errmsg, headers):
sys.stderr.write("ERROR: could not fetch {0}\n".format(url))
sys.exit(-1)
else:
import urllib
class URLopener(urllib.FancyURLopener):
def http_error_default(self, url, fp, errcode, errmsg, headers):
sys.stderr.write("ERROR: could not fetch {0}\n".format(url))
sys.exit(-1)
dirname = os.path.dirname(dst) dirname = os.path.dirname(dst)
if dirname != '': if dirname != '':
if not os.path.isdir(dirname): if not os.path.isdir(dirname):
os.makedirs(dirname) os.makedirs(dirname)
opener = URLopener() try:
opener.retrieve(src, dst) with urllib.request.urlopen(src) as response, open(dst, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
except urllib.error.HTTPError as e:
sys.stderr.write(f"\n\nERROR: could not fetch {src}, request failed with error {e.code} \n\t {e.reason}\n")
sys.exit(-1)
except urllib.error.URLError as e:
sys.stderr.write(f"\n\nERROR: could not fetch {src}, {e.reason}\n")
sys.exit(-1)
if __name__ == '__main__': if __name__ == '__main__':