From e1f8c70e90fea1ae445c6203b9da531bccb5ba5f Mon Sep 17 00:00:00 2001 From: Edwin Carlinet Date: Tue, 5 May 2020 19:54:32 +0200 Subject: [PATCH 1/4] Change concepts to be C++20 compliant and update range-v3 version. * Fix namespace ::ranges::view -> ::ranges::views. * Fix bad concept checking in extensions. --- conanfile.py | 2 +- pylene/CMakeLists.txt | 2 +- pylene/PyleneConfig.cmake.in | 2 +- pylene/include/mln/core/box.hpp | 4 +-- .../mln/core/canvas/local_algorithm.hpp | 5 ++- pylene/include/mln/core/concepts/domain.hpp | 7 ++-- pylene/include/mln/core/concepts/image.hpp | 36 +++++++++---------- pylene/include/mln/core/concepts/object.hpp | 4 +++ pylene/include/mln/core/concepts/pixel.hpp | 2 +- .../mln/core/concepts/structuring_element.hpp | 6 ++-- .../mln/core/extension/private/by_clamp.hpp | 2 +- .../mln/core/extension/private/by_image.hpp | 2 +- .../mln/core/extension/private/by_mirror.hpp | 2 +- .../core/extension/private/by_periodize.hpp | 2 +- .../mln/core/extension/private/by_value.hpp | 2 +- .../mln/core/extension/private/none.hpp | 2 +- .../image/private/ndbuffer_image_data.hpp | 4 +-- .../include/mln/core/image/view/extended.hpp | 2 +- .../private/neighborhood_facade.hpp | 12 +++---- pylene/include/mln/core/point.hpp | 2 +- .../mln/core/private/categories/image.hpp | 5 +-- .../include/mln/core/range/multi_indices.hpp | 2 +- pylene/include/mln/core/range/multi_span.hpp | 2 +- pylene/include/mln/core/range/view/filter.hpp | 2 +- .../include/mln/core/range/view/reverse.hpp | 2 +- .../include/mln/core/range/view/transform.hpp | 4 +-- .../mln/core/range/view/transform_if.hpp | 6 ++-- .../include/mln/core/range/view/zip_with.hpp | 7 ++-- .../include/mln/core/se/private/se_facade.hpp | 2 +- pylene/include/mln/core/se/view/filter.hpp | 4 +-- .../include/mln/morpho/canvas/unionfind.hpp | 2 +- tests/core/box.cpp | 4 +-- tests/core/point.cpp | 8 ++--- tests/core/range/multi_span.cpp | 4 +-- 34 files changed, 80 insertions(+), 76 deletions(-) diff --git a/conanfile.py b/conanfile.py index af1d8c14..e235680a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -45,7 +45,7 @@ class Pylene(ConanFile): # Requirements part of the INTERFACE def requirements(self): - self.requires("range-v3/0.9.1@ericniebler/stable") + self.requires("range-v3/0.10.0@ericniebler/stable") self.requires("fmt/6.0.0") if self.options.freeimage: diff --git a/pylene/CMakeLists.txt b/pylene/CMakeLists.txt index 440531b1..c1e836ea 100644 --- a/pylene/CMakeLists.txt +++ b/pylene/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Boost 1.58 REQUIRED) find_package(FreeImage REQUIRED) find_package(TBB) -find_package(range-v3 0.9.1 REQUIRED CONFIG) +find_package(range-v3 0.10.0 REQUIRED CONFIG) find_package(fmt 6.0 REQUIRED) set(PYLENE_USE_TBB YES CACHE BOOL "Set to NO to disable use of TBB and parallelization") diff --git a/pylene/PyleneConfig.cmake.in b/pylene/PyleneConfig.cmake.in index af23ee81..ba9a584d 100644 --- a/pylene/PyleneConfig.cmake.in +++ b/pylene/PyleneConfig.cmake.in @@ -1,6 +1,6 @@ include(CMakeFindDependencyMacro) find_dependency(Boost 1.58) -find_dependency(range-v3 0.9.1 CONFIG) +find_dependency(range-v3 0.10.0 CONFIG) find_dependency(fmt 6.0) include("${CMAKE_CURRENT_LIST_DIR}/PyleneTargets.cmake") diff --git a/pylene/include/mln/core/box.hpp b/pylene/include/mln/core/box.hpp index e0c57042..3b2069ad 100644 --- a/pylene/include/mln/core/box.hpp +++ b/pylene/include/mln/core/box.hpp @@ -98,8 +98,8 @@ namespace mln return size(2); } - using Impl::cursor; - using Impl::backward_cursor; + using typename Impl::cursor; + using typename Impl::backward_cursor; using Impl::begin_cursor; using Impl::end_cursor; using Impl::rbegin_cursor; diff --git a/pylene/include/mln/core/canvas/local_algorithm.hpp b/pylene/include/mln/core/canvas/local_algorithm.hpp index dbfa260c..c4e5b2e8 100644 --- a/pylene/include/mln/core/canvas/local_algorithm.hpp +++ b/pylene/include/mln/core/canvas/local_algorithm.hpp @@ -13,7 +13,7 @@ namespace mln::canvas template // This concept check makes an ICE with MSVC #ifndef _MSC_VER - requires concepts::StructuringElement>&& concepts::Image&& concepts::Image + requires concepts::StructuringElement> && concepts::Image && concepts::Image #endif class LocalAlgorithm { @@ -101,6 +101,9 @@ namespace mln::canvas template +#ifndef _MSC_VER + requires concepts::StructuringElement> && concepts::Image && concepts::Image +#endif void LocalAlgorithm::Execute() { mln_entering("LocalAlgorithm::Execute (Non-incremental)"); diff --git a/pylene/include/mln/core/concepts/domain.hpp b/pylene/include/mln/core/concepts/domain.hpp index d5c1cf29..26d0375a 100644 --- a/pylene/include/mln/core/concepts/domain.hpp +++ b/pylene/include/mln/core/concepts/domain.hpp @@ -20,9 +20,9 @@ namespace mln::concepts mln::ranges::mdrange && Point> && requires(const Dom cdom, mln::ranges::mdrange_value_t p) { - { cdom.has(p) } -> bool; - { cdom.empty() } -> bool; - { cdom.dim() } -> int; + { cdom.has(p) } -> ::concepts::same_as; + { cdom.empty() } -> ::concepts::same_as; + { cdom.dim() } -> ::concepts::same_as; }; @@ -39,7 +39,6 @@ namespace mln::concepts concept ShapedDomain = SizedDomain && requires(const Dom cdom) { - { cdom.shape() } -> ::ranges::range_value_t; { cdom.extents() } -> ::ranges::cpp20::forward_range; }; diff --git a/pylene/include/mln/core/concepts/image.hpp b/pylene/include/mln/core/concepts/image.hpp index d3f9456f..3482df1b 100644 --- a/pylene/include/mln/core/concepts/image.hpp +++ b/pylene/include/mln/core/concepts/image.hpp @@ -73,7 +73,7 @@ namespace mln::concepts { cima.template ch_value() } -> ::concepts::convertible_to>; { cima.concretize() } -> ::concepts::convertible_to>; - { cima.domain() } -> image_domain_t; + { cima.domain() } -> ::concepts::convertible_to>; { ima.pixels() } -> mln::ranges::mdrange; { ima.values() } -> mln::ranges::mdrange; requires ::concepts::convertible_to, image_pixel_t>; @@ -120,7 +120,7 @@ namespace mln::concepts } && image_indexable_v && requires (I ima, image_index_t k) { - { ima[k] } -> image_reference_t; // For concrete image it returns a const_reference + { ima[k] } -> ::concepts::same_as>; // For concrete image it returns a const_reference }; @@ -133,9 +133,9 @@ namespace mln::concepts WritableImage && IndexableImage && requires(I ima, image_index_t k, image_value_t v) { - { ima[k] = v } -> image_reference_t; + { ima[k] = v } -> ::concepts::same_as>; }; - + } // namespace detail @@ -145,10 +145,10 @@ namespace mln::concepts Image && image_accessible_v && requires (I ima, image_point_t p) { - { ima(p) } -> image_reference_t; // For concrete image it returns a const_reference - { ima.at(p) } -> image_reference_t; // idem - { ima.new_pixel(p) } -> image_pixel_t; // For concrete image pixel may propagate constness - { ima.new_pixel_at(p) } -> image_pixel_t; // idem + { ima(p) } -> ::concepts::same_as>; // For concrete image it returns a const_reference + { ima.at(p) } -> ::concepts::same_as>; // idem + { ima.new_pixel(p) } -> ::concepts::same_as>; // For concrete image pixel may propagate constness + { ima.new_pixel_at(p) } -> ::concepts::same_as>; // idem }; @@ -161,10 +161,10 @@ namespace mln::concepts detail::WritableImage && AccessibleImage && requires(I ima, image_point_t p, image_value_t v) { - { ima(p) = v } -> image_reference_t; - { ima.at(p) = v } -> image_reference_t; + { ima(p) = v }; + { ima.at(p) = v }; }; - + } // namespace detail @@ -174,9 +174,9 @@ namespace mln::concepts IndexableImage && AccessibleImage && requires (const I cima, image_index_t k, image_point_t p) { - { cima.point_at_index(k) } -> image_point_t; - { cima.index_of_point(p) } -> image_index_t; - { cima.delta_index(p) } -> image_index_t; + { cima.point_at_index(k) } -> ::concepts::same_as>; + { cima.index_of_point(p) } -> ::concepts::same_as>; + { cima.delta_index(p) } -> ::concepts::same_as>; }; @@ -222,8 +222,8 @@ namespace mln::concepts BidirectionalImage && ::concepts::derived_from, raw_image_tag> && requires (I ima, const I cima, int dim) { - { ima.data() } -> ::concepts::convertible_to*>; // data() may be proxied by a view - { cima.stride(dim) } -> std::ptrdiff_t; + { ima.data() } -> ::concepts::convertible_to*>; // data() may be proxied by a view + { cima.stride(dim) } -> ::concepts::same_as; }; @@ -238,7 +238,7 @@ namespace mln::concepts WritableBidirectionalImage && RawImage && requires(I ima, image_value_t v) { - { ima.data() } -> ::concepts::convertible_to*>; + { ima.data() } -> ::concepts::convertible_to*>; { *(ima.data()) = v }; }; @@ -267,7 +267,7 @@ namespace mln::concepts } && not ::concepts::same_as> && requires (I ima, image_point_t p) { - { ima.extension() } -> image_extension_t; + { ima.extension() } -> ::concepts::same_as>; }; diff --git a/pylene/include/mln/core/concepts/object.hpp b/pylene/include/mln/core/concepts/object.hpp index 8cd5f64a..70581751 100644 --- a/pylene/include/mln/core/concepts/object.hpp +++ b/pylene/include/mln/core/concepts/object.hpp @@ -49,6 +49,10 @@ namespace mln template class Concept> using is_a = typename internal::is_a_helper::type; + + template class Concept> + constexpr inline bool is_a_v = is_a::value; + /*********************/ /* Implementation */ /*********************/ diff --git a/pylene/include/mln/core/concepts/pixel.hpp b/pylene/include/mln/core/concepts/pixel.hpp index f5468bc4..039f372f 100644 --- a/pylene/include/mln/core/concepts/pixel.hpp +++ b/pylene/include/mln/core/concepts/pixel.hpp @@ -33,7 +33,7 @@ namespace mln::concepts !std::is_reference_v> && requires(const Pix cpix, Pix pix, pixel_point_t p) { { cpix.point() } -> ::concepts::convertible_to>; -#if (__GNUG__) // see https://stackoverflow.com/questions/55198202/unable-to-deduce-placeholder-type-in-concept +#if (__GNUG__ == 9) // see https://stackoverflow.com/questions/55198202/unable-to-deduce-placeholder-type-in-concept { cpix.val() } -> ::concepts::convertible_to>&&; #else { cpix.val() } -> ::concepts::convertible_to>; diff --git a/pylene/include/mln/core/concepts/structuring_element.hpp b/pylene/include/mln/core/concepts/structuring_element.hpp index 05e8f4ee..689dfe29 100644 --- a/pylene/include/mln/core/concepts/structuring_element.hpp +++ b/pylene/include/mln/core/concepts/structuring_element.hpp @@ -27,7 +27,7 @@ namespace mln::concepts template concept DynamicStructuringElement = requires (SE se) { - { se.radial_extent() } -> int; + { se.radial_extent() } -> ::concepts::same_as; }; @@ -73,7 +73,7 @@ namespace mln::concepts StructuringElement && ::concepts::convertible_to && requires(const SE se) { - { se.is_decomposable() } -> bool; + { se.is_decomposable() } -> ::concepts::same_as; { se.decompose() } -> ::ranges::cpp20::forward_range; requires details::RangeOfStructuringElement; }; @@ -84,7 +84,7 @@ namespace mln::concepts StructuringElement && ::concepts::convertible_to && requires(const SE se) { - { se.is_separable() } -> bool; + { se.is_separable() } -> ::concepts::same_as; { se.separate() } -> ::ranges::cpp20::forward_range; requires details::RangeOfStructuringElement; }; diff --git a/pylene/include/mln/core/extension/private/by_clamp.hpp b/pylene/include/mln/core/extension/private/by_clamp.hpp index f5499ede..229e675a 100644 --- a/pylene/include/mln/core/extension/private/by_clamp.hpp +++ b/pylene/include/mln/core/extension/private/by_clamp.hpp @@ -25,7 +25,7 @@ namespace mln::extension template constexpr bool fit(const SE&) const { - static_assert(concepts::StructuringElement, "SE is not a valid Structuring Element!"); + static_assert(mln::is_a_v, "SE is not a valid Structuring Element!"); return true; } diff --git a/pylene/include/mln/core/extension/private/by_image.hpp b/pylene/include/mln/core/extension/private/by_image.hpp index 19886724..36c01b3a 100644 --- a/pylene/include/mln/core/extension/private/by_image.hpp +++ b/pylene/include/mln/core/extension/private/by_image.hpp @@ -37,7 +37,7 @@ namespace mln::extension template constexpr bool fit(const SE&) const { - static_assert(concepts::StructuringElement, "SE is not a valid Structuring Element!"); + static_assert(mln::is_a_v, "SE is not a valid Structuring Element!"); // TODO: non-trivial return true; diff --git a/pylene/include/mln/core/extension/private/by_mirror.hpp b/pylene/include/mln/core/extension/private/by_mirror.hpp index 2daeddb4..099c9497 100644 --- a/pylene/include/mln/core/extension/private/by_mirror.hpp +++ b/pylene/include/mln/core/extension/private/by_mirror.hpp @@ -23,7 +23,7 @@ namespace mln::extension template constexpr bool fit(const SE&) const { - static_assert(concepts::StructuringElement, "SE is not a valid Structuring Element!"); + static_assert(mln::is_a_v, "SE is not a valid Structuring Element!"); return true; } diff --git a/pylene/include/mln/core/extension/private/by_periodize.hpp b/pylene/include/mln/core/extension/private/by_periodize.hpp index d060f721..64afb6a2 100644 --- a/pylene/include/mln/core/extension/private/by_periodize.hpp +++ b/pylene/include/mln/core/extension/private/by_periodize.hpp @@ -25,7 +25,7 @@ namespace mln::extension template constexpr bool fit(const SE&) const { - static_assert(concepts::StructuringElement, "SE is not a valid Structuring Element!"); + static_assert(mln::is_a_v, "SE is not a valid Structuring Element!"); return true; } diff --git a/pylene/include/mln/core/extension/private/by_value.hpp b/pylene/include/mln/core/extension/private/by_value.hpp index 47122116..dce829d0 100644 --- a/pylene/include/mln/core/extension/private/by_value.hpp +++ b/pylene/include/mln/core/extension/private/by_value.hpp @@ -30,7 +30,7 @@ namespace mln::extension template constexpr bool fit(const SE&) const { - static_assert(concepts::StructuringElement, "SE is not a valid Structuring Element!"); + static_assert(mln::is_a_v, "SE is not a valid Structuring Element!"); return true; } diff --git a/pylene/include/mln/core/extension/private/none.hpp b/pylene/include/mln/core/extension/private/none.hpp index 28875892..c0cf2aed 100644 --- a/pylene/include/mln/core/extension/private/none.hpp +++ b/pylene/include/mln/core/extension/private/none.hpp @@ -22,7 +22,7 @@ namespace mln::extension template constexpr bool fit(const SE& se) const { - static_assert(concepts::StructuringElement, "SE is not a valid Structuring Element!"); + static_assert(mln::is_a_v, "SE is not a valid Structuring Element!"); if constexpr (std::is_base_of_v) { diff --git a/pylene/include/mln/core/image/private/ndbuffer_image_data.hpp b/pylene/include/mln/core/image/private/ndbuffer_image_data.hpp index 7b26545d..62878250 100644 --- a/pylene/include/mln/core/image/private/ndbuffer_image_data.hpp +++ b/pylene/include/mln/core/image/private/ndbuffer_image_data.hpp @@ -21,7 +21,7 @@ namespace mln::internal class __ndbuffer_image_data; template <> - class __ndbuffer_image_data : public ndbuffer_image_data + class __ndbuffer_image_data final : public ndbuffer_image_data { std::allocator m_allocator; @@ -33,7 +33,7 @@ namespace mln::internal }; template - class __ndbuffer_image_data : public ndbuffer_image_data + class __ndbuffer_image_data final : public ndbuffer_image_data { std::allocator m_allocator; diff --git a/pylene/include/mln/core/image/view/extended.hpp b/pylene/include/mln/core/image/view/extended.hpp index 224a5b65..155aa816 100644 --- a/pylene/include/mln/core/image/view/extended.hpp +++ b/pylene/include/mln/core/image/view/extended.hpp @@ -76,7 +76,7 @@ namespace mln template constexpr bool fit(const SE& se) const { - static_assert(concepts::StructuringElement, "SE is not a valid Structuring Element!"); + static_assert(mln::is_a_v, "SE is not a valid Structuring Element!"); return std::visit([&se](auto&& ima) { return ima.extension().fit(se); }, *m_adapted_image_ptr); } diff --git a/pylene/include/mln/core/neighborhood/private/neighborhood_facade.hpp b/pylene/include/mln/core/neighborhood/private/neighborhood_facade.hpp index 8e8b52be..5c09c10f 100644 --- a/pylene/include/mln/core/neighborhood/private/neighborhood_facade.hpp +++ b/pylene/include/mln/core/neighborhood/private/neighborhood_facade.hpp @@ -59,19 +59,19 @@ namespace mln template requires(!mln::is_a::value) auto operator()(const P& point) const { - return ::ranges::view::transform(static_cast(this)->offsets(), details::add_point

