# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
add_subdirectory(json)
add_subdirectory(types)
add_subdirectory(window)

add_library(
  velox_functions_prestosql_impl
  ArrayConstructor.cpp
  ArrayContains.cpp
  ArrayDistinct.cpp
  ArrayDuplicates.cpp
  ArrayIntersectExcept.cpp
  ArrayMatch.cpp
  ArrayPosition.cpp
  ArrayShuffle.cpp
  ArraySort.cpp
  ArraySum.cpp
  Comparisons.cpp
  DecimalVectorFunctions.cpp
  ElementAt.cpp
  FilterFunctions.cpp
  FromUnixTime.cpp
  FromUtf8.cpp
  GreatestLeast.cpp
  InPredicate.cpp
  JsonFunctions.cpp
  Map.cpp
  MapEntries.cpp
  MapFromEntries.cpp
  MapKeysAndValues.cpp
  MapZipWith.cpp
  Not.cpp
  Reduce.cpp
  Repeat.cpp
  Reverse.cpp
  RowFunction.cpp
  Sequence.cpp
  SimpleComparisonMatcher.cpp
  Slice.cpp
  Split.cpp
  StringFunctions.cpp
  Subscript.cpp
  ToUtf8.cpp
  Transform.cpp
  TransformKeys.cpp
  TransformValues.cpp
  URLFunctions.cpp
  Utf8Utils.cpp
  VectorArithmetic.cpp
  WidthBucketArray.cpp
  Zip.cpp
  ZipWith.cpp)

target_link_libraries(
  velox_functions_prestosql_impl
  velox_common_hyperloglog
  velox_functions_json
  velox_functions_lib
  velox_expression
  md5
  velox_type_tz
  velox_presto_types
  velox_functions_util
  Folly::folly)

set_property(TARGET velox_functions_prestosql_impl PROPERTY JOB_POOL_COMPILE
                                                            high_memory_pool)

if(${VELOX_ENABLE_AGGREGATES})
  add_subdirectory(aggregates)
endif()

if(${VELOX_BUILD_TESTING})
  add_subdirectory(tests)
  add_subdirectory(coverage)
elseif(${VELOX_BUILD_TEST_UTILS})
  add_subdirectory(tests/utils)
endif()

if(${VELOX_ENABLE_BENCHMARKS})
  add_subdirectory(benchmarks)
endif()

add_subdirectory(registration)
