# Copyright (c) 2019-2020 The STE||AR-Group
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

set(algorithms_headers
    hpx/algorithms/traits/is_value_proxy.hpp
    hpx/algorithms/traits/pointer_category.hpp
    hpx/algorithms/traits/projected.hpp
    hpx/algorithms/traits/projected_range.hpp
    hpx/algorithms/traits/segmented_iterator_traits.hpp
    hpx/parallel/algorithm.hpp
    hpx/parallel/algorithms/adjacent_difference.hpp
    hpx/parallel/algorithms/adjacent_find.hpp
    hpx/parallel/algorithms/all_any_none.hpp
    hpx/parallel/algorithms/copy.hpp
    hpx/parallel/algorithms/count.hpp
    hpx/parallel/algorithms/destroy.hpp
    hpx/parallel/algorithms/detail/accumulate.hpp
    hpx/parallel/algorithms/detail/advance_to_sentinel.hpp
    hpx/parallel/algorithms/detail/dispatch.hpp
    hpx/parallel/algorithms/detail/distance.hpp
    hpx/parallel/algorithms/detail/fill.hpp
    hpx/parallel/algorithms/detail/find.hpp
    hpx/parallel/algorithms/detail/indirect.hpp
    hpx/parallel/algorithms/detail/insertion_sort.hpp
    hpx/parallel/algorithms/detail/is_sorted.hpp
    hpx/parallel/algorithms/detail/parallel_stable_sort.hpp
    hpx/parallel/algorithms/detail/rotate.hpp
    hpx/parallel/algorithms/detail/sample_sort.hpp
    hpx/parallel/algorithms/detail/search.hpp
    hpx/parallel/algorithms/detail/set_operation.hpp
    hpx/parallel/algorithms/detail/spin_sort.hpp
    hpx/parallel/algorithms/detail/transfer.hpp
    hpx/parallel/algorithms/detail/upper_lower_bound.hpp
    hpx/parallel/algorithms/equal.hpp
    hpx/parallel/algorithms/exclusive_scan.hpp
    hpx/parallel/algorithms/fill.hpp
    hpx/parallel/algorithms/find.hpp
    hpx/parallel/algorithms/for_each.hpp
    hpx/parallel/algorithms/for_loop.hpp
    hpx/parallel/algorithms/for_loop_induction.hpp
    hpx/parallel/algorithms/for_loop_reduction.hpp
    hpx/parallel/algorithms/generate.hpp
    hpx/parallel/algorithms/includes.hpp
    hpx/parallel/algorithms/inclusive_scan.hpp
    hpx/parallel/algorithms/is_heap.hpp
    hpx/parallel/algorithms/is_partitioned.hpp
    hpx/parallel/algorithms/is_sorted.hpp
    hpx/parallel/algorithms/lexicographical_compare.hpp
    hpx/parallel/algorithms/make_heap.hpp
    hpx/parallel/algorithms/merge.hpp
    hpx/parallel/algorithms/minmax.hpp
    hpx/parallel/algorithms/mismatch.hpp
    hpx/parallel/algorithms/move.hpp
    hpx/parallel/algorithms/partial_sort.hpp
    hpx/parallel/algorithms/partition.hpp
    hpx/parallel/algorithms/reduce_by_key.hpp
    hpx/parallel/algorithms/reduce.hpp
    hpx/parallel/algorithms/remove_copy.hpp
    hpx/parallel/algorithms/remove.hpp
    hpx/parallel/algorithms/replace.hpp
    hpx/parallel/algorithms/reverse.hpp
    hpx/parallel/algorithms/rotate.hpp
    hpx/parallel/algorithms/search.hpp
    hpx/parallel/algorithms/set_difference.hpp
    hpx/parallel/algorithms/set_intersection.hpp
    hpx/parallel/algorithms/set_symmetric_difference.hpp
    hpx/parallel/algorithms/set_union.hpp
    hpx/parallel/algorithms/stable_sort.hpp
    hpx/parallel/algorithms/sort_by_key.hpp
    hpx/parallel/algorithms/sort.hpp
    hpx/parallel/algorithms/swap_ranges.hpp
    hpx/parallel/algorithms/transform_exclusive_scan.hpp
    hpx/parallel/algorithms/transform.hpp
    hpx/parallel/algorithms/transform_inclusive_scan.hpp
    hpx/parallel/algorithms/transform_reduce_binary.hpp
    hpx/parallel/algorithms/transform_reduce.hpp
    hpx/parallel/algorithms/uninitialized_copy.hpp
    hpx/parallel/algorithms/uninitialized_default_construct.hpp
    hpx/parallel/algorithms/uninitialized_fill.hpp
    hpx/parallel/algorithms/uninitialized_move.hpp
    hpx/parallel/algorithms/uninitialized_value_construct.hpp
    hpx/parallel/algorithms/unique.hpp
    hpx/parallel/container_algorithms/adjacent_find.hpp
    hpx/parallel/container_algorithms/all_any_none.hpp
    hpx/parallel/container_algorithms/copy.hpp
    hpx/parallel/container_algorithms/count.hpp
    hpx/parallel/container_algorithms/destroy.hpp
    hpx/parallel/container_algorithms/equal.hpp
    hpx/parallel/container_algorithms/fill.hpp
    hpx/parallel/container_algorithms/find.hpp
    hpx/parallel/container_algorithms/for_each.hpp
    hpx/parallel/container_algorithms/for_loop.hpp
    hpx/parallel/container_algorithms/generate.hpp
    hpx/parallel/container_algorithms.hpp
    hpx/parallel/container_algorithms/includes.hpp
    hpx/parallel/container_algorithms/is_heap.hpp
    hpx/parallel/container_algorithms/is_partitioned.hpp
    hpx/parallel/container_algorithms/is_sorted.hpp
    hpx/parallel/container_algorithms/lexicographical_compare.hpp
    hpx/parallel/container_algorithms/make_heap.hpp
    hpx/parallel/container_algorithms/merge.hpp
    hpx/parallel/container_algorithms/minmax.hpp
    hpx/parallel/container_algorithms/mismatch.hpp
    hpx/parallel/container_algorithms/move.hpp
    hpx/parallel/container_algorithms/partition.hpp
    hpx/parallel/container_algorithms/reduce.hpp
    hpx/parallel/container_algorithms/remove_copy.hpp
    hpx/parallel/container_algorithms/remove.hpp
    hpx/parallel/container_algorithms/replace.hpp
    hpx/parallel/container_algorithms/reverse.hpp
    hpx/parallel/container_algorithms/rotate.hpp
    hpx/parallel/container_algorithms/search.hpp
    hpx/parallel/container_algorithms/set_difference.hpp
    hpx/parallel/container_algorithms/set_intersection.hpp
    hpx/parallel/container_algorithms/set_symmetric_difference.hpp
    hpx/parallel/container_algorithms/set_union.hpp
    hpx/parallel/container_algorithms/sort.hpp
    hpx/parallel/container_algorithms/stable_sort.hpp
    hpx/parallel/container_algorithms/transform.hpp
    hpx/parallel/container_algorithms/transform_reduce.hpp
    hpx/parallel/container_algorithms/uninitialized_copy.hpp
    hpx/parallel/container_algorithms/uninitialized_default_construct.hpp
    hpx/parallel/container_algorithms/uninitialized_fill.hpp
    hpx/parallel/container_algorithms/uninitialized_move.hpp
    hpx/parallel/container_algorithms/uninitialized_value_construct.hpp
    hpx/parallel/container_algorithms/unique.hpp
    hpx/parallel/container_memory.hpp
    hpx/parallel/container_numeric.hpp
    hpx/parallel/datapar.hpp
    hpx/parallel/datapar/iterator_helpers.hpp
    hpx/parallel/datapar/loop.hpp
    hpx/parallel/datapar/transform_loop.hpp
    hpx/parallel/datapar/zip_iterator.hpp
    hpx/parallel/memory.hpp
    hpx/parallel/numeric.hpp
    hpx/parallel/spmd_block.hpp
    hpx/parallel/tagspec.hpp
    hpx/parallel/task_block.hpp
    hpx/parallel/task_group.hpp
    hpx/parallel/util/cancellation_token.hpp
    hpx/parallel/util/compare_projected.hpp
    hpx/parallel/util/detail/algorithm_result.hpp
    hpx/parallel/util/detail/chunk_size.hpp
    hpx/parallel/util/detail/chunk_size_iterator.hpp
    hpx/parallel/util/detail/handle_exception_termination_handler.hpp
    hpx/parallel/util/detail/handle_local_exceptions.hpp
    hpx/parallel/util/detail/handle_remote_exceptions.hpp
    hpx/parallel/util/detail/partitioner_iteration.hpp
    hpx/parallel/util/detail/scoped_executor_parameters.hpp
    hpx/parallel/util/detail/select_partitioner.hpp
    hpx/parallel/util/foreach_partitioner.hpp
    hpx/parallel/util/invoke_projected.hpp
    hpx/parallel/util/loop.hpp
    hpx/parallel/util/low_level.hpp
    hpx/parallel/util/merge_four.hpp
    hpx/parallel/util/merge_vector.hpp
    hpx/parallel/util/nbits.hpp
    hpx/parallel/util/partitioner.hpp
    hpx/parallel/util/partitioner_with_cleanup.hpp
    hpx/parallel/util/prefetching.hpp
    hpx/parallel/util/projection_identity.hpp
    hpx/parallel/util/range.hpp
    hpx/parallel/util/ranges_facilities.hpp
    hpx/parallel/util/result_types.hpp
    hpx/parallel/util/scan_partitioner.hpp
    hpx/parallel/util/tagged_pair.hpp
    hpx/parallel/util/tagged_tuple.hpp
    hpx/parallel/util/transfer.hpp
    hpx/parallel/util/transform_loop.hpp
    hpx/parallel/util/zip_iterator.hpp
)

