-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 823bd4d
Showing
68 changed files
with
11,064 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Copyright (c) 2019 Álvaro Ceballos | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
|
||
cmake_minimum_required(VERSION 3.11) | ||
|
||
|
||
set(detail_header_files | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/arg_value_holder.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/call_status_holder.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/help_generation_helpers.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/is_flag_aliases_naming_valid.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/is_in_string_vector.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/join_all_parser_flags.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/make_flag_aliases_list.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/multiple_flag_arg_values_holder.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/multiple_flag_getters_maker.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/name_of_arg_type.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/parser_helper.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/parser_runtime_data_holder.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/remove_zeroes_from_string.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/set_values_from_strings.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/detail/string_parsing_helper.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/preprocessor/detail/flag_argument_helpers.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/preprocessor/detail/get_argument_helpers.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/preprocessor/detail/pp_concat.hpp | ||
) | ||
|
||
|
||
set(header_files | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/config.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/preprocessor/pp_flag.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/preprocessor/pp_flag_arguments.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/preprocessor/pp_parser.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/argument_type.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/argument_types_list.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/finish_at.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/flag.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/flag_arguments.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/generate_list_of_flags.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/get_as_tuple.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/help_parameters.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/is_switch.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/number_of_flag_args.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/parser.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/parser_parameters.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/start_at.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/exceptions/bad_argument_parsing.hpp | ||
${PROJECT_SOURCE_DIR}/include/cynodelic/metaflags/fwd/parser_fwd.hpp | ||
) | ||
|
||
|
||
# Gets the version | ||
file(READ include/cynodelic/metaflags/config.hpp _ver_impl) | ||
|
||
string(REGEX MATCH "#define CYNODELIC_METAFLAGS_VERSION_MAJOR ([0-9]+)(.*)" _ ${_ver_impl}) | ||
set(cynodelic_metaflags_ver_major ${CMAKE_MATCH_1}) | ||
|
||
string(REGEX MATCH "#define CYNODELIC_METAFLAGS_VERSION_MINOR ([0-9]+)(.*)" _ ${_ver_impl}) | ||
set(cynodelic_metaflags_ver_minor ${CMAKE_MATCH_1}) | ||
|
||
string(REGEX MATCH "#define CYNODELIC_METAFLAGS_VERSION_PATCH ([0-9]+)(.*)" _ ${_ver_impl}) | ||
set(cynodelic_metaflags_ver_patch ${CMAKE_MATCH_1}) | ||
|
||
set(cynodelic_metaflags_ver_string "${cynodelic_metaflags_ver_major}.${cynodelic_metaflags_ver_minor}.${cynodelic_metaflags_ver_patch}") | ||
|
||
message("Cynodelic::Metaflags, version ${cynodelic_metaflags_ver_string}") | ||
|
||
|
||
# Project name and version | ||
project(cynodelic_metaflags VERSION ${cynodelic_metaflags_ver_string} LANGUAGES CXX) | ||
|
||
|
||
# Options | ||
option(CYNODELIC_METAFLAGS_BUILD_EXAMPLES "Builds the examples" OFF) | ||
option(CYNODELIC_METAFLAGS_BUILD_DOC "Builds the corresponding documentation" OFF) | ||
option(CYNODELIC_METAFLAGS_BUILD_TEST "Builds the unit tests" ON) | ||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
# Path to Mulinum doc directory | ||
set(CYNODELIC_METAFLAGS_MULINUM_DOC_DIR "" CACHE PATH "Path of Mulinum\'s \"doc\" directory") | ||
|
||
|
||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") | ||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") | ||
endif() | ||
|
||
|
||
# Library operations | ||
add_library(metaflags INTERFACE) | ||
target_sources(metaflags INTERFACE $<BUILD_INTERFACE:${detail_header_files} ${header_files}>) | ||
target_include_directories(metaflags INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>) | ||
|
||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/cynodelic" DESTINATION include) | ||
|
||
|
||
# Builds unit tests | ||
if (CYNODELIC_METAFLAGS_BUILD_TEST) | ||
enable_testing() | ||
add_subdirectory(test) | ||
endif() | ||
|
||
|
||
# Builds examples | ||
if (CYNODELIC_METAFLAGS_BUILD_EXAMPLES) | ||
add_subdirectory(example) | ||
endif() | ||
|
||
|
||
# Builds documentation | ||
if (CYNODELIC_METAFLAGS_BUILD_DOC) | ||
add_subdirectory(doc) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Boost Software License - Version 1.0 - August 17th, 2003 | ||
|
||
Permission is hereby granted, free of charge, to any person or organization | ||
obtaining a copy of the software and accompanying documentation covered by | ||
this license (the "Software") to use, reproduce, display, distribute, | ||
execute, and transmit the Software, and to prepare derivative works of the | ||
Software, and to permit third-parties to whom the Software is furnished to | ||
do so, all subject to the following: | ||
|
||
The copyright notices in the Software and this entire statement, including | ||
the above license grant, this restriction and the following disclaimer, | ||
must be included in all copies of the Software, in whole or in part, and | ||
all derivative works of the Software, unless such copies or derivative | ||
works are solely in the form of machine-executable object code generated by | ||
a source language processor. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT | ||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE | ||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Metaflags | ||
|
||
A header-only, C++14 library for parsing command-line arguments, which is based on template metaprogramming and magic statics. | ||
|
||
## Requirements | ||
|
||
- A C++14-compatible compiler | ||
- [Mulinum](https://github.com/cynodelic/mulinum) | ||
|
||
## Building and installation | ||
|
||
This library is header-only, so no building is necessary for installing it. However, the examples, unit tests and documentation need to be built, using [CMake](http://cmake.org/). | ||
|
||
Run `mkdir build && cd build && cmake [options] .. && make` (or your equivalent) for building. | ||
|
||
### Building the examples | ||
|
||
Use the `-DCYNODELIC_METAFLAGS_BUILD_EXAMPLES=1` option for building the examples. | ||
|
||
### Building and running the tests | ||
|
||
Use the `-DCYNODELIC_METAFLAGS_BUILD_TEST=1` option for building the unit tests. | ||
|
||
Run the tests using `make test`. | ||
|
||
### Building the documentation | ||
|
||
The documentation is generated with [Doxygen](http://www.doxygen.nl/), if avaliable. | ||
|
||
Use the `-DCYNODELIC_METAFLAGS_BUILD_DOC=1` for allowing its generation. | ||
|
||
#### Linking with Mulinum's documentation | ||
|
||
To link with Mulinum's documentation, set the path to it using the `-DCYNODELIC_METAFLAGS_MULINUM_DOC_DIR=/path/to/your/mulinum/doc` option. | ||
|
||
### Installing the library | ||
|
||
The installation path is set using the `-DCMAKE_INSTALL_PREFIX=path/to/your/libraries` option. | ||
|
||
Run `make install` to install the library, as well as its documentation. | ||
|
||
The documentation will be installed in `path/to/your/libraries/doc/cynodelic/metaflags`. | ||
|
||
## License | ||
This library is licensed under the Boost Software License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright (c) 2019 Álvaro Ceballos | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
|
||
find_package(Doxygen REQUIRED) | ||
|
||
if(NOT DOXYGEN_FOUND) | ||
message(WARNING "Doxygen was not found; the documentation files will not be built.") | ||
return() | ||
endif() | ||
|
||
|
||
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}) | ||
set(DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/doc/cynodelic/metaflags) | ||
|
||
|
||
configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_SOURCE_DIR}/doc/Doxyfile @ONLY) | ||
add_custom_target(doc ALL | ||
COMMAND ${CMAKE_COMMAND} -E echo_append "Building documentation..." | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOXYGEN_OUTPUT_DIR} | ||
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_SOURCE_DIR}/doc/Doxyfile | ||
COMMAND ${CMAKE_COMMAND} -E echo "Done." | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
) | ||
|
||
install(DIRECTORY ${DOXYGEN_OUTPUT_DIR} | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/doc/cynodelic | ||
COMPONENT doc | ||
) | ||
|
||
install(FILES ${PROJECT_SOURCE_DIR}/doc/cynodelic_metaflags_tagfile.tag | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/doc/cynodelic/metaflags | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
PROJECT_NAME = Metaflags | ||
PROJECT_NUMBER = @PROJECT_VERSION@ | ||
OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIR@ | ||
OUTPUT_LANGUAGE = English | ||
EXTRACT_ALL = YES | ||
ENABLE_PREPROCESSING = YES | ||
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS | ||
INPUT = @DOXYGEN_INPUT_DIR@/doc/doxygen_defs.hpp @DOXYGEN_INPUT_DIR@/include/cynodelic/metaflags/ @DOXYGEN_INPUT_DIR@/include/cynodelic/metaflags/exceptions/ @DOXYGEN_INPUT_DIR@/include/cynodelic/metaflags/preprocessor/ | ||
RECURSIVE = NO | ||
PDF_HYPERLINKS = YES | ||
USE_PDFLATEX = NO | ||
HAVE_DOT = YES | ||
TAGFILES = @CYNODELIC_METAFLAGS_MULINUM_DOC_DIR@/cynodelic/mulinum/cynodelic_mulinum_tagfile.tag=file://@CYNODELIC_METAFLAGS_MULINUM_DOC_DIR@/cynodelic/mulinum/html | ||
GENERATE_TAGFILE = @DOXYGEN_INPUT_DIR@/doc/cynodelic_metaflags_tagfile.tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright (c) 2019 Álvaro Ceballos | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
|
||
/** | ||
* @defgroup configuration_ Configuration utilities | ||
* | ||
* Utilities for the configurations of this library. | ||
*/ | ||
|
||
/** | ||
* @defgroup types Types | ||
* | ||
* The types used in this library. | ||
*/ | ||
|
||
/** | ||
* @defgroup flags Flag types | ||
* @ingroup types | ||
* | ||
* The types corresponding to the command-line flags. | ||
*/ | ||
|
||
/** | ||
* @defgroup flagargs Flag arguments | ||
* @ingroup types | ||
* | ||
* The types corresponding to the flag arguments, used in `flag`. | ||
*/ | ||
|
||
/** | ||
* @defgroup parsing Parsing | ||
* | ||
* Stuff related to the parsing of the command-line arguments. | ||
*/ | ||
|
||
/** | ||
* @defgroup parsingparams Parameters for parsing | ||
* @ingroup parsing | ||
* | ||
* Parameters related to the position of the first and last arguments to be | ||
* parsed. | ||
* | ||
* Used in `parser_parameters`. | ||
*/ | ||
|
||
/** | ||
* @defgroup startatparams "Start-at" parameters | ||
* @ingroup parsingparams | ||
* | ||
* Parameters related to the first argument to parse. | ||
*/ | ||
|
||
/** | ||
* @defgroup finishatparams "Finish-at" parameters | ||
* @ingroup parsingparams | ||
* | ||
* Parameters related to the last argument to parse. | ||
*/ | ||
|
||
/** | ||
* @defgroup helpgeneration Help generation | ||
* | ||
* Stuff for help generation. | ||
*/ | ||
|
||
/** | ||
* @defgroup helpparams Holders for help generation parameters | ||
* @ingroup helpgeneration | ||
* | ||
* Types used for holding the help generation parameters. | ||
*/ | ||
|
||
/** | ||
* @defgroup helpparamsargs Parameters for help generation | ||
* @ingroup helpparams | ||
* | ||
* Arguments used in `help_parameters` for the generation of help. | ||
*/ | ||
|
||
/** | ||
* @defgroup typetraits_ Type traits | ||
* | ||
* Type traits and operations. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2019 Álvaro Ceballos | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
|
||
set(example_names | ||
custom_help_parameters | ||
get_as_tuple | ||
runtime_start_at | ||
switches | ||
two_parsers | ||
) | ||
|
||
foreach(example_nm ${example_names}) | ||
add_executable(${example_nm} ${example_nm}.cpp) | ||
target_include_directories(${example_nm} PUBLIC ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include ${image_libs_libraries}) | ||
endforeach() |
Oops, something went wrong.