added build option GENERATE_CMAKE_CONFIG [skip ci]

also:
- minor cleanup
This commit is contained in:
Mark Gillard 2020-04-07 22:34:54 +03:00
parent ee35432b71
commit 45c0fe26c0
10 changed files with 48 additions and 40 deletions

View File

@ -24,7 +24,7 @@ jobs:
- run:
name: Building and testing with clang 9
command: |
CXX=clang++-9 meson build --buildtype=debug
CXX=clang++-9 meson build --buildtype=debug -DGENERATE_CMAKE_CONFIG=disabled
cd build && ninja -v -j 4 && ninja test
- run:
name: Generating documentation
@ -58,7 +58,7 @@ jobs:
- run:
name: Building and testing with clang 9
command: |
CXX=clang++-9 meson build --buildtype=debug
CXX=clang++-9 meson build --buildtype=debug -DGENERATE_CMAKE_CONFIG=disabled
cd build && ninja -v -j 4 && ninja test
@ -84,7 +84,7 @@ jobs:
- run:
name: Building and testing with clang 9
command: |
CXX=clang++-9 meson build --buildtype=release
CXX=clang++-9 meson build --buildtype=release -DGENERATE_CMAKE_CONFIG=disabled
cd build && ninja -v -j 4 && ninja test
@ -106,7 +106,7 @@ jobs:
- run:
name: Building and testing with gcc9
command: |
CXX=g++-9 meson build --buildtype=debug
CXX=g++-9 meson build --buildtype=debug -DGENERATE_CMAKE_CONFIG=disabled
cd build && ninja -v -j 4 && ninja test
@ -128,7 +128,7 @@ jobs:
- run:
name: Building and testing with gcc9
command: |
CXX=g++-9 meson build --buildtype=release
CXX=g++-9 meson build --buildtype=release -DGENERATE_CMAKE_CONFIG=disabled
cd build && ninja -v -j 4 && ninja test

View File

@ -335,7 +335,7 @@ TOML_DISABLE_ALL_WARNINGS
TOML_POP_WARNINGS
#if TOML_CHAR_8_STRINGS
#if !defined(__cpp_lib_char8_t)
#ifndef __cpp_lib_char8_t
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif

View File

@ -102,7 +102,7 @@ namespace toml
base::clear_naked_newline();
}
inline void print_inline(const table& /*tbl*/);
void print_inline(const table& /*tbl*/);
void print(const array& arr)
{

View File

@ -50,7 +50,7 @@ namespace toml
private:
using base = impl::formatter<Char>;
inline void print(const toml::table& tbl);
void print(const toml::table& tbl);
void print(const array& arr)
{

View File

@ -331,7 +331,7 @@ namespace toml
[[nodiscard]] TOML_API
parse_result parse(std::string_view doc, std::string&& source_path) TOML_MAY_THROW;
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
/// \brief Parses a TOML document from a char8_t string view.
///
@ -379,7 +379,7 @@ namespace toml
[[nodiscard]] TOML_API
parse_result parse(std::u8string_view doc, std::string&& source_path) TOML_MAY_THROW;
#endif // defined(__cpp_lib_char8_t)
#endif // __cpp_lib_char8_t
/// \brief Parses a TOML document from a stream.
///
@ -553,7 +553,7 @@ namespace toml
[[nodiscard]] TOML_API
parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW;
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
/// \brief Parses TOML data from a string.
///
@ -579,7 +579,7 @@ namespace toml
[[nodiscard]] TOML_API
parse_result operator"" _toml(const char8_t* str, size_t len) TOML_MAY_THROW;
#endif
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS

View File

@ -3305,7 +3305,7 @@ namespace toml
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
}
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
TOML_API
TOML_FUNC_EXTERNAL_LINKAGE
@ -3321,7 +3321,7 @@ namespace toml
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
}
#endif // defined(__cpp_lib_char8_t)
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
@ -3344,7 +3344,7 @@ namespace toml
return parse(std::string_view{ str, len });
}
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
TOML_API
TOML_FUNC_EXTERNAL_LINKAGE
@ -3353,7 +3353,7 @@ namespace toml
return parse(std::u8string_view{ str, len });
}
#endif // defined(__cpp_lib_char8_t)
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS

View File

