Skip to content

Commit

Permalink
Add VELOX_BUILD_MINIMAL_WITH_DWIO compilation option
Browse files Browse the repository at this point in the history
`VELOX_BUILD_MINIMAL_WITH_DWIO` allows developers using Velox
to compile only dwio (in addition to Velox minimal), but without
pulling all other dependencies and internal libraries (exec,
connectors, etc).
  • Loading branch information
pedroerp committed Feb 13, 2024
1 parent 3004e34 commit d682418
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
23 changes: 18 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ option(
VELOX_BUILD_MINIMAL
"Build a minimal set of components only. This will override other build options."
OFF)
option(
VELOX_BUILD_MINIMAL_WITH_DWIO
"Build a minimal set of components, including DWIO (file format readers/writers).
This will override other build options."
OFF)

# option() always creates a BOOL variable so we have to use a normal cache
# variable with STRING type for this option.
Expand Down Expand Up @@ -96,6 +101,7 @@ option(VELOX_ENABLE_PARQUET "Enable Parquet support" OFF)
option(VELOX_ENABLE_ARROW "Enable Arrow support" OFF)
option(VELOX_ENABLE_REMOTE_FUNCTIONS "Enable remote function support" OFF)
option(VELOX_ENABLE_CCACHE "Use ccache if installed." ON)
option(VELOX_ENABLE_CODEGEN_SUPPORT "Enable experimental codegen support." OFF)

option(VELOX_BUILD_TEST_UTILS "Builds Velox test utilities" OFF)
option(VELOX_BUILD_PYTHON_PACKAGE "Builds Velox Python bindings" OFF)
Expand Down Expand Up @@ -125,7 +131,7 @@ if(${VELOX_BUILD_MINIMAL})
set(VELOX_ENABLE_GCS OFF)
set(VELOX_ENABLE_ABFS OFF)
set(VELOX_ENABLE_SUBSTRAIT OFF)
set(VELOX_CODEGEN_SUPPORT OFF)
set(VELOX_ENABLE_CODEGEN_SUPPORT OFF)
endif()

if(${VELOX_BUILD_TESTING})
Expand Down Expand Up @@ -175,7 +181,7 @@ if(${VELOX_BUILD_PYTHON_PACKAGE})
set(VELOX_ENABLE_GCS OFF)
set(VELOX_ENABLE_ABFS OFF)
set(VELOX_ENABLE_SUBSTRAIT OFF)
set(VELOX_CODEGEN_SUPPORT OFF)
set(VELOX_ENABLE_CODEGEN_SUPPORT OFF)
set(VELOX_ENABLE_BENCHMARKS_BASIC OFF)
set(VELOX_ENABLE_BENCHMARKS OFF)
endif()
Expand Down Expand Up @@ -257,7 +263,7 @@ if(VELOX_ENABLE_PARQUET)
endif()

# define processor variable for conditional compilation
if(${VELOX_CODEGEN_SUPPORT})
if(${VELOX_ENABLE_CODEGEN_SUPPORT})
add_compile_definitions(CODEGEN_ENABLED=1)
endif()

Expand Down Expand Up @@ -420,7 +426,10 @@ endif()
set_source(fmt)
resolve_dependency(fmt)

if(NOT ${VELOX_BUILD_MINIMAL})
if(${VELOX_BUILD_MINIMAL_WITH_DWIO} OR ${VELOX_ENABLE_HIVE_CONNECTOR})
# DWIO needs all sorts of stream compression libraries.
#
# TODO: make these optional and pluggable.
find_package(ZLIB REQUIRED)
find_package(lz4 REQUIRED)
find_package(lzo2 REQUIRED)
Expand Down Expand Up @@ -467,7 +476,11 @@ else()
set(FOLLY_BENCHMARK Folly::follybenchmark)
endif()

if(NOT ${VELOX_BUILD_MINIMAL})
# DWIO (ORC/DWRF), Substrait and experimental/codegen depend on protobuf.
if(${VELOX_BUILD_MINIMAL_WITH_DWIO}
OR ${VELOX_ENABLE_HIVE_CONNECTOR}
OR ${VELOX_ENABLE_SUBSTRAIT}
OR ${VELOX_ENABLE_CODEGEN_SUPPORT})
# Locate or build protobuf.
set_source(Protobuf)
resolve_dependency(Protobuf 3.21 EXACT)
Expand Down
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,26 @@ release: #: Build the release version
$(MAKE) cmake BUILD_DIR=release BUILD_TYPE=Release && \
$(MAKE) build BUILD_DIR=release

min_debug: #: Minimal build with debugging symbols
minimal_debug: #: Minimal build with debugging symbols
$(MAKE) cmake BUILD_DIR=debug BUILD_TYPE=debug EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DVELOX_BUILD_MINIMAL=ON"
$(MAKE) build BUILD_DIR=debug

min_debug: minimal_debug

minimal: #: Minimal build
$(MAKE) cmake BUILD_DIR=release BUILD_TYPE=release EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DVELOX_BUILD_MINIMAL=ON"
$(MAKE) build BUILD_DIR=release

dwio: #: Minimal build with dwio enabled.
$(MAKE) cmake BUILD_DIR=release BUILD_TYPE=release EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} \
-DVELOX_BUILD_MINIMAL_WITH_DWIO=ON"
$(MAKE) build BUILD_DIR=release

dwio_debug: #: Minimal build with dwio debugging symbols.
$(MAKE) cmake BUILD_DIR=debug BUILD_TYPE=debug EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} \
-DVELOX_BUILD_MINIMAL_WITH_DWIO=ON"
$(MAKE) build BUILD_DIR=debug

benchmarks-basic-build:
$(MAKE) release EXTRA_CMAKE_FLAGS=" ${EXTRA_CMAKE_FLAGS} \
-DVELOX_BUILD_TESTING=OFF \
Expand Down
4 changes: 2 additions & 2 deletions velox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if(${VELOX_ENABLE_PARSE})
endif()

# hive connector depends on dwio
if(${VELOX_ENABLE_HIVE_CONNECTOR})
if(${VELOX_BUILD_MINIMAL_WITH_DWIO} OR ${VELOX_ENABLE_HIVE_CONNECTOR})
add_subdirectory(dwio)
endif()

Expand All @@ -65,7 +65,7 @@ if(${VELOX_ENABLE_DUCKDB})
add_subdirectory(duckdb)
endif()

if(${VELOX_CODEGEN_SUPPORT})
if(${VELOX_ENABLE_CODEGEN_SUPPORT})
add_subdirectory(experimental/codegen)
endif()

Expand Down
2 changes: 1 addition & 1 deletion velox/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

add_library(velox_codegen Codegen.cpp)
if(${VELOX_CODEGEN_SUPPORT})
if(${VELOX_ENABLE_CODEGEN_SUPPORT})
target_link_libraries(velox_codegen velox_experimental_codegen)
else()
target_link_libraries(velox_codegen velox_core velox_exec velox_expression
Expand Down
1 change: 0 additions & 1 deletion velox/dwio/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ target_link_libraries(
velox_exception
velox_expression
velox_memory
velox_exec
Boost::regex
Folly::folly
glog::glog)

0 comments on commit d682418

Please sign in to comment.