# Copyright (c) 2019-2023 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_pair.hpp
    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/adjacent_difference.hpp
    hpx/parallel/algorithms/detail/adjacent_find.hpp
    hpx/parallel/algorithms/detail/accumulate.hpp
    hpx/parallel/algorithms/detail/advance_and_get_distance.hpp
    hpx/parallel/algorithms/detail/advance_to_sentinel.hpp
    hpx/parallel/algorithms/detail/contains.hpp
    hpx/parallel/algorithms/detail/dispatch.hpp
    hpx/parallel/algorithms/detail/distance.hpp
    hpx/parallel/algorithms/detail/equal.hpp
    hpx/parallel/algorithms/detail/fill.hpp
    hpx/parallel/algorithms/detail/find.hpp
    hpx/parallel/algorithms/detail/generate.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/mismatch.hpp
    hpx/parallel/algorithms/detail/parallel_stable_sort.hpp
    hpx/parallel/algorithms/detail/pivot.hpp
    hpx/parallel/algorithms/detail/reduce.hpp
    hpx/parallel/algorithms/detail/reduce_deterministic.hpp
    hpx/parallel/algorithms/detail/replace.hpp
    hpx/parallel/algorithms/detail/rfa.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/ends_with.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/for_loop_reduction_base.hpp
    hpx/parallel/algorithms/for_loop_reduction_bit_and.hpp
    hpx/parallel/algorithms/for_loop_reduction_bit_or.hpp
    hpx/parallel/algorithms/for_loop_reduction_bit_xor.hpp
    hpx/parallel/algorithms/for_loop_reduction_max.hpp
    hpx/parallel/algorithms/for_loop_reduction_min.hpp
    hpx/parallel/algorithms/for_loop_reduction_multiplies.hpp
    hpx/parallel/algorithms/for_loop_reduction_plus.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/nth_element.hpp
    hpx/parallel/algorithms/partial_sort.hpp
    hpx/parallel/algorithms/partial_sort_copy.hpp
    hpx/parallel/algorithms/partition.hpp
    hpx/parallel/algorithms/reduce_by_key.hpp
    hpx/parallel/algorithms/reduce.hpp
    hpx/parallel/algorithms/reduce_deterministic.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/shift_left.hpp
    hpx/parallel/algorithms/shift_right.hpp
    hpx/parallel/algorithms/stable_sort.hpp
    hpx/parallel/algorithms/starts_with.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_relocate.hpp
    hpx/parallel/algorithms/uninitialized_value_construct.hpp
    hpx/parallel/algorithms/unique.hpp
    hpx/parallel/container_algorithms/adjacent_difference.hpp
    hpx/parallel/container_algorithms/adjacent_find.hpp
    hpx/parallel/container_algorithms/all_any_none.hpp
    hpx/parallel/container_algorithms/contains.hpp
    hpx/parallel/container_algorithms/copy.hpp
    hpx/parallel/container_algorithms/count.hpp
    hpx/parallel/container_algorithms/destroy.hpp
    hpx/parallel/container_algorithms/ends_with.hpp
    hpx/parallel/container_algorithms/equal.hpp
    hpx/parallel/container_algorithms/exclusive_scan.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/inclusive_scan.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/nth_element.hpp
    hpx/parallel/container_algorithms/partial_sort.hpp
    hpx/parallel/container_algorithms/partial_sort_copy.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/shift_left.hpp
    hpx/parallel/container_algorithms/shift_right.hpp
    hpx/parallel/container_algorithms/sort.hpp
    hpx/parallel/container_algorithms/stable_sort.hpp
    hpx/parallel/container_algorithms/starts_with.hpp
    hpx/parallel/container_algorithms/swap_ranges.hpp
    hpx/parallel/container_algorithms/transform.hpp
    hpx/parallel/container_algorithms/transform_exclusive_scan.hpp
    hpx/parallel/container_algorithms/transform_inclusive_scan.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/adjacent_difference.hpp
    hpx/parallel/datapar/adjacent_find.hpp
    hpx/parallel/datapar/equal.hpp
    hpx/parallel/datapar/fill.hpp
    hpx/parallel/datapar/find.hpp
    hpx/parallel/datapar/generate.hpp
    hpx/parallel/datapar/handle_local_exceptions.hpp
    hpx/parallel/datapar/iterator_helpers.hpp
    hpx/parallel/datapar/loop.hpp
    hpx/parallel/datapar/mismatch.hpp
    hpx/parallel/datapar/reduce.hpp
    hpx/parallel/datapar/replace.hpp
    hpx/parallel/datapar/transfer.hpp
    hpx/parallel/datapar/transform_loop.hpp
    hpx/parallel/datapar/zip_iterator.hpp
    hpx/parallel/memory.hpp
    hpx/parallel/numeric.hpp
    hpx/parallel/run_on_all.hpp
    hpx/parallel/spmd_block.hpp
    hpx/parallel/task_block.hpp
    hpx/parallel/task_group.hpp
    hpx/parallel/unseq.hpp
    hpx/parallel/unseq/loop.hpp
    hpx/parallel/unseq/reduce.hpp
    hpx/parallel/unseq/reduce_helpers.hpp
    hpx/parallel/unseq/simd_helpers.hpp
    hpx/parallel/unseq/transform_loop.hpp
    hpx/parallel/util/adapt_placement_mode.hpp
    hpx/parallel/util/adapt_sharing_mode.hpp
    hpx/parallel/util/adapt_thread_priority.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/clear_container.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/sender_util.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/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
)
# cmake-format: on

set(algorithms_sources handle_exception_termination_handler.cpp task_group.cpp)

include(HPX_AddModule)
add_hpx_module(
  core algorithms
  HEADERS ${algorithms_headers}
  COMPAT_HEADERS ${algorithms_compat_headers}
  SOURCES ${algorithms_sources}
  MODULE_DEPENDENCIES
    hpx_async_combinators
    hpx_async_local
    hpx_config
    hpx_execution
    hpx_executors
    hpx_futures
    hpx_iterator_support
    hpx_lcos_local
    hpx_pack_traversal
    hpx_serialization
    hpx_util
  CMAKE_SUBDIRS examples tests
)
