From 9f64e42fd2f4eea53c115911baf35d548694de76 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 23 Jul 2024 13:19:00 -0700 Subject: [PATCH] Enable Monolithic build (#9948) Summary: This PR adds an option that combines all targets into a single `velox` target and build a single unified `libvelox.a`. This is entirely optional and defaults to off. This will make it easier for downstream users to use Velox by just linking to `velox::velox` in their own cmake instead of having to look through our cmake which targets they need. (Once we have a config etc.). I have yet to test the install functionality (it's strictly a bonus, the monolithic build is the goal for now). Pull Request resolved: https://github.com/facebookincubator/velox/pull/9948 Reviewed By: kgpai Differential Revision: D59974408 Pulled By: kevinwilfong fbshipit-source-id: 67459767d247a1264e1c5465c248586ac047ef4f --- .cmake-format.yaml | 84 +++++++++++ .github/workflows/linux-build.yml | 1 + .github/workflows/preliminary_checks.yml | 6 +- CMake/VeloxUtils.cmake | 132 ++++++++++++++++++ CMakeLists.txt | 8 +- scripts/check.py | 9 ++ scripts/setup-check.sh | 2 +- velox/buffer/CMakeLists.txt | 4 +- velox/common/base/CMakeLists.txt | 26 ++-- velox/common/caching/CMakeLists.txt | 4 +- velox/common/compression/CMakeLists.txt | 4 +- velox/common/encode/CMakeLists.txt | 4 +- velox/common/file/CMakeLists.txt | 4 +- velox/common/hyperloglog/CMakeLists.txt | 6 +- velox/common/io/CMakeLists.txt | 4 +- velox/common/memory/CMakeLists.txt | 4 +- velox/common/process/CMakeLists.txt | 12 +- velox/common/serialization/CMakeLists.txt | 6 +- velox/common/testutil/CMakeLists.txt | 4 +- velox/common/time/CMakeLists.txt | 6 +- velox/connectors/CMakeLists.txt | 4 +- velox/connectors/hive/CMakeLists.txt | 48 ++++--- velox/connectors/hive/iceberg/CMakeLists.txt | 9 +- .../hive/storage_adapters/abfs/CMakeLists.txt | 12 +- .../abfs/tests/AbfsFileSystemTest.cpp | 4 + .../hive/storage_adapters/gcs/CMakeLists.txt | 8 +- .../hive/storage_adapters/hdfs/CMakeLists.txt | 12 +- .../hive/storage_adapters/s3fs/CMakeLists.txt | 10 +- velox/connectors/tpch/CMakeLists.txt | 6 +- velox/core/CMakeLists.txt | 16 ++- velox/duckdb/conversion/CMakeLists.txt | 12 +- velox/dwio/CMakeLists.txt | 33 ++--- velox/dwio/catalog/fbhive/CMakeLists.txt | 6 +- velox/dwio/common/CMakeLists.txt | 6 +- velox/dwio/common/compression/CMakeLists.txt | 8 +- velox/dwio/common/encryption/CMakeLists.txt | 4 +- velox/dwio/common/exception/CMakeLists.txt | 6 +- velox/dwio/dwrf/common/CMakeLists.txt | 8 +- velox/dwio/dwrf/proto/CMakeLists.txt | 9 +- velox/dwio/dwrf/reader/CMakeLists.txt | 4 +- velox/dwio/dwrf/utils/CMakeLists.txt | 10 +- velox/dwio/dwrf/writer/CMakeLists.txt | 4 +- velox/dwio/orc/reader/CMakeLists.txt | 4 +- velox/dwio/parquet/CMakeLists.txt | 12 +- velox/dwio/parquet/reader/CMakeLists.txt | 4 +- velox/dwio/parquet/thrift/CMakeLists.txt | 10 +- velox/dwio/parquet/writer/CMakeLists.txt | 4 +- .../dwio/parquet/writer/arrow/CMakeLists.txt | 4 +- .../writer/arrow/generated/CMakeLists.txt | 6 +- .../parquet/writer/arrow/tests/CMakeLists.txt | 6 +- .../parquet/writer/arrow/util/CMakeLists.txt | 11 +- velox/examples/CMakeLists.txt | 34 +++-- velox/exec/CMakeLists.txt | 4 +- velox/exec/fuzzer/CMakeLists.txt | 20 ++- velox/experimental/wave/common/CMakeLists.txt | 14 +- velox/experimental/wave/dwio/CMakeLists.txt | 10 +- .../wave/dwio/decode/CMakeLists.txt | 4 +- velox/experimental/wave/exec/CMakeLists.txt | 8 +- velox/experimental/wave/vector/CMakeLists.txt | 4 +- velox/expression/CMakeLists.txt | 22 +-- .../signature_parser/CMakeLists.txt | 14 +- .../type_calculation/CMakeLists.txt | 18 ++- velox/external/date/CMakeLists.txt | 6 +- velox/external/md5/CMakeLists.txt | 8 +- velox/flag_definitions/CMakeLists.txt | 4 +- velox/functions/CMakeLists.txt | 14 +- velox/functions/lib/CMakeLists.txt | 25 ++-- velox/functions/lib/aggregates/CMakeLists.txt | 13 +- velox/functions/lib/string/CMakeLists.txt | 6 +- velox/functions/lib/window/CMakeLists.txt | 12 +- velox/functions/prestosql/CMakeLists.txt | 12 +- .../prestosql/aggregates/CMakeLists.txt | 4 +- velox/functions/prestosql/json/CMakeLists.txt | 12 +- .../prestosql/registration/CMakeLists.txt | 14 +- .../functions/prestosql/types/CMakeLists.txt | 18 ++- .../functions/prestosql/window/CMakeLists.txt | 16 ++- velox/functions/remote/client/CMakeLists.txt | 17 ++- velox/functions/remote/if/CMakeLists.txt | 4 +- velox/functions/sparksql/CMakeLists.txt | 12 +- .../sparksql/aggregates/CMakeLists.txt | 11 +- .../sparksql/specialforms/CMakeLists.txt | 13 +- .../functions/sparksql/window/CMakeLists.txt | 10 +- velox/parse/CMakeLists.txt | 26 ++-- velox/row/CMakeLists.txt | 4 +- velox/serializers/CMakeLists.txt | 7 +- velox/substrait/CMakeLists.txt | 6 +- velox/tpch/gen/CMakeLists.txt | 6 +- velox/tpch/gen/dbgen/CMakeLists.txt | 22 ++- velox/type/CMakeLists.txt | 4 +- velox/type/fbhive/CMakeLists.txt | 4 +- velox/type/parser/CMakeLists.txt | 13 +- velox/type/tz/CMakeLists.txt | 11 +- velox/vector/CMakeLists.txt | 11 +- velox/vector/arrow/CMakeLists.txt | 10 +- 94 files changed, 781 insertions(+), 356 deletions(-) create mode 100644 .cmake-format.yaml create mode 100644 CMake/VeloxUtils.cmake diff --git a/.cmake-format.yaml b/.cmake-format.yaml new file mode 100644 index 000000000000..91c373bf6b3b --- /dev/null +++ b/.cmake-format.yaml @@ -0,0 +1,84 @@ +# 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. + +# Currently this config mostly mirrors the default with the addition of custom functions +format: + line_width: 80 + tab_size: 2 + use_tabchars: false + max_pargs_hwrap: 4 + max_subgroups_hwrap: 2 + min_prefix_chars: 4 + max_prefix_chars: 6 + separate_ctrl_name_with_space: false + separate_fn_name_with_space: false + dangle_parens: false + command_case: "canonical" + keyword_case: "unchanged" + always_wrap: + - set_target_properties + - target_sources + - target_link_libraries + +parse: + # We define these for our custom + # functions so they get formatted correctly + additional_commands: + velox_add_library: + pargs: + nargs: 1+ + flags: + - OBJECT + - STATIC + - SHARED + - INTERFACE + kwargs: {} + + velox_base_add_library: + pargs: + nargs: 1+ + flags: + - OBJECT + - STATIC + - SHARED + - INTERFACE + kwargs: {} + + velox_compile_definitions: + pargs: 1 + kwargs: + PRIVATE: '*' + PUBLIC: '*' + INTERFACE: '*' + + velox_include_directories: + pargs: '1+' + flags: + - SYSTEM + - BEFORE + - AFTER + kwargs: + PRIVATE: '*' + PUBLIC: '*' + INTERFACE: '*' + + velox_link_libraries: + pargs: '1+' + kwargs: + PRIVATE: '*' + PUBLIC: '*' + INTERFACE: '*' + +markup: + first_comment_is_literal: true diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index ca62f2401192..8950ee0284a6 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -108,6 +108,7 @@ jobs: "-DVELOX_ENABLE_ABFS=ON" "-DVELOX_ENABLE_REMOTE_FUNCTIONS=ON" "-DVELOX_ENABLE_GPU=ON" + "-DVELOX_MONO_LIBRARY=ON" ) make release EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS[*]}" diff --git a/.github/workflows/preliminary_checks.yml b/.github/workflows/preliminary_checks.yml index 60ae77f6718b..205f440e074b 100644 --- a/.github/workflows/preliminary_checks.yml +++ b/.github/workflows/preliminary_checks.yml @@ -38,13 +38,15 @@ jobs: } - { name: "Code Format", command: "format-fix", - message: "Found format issues", + message: "Found format issues" } steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - + - run: | + apt -y install python3-pip + pip3 install --break-system-packages pyyaml - name: Fix git permissions # Usually actions/checkout does this but as we run in a container # it doesn't work diff --git a/CMake/VeloxUtils.cmake b/CMake/VeloxUtils.cmake new file mode 100644 index 000000000000..fa8f9456d7e2 --- /dev/null +++ b/CMake/VeloxUtils.cmake @@ -0,0 +1,132 @@ +# 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. +include_guard(GLOBAL) + +# TODO use file sets +function(velox_install_library_headers) + # Find any headers and install them relative to the source tree in include. + file(GLOB _hdrs "*.h") + if(NOT "${_hdrs}" STREQUAL "") + cmake_path( + RELATIVE_PATH + CMAKE_CURRENT_SOURCE_DIR + BASE_DIRECTORY + "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE + _hdr_dir) + install(FILES ${_hdrs} DESTINATION include/${_hdr_dir}) + endif() +endfunction() + +# Base add velox library call to add a library and install it. +function(velox_base_add_library TARGET) + add_library(${TARGET} ${ARGN}) + install(TARGETS ${TARGET} DESTINATION lib/velox) + velox_install_library_headers() +endfunction() + +# This is extremely hackish but presents an easy path to installation. +function(velox_add_library TARGET) + set(options OBJECT STATIC SHARED INTERFACE) + set(oneValueArgs) + set(multiValueArgs) + cmake_parse_arguments( + VELOX + "${options}" + "${oneValueArgs}" + "${multiValueArgs}" + ${ARGN}) + + # Remove library type specifiers from ARGN + set(library_type) + if(VELOX_OBJECT) + set(library_type OBJECT) + elseif(VELOX_STATIC) + set(library_type STATIC) + elseif(VELOX_SHARED) + set(library_type SHARED) + elseif(VELOX_INTERFACE) + set(library_type INTERFACE) + endif() + + list(REMOVE_ITEM ARGN OBJECT) + list(REMOVE_ITEM ARGN STATIC) + list(REMOVE_ITEM ARGN SHARED) + list(REMOVE_ITEM ARGN INTERFACE) + # Propagate to the underlying add_library and then install the target. + if(VELOX_MONO_LIBRARY) + if(TARGET velox) + # Target already exists, append sources to it. + target_sources(velox PRIVATE ${ARGN}) + else() + # Create the target if this is the first invocation. + add_library(velox ${ARGN}) + set_target_properties(velox PROPERTIES LIBRARY_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/lib) + set_target_properties(velox PROPERTIES ARCHIVE_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/lib) + install(TARGETS velox DESTINATION lib/velox) + endif() + # create alias for compatability + if(NOT TARGET ${TARGET}) + add_library(${TARGET} ALIAS velox) + endif() + else() + # Create a library for each invocation. + velox_base_add_library(${TARGET} ${library_type} ${ARGN}) + endif() + velox_install_library_headers() +endfunction() + +function(velox_link_libraries TARGET) + # TODO(assignUser): Handle scope keywords (they currently are empty calls ala + # target_link_libraries(target PRIVATE)) + if(VELOX_MONO_LIBRARY) + message(DEBUG "${TARGET}: ${ARGN}") + foreach(_lib ${ARGN}) + if("${_lib}" MATCHES "^velox_*") + message(DEBUG "\t\tDROP: ${_lib}") + else() + message(DEBUG "\t\tADDING: ${_lib}") + target_link_libraries(velox ${_lib}) + endif() + endforeach() + else() + target_link_libraries(${TARGET} ${ARGN}) + endif() +endfunction() + +function(velox_include_directories TARGET) + if(VELOX_MONO_LIBRARY) + target_include_directories(velox ${ARGN}) + else() + target_include_directories(${TARGET} ${ARGN}) + endif() +endfunction() + +function(velox_compile_definitions TARGET) + if(VELOX_MONO_LIBRARY) + target_compile_definitions(velox ${ARGN}) + else() + target_compile_definitions(${TARGET} ${ARGN}) + endif() +endfunction() + +function(velox_sources TARGET) + if(VELOX_MONO_LIBRARY) + target_sources(velox ${ARGN}) + else() + target_sources(${TARGET} ${ARGN}) + endif() +endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index bb7c49907980..2dc95f972877 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake" # Include our ThirdPartyToolchain dependencies macros include(ResolveDependency) +include(VeloxUtils) set_with_default(VELOX_DEPENDENCY_SOURCE_DEFAULT VELOX_DEPENDENCY_SOURCE AUTO) message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") @@ -68,6 +69,7 @@ option( "Build a minimal set of components, including DWIO (file format readers/writers). This will override other build options." OFF) +option(VELOX_MONO_LIBRARY "Build single unified library." OFF) # option() always creates a BOOL variable so we have to use a normal cache # variable with STRING type for this option. @@ -94,9 +96,9 @@ option(VELOX_ENABLE_TPCH_CONNECTOR "Build TPC-H connector." ON) option(VELOX_ENABLE_PRESTO_FUNCTIONS "Build Presto SQL functions." ON) option(VELOX_ENABLE_SPARK_FUNCTIONS "Build Spark SQL functions." ON) option(VELOX_ENABLE_EXPRESSION "Build expression." ON) -option(VELOX_ENABLE_EXAMPLES - "Build examples. This will enable VELOX_ENABLE_EXPRESSION automatically." - OFF) +option( + VELOX_ENABLE_EXAMPLES + "Build examples. This will enable VELOX_ENABLE_EXPRESSION automatically." OFF) option(VELOX_ENABLE_SUBSTRAIT "Build Substrait-to-Velox converter." OFF) option(VELOX_ENABLE_BENCHMARKS "Enable Velox top level benchmarks." OFF) option(VELOX_ENABLE_BENCHMARKS_BASIC "Enable Velox basic benchmarks." OFF) diff --git a/scripts/check.py b/scripts/check.py index 43badc5ebefa..bd47ecd5324f 100755 --- a/scripts/check.py +++ b/scripts/check.py @@ -63,6 +63,15 @@ def fix(self, commit): class CMakeFormatter(str): + def __init__(self, commit) -> None: + super().__init__() + try: + import yaml + except ModuleNotFoundError: + # We need pyyaml so cmake-format can read '.cmake-format.yml' + # otherwise it will run with default + raise SystemExit("Please install 'pyyaml' for the CMake formatter.") + def diff(self, commit): return get_diff( self, util.run(f"cmake-format --first-comment-is-literal True {self}")[1] diff --git a/scripts/setup-check.sh b/scripts/setup-check.sh index ac255ffa1543..d3d6573a8eda 100644 --- a/scripts/setup-check.sh +++ b/scripts/setup-check.sh @@ -19,7 +19,7 @@ set -x export DEBIAN_FRONTEND=noninteractive apt update apt install --no-install-recommends -y clang-format-18 python3-pip git make ssh -pip3 install --break-system-packages cmake==3.28.3 cmake_format black regex +pip3 install --break-system-packages cmake==3.28.3 cmake_format black pyyaml regex pip3 cache purge apt purge --auto-remove -y python3-pip update-alternatives --install /usr/bin/clang-format clang-format "$(command -v clang-format-18)" 18 diff --git a/velox/buffer/CMakeLists.txt b/velox/buffer/CMakeLists.txt index 8a6df1c1e87e..2b1e8ea65a78 100644 --- a/velox/buffer/CMakeLists.txt +++ b/velox/buffer/CMakeLists.txt @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_buffer StringViewBufferHolder.cpp) +velox_add_library(velox_buffer StringViewBufferHolder.cpp) -target_link_libraries(velox_buffer velox_memory velox_common_base Folly::folly) +velox_link_libraries(velox_buffer velox_memory velox_common_base Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/common/base/CMakeLists.txt b/velox/common/base/CMakeLists.txt index d70afb59d639..6c26222ef56c 100644 --- a/velox/common/base/CMakeLists.txt +++ b/velox/common/base/CMakeLists.txt @@ -12,12 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_exception Exceptions.cpp VeloxException.cpp Exceptions.h) -target_link_libraries( - velox_exception PUBLIC velox_flag_definitions velox_process Folly::folly - fmt::fmt gflags::gflags glog::glog) +velox_add_library(velox_exception Exceptions.cpp VeloxException.cpp + Exceptions.h) +velox_link_libraries( + velox_exception + PUBLIC velox_flag_definitions + velox_process + Folly::folly + fmt::fmt + gflags::gflags + glog::glog) -add_library( +velox_add_library( velox_common_base BitUtil.cpp Counters.cpp @@ -32,7 +38,7 @@ add_library( StatsReporter.cpp SuccinctPrinter.cpp) -target_link_libraries( +velox_link_libraries( velox_common_base PUBLIC velox_exception Folly::folly fmt::fmt xsimd PRIVATE velox_common_compression velox_process velox_test_util glog::glog) @@ -45,8 +51,8 @@ if(${VELOX_ENABLE_BENCHMARKS}) add_subdirectory(benchmarks) endif() -add_library(velox_id_map BigintIdMap.cpp) -target_link_libraries( +velox_add_library(velox_id_map BigintIdMap.cpp) +velox_link_libraries( velox_id_map velox_memory velox_flag_definitions @@ -56,8 +62,8 @@ target_link_libraries( fmt::fmt gflags::gflags) -add_library(velox_status Status.cpp) -target_link_libraries( +velox_add_library(velox_status Status.cpp) +velox_link_libraries( velox_status PUBLIC fmt::fmt Folly::folly PRIVATE glog::glog) diff --git a/velox/common/caching/CMakeLists.txt b/velox/common/caching/CMakeLists.txt index 9a1d91f1f0f4..76d7694b0a80 100644 --- a/velox/common/caching/CMakeLists.txt +++ b/velox/common/caching/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_caching AsyncDataCache.cpp CacheTTLController.cpp @@ -22,7 +22,7 @@ add_library( SsdFile.cpp SsdFileTracker.cpp StringIdMap.cpp) -target_link_libraries( +velox_link_libraries( velox_caching PUBLIC velox_common_base velox_exception diff --git a/velox/common/compression/CMakeLists.txt b/velox/common/compression/CMakeLists.txt index e429485151e3..25835c26c4bb 100644 --- a/velox/common/compression/CMakeLists.txt +++ b/velox/common/compression/CMakeLists.txt @@ -16,8 +16,8 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library(velox_common_compression Compression.cpp LzoDecompressor.cpp) -target_link_libraries( +velox_add_library(velox_common_compression Compression.cpp LzoDecompressor.cpp) +velox_link_libraries( velox_common_compression PUBLIC Folly::folly PRIVATE velox_exception) diff --git a/velox/common/encode/CMakeLists.txt b/velox/common/encode/CMakeLists.txt index bc27527e14ac..501c690c476b 100644 --- a/velox/common/encode/CMakeLists.txt +++ b/velox/common/encode/CMakeLists.txt @@ -16,5 +16,5 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library(velox_encode Base64.cpp) -target_link_libraries(velox_encode PUBLIC Folly::folly) +velox_add_library(velox_encode Base64.cpp) +velox_link_libraries(velox_encode PUBLIC Folly::folly) diff --git a/velox/common/file/CMakeLists.txt b/velox/common/file/CMakeLists.txt index 84375189a2a4..b68e32322fe6 100644 --- a/velox/common/file/CMakeLists.txt +++ b/velox/common/file/CMakeLists.txt @@ -14,8 +14,8 @@ # for generated headers include_directories(.) -add_library(velox_file File.cpp FileSystems.cpp Utils.cpp) -target_link_libraries( +velox_add_library(velox_file File.cpp FileSystems.cpp Utils.cpp) +velox_link_libraries( velox_file PUBLIC velox_exception Folly::folly PRIVATE velox_common_base fmt::fmt glog::glog) diff --git a/velox/common/hyperloglog/CMakeLists.txt b/velox/common/hyperloglog/CMakeLists.txt index 14e2799566ec..27c07830b864 100644 --- a/velox/common/hyperloglog/CMakeLists.txt +++ b/velox/common/hyperloglog/CMakeLists.txt @@ -11,10 +11,10 @@ # 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_library(velox_common_hyperloglog BiasCorrection.cpp DenseHll.cpp - SparseHll.cpp) +velox_add_library(velox_common_hyperloglog BiasCorrection.cpp DenseHll.cpp + SparseHll.cpp) -target_link_libraries( +velox_link_libraries( velox_common_hyperloglog PUBLIC velox_memory PRIVATE velox_exception) diff --git a/velox/common/io/CMakeLists.txt b/velox/common/io/CMakeLists.txt index 52619f0d5ce1..3498214b4fdb 100644 --- a/velox/common/io/CMakeLists.txt +++ b/velox/common/io/CMakeLists.txt @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_common_io IoStatistics.cpp) +velox_add_library(velox_common_io IoStatistics.cpp) -target_link_libraries(velox_common_io Folly::folly glog::glog) +velox_link_libraries(velox_common_io Folly::folly glog::glog) diff --git a/velox/common/memory/CMakeLists.txt b/velox/common/memory/CMakeLists.txt index dc0e618d93f1..a4ea2a847f2c 100644 --- a/velox/common/memory/CMakeLists.txt +++ b/velox/common/memory/CMakeLists.txt @@ -15,7 +15,7 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library( +velox_add_library( velox_memory Allocation.cpp AllocationPool.cpp @@ -31,7 +31,7 @@ add_library( SharedArbitrator.cpp StreamArena.cpp) -target_link_libraries( +velox_link_libraries( velox_memory PUBLIC velox_common_base velox_exception diff --git a/velox/common/process/CMakeLists.txt b/velox/common/process/CMakeLists.txt index c36468582fb4..0cebd335cb98 100644 --- a/velox/common/process/CMakeLists.txt +++ b/velox/common/process/CMakeLists.txt @@ -12,10 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_process ProcessBase.cpp Profiler.cpp StackTrace.cpp - ThreadDebugInfo.cpp TraceContext.cpp TraceHistory.cpp) +velox_add_library( + velox_process + ProcessBase.cpp + Profiler.cpp + StackTrace.cpp + ThreadDebugInfo.cpp + TraceContext.cpp + TraceHistory.cpp) -target_link_libraries( +velox_link_libraries( velox_process PUBLIC velox_file velox_flag_definitions Folly::folly PRIVATE fmt::fmt gflags::gflags glog::glog) diff --git a/velox/common/serialization/CMakeLists.txt b/velox/common/serialization/CMakeLists.txt index 4d5ccaebe7c2..c818597442d2 100644 --- a/velox/common/serialization/CMakeLists.txt +++ b/velox/common/serialization/CMakeLists.txt @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_serialization DeserializationRegistry.cpp) +velox_add_library(velox_serialization DeserializationRegistry.cpp) -target_link_libraries(velox_serialization PUBLIC velox_exception Folly::folly - glog::glog) +velox_link_libraries(velox_serialization PUBLIC velox_exception Folly::folly + glog::glog) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/common/testutil/CMakeLists.txt b/velox/common/testutil/CMakeLists.txt index b72e82c3efbd..f33bb98be06f 100644 --- a/velox/common/testutil/CMakeLists.txt +++ b/velox/common/testutil/CMakeLists.txt @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_test_util ScopedTestTime.cpp TestValue.cpp) -target_link_libraries(velox_test_util PUBLIC velox_exception) +velox_add_library(velox_test_util ScopedTestTime.cpp TestValue.cpp) +velox_link_libraries(velox_test_util PUBLIC velox_exception) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/common/time/CMakeLists.txt b/velox/common/time/CMakeLists.txt index f01a0ef95a94..8c9e39f51835 100644 --- a/velox/common/time/CMakeLists.txt +++ b/velox/common/time/CMakeLists.txt @@ -15,6 +15,6 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library(velox_time CpuWallTimer.cpp Timer.cpp) -target_link_libraries(velox_time PUBLIC velox_process velox_test_util - Folly::folly fmt::fmt) +velox_add_library(velox_time CpuWallTimer.cpp Timer.cpp) +velox_link_libraries(velox_time PUBLIC velox_process velox_test_util + Folly::folly fmt::fmt) diff --git a/velox/connectors/CMakeLists.txt b/velox/connectors/CMakeLists.txt index 156463630a0a..1c673903aba3 100644 --- a/velox/connectors/CMakeLists.txt +++ b/velox/connectors/CMakeLists.txt @@ -11,9 +11,9 @@ # 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_library(velox_connector Connector.cpp) +velox_add_library(velox_connector Connector.cpp) -target_link_libraries(velox_connector velox_config velox_vector) +velox_link_libraries(velox_connector velox_config velox_vector) add_subdirectory(fuzzer) diff --git a/velox/connectors/hive/CMakeLists.txt b/velox/connectors/hive/CMakeLists.txt index 530e5068aeb2..9fb48ba1392c 100644 --- a/velox/connectors/hive/CMakeLists.txt +++ b/velox/connectors/hive/CMakeLists.txt @@ -12,13 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_hive_config OBJECT HiveConfig.cpp) -target_link_libraries(velox_hive_config velox_core velox_exception) +velox_add_library(velox_hive_config OBJECT HiveConfig.cpp) +velox_link_libraries(velox_hive_config velox_core velox_exception) add_subdirectory(iceberg) -add_library( - velox_hive_connector OBJECT +velox_add_library( + velox_hive_connector + OBJECT FileHandle.cpp HiveConfig.cpp HiveConnector.cpp @@ -30,27 +31,28 @@ add_library( SplitReader.cpp TableHandle.cpp) -target_link_libraries( +velox_link_libraries( velox_hive_connector PUBLIC velox_hive_iceberg_splitreader - PRIVATE velox_common_io - velox_connector - velox_dwio_catalog_fbhive - velox_dwio_dwrf_reader - velox_dwio_dwrf_writer - velox_dwio_orc_reader - velox_dwio_parquet_reader - velox_dwio_parquet_writer - velox_file - velox_hive_partition_function - velox_s3fs - velox_hdfs - velox_gcs - velox_abfs) - -add_library(velox_hive_partition_function HivePartitionFunction.cpp) - -target_link_libraries(velox_hive_partition_function velox_core velox_exec) + PRIVATE + velox_common_io + velox_connector + velox_dwio_catalog_fbhive + velox_dwio_dwrf_reader + velox_dwio_dwrf_writer + velox_dwio_orc_reader + velox_dwio_parquet_reader + velox_dwio_parquet_writer + velox_file + velox_hive_partition_function + velox_s3fs + velox_hdfs + velox_gcs + velox_abfs) + +velox_add_library(velox_hive_partition_function HivePartitionFunction.cpp) + +velox_link_libraries(velox_hive_partition_function velox_core velox_exec) add_subdirectory(storage_adapters) diff --git a/velox/connectors/hive/iceberg/CMakeLists.txt b/velox/connectors/hive/iceberg/CMakeLists.txt index 73e5d5f00ce3..bc78005c91bb 100644 --- a/velox/connectors/hive/iceberg/CMakeLists.txt +++ b/velox/connectors/hive/iceberg/CMakeLists.txt @@ -12,12 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( - velox_hive_iceberg_splitreader IcebergSplitReader.cpp IcebergSplit.cpp - PositionalDeleteFileReader.cpp) +velox_add_library(velox_hive_iceberg_splitreader IcebergSplitReader.cpp + IcebergSplit.cpp PositionalDeleteFileReader.cpp) -target_link_libraries(velox_hive_iceberg_splitreader velox_connector - Folly::folly) +velox_link_libraries(velox_hive_iceberg_splitreader velox_connector + Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/connectors/hive/storage_adapters/abfs/CMakeLists.txt b/velox/connectors/hive/storage_adapters/abfs/CMakeLists.txt index e9997f142a73..ec71a1353ccd 100644 --- a/velox/connectors/hive/storage_adapters/abfs/CMakeLists.txt +++ b/velox/connectors/hive/storage_adapters/abfs/CMakeLists.txt @@ -14,12 +14,16 @@ # for generated headers -add_library(velox_abfs RegisterAbfsFileSystem.cpp) +velox_add_library(velox_abfs RegisterAbfsFileSystem.cpp) if(VELOX_ENABLE_ABFS) - target_sources(velox_abfs PRIVATE AbfsFileSystem.cpp AbfsUtils.cpp - AbfsWriteFile.cpp) - target_link_libraries( + velox_sources( + velox_abfs + PRIVATE + AbfsFileSystem.cpp + AbfsUtils.cpp + AbfsWriteFile.cpp) + velox_link_libraries( velox_abfs PUBLIC velox_file velox_core diff --git a/velox/connectors/hive/storage_adapters/abfs/tests/AbfsFileSystemTest.cpp b/velox/connectors/hive/storage_adapters/abfs/tests/AbfsFileSystemTest.cpp index d615b51b5518..1e9559096a4a 100644 --- a/velox/connectors/hive/storage_adapters/abfs/tests/AbfsFileSystemTest.cpp +++ b/velox/connectors/hive/storage_adapters/abfs/tests/AbfsFileSystemTest.cpp @@ -61,6 +61,10 @@ class AbfsFileSystemTest : public testing::Test { public: std::shared_ptr azuriteServer; + static void SetUpTestCase() { + registerAbfsFileSystem(); + } + void SetUp() override { auto port = facebook::velox::exec::test::getFreePort(); azuriteServer = std::make_shared(port); diff --git a/velox/connectors/hive/storage_adapters/gcs/CMakeLists.txt b/velox/connectors/hive/storage_adapters/gcs/CMakeLists.txt index 5a144b65f405..c5ac37c73fd5 100644 --- a/velox/connectors/hive/storage_adapters/gcs/CMakeLists.txt +++ b/velox/connectors/hive/storage_adapters/gcs/CMakeLists.txt @@ -14,12 +14,12 @@ # for generated headers -add_library(velox_gcs RegisterGCSFileSystem.cpp) +velox_add_library(velox_gcs RegisterGCSFileSystem.cpp) if(VELOX_ENABLE_GCS) - target_sources(velox_gcs PRIVATE GCSFileSystem.cpp GCSUtil.cpp) - target_link_libraries(velox_gcs velox_exception Folly::folly - google-cloud-cpp::storage) + velox_sources(velox_gcs PRIVATE GCSFileSystem.cpp GCSUtil.cpp) + velox_link_libraries(velox_gcs velox_exception Folly::folly + google-cloud-cpp::storage) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/connectors/hive/storage_adapters/hdfs/CMakeLists.txt b/velox/connectors/hive/storage_adapters/hdfs/CMakeLists.txt index d6363d9e71c5..6c1e84aec404 100644 --- a/velox/connectors/hive/storage_adapters/hdfs/CMakeLists.txt +++ b/velox/connectors/hive/storage_adapters/hdfs/CMakeLists.txt @@ -14,12 +14,16 @@ # for generated headers -add_library(velox_hdfs RegisterHdfsFileSystem.cpp) +velox_add_library(velox_hdfs RegisterHdfsFileSystem.cpp) if(VELOX_ENABLE_HDFS) - target_sources(velox_hdfs PRIVATE HdfsFileSystem.cpp HdfsReadFile.cpp - HdfsWriteFile.cpp) - target_link_libraries(velox_hdfs Folly::folly ${LIBHDFS3} xsimd) + velox_sources( + velox_hdfs + PRIVATE + HdfsFileSystem.cpp + HdfsReadFile.cpp + HdfsWriteFile.cpp) + velox_link_libraries(velox_hdfs Folly::folly ${LIBHDFS3} xsimd) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/connectors/hive/storage_adapters/s3fs/CMakeLists.txt b/velox/connectors/hive/storage_adapters/s3fs/CMakeLists.txt index bbe764d2ea22..96d6031c1728 100644 --- a/velox/connectors/hive/storage_adapters/s3fs/CMakeLists.txt +++ b/velox/connectors/hive/storage_adapters/s3fs/CMakeLists.txt @@ -14,13 +14,13 @@ # for generated headers -add_library(velox_s3fs RegisterS3FileSystem.cpp) +velox_add_library(velox_s3fs RegisterS3FileSystem.cpp) if(VELOX_ENABLE_S3) - target_sources(velox_s3fs PRIVATE S3FileSystem.cpp S3Util.cpp) + velox_sources(velox_s3fs PRIVATE S3FileSystem.cpp S3Util.cpp) - target_include_directories(velox_s3fs PUBLIC ${AWSSDK_INCLUDE_DIRS}) - target_link_libraries(velox_s3fs velox_dwio_common Folly::folly - ${AWSSDK_LIBRARIES}) + velox_include_directories(velox_s3fs PUBLIC ${AWSSDK_INCLUDE_DIRS}) + velox_link_libraries(velox_s3fs velox_dwio_common Folly::folly + ${AWSSDK_LIBRARIES}) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/connectors/tpch/CMakeLists.txt b/velox/connectors/tpch/CMakeLists.txt index 6d1bcddcd052..b8373349e7d0 100644 --- a/velox/connectors/tpch/CMakeLists.txt +++ b/velox/connectors/tpch/CMakeLists.txt @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_tpch_connector OBJECT TpchConnector.cpp) +velox_add_library(velox_tpch_connector OBJECT TpchConnector.cpp) -target_link_libraries(velox_tpch_connector velox_connector velox_tpch_gen - fmt::fmt) +velox_link_libraries(velox_tpch_connector velox_connector velox_tpch_gen + fmt::fmt) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/core/CMakeLists.txt b/velox/core/CMakeLists.txt index 60bb16c23930..f2a272937773 100644 --- a/velox/core/CMakeLists.txt +++ b/velox/core/CMakeLists.txt @@ -15,16 +15,22 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library(velox_config Config.cpp) -target_link_libraries( +velox_add_library(velox_config Config.cpp) +velox_link_libraries( velox_config PUBLIC velox_exception Folly::folly PRIVATE velox_type_tz) -add_library(velox_core Expressions.cpp PlanFragment.cpp PlanNode.cpp - QueryConfig.cpp QueryCtx.cpp SimpleFunctionMetadata.cpp) +velox_add_library( + velox_core + Expressions.cpp + PlanFragment.cpp + PlanNode.cpp + QueryConfig.cpp + QueryCtx.cpp + SimpleFunctionMetadata.cpp) -target_link_libraries( +velox_link_libraries( velox_core PUBLIC velox_arrow_bridge velox_caching diff --git a/velox/duckdb/conversion/CMakeLists.txt b/velox/duckdb/conversion/CMakeLists.txt index dc4c13987dcd..8361cb68e20f 100644 --- a/velox/duckdb/conversion/CMakeLists.txt +++ b/velox/duckdb/conversion/CMakeLists.txt @@ -11,15 +11,15 @@ # 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_library(velox_duckdb_conversion DuckConversion.cpp) +velox_add_library(velox_duckdb_conversion DuckConversion.cpp) -target_link_libraries(velox_duckdb_conversion velox_core velox_vector - duckdb_static) +velox_link_libraries(velox_duckdb_conversion velox_core velox_vector + duckdb_static) -add_library(velox_duckdb_parser DuckParser.cpp) +velox_add_library(velox_duckdb_parser DuckParser.cpp) -target_link_libraries(velox_duckdb_parser velox_duckdb_conversion - velox_parse_expression duckdb_static) +velox_link_libraries(velox_duckdb_parser velox_duckdb_conversion + velox_parse_expression duckdb_static) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/dwio/CMakeLists.txt b/velox/dwio/CMakeLists.txt index c8e002b7331f..efcb3c06bebe 100644 --- a/velox/dwio/CMakeLists.txt +++ b/velox/dwio/CMakeLists.txt @@ -11,23 +11,24 @@ # 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_library(velox_link_libs INTERFACE) -target_link_libraries( +velox_add_library(velox_link_libs INTERFACE) +velox_link_libraries( velox_link_libs - INTERFACE velox_caching - velox_dwio_catalog_fbhive - velox_dwio_common - velox_dwio_common_exception - velox_encode - velox_exception - velox_memory - velox_process - velox_serialization - velox_type - velox_type_fbhive - velox_vector - Folly::folly - fmt::fmt) + INTERFACE + velox_caching + velox_dwio_catalog_fbhive + velox_dwio_common + velox_dwio_common_exception + velox_encode + velox_exception + velox_memory + velox_process + velox_serialization + velox_type + velox_type_fbhive + velox_vector + Folly::folly + fmt::fmt) add_subdirectory(common) add_subdirectory(catalog) diff --git a/velox/dwio/catalog/fbhive/CMakeLists.txt b/velox/dwio/catalog/fbhive/CMakeLists.txt index f901b5727b33..e89210732368 100644 --- a/velox/dwio/catalog/fbhive/CMakeLists.txt +++ b/velox/dwio/catalog/fbhive/CMakeLists.txt @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_dwio_catalog_fbhive FileUtils.cpp) -target_link_libraries(velox_dwio_catalog_fbhive velox_dwio_common_exception - fmt::fmt Folly::folly) +velox_add_library(velox_dwio_catalog_fbhive FileUtils.cpp) +velox_link_libraries(velox_dwio_catalog_fbhive velox_dwio_common_exception + fmt::fmt Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(test) diff --git a/velox/dwio/common/CMakeLists.txt b/velox/dwio/common/CMakeLists.txt index 06a171b72684..021b41348cee 100644 --- a/velox/dwio/common/CMakeLists.txt +++ b/velox/dwio/common/CMakeLists.txt @@ -21,7 +21,7 @@ elseif(${VELOX_BUILD_TEST_UTILS}) add_subdirectory(tests/utils) endif() -add_library( +velox_add_library( velox_dwio_common BitConcatenation.cpp BitPackDecoder.cpp @@ -63,7 +63,9 @@ add_library( Writer.cpp WriterFactory.cpp) -target_link_libraries( +velox_include_directories(velox_dwio_common PRIVATE ${Protobuf_INCLUDE_DIRS}) + +velox_link_libraries( velox_dwio_common velox_buffer velox_caching diff --git a/velox/dwio/common/compression/CMakeLists.txt b/velox/dwio/common/compression/CMakeLists.txt index bda716ca7a25..b3bc9f4687ca 100644 --- a/velox/dwio/common/compression/CMakeLists.txt +++ b/velox/dwio/common/compression/CMakeLists.txt @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_dwio_common_compression Compression.cpp PagedInputStream.cpp - PagedOutputStream.cpp) +velox_add_library(velox_dwio_common_compression Compression.cpp + PagedInputStream.cpp PagedOutputStream.cpp) -target_link_libraries(velox_dwio_common_compression velox_dwio_common xsimd - Folly::folly) +velox_link_libraries(velox_dwio_common_compression velox_dwio_common xsimd + Folly::folly) diff --git a/velox/dwio/common/encryption/CMakeLists.txt b/velox/dwio/common/encryption/CMakeLists.txt index b6c55051e38f..610ebb4684af 100644 --- a/velox/dwio/common/encryption/CMakeLists.txt +++ b/velox/dwio/common/encryption/CMakeLists.txt @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_dwio_common_encryption Encryption.cpp) +velox_add_library(velox_dwio_common_encryption Encryption.cpp) -target_link_libraries(velox_dwio_common_encryption Folly::folly) +velox_link_libraries(velox_dwio_common_encryption Folly::folly) diff --git a/velox/dwio/common/exception/CMakeLists.txt b/velox/dwio/common/exception/CMakeLists.txt index 325c2c1a94f1..43d2d8a067b2 100644 --- a/velox/dwio/common/exception/CMakeLists.txt +++ b/velox/dwio/common/exception/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_dwio_common_exception Exception.cpp Exceptions.cpp) +velox_add_library(velox_dwio_common_exception Exception.cpp Exceptions.cpp) -target_link_libraries(velox_dwio_common_exception velox_exception Folly::folly - glog::glog) +velox_link_libraries(velox_dwio_common_exception velox_exception Folly::folly + glog::glog) diff --git a/velox/dwio/dwrf/common/CMakeLists.txt b/velox/dwio/dwrf/common/CMakeLists.txt index 0856576e6845..a59b0b7d3ece 100644 --- a/velox/dwio/dwrf/common/CMakeLists.txt +++ b/velox/dwio/dwrf/common/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_dwio_dwrf_common ByteRLE.cpp Common.cpp @@ -28,9 +28,11 @@ add_library( wrap/dwrf-proto-wrapper.cpp wrap/orc-proto-wrapper.cpp) -add_dependencies(velox_dwio_dwrf_common velox_dwio_dwrf_proto) +if(NOT VELOX_MONO_LIBRARY) + add_dependencies(velox_dwio_dwrf_common velox_dwio_dwrf_proto) +endif() -target_link_libraries( +velox_link_libraries( velox_dwio_dwrf_common velox_common_base velox_common_compression diff --git a/velox/dwio/dwrf/proto/CMakeLists.txt b/velox/dwio/dwrf/proto/CMakeLists.txt index 99c8b45cad2a..299587a1f415 100644 --- a/velox/dwio/dwrf/proto/CMakeLists.txt +++ b/velox/dwio/dwrf/proto/CMakeLists.txt @@ -44,10 +44,13 @@ add_custom_command( VERBATIM) add_custom_target(dwio_proto ALL DEPENDS ${PROTO_OUTPUT_FILES}) -add_library(velox_dwio_dwrf_proto ${PROTO_HDRS} ${PROTO_SRCS}) +if(VELOX_MONO_LIBRARY) + add_dependencies(velox dwio_proto) +endif() +velox_add_library(velox_dwio_dwrf_proto ${PROTO_HDRS} ${PROTO_SRCS}) # Access generated proto file with. # # #include "velox/dwio/dwrf/proto/dwrf_proto.pb.h" -target_link_libraries(velox_dwio_dwrf_proto protobuf::libprotobuf) -target_include_directories(velox_dwio_dwrf_proto PUBLIC ${PROJECT_BINARY_DIR}) +velox_link_libraries(velox_dwio_dwrf_proto protobuf::libprotobuf) +velox_include_directories(velox_dwio_dwrf_proto PUBLIC ${PROJECT_BINARY_DIR}) diff --git a/velox/dwio/dwrf/reader/CMakeLists.txt b/velox/dwio/dwrf/reader/CMakeLists.txt index 58e09e27c4fd..cae8fcc24bbe 100644 --- a/velox/dwio/dwrf/reader/CMakeLists.txt +++ b/velox/dwio/dwrf/reader/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_dwio_dwrf_reader BinaryStreamReader.cpp ColumnReader.cpp @@ -35,7 +35,7 @@ add_library( StripeReaderBase.cpp StripeStream.cpp) -target_link_libraries( +velox_link_libraries( velox_dwio_dwrf_reader velox_dwio_common velox_dwio_dwrf_common diff --git a/velox/dwio/dwrf/utils/CMakeLists.txt b/velox/dwio/dwrf/utils/CMakeLists.txt index 0f9f472cd7e6..c05206e7d1b7 100644 --- a/velox/dwio/dwrf/utils/CMakeLists.txt +++ b/velox/dwio/dwrf/utils/CMakeLists.txt @@ -16,9 +16,11 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(test) endif() -add_library(velox_dwio_dwrf_utils ProtoUtils.cpp BitIterator.h) +velox_add_library(velox_dwio_dwrf_utils ProtoUtils.cpp BitIterator.h) -add_dependencies(velox_dwio_dwrf_utils velox_dwio_dwrf_proto) +if(NOT VELOX_MONO_LIBRARY) + add_dependencies(velox_dwio_dwrf_utils velox_dwio_dwrf_proto) +endif() -target_link_libraries(velox_dwio_dwrf_utils velox_dwio_dwrf_proto velox_type - velox_memory) +velox_link_libraries(velox_dwio_dwrf_utils velox_dwio_dwrf_proto velox_type + velox_memory) diff --git a/velox/dwio/dwrf/writer/CMakeLists.txt b/velox/dwio/dwrf/writer/CMakeLists.txt index 47efc22e0e24..72726d3e79cd 100644 --- a/velox/dwio/dwrf/writer/CMakeLists.txt +++ b/velox/dwio/dwrf/writer/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_dwio_dwrf_writer ColumnWriter.cpp FlatMapColumnWriter.cpp @@ -26,7 +26,7 @@ add_library( WriterContext.cpp WriterSink.cpp) -target_link_libraries( +velox_link_libraries( velox_dwio_dwrf_writer velox_dwio_common velox_dwio_dwrf_common diff --git a/velox/dwio/orc/reader/CMakeLists.txt b/velox/dwio/orc/reader/CMakeLists.txt index 53ff149469cd..18a977afee3f 100644 --- a/velox/dwio/orc/reader/CMakeLists.txt +++ b/velox/dwio/orc/reader/CMakeLists.txt @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_dwio_orc_reader OrcReader.cpp) +velox_add_library(velox_dwio_orc_reader OrcReader.cpp) -target_link_libraries(velox_dwio_orc_reader velox_dwio_dwrf_reader) +velox_link_libraries(velox_dwio_orc_reader velox_dwio_dwrf_reader) diff --git a/velox/dwio/parquet/CMakeLists.txt b/velox/dwio/parquet/CMakeLists.txt index c14149c7eb6b..dca38504baa0 100644 --- a/velox/dwio/parquet/CMakeLists.txt +++ b/velox/dwio/parquet/CMakeLists.txt @@ -22,12 +22,12 @@ if(VELOX_ENABLE_PARQUET) endif() endif() -add_library(velox_dwio_parquet_reader RegisterParquetReader.cpp) -add_library(velox_dwio_parquet_writer RegisterParquetWriter.cpp) +velox_add_library(velox_dwio_parquet_reader RegisterParquetReader.cpp) +velox_add_library(velox_dwio_parquet_writer RegisterParquetWriter.cpp) if(VELOX_ENABLE_PARQUET) - target_link_libraries(velox_dwio_parquet_reader - velox_dwio_native_parquet_reader xsimd) - target_link_libraries(velox_dwio_parquet_writer - velox_dwio_arrow_parquet_writer) + velox_link_libraries(velox_dwio_parquet_reader + velox_dwio_native_parquet_reader xsimd) + velox_link_libraries(velox_dwio_parquet_writer + velox_dwio_arrow_parquet_writer) endif() diff --git a/velox/dwio/parquet/reader/CMakeLists.txt b/velox/dwio/parquet/reader/CMakeLists.txt index fbb38dd64eef..6c7b243ec176 100644 --- a/velox/dwio/parquet/reader/CMakeLists.txt +++ b/velox/dwio/parquet/reader/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_dwio_native_parquet_reader Metadata.cpp NestedStructureDecoder.cpp @@ -26,7 +26,7 @@ add_library( StructColumnReader.cpp StringColumnReader.cpp) -target_link_libraries( +velox_link_libraries( velox_dwio_native_parquet_reader velox_dwio_parquet_thrift velox_type diff --git a/velox/dwio/parquet/thrift/CMakeLists.txt b/velox/dwio/parquet/thrift/CMakeLists.txt index 8b21b15a2e60..cb0b6ea91881 100644 --- a/velox/dwio/parquet/thrift/CMakeLists.txt +++ b/velox/dwio/parquet/thrift/CMakeLists.txt @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_dwio_parquet_thrift ParquetThriftTypes.cpp) -target_link_libraries(velox_dwio_parquet_thrift arrow thrift Boost::headers - fmt::fmt) +velox_add_library(velox_dwio_parquet_thrift ParquetThriftTypes.cpp) +velox_link_libraries( + velox_dwio_parquet_thrift + arrow + thrift + Boost::headers + fmt::fmt) diff --git a/velox/dwio/parquet/writer/CMakeLists.txt b/velox/dwio/parquet/writer/CMakeLists.txt index 4974f0570b8e..6d2e42434c4b 100644 --- a/velox/dwio/parquet/writer/CMakeLists.txt +++ b/velox/dwio/parquet/writer/CMakeLists.txt @@ -14,9 +14,9 @@ add_subdirectory(arrow) -add_library(velox_dwio_arrow_parquet_writer Writer.cpp) +velox_add_library(velox_dwio_arrow_parquet_writer Writer.cpp) -target_link_libraries( +velox_link_libraries( velox_dwio_arrow_parquet_writer velox_dwio_arrow_parquet_writer_lib velox_dwio_arrow_parquet_writer_util_lib diff --git a/velox/dwio/parquet/writer/arrow/CMakeLists.txt b/velox/dwio/parquet/writer/arrow/CMakeLists.txt index 86ef9f7776c5..e3bdcb90e874 100644 --- a/velox/dwio/parquet/writer/arrow/CMakeLists.txt +++ b/velox/dwio/parquet/writer/arrow/CMakeLists.txt @@ -19,7 +19,7 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library( +velox_add_library( velox_dwio_arrow_parquet_writer_lib ArrowSchema.cpp ArrowSchemaInternal.cpp @@ -44,7 +44,7 @@ add_library( Types.cpp Writer.cpp) -target_link_libraries( +velox_link_libraries( velox_dwio_arrow_parquet_writer_lib velox_dwio_arrow_parquet_writer_util_lib velox_dwio_arrow_parquet_writer_thrift_lib diff --git a/velox/dwio/parquet/writer/arrow/generated/CMakeLists.txt b/velox/dwio/parquet/writer/arrow/generated/CMakeLists.txt index a37f134ede80..fefbb35e3772 100644 --- a/velox/dwio/parquet/writer/arrow/generated/CMakeLists.txt +++ b/velox/dwio/parquet/writer/arrow/generated/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_dwio_arrow_parquet_writer_thrift_lib parquet_types.cpp) +velox_add_library(velox_dwio_arrow_parquet_writer_thrift_lib parquet_types.cpp) -target_link_libraries(velox_dwio_arrow_parquet_writer_thrift_lib arrow - Boost::headers) +velox_link_libraries(velox_dwio_arrow_parquet_writer_thrift_lib arrow + Boost::headers) diff --git a/velox/dwio/parquet/writer/arrow/tests/CMakeLists.txt b/velox/dwio/parquet/writer/arrow/tests/CMakeLists.txt index 2cabfc29a3cf..97266c25306d 100644 --- a/velox/dwio/parquet/writer/arrow/tests/CMakeLists.txt +++ b/velox/dwio/parquet/writer/arrow/tests/CMakeLists.txt @@ -33,7 +33,6 @@ add_test(velox_dwio_arrow_parquet_writer_test target_link_libraries( velox_dwio_arrow_parquet_writer_test - velox_dwio_arrow_parquet_writer_lib velox_dwio_arrow_parquet_writer_test_lib gmock gtest @@ -51,5 +50,6 @@ add_library( TestUtil.cpp XxHasher.cpp) -target_link_libraries(velox_dwio_arrow_parquet_writer_test_lib - velox_dwio_arrow_parquet_writer_lib arrow gtest) +target_link_libraries( + velox_dwio_arrow_parquet_writer_test_lib arrow + velox_dwio_arrow_parquet_writer_lib gtest) diff --git a/velox/dwio/parquet/writer/arrow/util/CMakeLists.txt b/velox/dwio/parquet/writer/arrow/util/CMakeLists.txt index c1d70d659997..e5757f81646b 100644 --- a/velox/dwio/parquet/writer/arrow/util/CMakeLists.txt +++ b/velox/dwio/parquet/writer/arrow/util/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_dwio_arrow_parquet_writer_util_lib Compression.cpp CompressionSnappy.cpp @@ -22,5 +22,10 @@ add_library( Hashing.cpp Crc32.cpp) -target_link_libraries(velox_dwio_arrow_parquet_writer_util_lib arrow - Snappy::snappy zstd::zstd ZLIB::ZLIB lz4::lz4) +velox_link_libraries( + velox_dwio_arrow_parquet_writer_util_lib + arrow + Snappy::snappy + zstd::zstd + ZLIB::ZLIB + lz4::lz4) diff --git a/velox/examples/CMakeLists.txt b/velox/examples/CMakeLists.txt index 8625d34ce82e..958c7c296ec0 100644 --- a/velox/examples/CMakeLists.txt +++ b/velox/examples/CMakeLists.txt @@ -14,25 +14,38 @@ add_executable(velox_example_simple_functions SimpleFunctions.cpp) -target_link_libraries(velox_example_simple_functions velox_functions_lib - velox_core velox_expression re2::re2) +target_link_libraries( + velox_example_simple_functions + velox_functions_lib + velox_core + velox_expression + re2::re2) add_executable(velox_example_expression_eval ExpressionEval.cpp) -target_link_libraries(velox_example_expression_eval velox_type velox_vector - velox_caching velox_memory velox_expression) +target_link_libraries( + velox_example_expression_eval + velox_type + velox_vector + velox_caching + velox_memory + velox_expression) add_executable(velox_example_opaque_type OpaqueType.cpp) - -target_link_libraries(velox_example_opaque_type velox_type velox_vector - velox_caching velox_expression velox_memory) +target_link_libraries( + velox_example_opaque_type + velox_type + velox_vector + velox_caching + velox_expression + velox_memory) # This is disabled temporarily until we figure out why g++ is crashing linking # it on linux builds. # add_executable(velox_example_scan_and_sort ScanAndSort.cpp) -# target_link_libraries( velox_example_scan_and_sort velox_type velox_vector +# velox_link_libraries( velox_example_scan_and_sort velox_type velox_vector # velox_exec velox_exec_test_lib velox_hive_connector velox_memory # velox_vector_test_lib) @@ -49,11 +62,10 @@ target_link_libraries( add_executable(velox_example_vector_reader_writer VectorReaderWriter.cpp) -target_link_libraries(velox_example_vector_reader_writer velox_expression - velox_type velox_vector) +target_link_libraries( + velox_example_vector_reader_writer velox_expression velox_type velox_vector) add_executable(velox_example_operator_extensibility OperatorExtensibility.cpp) - target_link_libraries( velox_example_operator_extensibility velox_type diff --git a/velox/exec/CMakeLists.txt b/velox/exec/CMakeLists.txt index dc89f71dbdc5..4bcc61321381 100644 --- a/velox/exec/CMakeLists.txt +++ b/velox/exec/CMakeLists.txt @@ -11,7 +11,7 @@ # 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_library( +velox_add_library( velox_exec AddressableNonNullValueList.cpp Aggregate.cpp @@ -87,7 +87,7 @@ add_library( WindowFunction.cpp WindowPartition.cpp) -target_link_libraries( +velox_link_libraries( velox_exec velox_file velox_core diff --git a/velox/exec/fuzzer/CMakeLists.txt b/velox/exec/fuzzer/CMakeLists.txt index 64fa24bb6b5e..fb6c80c6c00d 100644 --- a/velox/exec/fuzzer/CMakeLists.txt +++ b/velox/exec/fuzzer/CMakeLists.txt @@ -72,14 +72,22 @@ target_link_libraries( add_library(velox_row_number_fuzzer RowNumberFuzzer.cpp) target_link_libraries( - velox_row_number_fuzzer velox_fuzzer_util velox_type velox_vector_fuzzer - velox_exec_test_lib velox_expression_test_utility) + velox_row_number_fuzzer + velox_fuzzer_util + velox_type + velox_vector_fuzzer + velox_exec_test_lib + velox_expression_test_utility) add_library(velox_join_fuzzer JoinFuzzer.cpp) target_link_libraries( - velox_join_fuzzer velox_type velox_vector_fuzzer velox_fuzzer_util - velox_exec_test_lib velox_expression_test_utility) + velox_join_fuzzer + velox_type + velox_vector_fuzzer + velox_fuzzer_util + velox_exec_test_lib + velox_expression_test_utility) add_library(velox_writer_fuzzer WriterFuzzer.cpp) @@ -107,5 +115,5 @@ target_link_libraries( add_library(velox_cache_fuzzer CacheFuzzer.cpp) -target_link_libraries(velox_cache_fuzzer velox_dwio_common velox_temp_path - velox_vector_test_lib) +target_link_libraries( + velox_cache_fuzzer velox_dwio_common velox_temp_path velox_vector_test_lib) diff --git a/velox/experimental/wave/common/CMakeLists.txt b/velox/experimental/wave/common/CMakeLists.txt index 5a30aebd52bb..db1f54f25568 100644 --- a/velox/experimental/wave/common/CMakeLists.txt +++ b/velox/experimental/wave/common/CMakeLists.txt @@ -12,11 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_wave_common GpuArena.cpp Buffer.cpp Cuda.cu Exception.cpp - Type.cpp ResultStaging.cpp) +velox_add_library( + velox_wave_common + GpuArena.cpp + Buffer.cpp + Cuda.cu + Exception.cpp + Type.cpp + ResultStaging.cpp) -target_link_libraries(velox_wave_common velox_exception velox_common_base - velox_type) +velox_link_libraries(velox_wave_common velox_exception velox_common_base + velox_type) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/experimental/wave/dwio/CMakeLists.txt b/velox/experimental/wave/dwio/CMakeLists.txt index 109bc63bb10a..f43052462fdc 100644 --- a/velox/experimental/wave/dwio/CMakeLists.txt +++ b/velox/experimental/wave/dwio/CMakeLists.txt @@ -14,7 +14,11 @@ add_subdirectory(decode) -add_library(velox_wave_dwio ColumnReader.cpp FormatData.cpp ReadStream.cpp - StructColumnReader.cpp) +velox_add_library( + velox_wave_dwio + ColumnReader.cpp + FormatData.cpp + ReadStream.cpp + StructColumnReader.cpp) -target_link_libraries(velox_wave_dwio Folly::folly fmt::fmt xsimd) +velox_link_libraries(velox_wave_dwio Folly::folly fmt::fmt xsimd) diff --git a/velox/experimental/wave/dwio/decode/CMakeLists.txt b/velox/experimental/wave/dwio/decode/CMakeLists.txt index 412ba83c8bd3..790995c47a3c 100644 --- a/velox/experimental/wave/dwio/decode/CMakeLists.txt +++ b/velox/experimental/wave/dwio/decode/CMakeLists.txt @@ -14,6 +14,6 @@ add_subdirectory(tests) -add_library(velox_wave_decode GpuDecoder.cu) +velox_add_library(velox_wave_decode GpuDecoder.cu) -target_link_libraries(velox_wave_decode velox_wave_common) +velox_link_libraries(velox_wave_decode velox_wave_common) diff --git a/velox/experimental/wave/exec/CMakeLists.txt b/velox/experimental/wave/exec/CMakeLists.txt index 98548c2b44b1..024efe9f8f97 100644 --- a/velox/experimental/wave/exec/CMakeLists.txt +++ b/velox/experimental/wave/exec/CMakeLists.txt @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_wave_stream OperandSet.cpp Wave.cpp) +velox_add_library(velox_wave_stream OperandSet.cpp Wave.cpp) -target_link_libraries(velox_wave_stream Folly::folly fmt::fmt xsimd) +velox_link_libraries(velox_wave_stream Folly::folly fmt::fmt xsimd) -add_library( +velox_add_library( velox_wave_exec Aggregation.cpp AggregationInstructions.cu @@ -34,7 +34,7 @@ add_library( WaveHiveDataSource.cpp WaveSplitReader.cpp) -target_link_libraries( +velox_link_libraries( velox_wave_exec velox_wave_vector velox_wave_common diff --git a/velox/experimental/wave/vector/CMakeLists.txt b/velox/experimental/wave/vector/CMakeLists.txt index 4f04b01abe16..7e3082486789 100644 --- a/velox/experimental/wave/vector/CMakeLists.txt +++ b/velox/experimental/wave/vector/CMakeLists.txt @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_wave_vector WaveVector.cpp) -target_link_libraries(velox_wave_vector velox_vector velox_common_base) +velox_add_library(velox_wave_vector WaveVector.cpp) +velox_link_libraries(velox_wave_vector velox_vector velox_common_base) diff --git a/velox/expression/CMakeLists.txt b/velox/expression/CMakeLists.txt index 5be222482e2a..548e47720a85 100644 --- a/velox/expression/CMakeLists.txt +++ b/velox/expression/CMakeLists.txt @@ -12,19 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_type_signature OBJECT TypeSignature.cpp) +velox_add_library(velox_type_signature OBJECT TypeSignature.cpp) -target_link_libraries(velox_type_signature velox_common_base) +velox_link_libraries(velox_type_signature velox_common_base) -add_library( - velox_expression_functions FunctionSignature.cpp SignatureBinder.cpp - ReverseSignatureBinder.cpp) +velox_add_library(velox_expression_functions FunctionSignature.cpp + SignatureBinder.cpp ReverseSignatureBinder.cpp) -target_link_libraries( - velox_expression_functions velox_common_base velox_type_calculation - velox_type_signature velox_signature_parser) +velox_link_libraries( + velox_expression_functions + velox_common_base + velox_type_calculation + velox_type_signature + velox_signature_parser) -add_library( +velox_add_library( velox_expression BooleanMix.cpp CastExpr.cpp @@ -50,7 +52,7 @@ add_library( TryExpr.cpp VectorFunction.cpp) -target_link_libraries( +velox_link_libraries( velox_expression velox_core velox_vector diff --git a/velox/expression/signature_parser/CMakeLists.txt b/velox/expression/signature_parser/CMakeLists.txt index a59d525cb84c..0627986c9879 100644 --- a/velox/expression/signature_parser/CMakeLists.txt +++ b/velox/expression/signature_parser/CMakeLists.txt @@ -28,9 +28,15 @@ flex_target( add_flex_bison_dependency(SignatureParserScanner SignatureParser) +if(VELOX_MONO_LIBRARY) + add_custom_target( + velox_signature_gen_src DEPENDS ${BISON_SignatureParser_OUTPUTS} + ${FLEX_SignatureParserScanner_OUTPUTS}) + add_dependencies(velox velox_signature_gen_src) +endif() + include_directories(${PROJECT_BINARY_DIR}) include_directories(${FLEX_INCLUDE_DIRS}) -add_library( - velox_signature_parser ${BISON_SignatureParser_OUTPUTS} - ${FLEX_SignatureParserScanner_OUTPUTS} ParseUtil.cpp) -target_link_libraries(velox_signature_parser velox_common_base velox_type) +velox_add_library(velox_signature_parser ${BISON_SignatureParser_OUTPUTS} + ${FLEX_SignatureParserScanner_OUTPUTS} ParseUtil.cpp) +velox_link_libraries(velox_signature_parser velox_common_base velox_type) diff --git a/velox/expression/type_calculation/CMakeLists.txt b/velox/expression/type_calculation/CMakeLists.txt index 4918d77c4b0b..0c0a3b114b1c 100644 --- a/velox/expression/type_calculation/CMakeLists.txt +++ b/velox/expression/type_calculation/CMakeLists.txt @@ -24,10 +24,20 @@ flex_target( add_flex_bison_dependency(TypeCalculationScanner TypeCalculationParser) +if(VELOX_MONO_LIBRARY) + add_custom_target( + velox_type_calculation_gen_src + DEPENDS ${BISON_TypeCalculationParser_OUTPUTS} + ${FLEX_TypeCalculationScanner_OUTPUTS}) + add_dependencies(velox velox_type_calculation_gen_src) +endif() + include_directories(${PROJECT_BINARY_DIR}) include_directories(${FLEX_INCLUDE_DIRS}) -add_library( +velox_add_library( velox_type_calculation - ${BISON_TypeCalculationParser_OUTPUTS} ${FLEX_TypeCalculationScanner_OUTPUTS} - Scanner.h TypeCalculation.h) -target_link_libraries(velox_type_calculation velox_common_base) + ${BISON_TypeCalculationParser_OUTPUTS} + ${FLEX_TypeCalculationScanner_OUTPUTS} + Scanner.h + TypeCalculation.h) +velox_link_libraries(velox_type_calculation velox_common_base) diff --git a/velox/external/date/CMakeLists.txt b/velox/external/date/CMakeLists.txt index 3cde881bc2a5..1cc626b2b60d 100644 --- a/velox/external/date/CMakeLists.txt +++ b/velox/external/date/CMakeLists.txt @@ -9,8 +9,8 @@ # 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. -include_directories(SYSTEM velox/external) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_OS_TZDB") -add_library(velox_external_date tz.cpp) +velox_add_library(velox_external_date tz.cpp) +velox_include_directories(velox_external_date SYSTEM PUBLIC velox/external) +velox_compile_definitions(velox_external_date PRIVATE USE_OS_TZDB) diff --git a/velox/external/md5/CMakeLists.txt b/velox/external/md5/CMakeLists.txt index a066f336ca81..b953447b54f6 100644 --- a/velox/external/md5/CMakeLists.txt +++ b/velox/external/md5/CMakeLists.txt @@ -9,9 +9,9 @@ # 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_library(md5 md5.cpp) +velox_add_library(velox_external_md5 md5.cpp) -add_compile_definitions(FOLLY_HAVE_INT128_T=1) -target_link_libraries( - md5 +velox_link_libraries( + velox_external_md5 + PRIVATE Folly::folly) diff --git a/velox/flag_definitions/CMakeLists.txt b/velox/flag_definitions/CMakeLists.txt index 276f4bf4bbbe..8569cc3f997d 100644 --- a/velox/flag_definitions/CMakeLists.txt +++ b/velox/flag_definitions/CMakeLists.txt @@ -11,5 +11,5 @@ # 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_library(velox_flag_definitions OBJECT flags.cpp) -target_link_libraries(velox_flag_definitions PRIVATE gflags::gflags) +velox_add_library(velox_flag_definitions OBJECT flags.cpp) +velox_link_libraries(velox_flag_definitions PRIVATE gflags::gflags) diff --git a/velox/functions/CMakeLists.txt b/velox/functions/CMakeLists.txt index 6afd4edbccf2..77e5f83428d5 100644 --- a/velox/functions/CMakeLists.txt +++ b/velox/functions/CMakeLists.txt @@ -11,12 +11,16 @@ # 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_library(velox_function_registry FunctionRegistry.cpp) -add_library(velox_coverage_util CoverageUtil.cpp) +velox_add_library(velox_function_registry FunctionRegistry.cpp) +velox_add_library(velox_coverage_util CoverageUtil.cpp) -target_link_libraries(velox_function_registry velox_expression velox_type - velox_core velox_exception) -target_link_libraries(velox_coverage_util velox_function_registry) +velox_link_libraries( + velox_function_registry + velox_expression + velox_type + velox_core + velox_exception) +velox_link_libraries(velox_coverage_util velox_function_registry) add_subdirectory(lib) if(${VELOX_ENABLE_PRESTO_FUNCTIONS}) add_subdirectory(prestosql) diff --git a/velox/functions/lib/CMakeLists.txt b/velox/functions/lib/CMakeLists.txt index 34e3eec8fc74..26c40c68b275 100644 --- a/velox/functions/lib/CMakeLists.txt +++ b/velox/functions/lib/CMakeLists.txt @@ -12,20 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_is_null_functions IsNull.cpp) +velox_add_library(velox_is_null_functions IsNull.cpp) -target_link_libraries(velox_is_null_functions velox_expression) +velox_link_libraries(velox_is_null_functions velox_expression) -add_library(velox_functions_util LambdaFunctionUtil.cpp RowsTranslationUtil.cpp) +velox_add_library(velox_functions_util LambdaFunctionUtil.cpp + RowsTranslationUtil.cpp) -target_link_libraries(velox_functions_util velox_vector velox_common_base) +velox_link_libraries(velox_functions_util velox_vector velox_common_base) -add_library(velox_functions_lib_date_time_formatter - DateTimeFormatter.cpp DateTimeFormatterBuilder.cpp) +velox_add_library(velox_functions_lib_date_time_formatter DateTimeFormatter.cpp + DateTimeFormatterBuilder.cpp) -target_link_libraries(velox_functions_lib_date_time_formatter velox_type_tz) +velox_link_libraries(velox_functions_lib_date_time_formatter velox_type_tz) -add_library( +velox_add_library( velox_functions_lib ArrayShuffle.cpp CheckDuplicateKeys.cpp @@ -38,8 +39,12 @@ add_library( SubscriptUtil.cpp TimeUtils.cpp) -target_link_libraries(velox_functions_lib velox_functions_util velox_vector - re2::re2 Folly::folly) +velox_link_libraries( + velox_functions_lib + velox_functions_util + velox_vector + re2::re2 + Folly::folly) add_subdirectory(aggregates) add_subdirectory(string) diff --git a/velox/functions/lib/aggregates/CMakeLists.txt b/velox/functions/lib/aggregates/CMakeLists.txt index 88d53af24bf6..e3d04ab8333d 100644 --- a/velox/functions/lib/aggregates/CMakeLists.txt +++ b/velox/functions/lib/aggregates/CMakeLists.txt @@ -12,13 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_functions_aggregates - AverageAggregateBase.cpp CentralMomentsAggregatesBase.cpp - SingleValueAccumulator.cpp ValueList.cpp ValueSet.cpp) + AverageAggregateBase.cpp + CentralMomentsAggregatesBase.cpp + SingleValueAccumulator.cpp + ValueList.cpp + ValueSet.cpp) -target_link_libraries(velox_functions_aggregates velox_exec - velox_presto_serializer Folly::folly) +velox_link_libraries(velox_functions_aggregates velox_exec + velox_presto_serializer Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/functions/lib/string/CMakeLists.txt b/velox/functions/lib/string/CMakeLists.txt index 8fcd0f490dfa..a64902a30f68 100644 --- a/velox/functions/lib/string/CMakeLists.txt +++ b/velox/functions/lib/string/CMakeLists.txt @@ -11,10 +11,10 @@ # 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_library(velox_functions_string INTERFACE) +velox_add_library(velox_functions_string INTERFACE) -target_link_libraries(velox_functions_string INTERFACE velox_exception - Folly::folly) +velox_link_libraries(velox_functions_string INTERFACE velox_exception + Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/functions/lib/window/CMakeLists.txt b/velox/functions/lib/window/CMakeLists.txt index a77142c21f72..9594f3814569 100644 --- a/velox/functions/lib/window/CMakeLists.txt +++ b/velox/functions/lib/window/CMakeLists.txt @@ -12,11 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_functions_window NthValue.cpp Ntile.cpp Rank.cpp - RowNumber.cpp) +velox_add_library( + velox_functions_window + NthValue.cpp + Ntile.cpp + Rank.cpp + RowNumber.cpp) -target_link_libraries(velox_functions_window velox_buffer velox_exec - Folly::folly) +velox_link_libraries(velox_functions_window velox_buffer velox_exec + Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/functions/prestosql/CMakeLists.txt b/velox/functions/prestosql/CMakeLists.txt index 08e7e1e12eea..9c52ceaac6cd 100644 --- a/velox/functions/prestosql/CMakeLists.txt +++ b/velox/functions/prestosql/CMakeLists.txt @@ -15,7 +15,7 @@ add_subdirectory(json) add_subdirectory(types) add_subdirectory(window) -add_library( +velox_add_library( velox_functions_prestosql_impl ArrayConstructor.cpp ArrayContains.cpp @@ -62,21 +62,23 @@ add_library( Zip.cpp ZipWith.cpp) -target_link_libraries( +velox_link_libraries( velox_functions_prestosql_impl velox_common_hyperloglog velox_functions_json velox_functions_lib velox_expression - md5 + velox_external_md5 velox_type_tz velox_presto_types velox_functions_util Folly::folly stemmer::stemmer) -set_property(TARGET velox_functions_prestosql_impl PROPERTY JOB_POOL_COMPILE - high_memory_pool) +if(NOT VELOX_MONO_LIBRARY) + set_property(TARGET velox_functions_prestosql_impl PROPERTY JOB_POOL_COMPILE + high_memory_pool) +endif() if(${VELOX_ENABLE_AGGREGATES}) add_subdirectory(aggregates) diff --git a/velox/functions/prestosql/aggregates/CMakeLists.txt b/velox/functions/prestosql/aggregates/CMakeLists.txt index d06ee83e93db..49b680bb61b5 100644 --- a/velox/functions/prestosql/aggregates/CMakeLists.txt +++ b/velox/functions/prestosql/aggregates/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_aggregates ApproxDistinctAggregate.cpp ApproxMostFrequentAggregate.cpp @@ -47,7 +47,7 @@ add_library( SumDataSizeForStatsAggregate.cpp VarianceAggregates.cpp) -target_link_libraries( +velox_link_libraries( velox_aggregates velox_common_hyperloglog velox_exec diff --git a/velox/functions/prestosql/json/CMakeLists.txt b/velox/functions/prestosql/json/CMakeLists.txt index d73ff97f8e00..20f4ef810a72 100644 --- a/velox/functions/prestosql/json/CMakeLists.txt +++ b/velox/functions/prestosql/json/CMakeLists.txt @@ -11,11 +11,15 @@ # 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_library(velox_functions_json JsonExtractor.cpp JsonPathTokenizer.cpp - SIMDJsonExtractor.cpp SIMDJsonUtil.cpp) +velox_add_library( + velox_functions_json + JsonExtractor.cpp + JsonPathTokenizer.cpp + SIMDJsonExtractor.cpp + SIMDJsonUtil.cpp) -target_link_libraries(velox_functions_json velox_exception Folly::folly - simdjson::simdjson) +velox_link_libraries(velox_functions_json velox_exception Folly::folly + simdjson::simdjson) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/functions/prestosql/registration/CMakeLists.txt b/velox/functions/prestosql/registration/CMakeLists.txt index 17cd838358d8..1e477d547506 100644 --- a/velox/functions/prestosql/registration/CMakeLists.txt +++ b/velox/functions/prestosql/registration/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( +velox_add_library( velox_functions_prestosql ArrayConcatRegistration.cpp ArrayFunctionsRegistration.cpp @@ -36,13 +36,15 @@ add_library( # GCC 12 has a bug where it does not respect "pragma ignore" directives and ends # up failing compilation in an openssl header included by a hash-related # function. -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT VELOX_MONO_LIBRARY) target_compile_options(velox_functions_prestosql PRIVATE -Wno-deprecated-declarations) endif() -target_link_libraries(velox_functions_prestosql velox_functions_prestosql_impl - velox_is_null_functions simdjson::simdjson) +velox_link_libraries(velox_functions_prestosql velox_functions_prestosql_impl + velox_is_null_functions simdjson::simdjson) -set_property(TARGET velox_functions_prestosql PROPERTY JOB_POOL_COMPILE - high_memory_pool) +if(NOT VELOX_MONO_LIBRARY) + set_property(TARGET velox_functions_prestosql PROPERTY JOB_POOL_COMPILE + high_memory_pool) +endif() diff --git a/velox/functions/prestosql/types/CMakeLists.txt b/velox/functions/prestosql/types/CMakeLists.txt index b3481493a3c0..dc7c6b9c6348 100644 --- a/velox/functions/prestosql/types/CMakeLists.txt +++ b/velox/functions/prestosql/types/CMakeLists.txt @@ -11,12 +11,20 @@ # 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_library(velox_presto_types HyperLogLogType.cpp JsonType.cpp - TimestampWithTimeZoneType.cpp UuidType.cpp) +velox_add_library( + velox_presto_types + HyperLogLogType.cpp + JsonType.cpp + TimestampWithTimeZoneType.cpp + UuidType.cpp) -target_link_libraries( - velox_presto_types velox_memory velox_expression velox_functions_util - velox_functions_json velox_functions_lib_date_time_formatter) +velox_link_libraries( + velox_presto_types + velox_memory + velox_expression + velox_functions_util + velox_functions_json + velox_functions_lib_date_time_formatter) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/functions/prestosql/window/CMakeLists.txt b/velox/functions/prestosql/window/CMakeLists.txt index 61bcfedd81e2..2fa0b2f04f3c 100644 --- a/velox/functions/prestosql/window/CMakeLists.txt +++ b/velox/functions/prestosql/window/CMakeLists.txt @@ -15,8 +15,16 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library(velox_window CumeDist.cpp FirstLastValue.cpp LeadLag.cpp - WindowFunctionsRegistration.cpp) +velox_add_library( + velox_window + CumeDist.cpp + FirstLastValue.cpp + LeadLag.cpp + WindowFunctionsRegistration.cpp) -target_link_libraries(velox_window velox_buffer velox_exec - velox_functions_window Folly::folly) +velox_link_libraries( + velox_window + velox_buffer + velox_exec + velox_functions_window + Folly::folly) diff --git a/velox/functions/remote/client/CMakeLists.txt b/velox/functions/remote/client/CMakeLists.txt index c8e442410b27..afb1722733ef 100644 --- a/velox/functions/remote/client/CMakeLists.txt +++ b/velox/functions/remote/client/CMakeLists.txt @@ -12,15 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_functions_remote_thrift_client ThriftClient.cpp) -target_link_libraries(velox_functions_remote_thrift_client - PUBLIC velox_remote_function_thrift FBThrift::thriftcpp2) +velox_add_library(velox_functions_remote_thrift_client ThriftClient.cpp) +velox_link_libraries(velox_functions_remote_thrift_client + PUBLIC velox_remote_function_thrift FBThrift::thriftcpp2) -add_library(velox_functions_remote Remote.cpp) -target_link_libraries( +velox_add_library(velox_functions_remote Remote.cpp) +velox_link_libraries( velox_functions_remote - PUBLIC velox_expression velox_functions_remote_thrift_client - velox_functions_remote_get_serde velox_type_fbhive Folly::folly) + PUBLIC velox_expression + velox_functions_remote_thrift_client + velox_functions_remote_get_serde + velox_type_fbhive + Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/functions/remote/if/CMakeLists.txt b/velox/functions/remote/if/CMakeLists.txt index 087ecbbd04ab..12b3656382d3 100644 --- a/velox/functions/remote/if/CMakeLists.txt +++ b/velox/functions/remote/if/CMakeLists.txt @@ -20,7 +20,7 @@ add_fbthrift_cpp_library(velox_remote_function_thrift RemoteFunction.thrift target_compile_options(velox_remote_function_thrift PRIVATE -Wno-deprecated-declarations) -add_library(velox_functions_remote_get_serde GetSerde.cpp) -target_link_libraries( +velox_add_library(velox_functions_remote_get_serde GetSerde.cpp) +velox_link_libraries( velox_functions_remote_get_serde PUBLIC velox_remote_function_thrift velox_presto_serializer) diff --git a/velox/functions/sparksql/CMakeLists.txt b/velox/functions/sparksql/CMakeLists.txt index eb49abd92435..600967a14bc9 100644 --- a/velox/functions/sparksql/CMakeLists.txt +++ b/velox/functions/sparksql/CMakeLists.txt @@ -13,7 +13,7 @@ # limitations under the License. add_subdirectory(specialforms) -add_library( +velox_add_library( velox_functions_spark ArrayGetFunction.cpp ArraySort.cpp @@ -38,12 +38,12 @@ add_library( # GCC 12 has a bug where it does not respect "pragma ignore" directives and ends # up failing compilation in an openssl header included by a hash-related # function. -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT VELOX_MONO_LIBRARY) target_compile_options(velox_functions_spark PRIVATE -Wno-deprecated-declarations) endif() -target_link_libraries( +velox_link_libraries( velox_functions_spark velox_functions_lib velox_functions_prestosql_impl @@ -52,8 +52,10 @@ target_link_libraries( velox_functions_util Folly::folly) -set_property(TARGET velox_functions_spark PROPERTY JOB_POOL_COMPILE - high_memory_pool) +if(NOT VELOX_MONO_LIBRARY) + set_property(TARGET velox_functions_spark PROPERTY JOB_POOL_COMPILE + high_memory_pool) +endif() add_subdirectory(window) diff --git a/velox/functions/sparksql/aggregates/CMakeLists.txt b/velox/functions/sparksql/aggregates/CMakeLists.txt index d9af0cf4d57f..b4b965d432e3 100644 --- a/velox/functions/sparksql/aggregates/CMakeLists.txt +++ b/velox/functions/sparksql/aggregates/CMakeLists.txt @@ -11,7 +11,7 @@ # 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_library( +velox_add_library( velox_functions_spark_aggregates AverageAggregate.cpp BitwiseXorAggregate.cpp @@ -24,8 +24,13 @@ add_library( RegrReplacementAggregate.cpp SumAggregate.cpp) -target_link_libraries(velox_functions_spark_aggregates fmt::fmt velox_exec - velox_expression_functions velox_aggregates velox_vector) +velox_link_libraries( + velox_functions_spark_aggregates + fmt::fmt + velox_exec + velox_expression_functions + velox_aggregates + velox_vector) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/functions/sparksql/specialforms/CMakeLists.txt b/velox/functions/sparksql/specialforms/CMakeLists.txt index 33f44c5d4b30..e134309b7b5e 100644 --- a/velox/functions/sparksql/specialforms/CMakeLists.txt +++ b/velox/functions/sparksql/specialforms/CMakeLists.txt @@ -12,9 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library( - velox_functions_spark_specialforms DecimalRound.cpp MakeDecimal.cpp - SparkCastExpr.cpp SparkCastHooks.cpp) +velox_add_library( + velox_functions_spark_specialforms + DecimalRound.cpp + MakeDecimal.cpp + SparkCastExpr.cpp + SparkCastHooks.cpp) -target_link_libraries(velox_functions_spark_specialforms fmt::fmt - velox_expression) +velox_link_libraries(velox_functions_spark_specialforms fmt::fmt + velox_expression) diff --git a/velox/functions/sparksql/window/CMakeLists.txt b/velox/functions/sparksql/window/CMakeLists.txt index f79546442d79..0aac94596717 100644 --- a/velox/functions/sparksql/window/CMakeLists.txt +++ b/velox/functions/sparksql/window/CMakeLists.txt @@ -11,10 +11,14 @@ # 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_library(velox_functions_spark_window WindowFunctionsRegistration.cpp) +velox_add_library(velox_functions_spark_window WindowFunctionsRegistration.cpp) -target_link_libraries(velox_functions_spark_window velox_buffer velox_exec - velox_functions_window Folly::folly) +velox_link_libraries( + velox_functions_spark_window + velox_buffer + velox_exec + velox_functions_window + Folly::folly) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/parse/CMakeLists.txt b/velox/parse/CMakeLists.txt index 45b00d490fd4..75a5e835933c 100644 --- a/velox/parse/CMakeLists.txt +++ b/velox/parse/CMakeLists.txt @@ -11,17 +11,25 @@ # 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_library(velox_parse_expression Expressions.cpp) -target_link_libraries(velox_parse_expression velox_type velox_parse_utils - velox_expression velox_exec) +velox_add_library(velox_parse_expression Expressions.cpp) +velox_link_libraries( + velox_parse_expression + velox_type + velox_parse_utils + velox_expression + velox_exec) -add_library(velox_parse_parser ExpressionsParser.cpp QueryPlanner.cpp) -target_link_libraries(velox_parse_parser velox_parse_expression velox_type - velox_duckdb_parser) +velox_add_library(velox_parse_parser ExpressionsParser.cpp QueryPlanner.cpp) +velox_link_libraries(velox_parse_parser velox_parse_expression velox_type + velox_duckdb_parser) -add_library(velox_parse_utils TypeResolver.cpp) -target_link_libraries(velox_parse_utils velox_buffer velox_type velox_vector - velox_function_registry) +velox_add_library(velox_parse_utils TypeResolver.cpp) +velox_link_libraries( + velox_parse_utils + velox_buffer + velox_type + velox_vector + velox_function_registry) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/row/CMakeLists.txt b/velox/row/CMakeLists.txt index c0b04a3d724e..9eb9cb524682 100644 --- a/velox/row/CMakeLists.txt +++ b/velox/row/CMakeLists.txt @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_row_fast CompactRow.cpp UnsafeRowFast.cpp) +velox_add_library(velox_row_fast CompactRow.cpp UnsafeRowFast.cpp) -target_link_libraries(velox_row_fast PUBLIC velox_vector) +velox_link_libraries(velox_row_fast PUBLIC velox_vector) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/serializers/CMakeLists.txt b/velox/serializers/CMakeLists.txt index f23244083e5d..72a069d8ca55 100644 --- a/velox/serializers/CMakeLists.txt +++ b/velox/serializers/CMakeLists.txt @@ -11,11 +11,10 @@ # 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_library( - velox_presto_serializer CompactRowSerializer.cpp PrestoSerializer.cpp - UnsafeRowSerializer.cpp) +velox_add_library(velox_presto_serializer CompactRowSerializer.cpp + PrestoSerializer.cpp UnsafeRowSerializer.cpp) -target_link_libraries(velox_presto_serializer velox_vector velox_row_fast) +velox_link_libraries(velox_presto_serializer velox_vector velox_row_fast) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/substrait/CMakeLists.txt b/velox/substrait/CMakeLists.txt index 608b90fb87ba..13ce0e01a981 100644 --- a/velox/substrait/CMakeLists.txt +++ b/velox/substrait/CMakeLists.txt @@ -59,11 +59,11 @@ set(SRCS VeloxToSubstraitType.cpp VariantToVectorConverter.cpp) -add_library(velox_substrait_plan_converter ${SRCS}) +velox_add_library(velox_substrait_plan_converter ${SRCS}) target_include_directories(velox_substrait_plan_converter PUBLIC ${PROTO_OUTPUT_DIR}) -target_link_libraries(velox_substrait_plan_converter velox_connector - velox_dwio_dwrf_common) +velox_link_libraries(velox_substrait_plan_converter velox_connector + velox_dwio_dwrf_common) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/tpch/gen/CMakeLists.txt b/velox/tpch/gen/CMakeLists.txt index 51ff6646924e..eada0a24676d 100644 --- a/velox/tpch/gen/CMakeLists.txt +++ b/velox/tpch/gen/CMakeLists.txt @@ -14,11 +14,11 @@ add_subdirectory(dbgen) -add_library(velox_tpch_gen DBGenIterator.cpp TpchGen.cpp) +velox_add_library(velox_tpch_gen DBGenIterator.cpp TpchGen.cpp) -target_include_directories(velox_tpch_gen PRIVATE dbgen/include) +velox_include_directories(velox_tpch_gen PRIVATE dbgen/include) -target_link_libraries(velox_tpch_gen velox_memory velox_vector velox_dbgen) +velox_link_libraries(velox_tpch_gen velox_memory velox_vector dbgen) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/tpch/gen/dbgen/CMakeLists.txt b/velox/tpch/gen/dbgen/CMakeLists.txt index 05f29e382a0d..0f39ad339e04 100644 --- a/velox/tpch/gen/dbgen/CMakeLists.txt +++ b/velox/tpch/gen/dbgen/CMakeLists.txt @@ -1,12 +1,23 @@ +# 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. cmake_minimum_required(VERSION 3.0.0) cmake_policy(SET CMP0063 NEW) project(dbgen CXX C) -add_definitions(-DDBNAME=dss -DMAC -DORACLE -DTPCH) - add_library( - velox_dbgen STATIC + dbgen STATIC dbgen.cpp dbgen_gunk.cpp bm_utils.cpp @@ -17,7 +28,8 @@ add_library( speed_seed.cpp text.cpp) -target_include_directories(velox_dbgen PRIVATE include) +target_compile_definitions(dbgen PRIVATE DBNAME=dss MAC ORACLE TPCH) +target_include_directories(dbgen PRIVATE include) # Suppress warnings when compiling dbgen. -target_compile_options(velox_dbgen PRIVATE -w) +target_compile_options(dbgen PRIVATE -w) diff --git a/velox/type/CMakeLists.txt b/velox/type/CMakeLists.txt index 640a1458e187..7a01444b85a8 100644 --- a/velox/type/CMakeLists.txt +++ b/velox/type/CMakeLists.txt @@ -19,7 +19,7 @@ add_subdirectory(parser) add_subdirectory(tz) add_subdirectory(fbhive) -add_library( +velox_add_library( velox_type Conversions.cpp DecimalUtil.cpp @@ -35,7 +35,7 @@ add_library( Type.cpp Variant.cpp) -target_link_libraries( +velox_link_libraries( velox_type velox_type_tz velox_common_base diff --git a/velox/type/fbhive/CMakeLists.txt b/velox/type/fbhive/CMakeLists.txt index 8db23f2f667f..c6e7aa62319c 100644 --- a/velox/type/fbhive/CMakeLists.txt +++ b/velox/type/fbhive/CMakeLists.txt @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_library(velox_type_fbhive HiveTypeParser.cpp HiveTypeSerializer.cpp) +velox_add_library(velox_type_fbhive HiveTypeParser.cpp HiveTypeSerializer.cpp) -target_link_libraries(velox_type_fbhive velox_type) +velox_link_libraries(velox_type_fbhive velox_type) if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) diff --git a/velox/type/parser/CMakeLists.txt b/velox/type/parser/CMakeLists.txt index e14be87d9f5e..813d76d049cc 100644 --- a/velox/type/parser/CMakeLists.txt +++ b/velox/type/parser/CMakeLists.txt @@ -27,8 +27,15 @@ flex_target( add_flex_bison_dependency(TypeParserScanner TypeParser) +if(VELOX_MONO_LIBRARY) + add_custom_target( + velox_type_parser_gen_src DEPENDS ${BISON_TypeParser_OUTPUTS} + ${FLEX_TypeParserScanner_OUTPUTS}) + add_dependencies(velox velox_type_parser_gen_src) +endif() + include_directories(${PROJECT_BINARY_DIR}) include_directories(${FLEX_INCLUDE_DIRS}) -add_library(velox_type_parser ${BISON_TypeParser_OUTPUTS} - ${FLEX_TypeParserScanner_OUTPUTS} ParserUtil.cpp) -target_link_libraries(velox_type_parser velox_common_base) +velox_add_library(velox_type_parser ${BISON_TypeParser_OUTPUTS} + ${FLEX_TypeParserScanner_OUTPUTS} ParserUtil.cpp) +velox_link_libraries(velox_type_parser velox_common_base) diff --git a/velox/type/tz/CMakeLists.txt b/velox/type/tz/CMakeLists.txt index 3c8b0bcd6fa4..03f3c8297859 100644 --- a/velox/type/tz/CMakeLists.txt +++ b/velox/type/tz/CMakeLists.txt @@ -14,7 +14,12 @@ if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) endif() -add_library(velox_type_tz TimeZoneMap.h TimeZoneDatabase.cpp TimeZoneMap.cpp) +velox_add_library(velox_type_tz TimeZoneMap.h TimeZoneDatabase.cpp + TimeZoneMap.cpp) -target_link_libraries(velox_type_tz velox_exception Boost::regex fmt::fmt - Folly::folly) +velox_link_libraries( + velox_type_tz + velox_exception + Boost::regex + fmt::fmt + Folly::folly) diff --git a/velox/vector/CMakeLists.txt b/velox/vector/CMakeLists.txt index 171df0f9e759..2f8450565950 100644 --- a/velox/vector/CMakeLists.txt +++ b/velox/vector/CMakeLists.txt @@ -11,7 +11,7 @@ # 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_library( +velox_add_library( velox_vector BaseVector.cpp ComplexVector.cpp @@ -30,8 +30,13 @@ add_library( VectorSaver.cpp VectorStream.cpp) -target_link_libraries(velox_vector velox_encode velox_memory velox_time - velox_type velox_buffer) +velox_link_libraries( + velox_vector + velox_encode + velox_memory + velox_time + velox_type + velox_buffer) add_subdirectory(arrow) add_subdirectory(fuzzer) diff --git a/velox/vector/arrow/CMakeLists.txt b/velox/vector/arrow/CMakeLists.txt index 31038b1a41f5..ed3733205fbf 100644 --- a/velox/vector/arrow/CMakeLists.txt +++ b/velox/vector/arrow/CMakeLists.txt @@ -11,10 +11,14 @@ # 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_library(velox_arrow_bridge Bridge.cpp) +velox_add_library(velox_arrow_bridge Bridge.cpp) -target_link_libraries(velox_arrow_bridge velox_memory velox_type velox_buffer - velox_exception) +velox_link_libraries( + velox_arrow_bridge + velox_memory + velox_type + velox_buffer + velox_exception) if(VELOX_BUILD_TESTING AND VELOX_ENABLE_ARROW) add_subdirectory(tests)