{point}); + return ::ranges::views::transform(static_cast(this)->offsets(), details::add_point

{point}); } template requires(!mln::is_a::value) auto before(const P& point) const { - return ::ranges::view::transform(static_cast(this)->before_offsets(), details::add_point

{point}); + return ::ranges::views::transform(static_cast(this)->before_offsets(), details::add_point

{point}); } template requires(!mln::is_a::value) auto after(const P& point) const { - return ::ranges::view::transform(static_cast(this)->after_offsets(), details::add_point

{point}); + return ::ranges::views::transform(static_cast(this)->after_offsets(), details::add_point

{point}); } }; @@ -99,19 +99,19 @@ namespace mln template requires(!mln::is_a::value) auto operator()(const P& point) const { - return ::ranges::view::transform(static_cast(this)->offsets(), details::add_wpoint

{point}); + return ::ranges::views::transform(static_cast(this)->offsets(), details::add_wpoint

{point}); } template requires(!mln::is_a::value) auto before(const P& point) const { - return ::ranges::view::transform(static_cast(this)->before_offsets(), details::add_wpoint

{point}); + return ::ranges::views::transform(static_cast(this)->before_offsets(), details::add_wpoint

{point}); } template requires(!mln::is_a::value) auto after(const P& point) const { - return ::ranges::view::transform(static_cast(this)->after_offsets(), details::add_wpoint

{point}); + return ::ranges::views::transform(static_cast(this)->after_offsets(), details::add_wpoint

{point}); } }; } // namespace mln diff --git a/pylene/include/mln/core/point.hpp b/pylene/include/mln/core/point.hpp index 13bc4ec8..f8a2ddcd 100644 --- a/pylene/include/mln/core/point.hpp +++ b/pylene/include/mln/core/point.hpp @@ -205,7 +205,7 @@ namespace mln pcontainer(const pcontainer& other) = default; // From a span - constexpr pcontainer(int dim, const T* data) noexcept + constexpr pcontainer([[maybe_unused]] int dim, const T* data) noexcept { assert(dim == Dim && "Point dimensions mistmatch."); for (int i = 0; i < Dim; ++i) diff --git a/pylene/include/mln/core/private/categories/image.hpp b/pylene/include/mln/core/private/categories/image.hpp index 37ec2eb7..bdd6f47a 100644 --- a/pylene/include/mln/core/private/categories/image.hpp +++ b/pylene/include/mln/core/private/categories/image.hpp @@ -9,10 +9,7 @@ namespace mln struct bidirectional_image_tag : forward_image_tag { }; - struct[[deprecated]] random_access_image_tag : bidirectional_image_tag - { - }; - struct raw_image_tag : random_access_image_tag + struct raw_image_tag : bidirectional_image_tag { }; //clang-format on diff --git a/pylene/include/mln/core/range/multi_indices.hpp b/pylene/include/mln/core/range/multi_indices.hpp index 3345c473..307f8928 100644 --- a/pylene/include/mln/core/range/multi_indices.hpp +++ b/pylene/include/mln/core/range/multi_indices.hpp @@ -149,7 +149,7 @@ namespace mln::ranges x[k]--; } __back(x) = __back(m_from); - return ::ranges::view::reverse(row_t(x, static_cast(__back(m_to) - __back(m_from)))); + return ::ranges::views::reverse(row_t(x, static_cast(__back(m_to) - __back(m_from)))); } diff --git a/pylene/include/mln/core/range/multi_span.hpp b/pylene/include/mln/core/range/multi_span.hpp index 84c0e599..1fe6b662 100644 --- a/pylene/include/mln/core/range/multi_span.hpp +++ b/pylene/include/mln/core/range/multi_span.hpp @@ -47,7 +47,7 @@ namespace mln::ranges ::ranges::reverse_view<::ranges::span> __read_rrow() const { auto line = ::ranges::make_span(m_ptr[Rank - 2] - m_count.back() + 1, m_ptr[Rank - 2] + 1); - return ::ranges::view::reverse(line); + return ::ranges::views::reverse(line); } bool __is_at_end(std::size_t k) const { return m_i[k] == m_count[k]; } diff --git a/pylene/include/mln/core/range/view/filter.hpp b/pylene/include/mln/core/range/view/filter.hpp index 5ae828c6..0e10a986 100644 --- a/pylene/include/mln/core/range/view/filter.hpp +++ b/pylene/include/mln/core/range/view/filter.hpp @@ -19,7 +19,7 @@ namespace mln::ranges::view template <::ranges::cpp20::range Rng, class Fun> [[gnu::always_inline]] inline auto filter(Rng&& rng, Fun&& fun) { - return ::ranges::view::filter(std::forward(rng), std::forward(fun)); + return ::ranges::views::filter(std::forward(rng), std::forward(fun)); } } // namespace mln::ranges::view diff --git a/pylene/include/mln/core/range/view/reverse.hpp b/pylene/include/mln/core/range/view/reverse.hpp index d890f67f..37e76ae2 100644 --- a/pylene/include/mln/core/range/view/reverse.hpp +++ b/pylene/include/mln/core/range/view/reverse.hpp @@ -45,7 +45,7 @@ namespace mln::ranges requires ::ranges::cpp20::bidirectional_range auto reverse(R&& rng) { - return ::ranges::view::reverse(std::forward(rng)); + return ::ranges::views::reverse(std::forward(rng)); } } diff --git a/pylene/include/mln/core/range/view/transform.hpp b/pylene/include/mln/core/range/view/transform.hpp index 94dfccb7..18527f42 100644 --- a/pylene/include/mln/core/range/view/transform.hpp +++ b/pylene/include/mln/core/range/view/transform.hpp @@ -221,13 +221,13 @@ namespace mln::ranges template <::ranges::cpp20::range Rng, class Fun> [[gnu::always_inline]] inline auto transform(Rng&& rng, Fun&& fun) { - return ::ranges::view::transform(std::forward(rng), std::forward(fun)); + return ::ranges::views::transform(std::forward(rng), std::forward(fun)); } template <::ranges::cpp20::range Rng1, ::ranges::cpp20::range Rng2, class Fun> [[gnu::always_inline]] inline auto transform(Rng1&& rng1, Rng2&& rng2, Fun&& fun) { - return ::ranges::view::transform(std::forward(rng1), std::forward(rng2), std::forward(fun)); + return ::ranges::views::transform(std::forward(rng1), std::forward(rng2), std::forward(fun)); } } // namespace view diff --git a/pylene/include/mln/core/range/view/transform_if.hpp b/pylene/include/mln/core/range/view/transform_if.hpp index 3da5834a..5c8e56ab 100644 --- a/pylene/include/mln/core/range/view/transform_if.hpp +++ b/pylene/include/mln/core/range/view/transform_if.hpp @@ -171,9 +171,9 @@ namespace mln::ranges static_assert(::ranges::invocable...>); static_assert(::ranges::predicate...>); - auto z = ::ranges::view::zip(std::forward(ranges)...); - auto f = ::ranges::view::filter(z, [pred = std::move(pred_fn)](auto&& t) { return std::apply(pred, t); }); - auto m = ::ranges::view::transform( + auto z = ::ranges::views::zip(std::forward(ranges)...); + auto f = ::ranges::views::filter(z, [pred = std::move(pred_fn)](auto&& t) { return std::apply(pred, t); }); + auto m = ::ranges::views::transform( z, [f = std::move(map_fn)](auto&& t) -> decltype(auto) { return std::apply(f, t); }); return m; diff --git a/pylene/include/mln/core/range/view/zip_with.hpp b/pylene/include/mln/core/range/view/zip_with.hpp index 7ace5c0f..9838ccaf 100644 --- a/pylene/include/mln/core/range/view/zip_with.hpp +++ b/pylene/include/mln/core/range/view/zip_with.hpp @@ -103,9 +103,10 @@ namespace mln::ranges } // namespace details - template + template struct zip_with_mdview : details::mdview_facade> { + static_assert((... && MDRange)); using cursor = details::zip_with_mdcursor...>; cursor begin_cursor() const @@ -176,7 +177,7 @@ namespace mln::ranges template [[gnu::always_inline]] inline auto zip_with(F&& zip_fn, Rng&&... ranges) { - return ::ranges::view::zip_with(std::forward(zip_fn), std::forward(ranges)...); + return ::ranges::views::zip_with(std::forward(zip_fn), std::forward(ranges)...); } } @@ -192,7 +193,7 @@ namespace mln::ranges template <::ranges::cpp20::range... Rng> [[gnu::always_inline]] inline auto zip(Rng&&... ranges) { - return ::ranges::view::zip(std::forward(ranges)...); + return ::ranges::views::zip(std::forward(ranges)...); } } diff --git a/pylene/include/mln/core/se/private/se_facade.hpp b/pylene/include/mln/core/se/private/se_facade.hpp index e9c881c4..3a743e77 100644 --- a/pylene/include/mln/core/se/private/se_facade.hpp +++ b/pylene/include/mln/core/se/private/se_facade.hpp @@ -25,7 +25,7 @@ namespace mln template requires(!mln::is_a::value) auto operator()(const P& point) const { - return ::ranges::view::transform(static_cast(this)->offsets(), details::add_point

