Skip to content

Commit f41ed86

Browse files
authored
Integration and examples (#24)
* Added some examples, cleaned implementation * Cleaned up implementation of search_parameters * Updated documentation generation
1 parent 26809bc commit f41ed86

47 files changed

Lines changed: 462 additions & 475 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
11
sudo: false
22

3-
language:
4-
- cpp
3+
language: c++
54

6-
dist:
7-
- xenial
5+
dist: xenial
86

97
env:
108
global: DEPS_DIR="${TRAVIS_BUILD_DIR}/deps_"
119

1210
matrix:
1311
include:
1412
- os: linux
15-
compiler: gcc-8
13+
compiler: gcc
1614
addons: &gcc8
1715
apt:
1816
sources: ['ubuntu-toolchain-r-test']
1917
packages: ['g++-8']
2018
env: [COMPILER='g++-8', VCPKG_TRIPLET='x64-linux']
2119

2220
- os: linux
23-
compiler: gcc-9
21+
compiler: gcc
2422
addons: &gcc9
2523
apt:
2624
sources: ['ubuntu-toolchain-r-test']
2725
packages: ['g++-9']
2826
env: [COMPILER='g++-9', VCPKG_TRIPLET='x64-linux']
2927

28+
- os: linux
29+
compiler: clang
30+
addons: &clang7
31+
apt:
32+
sources: ['llvm-toolchain-xenial-7']
33+
packages: ['clang++-7', 'libc++-7-dev', 'libc++abi-7-dev']
34+
env: [COMPILER='clang++-7', VCPKG_TRIPLET='x64-linux']
35+
36+
- os: linux
37+
compiler: clang
38+
addons: &clang8
39+
apt:
40+
sources: ['llvm-toolchain-xenial-8']
41+
packages: ['clang++-8', 'libc++-8-dev', 'libc++abi-8-dev']
42+
env: [COMPILER='clang++-8', VCPKG_TRIPLET='x64-linux']
43+
3044
# # 3/ OSX Clang Builds
3145
# - os: osx
3246
# osx_image: xcode10

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,18 @@ compilers:
179179

180180
Linux:
181181

182-
* GCC 7
183182
* GCC 8
184183
* GCC 9
185-
* Clang 6
184+
* Clang 7
185+
* Clang 8
186186

187187
MacOS:
188188

189-
* Clang 6
189+
* Clang 7
190190

191191
Windows:
192192

193193
* Microsoft Visual C++ 2017
194-
* Microsoft Visual C++ 2019
195194

196195
## License
197196

cmake/FindPandoc.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#Look for an executable called pandoc
2+
find_program(PANDOC_EXECUTABLE
3+
NAMES pandoc
4+
DOC "Path to pandoc executable")
5+
6+
include(FindPackageHandleStandardArgs)
7+
8+
#Handle standard arguments to find_package like REQUIRED and QUIET
9+
find_package_handle_standard_args(Pandoc
10+
"Failed to find pandoc-build executable"
11+
PANDOC_EXECUTABLE)

cmake/FindSphinx.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#Look for an executable called sphinx-build
2+
find_program(SPHINX_EXECUTABLE
3+
NAMES sphinx-build
4+
DOC "Path to sphinx-build executable")
5+
6+
include(FindPackageHandleStandardArgs)
7+
8+
#Handle standard arguments to find_package like REQUIRED and QUIET
9+
find_package_handle_standard_args(Sphinx
10+
"Failed to find sphinx-build executable"
11+
SPHINX_EXECUTABLE)

docs/CMakeLists.txt

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,59 @@
1-
# Copyright (c) Glyn Matthews 2018.
1+
# Copyright (c) Glyn Matthews 2018-19.
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6-
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
7-
8-
find_package(Doxygen)
9-
10-
if (DOXYGEN_FOUND)
11-
# API documentation
12-
configure_file(
13-
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
14-
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
15-
16-
file(COPY _build DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
17-
file(COPY _static DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
18-
file(COPY _templates DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
19-
file(COPY index.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
20-
file(COPY url.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
21-
file(COPY url_search_parameters.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
22-
file(COPY optional.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
23-
file(COPY expected.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
24-
file(COPY percent_encode.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
25-
file(COPY domain.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
26-
file(COPY filesystem.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
27-
file(COPY unicode.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
28-
configure_file(
29-
${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in
30-
${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
31-
32-
configure_file(
33-
${CMAKE_CURRENT_SOURCE_DIR}/generate_docs.sh.in
34-
${CMAKE_CURRENT_BINARY_DIR}/generate_docs.sh @ONLY)
35-
36-
add_custom_target(doc
37-
${CMAKE_CURRENT_BINARY_DIR}/generate_docs.sh
38-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
39-
COMMENT "Generating API documentation with Doxygen + Sphinx" VERBATIM)
40-
endif()
6+
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
7+
8+
find_package(Doxygen REQUIRED)
9+
find_package(Pandoc REQUIRED)
10+
find_package(Sphinx REQUIRED)
11+
12+
# Copy RST files
13+
file(COPY _build DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
14+
file(COPY _static DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
15+
file(COPY _templates DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
16+
file(COPY index.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
17+
file(COPY url.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
18+
file(COPY url_record.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
19+
file(COPY url_search_parameters.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
20+
file(COPY error_codes.rst DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
21+
22+
# Generate API documentation using Doxygen
23+
configure_file(
24+
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
25+
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
26+
27+
configure_file(
28+
${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in
29+
${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
30+
31+
add_custom_target(doxygen ALL
32+
COMMAND
33+
${DOXYGEN}
34+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
35+
COMMENT "Generating documentation with Doxygen")
36+
37+
# Convert markdown to RST
38+
SET(
39+
GENERATED_FROM_MARKDOWN
40+
readme
41+
changelog
42+
)
43+
44+
foreach (basename ${GENERATED_FROM_MARKDOWN})
45+
string(TOUPPER ${basename} basename_upper)
46+
add_custom_target(${basename}
47+
pandoc ${CMAKE_SOURCE_DIR}/${basename_upper}.md -f markdown -t rst -s -o ${CMAKE_CURRENT_BINARY_DIR}/${basename}.rst
48+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
49+
BYPRODUCTS $CMAKE_CURRENT_BINARY_DIR}/${basename}.rst
50+
COMMENT "Generating RST file with pandoc" VERBATIM)
51+
endforeach()
52+
53+
# Bring it all together using Sphinx
54+
add_custom_target(doc ALL
55+
COMMAND
56+
${SPHINX_EXECUTABLE} -M html ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
57+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
58+
DEPENDS doxygen ${GENERATED_FROM_MARKDOWN}
59+
COMMENT "Generating documentation with Sphinx")

docs/Doxyfile.in

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -792,20 +792,13 @@ WARN_LOGFILE =
792792
# Note: If this tag is empty the current directory is searched.
793793

794794
INPUT = @CMAKE_SOURCE_DIR@/include/skyr/config.hpp \
795-
@CMAKE_SOURCE_DIR@/include/skyr/domain.hpp \
796-
@CMAKE_SOURCE_DIR@/include/skyr/expected.hpp \
797-
@CMAKE_SOURCE_DIR@/include/skyr/filesystem.hpp \
798-
@CMAKE_SOURCE_DIR@/include/skyr/ipv4_address.hpp \
799-
@CMAKE_SOURCE_DIR@/include/skyr/ipv6_address.hpp \
800-
@CMAKE_SOURCE_DIR@/include/skyr/optional.hpp \
801-
@CMAKE_SOURCE_DIR@/include/skyr/percent_encode.hpp \
802-
@CMAKE_SOURCE_DIR@/include/skyr/unicode.hpp \
795+
@CMAKE_SOURCE_DIR@/include/skyr/version.hpp \
803796
@CMAKE_SOURCE_DIR@/include/skyr/url.hpp \
804-
@CMAKE_SOURCE_DIR@/include/skyr/url_error.hpp \
805-
@CMAKE_SOURCE_DIR@/include/skyr/url_parse.hpp \
806-
@CMAKE_SOURCE_DIR@/include/skyr/url_record.hpp \
807-
@CMAKE_SOURCE_DIR@/include/skyr/url_search_parameters.hpp \
808-
@CMAKE_SOURCE_DIR@/include/skyr/url_serialize.hpp
797+
@CMAKE_SOURCE_DIR@/include/skyr/url/url_error.hpp \
798+
@CMAKE_SOURCE_DIR@/include/skyr/url/url_parse.hpp \
799+
@CMAKE_SOURCE_DIR@/include/skyr/url/url_record.hpp \
800+
@CMAKE_SOURCE_DIR@/include/skyr/url/url_search_parameters.hpp \
801+
@CMAKE_SOURCE_DIR@/include/skyr/url/url_serialize.hpp
809802

810803
# This tag can be used to specify the character encoding of the source files
811804
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

docs/conf.py.in

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import os
2323
# -- Project information -----------------------------------------------------
2424

2525
project = 'Skyr URL'
26-
copyright = '2018, Glyn Matthews'
26+
copyright = '2018-19, Glyn Matthews'
2727
author = 'Glyn Matthews'
2828

2929
def parse_version_header(version_header):
@@ -53,24 +53,26 @@ release = '{}.{}'.format(major, minor)
5353

5454
# If your documentation needs a minimal Sphinx version, state it here.
5555
#
56-
# needs_sphinx = '1.0'
56+
needs_sphinx = '2.2'
5757

5858
# Add any Sphinx extension module names here, as strings. They can be
5959
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
6060
# ones.
61-
extensions = ['breathe']
61+
extensions = [
62+
'breathe',
63+
'recommonmark'
64+
]
6265

6366
# Add any paths that contain templates here, relative to this directory.
6467
templates_path = ['_templates']
6568

66-
source_parsers = {
67-
'.md': 'recommonmark.parser.CommonMarkParser',
68-
}
69-
7069
# The suffix(es) of source filenames.
7170
# You can specify multiple suffix as a list of string:
7271
#
73-
source_suffix = ['.rst', '.md']
72+
source_suffix = {
73+
'.rst': 'restructuredtext',
74+
'.md': 'markdown',
75+
}
7476

7577
# The master toctree document.
7678
master_doc = 'index'

docs/domain.rst

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/error_codes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
`skyr::url_parse_error`
2+
=======================
3+
4+
.. doxygenenum:: skyr::url_parse_errc
5+
6+
.. doxygenclass:: skyr::url_parse_error
7+
:members:

docs/expected.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)