# cmake-format: off
set(algorithms_compat_headers
    hpx/algorithms.hpp => hpx/algorithm.hpp
    hpx/parallel/traits/projected.hpp => hpx/algorithms/traits/projected.hpp
    hpx/parallel/traits/projected_range.hpp => hpx/algorithms/traits/projected_range.hpp
    hpx/traits/is_value_proxy.hpp => hpx/algorithms/traits/is_value_proxy.hpp
    hpx/traits/pointer_category.hpp => hpx/algorithms/traits/pointer_category.hpp
    hpx/traits/segmented_iterator_traits.hpp => hpx/algorithms/traits/segmented_iterator_traits.hpp
    hpx/util/tagged_pair.hpp => hpx/datastructures/tagged_pair.hpp
    hpx/util/tagged_tuple.hpp => hpx/datastructures/tagged_tuple.hpp
)
# cmake-format: on

set(algorithms_sources handle_exception_termination_handler.cpp)

include(HPX_AddModule)
add_hpx_module(
  parallelism algorithms
  HEADERS ${algorithms_headers}
  COMPAT_HEADERS ${algorithms_compat_headers}
  SOURCES ${algorithms_sources}
  DEPENDENCIES hpx_core
  MODULE_DEPENDENCIES hpx_async_combinators hpx_async_local hpx_execution
                      hpx_executors hpx_futures hpx_pack_traversal
  CMAKE_SUBDIRS examples tests
)