{point}); + return ::ranges::views::transform(static_cast(this)->offsets(), details::add_point

{point}); } }; diff --git a/pylene/include/mln/core/se/view/filter.hpp b/pylene/include/mln/core/se/view/filter.hpp index ee4aff2f..f8b38dab 100644 --- a/pylene/include/mln/core/se/view/filter.hpp +++ b/pylene/include/mln/core/se/view/filter.hpp @@ -25,14 +25,14 @@ namespace mln template requires(mln::is_a::value) auto operator()(const P& pixel) const { - return ::ranges::view::filter(details::sliding_pixel_range{pixel, static_cast(this)->offsets()}, + return ::ranges::views::filter(details::sliding_pixel_range{pixel, static_cast(this)->offsets()}, [this](auto pix) { return m_pred(pix.point()); }); } template requires(!mln::is_a::value) auto operator()(const P& point) const { - return ::ranges::view::filter(::ranges::view::transform(static_cast(this)->offsets(), + return ::ranges::views::filter(::ranges::views::transform(static_cast(this)->offsets(), [point](P offset) -> P { return point + offset; }), m_pred); } diff --git a/pylene/include/mln/morpho/canvas/unionfind.hpp b/pylene/include/mln/morpho/canvas/unionfind.hpp index 9b9069da..754f880f 100644 --- a/pylene/include/mln/morpho/canvas/unionfind.hpp +++ b/pylene/include/mln/morpho/canvas/unionfind.hpp @@ -130,7 +130,7 @@ namespace mln::morpho::canvas // Forward pass { mln_entering("Union-find forward pass"); - for (auto p : ::ranges::view::reverse(S)) + for (auto p : ::ranges::views::reverse(S)) { par(p) = p; viz.on_make_set(p); diff --git a/tests/core/box.cpp b/tests/core/box.cpp index 57a494ee..ef69ed67 100644 --- a/tests/core/box.cpp +++ b/tests/core/box.cpp @@ -12,8 +12,8 @@ template concept Interoperable = ::concepts::equality_comparable_with && requires(A& a, const A& ca, const B& b) { - { ca.includes(b) } -> bool; - { ca.intersects(b) } -> bool; + { ca.includes(b) } -> ::concepts::same_as; + { ca.intersects(b) } -> ::concepts::same_as; { a.clip(b) }; }; diff --git a/tests/core/point.cpp b/tests/core/point.cpp index 33a04eb5..d1d25561 100644 --- a/tests/core/point.cpp +++ b/tests/core/point.cpp @@ -9,10 +9,10 @@ template concept AddableWith = requires(U a, V b) { - { a += b } -> U&; - { a -= b } -> U&; - { b += a } -> V&; - { b -= a } -> V&; + { a += b } -> ::concepts::same_as; + { a -= b } -> ::concepts::same_as; + { b += a } -> ::concepts::same_as; + { b -= a } -> ::concepts::same_as; { a + b }; { a - b }; { b + a}; diff --git a/tests/core/range/multi_span.cpp b/tests/core/range/multi_span.cpp index f6498fa1..105835de 100644 --- a/tests/core/range/multi_span.cpp +++ b/tests/core/range/multi_span.cpp @@ -111,7 +111,7 @@ TYPED_TEST(MultiSpanTest, forward) { typename TestFixture::range_type rng(this->m_data.data(), this->m_count, this->m_stride); - auto ref = ::ranges::to_vector(::ranges::view::indices(int(this->m_size))); + auto ref = ::ranges::to_vector(::ranges::views::indices(int(this->m_size))); auto vrng = this->rng_to_container(rng); auto vrng2 = this->rng_to_container_row_wise(rng); ASSERT_EQ(ref, vrng); @@ -123,7 +123,7 @@ TYPED_TEST(MultiSpanTest, backward) { typename TestFixture::range_type rng(this->m_data.data(), this->m_count, this->m_stride); - auto ref = ::ranges::to_vector(::ranges::view::reverse(::ranges::view::indices(int(this->m_size)))); + auto ref = ::ranges::to_vector(::ranges::views::reverse(::ranges::views::indices(int(this->m_size)))); auto vrng = this->rng_to_container(rng.reversed()); auto vrng2 = this->rng_to_container_row_wise(rng.reversed()); ASSERT_EQ(ref, vrng); -- GitLab From c790aaec64615308ff6766a6ad810f82ba4bca3d Mon Sep 17 00:00:00 2001 From: Edwin Carlinet Date: Wed, 6 May 2020 16:59:30 +0200 Subject: [PATCH 2/4] Upgrade GTest to 1.8.2 as conan deps. * Rename deprecated GTest TEST_CASE in TEST_SUITE. * GTest is set as a conan build depedancy --- bench/tests/CMakeLists.txt | 4 ++-- conanfile.py | 17 +++++++++-------- tests/CMakeLists.txt | 6 +++--- tests/core/range/mdindex.cpp | 2 +- tests/core/range/mdspan.cpp | 2 +- tests/morpho/running_max_1d.cpp | 8 ++++---- tests/morpho/tos.cpp | 2 +- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/bench/tests/CMakeLists.txt b/bench/tests/CMakeLists.txt index 64c26eca..56d6198b 100644 --- a/bench/tests/CMakeLists.txt +++ b/bench/tests/CMakeLists.txt @@ -1,11 +1,11 @@ include(CTest) find_package(Threads REQUIRED) -find_package(GTest MODULE REQUIRED) +find_package(GTest REQUIRED) add_executable(UTBenchImpl_Neighborhood neighborhood.cpp) -target_link_libraries(UTBenchImpl_Neighborhood PRIVATE BenchImpl Fixtures::ImagePath Fixtures::ImageCompare Pylene::Pylene GTest::GTest GTest::Main ${FreeImage_LIBRARIES}) +target_link_libraries(UTBenchImpl_Neighborhood PRIVATE BenchImpl Fixtures::ImagePath Fixtures::ImageCompare Pylene::Pylene GTest::GTest ${FreeImage_LIBRARIES}) add_test(NAME UTBenchImpl_Neighborhood COMMAND UTBenchImpl_Neighborhood --gtest_output=xml:UTBenchImpl_Neighborhood.xml WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bench/tests) diff --git a/conanfile.py b/conanfile.py index e235680a..373c20e9 100644 --- a/conanfile.py +++ b/conanfile.py @@ -11,19 +11,17 @@ class Pylene(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "gtest": [True, False], "benchmark": [True, False], "freeimage": [True, False], - "boost": [True, False], - "boost_program_options": [True, False]} + "boost": [True, False]} default_options = { "shared": False, "fPIC": False, - "gtest": False, "benchmark": False, "freeimage": False, "boost": False, - "boost_program_options": False} + "gtest:shared": False + } generators = [ "cmake", "cmake_paths", "cmake_find_package" ] exports_sources = ["pylene/*", "cmake/*", "CMakeLists.txt", "LICENSE"] @@ -43,17 +41,20 @@ class Pylene(ConanFile): if self.settings.compiler in ["gcc", "clang"]: self.cpp_info.cppflags = ["-std=c++20"] + # developer dependancies (to be removed) + def build_requirements(self): + self.build_requires("gtest/[>=1.10]", force_host_context=True) + + # Requirements part of the INTERFACE def requirements(self): self.requires("range-v3/0.10.0@ericniebler/stable") self.requires("fmt/6.0.0") + if self.options.freeimage: self.requires("freeimage/3.18.0@dutiona/stable") - if self.options.gtest: - self.requires("gtest/1.8.1") - if self.options.benchmark: self.requires("benchmark/1.5.0") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4653cf1a..cef6966d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,7 @@ project(tests) find_package(Threads REQUIRED) -find_package(GTest MODULE REQUIRED) +find_package(GTest 1.10 REQUIRED) find_package(Sanitizers REQUIRED) sanitizer_add_blacklist_file(${CMAKE_SOURCE_DIR}"/utils/sanitizers/blacklist.txt") @@ -15,9 +15,9 @@ function(add_core_test Executable) add_executable(${core_test_NAME} ${core_test_SOURCES}) add_test(NAME ${core_test_NAME} COMMAND ${core_test_NAME} --gtest_output=xml:${core_test_NAME}.xml WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests) - target_link_libraries(${core_test_NAME} PRIVATE Fixtures::ImagePath Fixtures::ImageCompare Pylene::Pylene GTest::GTest GTest::Main ${FreeImage_LIBRARIES}) + target_link_libraries(${core_test_NAME} PRIVATE Fixtures::ImagePath Fixtures::ImageCompare Pylene::Pylene GTest::GTest ${FreeImage_LIBRARIES}) set_tests_properties(${core_test_NAME} PROPERTIES LABELS UnitTests) - + add_sanitizers(${core_test_NAME}) add_dependencies(build-tests ${core_test_NAME}) diff --git a/tests/core/range/mdindex.cpp b/tests/core/range/mdindex.cpp index 2108b45c..df89bca1 100644 --- a/tests/core/range/mdindex.cpp +++ b/tests/core/range/mdindex.cpp @@ -102,7 +102,7 @@ public: using MyTypes = ::testing::Types, std::array, std::array, std::array, std::array>; -TYPED_TEST_CASE(MultiIndicesTest, MyTypes); +TYPED_TEST_SUITE(MultiIndicesTest, MyTypes); diff --git a/tests/core/range/mdspan.cpp b/tests/core/range/mdspan.cpp index 03529657..3ca92889 100644 --- a/tests/core/range/mdspan.cpp +++ b/tests/core/range/mdspan.cpp @@ -99,7 +99,7 @@ public: using MyTypes = ::testing::Types, std::array, std::array, std::array>; -TYPED_TEST_CASE(MdspanTest, MyTypes); +TYPED_TEST_SUITE(MdspanTest, MyTypes); TYPED_TEST(MdspanTest, forward) { diff --git a/tests/morpho/running_max_1d.cpp b/tests/morpho/running_max_1d.cpp index 78d4bb72..5ecd9d5c 100644 --- a/tests/morpho/running_max_1d.cpp +++ b/tests/morpho/running_max_1d.cpp @@ -129,7 +129,7 @@ TEST_P(RunningMin1D, check) -INSTANTIATE_TEST_CASE_P(se_leq_size, RunningMax1D, +INSTANTIATE_TEST_SUITE_P(se_leq_size, RunningMax1D, ::testing::Values(std::make_tuple(0, 0), // Identity std::make_tuple(12, 0), // Identity std::make_tuple(12, 1), // radius = 1 @@ -140,9 +140,9 @@ INSTANTIATE_TEST_CASE_P(se_leq_size, RunningMax1D, std::make_tuple(14, 3), // radius = 3 std::make_tuple(13, 6))); // n == k -INSTANTIATE_TEST_CASE_P(se_ge_size_, RunningMax1D, ::testing::Values(std::make_tuple(12, 6))); +INSTANTIATE_TEST_SUITE_P(se_ge_size_, RunningMax1D, ::testing::Values(std::make_tuple(12, 6))); -INSTANTIATE_TEST_CASE_P(se_leq_size, RunningMin1D, +INSTANTIATE_TEST_SUITE_P(se_leq_size, RunningMin1D, ::testing::Values(std::make_tuple(0, 0), // Identity std::make_tuple(12, 0), // Identity std::make_tuple(12, 1), // radius = 1 @@ -153,5 +153,5 @@ INSTANTIATE_TEST_CASE_P(se_leq_size, RunningMin1D, std::make_tuple(14, 3), // radius = 3 std::make_tuple(13, 6))); // n == k -INSTANTIATE_TEST_CASE_P(se_ge_size_, RunningMin1D, ::testing::Values(std::make_tuple(12, 6))); +INSTANTIATE_TEST_SUITE_P(se_ge_size_, RunningMin1D, ::testing::Values(std::make_tuple(12, 6))); diff --git a/tests/morpho/tos.cpp b/tests/morpho/tos.cpp index c14cb3c2..0f4b250e 100644 --- a/tests/morpho/tos.cpp +++ b/tests/morpho/tos.cpp @@ -121,7 +121,7 @@ class ToSPropagation : public ::testing::Test }; typedef ::testing::Types TestValueTypes; -TYPED_TEST_CASE(ToSPropagation, TestValueTypes); +TYPED_TEST_SUITE(ToSPropagation, TestValueTypes); TYPED_TEST(ToSPropagation, saddle_point) { -- GitLab From ef47704330f1db2071b5bf4df9ba27770f5da3ef Mon Sep 17 00:00:00 2001 From: Edwin Carlinet Date: Wed, 6 May 2020 17:00:45 +0200 Subject: [PATCH 3/4] Small fixes for compilation with Clang 10 & GCC 10 * Tag final classes as final. * Fix concept-based specialization * Fix warnings --- pylene/include/mln/core/box.hpp | 4 ++-- pylene/include/mln/core/concepts/image.hpp | 17 ++++++++++++++++- .../mln/core/image/private/ndbuffer_image.hpp | 4 ++-- pylene/include/mln/core/image/view/adaptor.hpp | 10 ++++------ .../mln/core/range/view/transform_if.hpp | 2 +- pylene/include/mln/io/imprint.hpp | 2 +- .../include/mln/io/private/freeimage_plugin.hpp | 4 ++-- pylene/include/mln/morpho/dilation.hpp | 3 ++- .../mln/morpho/private/hvector_unbounded.hpp | 2 +- tests/core/point.cpp | 7 +++++++ 10 files changed, 38 insertions(+), 17 deletions(-) diff --git a/pylene/include/mln/core/box.hpp b/pylene/include/mln/core/box.hpp index 3b2069ad..8979b106 100644 --- a/pylene/include/mln/core/box.hpp +++ b/pylene/include/mln/core/box.hpp @@ -713,11 +713,11 @@ namespace mln template constexpr std::size_t _box::size() const noexcept { - std::size_t sz = 1; + int sz = 1; for (int k = 0; k < this->dim(); ++k) sz *= (this->__end(k) - this->__begin(k)); if (sz < 0) - sz = 0; + return 0; return sz; } diff --git a/pylene/include/mln/core/concepts/image.hpp b/pylene/include/mln/core/concepts/image.hpp index 3482df1b..fe13d417 100644 --- a/pylene/include/mln/core/concepts/image.hpp +++ b/pylene/include/mln/core/concepts/image.hpp @@ -120,7 +120,11 @@ namespace mln::concepts } && image_indexable_v && requires (I ima, image_index_t k) { - { ima[k] } -> ::concepts::same_as>; // For concrete image it returns a const_reference +#if __GNUC__ == 9 + { ima[k] } -> ::concepts::same_as>&&; // For concrete image it returns a const_reference +#else + { ima[k] } -> ::concepts::same_as>; // For concrete image it returns a const_reference +#endif }; @@ -133,7 +137,11 @@ namespace mln::concepts WritableImage && IndexableImage && requires(I ima, image_index_t k, image_value_t v) { +#if __GNUC__ == 9 + { ima[k] = v } -> ::concepts::same_as>&&; +#else { ima[k] = v } -> ::concepts::same_as>; +#endif }; } // namespace detail @@ -145,10 +153,17 @@ namespace mln::concepts Image && image_accessible_v && requires (I ima, image_point_t p) { +#if __GNUC__ == 9 + { ima(p) } -> ::concepts::same_as>&&; // For concrete image it returns a const_reference + { ima.at(p) } -> ::concepts::same_as>&&; // idem + { ima.new_pixel(p) } -> ::concepts::same_as>&&; // For concrete image pixel may propagate constness + { ima.new_pixel_at(p) } -> ::concepts::same_as>&&; // idem +#else { ima(p) } -> ::concepts::same_as>; // For concrete image it returns a const_reference { ima.at(p) } -> ::concepts::same_as>; // idem { ima.new_pixel(p) } -> ::concepts::same_as>; // For concrete image pixel may propagate constness { ima.new_pixel_at(p) } -> ::concepts::same_as>; // idem +#endif }; diff --git a/pylene/include/mln/core/image/private/ndbuffer_image.hpp b/pylene/include/mln/core/image/private/ndbuffer_image.hpp index a3b8a8cb..bd01459f 100644 --- a/pylene/include/mln/core/image/private/ndbuffer_image.hpp +++ b/pylene/include/mln/core/image/private/ndbuffer_image.hpp @@ -139,7 +139,7 @@ namespace mln [[deprecated]] const T* data() const noexcept { return this->buffer(); } index_type index_of_point(fast_point_type p) const noexcept; - fast_point_type point_at_index(index_type i) const noexcept; + point_type point_at_index(index_type i) const noexcept; index_type delta_index(fast_point_type p) const noexcept; /// \} @@ -402,7 +402,7 @@ namespace mln template - inline auto __ndbuffer_image::point_at_index(index_type i) const noexcept -> fast_point_type + inline auto __ndbuffer_image::point_at_index(index_type i) const noexcept -> point_type { fast_point_type coords; Impl::get_point(this->__info(), i, coords.data()); diff --git a/pylene/include/mln/core/image/view/adaptor.hpp b/pylene/include/mln/core/image/view/adaptor.hpp index c58dce9d..bd0102bf 100644 --- a/pylene/include/mln/core/image/view/adaptor.hpp +++ b/pylene/include/mln/core/image/view/adaptor.hpp @@ -11,10 +11,9 @@ namespace mln template struct pixel_adaptor { - using point_type = typename Pix::point_type; - using site_type[[deprecated]] = point_type; - using value_type = typename Pix::value_type; - using reference = typename Pix::reference; + using point_type = typename Pix::point_type; + using value_type = typename Pix::value_type; + using reference = typename Pix::reference; decltype(auto) val() const { return m_pix.val(); } auto point() const { return m_pix.point(); } @@ -79,8 +78,7 @@ namespace mln template struct image_adaptor_base_indexable> { - using size_type[[deprecated]] = image_index_t; - using index_type = size_type; + using index_type = image_index_t; }; template diff --git a/pylene/include/mln/core/range/view/transform_if.hpp b/pylene/include/mln/core/range/view/transform_if.hpp index 5c8e56ab..05462be7 100644 --- a/pylene/include/mln/core/range/view/transform_if.hpp +++ b/pylene/include/mln/core/range/view/transform_if.hpp @@ -132,7 +132,7 @@ namespace mln::ranges { auto cursors = std::apply( [](auto&&... cur) { return std::make_tuple(::ranges::range_access::begin_cursor(cur)...); }, m_ranges); - return {{}, cursors, m_map_fn, m_pred_fn}; + return {{}, cursors, {m_map_fn}, {m_pred_fn}}; } ::ranges::default_sentinel_t end_cursor() const { return {}; } diff --git a/pylene/include/mln/io/imprint.hpp b/pylene/include/mln/io/imprint.hpp index 713b1e7b..2295db87 100644 --- a/pylene/include/mln/io/imprint.hpp +++ b/pylene/include/mln/io/imprint.hpp @@ -50,7 +50,7 @@ namespace mln::io }; template - struct impl_t : impl_base_t + struct impl_t final : impl_base_t { impl_t(I& x) { this->m_ima = (void*)(&x); } ~impl_t() final = default; diff --git a/pylene/include/mln/io/private/freeimage_plugin.hpp b/pylene/include/mln/io/private/freeimage_plugin.hpp index 20eeb593..faf7bb27 100644 --- a/pylene/include/mln/io/private/freeimage_plugin.hpp +++ b/pylene/include/mln/io/private/freeimage_plugin.hpp @@ -5,7 +5,7 @@ namespace mln::io::internal { - class freeimage_reader_plugin : public plugin_reader + class freeimage_reader_plugin final : public plugin_reader { public: ~freeimage_reader_plugin() final; @@ -13,7 +13,7 @@ namespace mln::io::internal void close() final; }; - class freeimage_writer_plugin : public plugin_writer + class freeimage_writer_plugin final : public plugin_writer { public: ~freeimage_writer_plugin() final; diff --git a/pylene/include/mln/morpho/dilation.hpp b/pylene/include/mln/morpho/dilation.hpp index e69b984a..39cc9ffd 100644 --- a/pylene/include/mln/morpho/dilation.hpp +++ b/pylene/include/mln/morpho/dilation.hpp @@ -40,7 +40,8 @@ namespace mln::morpho template struct dilation_value_set_base { - static inline constexpr auto sup = [](V a, V b) { return sup(a, b); }; + static inline constexpr auto _sup = [](V a, V b) { return sup(a, b); }; + static inline constexpr auto sup = _sup; static inline constexpr auto zero = mln::value_traits::inf(); }; diff --git a/pylene/include/mln/morpho/private/hvector_unbounded.hpp b/pylene/include/mln/morpho/private/hvector_unbounded.hpp index 0afc183e..7feb6f73 100644 --- a/pylene/include/mln/morpho/private/hvector_unbounded.hpp +++ b/pylene/include/mln/morpho/private/hvector_unbounded.hpp @@ -67,7 +67,7 @@ namespace mln::morpho::details template - class hvectors_unbounded : public hvectors_unbounded + class hvectors_unbounded final : public hvectors_unbounded { public: hvectors_unbounded(int nlevel); diff --git a/tests/core/point.cpp b/tests/core/point.cpp index d1d25561..64874d79 100644 --- a/tests/core/point.cpp +++ b/tests/core/point.cpp @@ -9,10 +9,17 @@ template concept AddableWith = requires(U a, V b) { +#if __GNUC__ == 9 + { a += b } -> U&; + { a -= b } -> U&; + { b += a } -> V&; + { b -= a } -> V&; +#else { a += b } -> ::concepts::same_as; { a -= b } -> ::concepts::same_as; { b += a } -> ::concepts::same_as; { b -= a } -> ::concepts::same_as; +#endif { a + b }; { a - b }; { b + a}; -- GitLab From 2d907e474c729195c4023b48205b4ef060778b29 Mon Sep 17 00:00:00 2001 From: Edwin Carlinet Date: Wed, 6 May 2020 17:33:53 +0200 Subject: [PATCH 4/4] Update gitlabci/readme with GCC 10 & CLANG 10 * Add clang 10, gcc 10 build in gitlab-ci. * Make only debug build automatic * Readme support section updated --- .gitlab-ci.yml | 66 ++++++++++++++++++++++++++++++++++++++++++++------ README.md | 5 ++-- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 75886dca..a624e2b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,11 +11,16 @@ cache: variables: FEDORA_RAWHIDE: "${CI_REGISTRY}/olena/pylene-dockers/fedora-rawhide" FEDORA_31: "${CI_REGISTRY}/olena/pylene-dockers/fedora-31" + FEDORA_32: "${CI_REGISTRY}/olena/pylene-dockers/fedora-32" PACKAGE_NAME: "pylene" # Conan package name PACKAGE_TAG: "stable" # Conan tag PACKAGE_VERSION: "head" # Version to build CMAKE_BUILD_PARALLEL_LEVEL: 6 CONAN_USER: "lrde" + CONAN_PROFILE: "gcc-9" + ASAN: "OFF" + MSAN: "OFF" + UBSAN: "OFF" before_script: - conan config set storage.path="${CI_PROJECT_DIR}/.cache/conan/data" @@ -45,6 +50,7 @@ windows-debug: - if: $CI_MERGE_REQUEST_ID - if: $CI_COMMIT_BRANCH == "master" - when: manual + allow_failure: true variables: VCVAR2019: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat' ARCH: x64 @@ -53,7 +59,7 @@ windows-debug: stage: build script: - mkdir build && cd build - - conan install .. -pr gcc-9 --build missing -e CXX=g++ -e CC=gcc + - conan install .. --build missing -e CXXFLAGS="" -e CCFLAGS="" -pr $CONAN_PROFILE - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DSANITIZE_ADDRESS=$ASAN -DSANITIZE_MEMORY=$MSAN -DSANITIZE_UNDEFINED=$UBSAN - cmake --build . --target Pylene - cmake --build . --target build-tests @@ -77,9 +83,8 @@ distcheck-linux-gcc9-release: PYLENE_CONFIGURATION: "Release" CXX: "g++" CC: "gcc" - ASAN: "OFF" - MSAN: "OFF" - UBSAN: "OFF" + CONAN_PROFILE: "gcc-9" + distcheck-linux-gcc9-debug-asan-ubsan: <<: *distcheck-linux-base @@ -91,6 +96,54 @@ distcheck-linux-gcc9-debug-asan-ubsan: ASAN: "ON" MSAN: "OFF" UBSAN: "ON" + CONAN_PROFILE: "gcc-9" + +distcheck-linux-clang10-release: + <<: *distcheck-linux-base + image: ${FEDORA_32} + variables: + PYLENE_CONFIGURATION: "Release" + CXX: "clang++" + CC: "clang" + CONAN_PROFILE: "clang-10" + rules: + - if: $CI_MERGE_REQUEST_ID + - if: $CI_COMMIT_BRANCH == "master" + +distcheck-linux-clang10-debug: + <<: *distcheck-linux-base + image: ${FEDORA_32} + variables: + PYLENE_CONFIGURATION: "Debug" + CXX: "clang++" + CC: "clang" + CCFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined + CXXFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined + CONAN_PROFILE: "clang-10" + +distcheck-linux-gcc10-release: + <<: *distcheck-linux-base + image: ${FEDORA_32} + variables: + PYLENE_CONFIGURATION: "Release" + CXX: "g++" + CC: "gcc" + CONAN_PROFILE: "gcc-10" + rules: + - if: $CI_MERGE_REQUEST_ID + - if: $CI_COMMIT_BRANCH == "master" + + +distcheck-linux-gcc10-debug: + <<: *distcheck-linux-base + image: ${FEDORA_32} + variables: + PYLENE_CONFIGURATION: "Debug" + CXX: "g++" + CC: "gcc" + CCFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined + CXXFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined + CONAN_PROFILE: "gcc-10" distcheck-linux-coverage: @@ -115,7 +168,6 @@ distcheck-linux-coverage: rules: - if: $CI_MERGE_REQUEST_ID - if: $CI_COMMIT_BRANCH == "master" - - when: manual ######### # Bench # @@ -125,7 +177,7 @@ distcheck-linux-coverage: stage: bench script: - mkdir build && cd build - - conan install .. -pr gcc-9 --build missing -e CXX=g++ -e CC=gcc + - conan install .. -pr gcc-9 --build missing - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release - cmake --build . --target fetch-external-data - cmake --build . --target build-bench @@ -158,7 +210,7 @@ distbench-linux-gcc9-release: stage: build script: - mkdir build && cd build - - conan install -u .. -pr gcc-9 --build missing -e CXX=g++ -e CC=gcc + - conan install -u .. -pr gcc-9 --build missing - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release - cmake --build . --target build-doc - mkdir ../public && mv doc/sphinx/* ../public/ diff --git a/README.md b/README.md index a983e151..754ad49e 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,11 @@ Link to the [C++ Documentation](http://olena.pages.lrde.epita.fr/pylene/) - # Requirements Pylene is developed in modern C++. You need a modern C++ compatible compiler: -* GCC 9 ~~GCC 10~~ (in progress) -* ~~Clang 10~~ (in progress) +* GCC 9 GCC 10 +* Clang 10 * Microsoft Visual Studio 2019 This project relies on: -- GitLab