@ -111,14 +111,20 @@ pkgc.generate (
description: 'Header-only TOML config file parser and serializer for modern C++'
)
cmake = import('cmake')
cmake.write_basic_package_version_file(
name: 'tomlplusplus',
version: meson.project_version())
conf = configuration_data()
cmake.configure_package_config_file(
name: 'tomlplusplus',
input: 'cmake/tomlplusplus.cmake.in',
configuration: conf,
)
# meson cmake stuff requires at least 0.50
if meson.version().version_compare('>= 0.50')
if get_option('GENERATE_CMAKE_CONFIG').enabled() or (get_option('GENERATE_CMAKE_CONFIG').auto() and not meson.is_subproject())
cmake = import('cmake')
cmake.write_basic_package_version_file(
name: meson.project_name(),
version: meson.project_version()
)
cmake_conf = configuration_data()
cmake.configure_package_config_file(
name: meson.project_name(),
input: 'cmake/tomlplusplus.cmake.in',
configuration: cmake_conf,
)
endif
endif

View File

@ -1,2 +1,3 @@
option('BUILD_TESTS', type : 'feature', value : 'auto', description : 'Whether to build tests (defaults to auto: only if not a subproject)')
option('BUILD_EXAMPLES', type : 'feature', value : 'auto', description : 'Whether to build examples (defaults to auto: only if not a subproject)')
option('BUILD_TESTS', type : 'feature', value : 'auto', description : 'Whether to build tests (default: auto - only if not a subproject)')
option('BUILD_EXAMPLES', type : 'feature', value : 'auto', description : 'Whether to build examples (default: auto - only if not a subproject)')
option('GENERATE_CMAKE_CONFIG', type : 'feature', value : 'auto', description : 'Whether to generate a cmake package config file (default: auto - only if not a subproject)')

View File

@ -380,7 +380,7 @@ TOML_DISABLE_ALL_WARNINGS
TOML_POP_WARNINGS
#if TOML_CHAR_8_STRINGS
#if !defined(__cpp_lib_char8_t)
#ifndef __cpp_lib_char8_t
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
@ -5107,7 +5107,7 @@ namespace toml
[[nodiscard]] TOML_API
parse_result parse(std::string_view doc, std::string&& source_path) TOML_MAY_THROW;
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
[[nodiscard]] TOML_API
parse_result parse(std::u8string_view doc, std::string_view source_path = {}) TOML_MAY_THROW;
@ -5115,7 +5115,7 @@ namespace toml
[[nodiscard]] TOML_API
parse_result parse(std::u8string_view doc, std::string&& source_path) TOML_MAY_THROW;
#endif // defined(__cpp_lib_char8_t)
#endif // __cpp_lib_char8_t
template <typename Char>
[[nodiscard]]
@ -5189,12 +5189,12 @@ namespace toml
[[nodiscard]] TOML_API
parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW;
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
[[nodiscard]] TOML_API
parse_result operator"" _toml(const char8_t* str, size_t len) TOML_MAY_THROW;
#endif
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
@ -5421,7 +5421,7 @@ namespace toml
base::clear_naked_newline();
}
inline void print_inline(const table& /*tbl*/);
void print_inline(const table& /*tbl*/);
void print(const array& arr)
{
if (arr.empty())
@ -5743,7 +5743,7 @@ namespace toml
private:
using base = impl::formatter<Char>;
inline void print(const toml::table& tbl);
void print(const toml::table& tbl);
void print(const array& arr)
{
if (arr.empty())
@ -9697,7 +9697,7 @@ namespace toml
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
}
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
TOML_API
TOML_FUNC_EXTERNAL_LINKAGE
@ -9713,7 +9713,7 @@ namespace toml
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
}
#endif // defined(__cpp_lib_char8_t)
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
@ -9736,7 +9736,7 @@ namespace toml
return parse(std::string_view{ str, len });
}
#if defined(__cpp_lib_char8_t)
#ifdef __cpp_lib_char8_t
TOML_API
TOML_FUNC_EXTERNAL_LINKAGE
@ -9745,7 +9745,7 @@ namespace toml
return parse(std::u8string_view{ str, len });
}
#endif // defined(__cpp_lib_char8_t)
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS

View File

@ -67,6 +67,7 @@
<PreprocessorDefinitions>%(PreprocessorDefinitions);NDEBUG</PreprocessorDefinitions>
<InlineFunctionExpansion Condition="$(PlatformToolsetVersion) &lt;= 141">AnySuitable</InlineFunctionExpansion> <!-- /Ob2 -->
<AdditionalOptions Condition="$(PlatformToolsetVersion) &gt;= 142">%(AdditionalOptions) /Ob3</AdditionalOptions> <!-- /Ob3 -->
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <!-- /Ot -->
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>