Skip to content

Commit

Permalink
make build velox usable by pyvelox
Browse files Browse the repository at this point in the history
  • Loading branch information
assignUser committed Mar 21, 2024
1 parent 9b9fa13 commit af6c64a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
19 changes: 7 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,19 @@ if(${VELOX_ENABLE_EXAMPLES})
endif()

if(${VELOX_BUILD_PYTHON_PACKAGE})
set(VELOX_BUILD_TESTING OFF)
# set(VELOX_BUILD_TESTING OFF)
set(VELOX_ENABLE_PRESTO_FUNCTIONS ON)
set(VELOX_ENABLE_DUCKDB ON)
set(VELOX_ENABLE_EXPRESSION ON)
set(VELOX_ENABLE_PARSE ON)
set(VELOX_ENABLE_EXEC ON)
set(VELOX_ENABLE_AGGREGATES OFF)
set(VELOX_ENABLE_HIVE_CONNECTOR OFF)
set(VELOX_ENABLE_TPCH_CONNECTOR OFF)
# set(VELOX_ENABLE_AGGREGATES OFF) set(VELOX_ENABLE_HIVE_CONNECTOR OFF)
# set(VELOX_ENABLE_TPCH_CONNECTOR OFF)
set(VELOX_ENABLE_SPARK_FUNCTIONS ON)
set(VELOX_ENABLE_EXAMPLES OFF)
set(VELOX_ENABLE_S3 OFF)
set(VELOX_ENABLE_GCS OFF)
set(VELOX_ENABLE_ABFS OFF)
set(VELOX_ENABLE_SUBSTRAIT OFF)
set(VELOX_ENABLE_CODEGEN_SUPPORT OFF)
set(VELOX_ENABLE_BENCHMARKS_BASIC OFF)
set(VELOX_ENABLE_BENCHMARKS OFF)
# set(VELOX_ENABLE_EXAMPLES OFF) set(VELOX_ENABLE_S3 OFF) set(VELOX_ENABLE_GCS
# OFF) set(VELOX_ENABLE_ABFS OFF) set(VELOX_ENABLE_SUBSTRAIT OFF)
# set(VELOX_ENABLE_CODEGEN_SUPPORT OFF) set(VELOX_ENABLE_BENCHMARKS_BASIC OFF)
# set(VELOX_ENABLE_BENCHMARKS OFF)
endif()

# We look for OpenSSL here to cache the result enforce the version across our
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ python-clean:
DEBUG=1 ${PYTHON_EXECUTABLE} setup.py clean

python-build:
DEBUG=1 CMAKE_BUILD_PARALLEL_LEVEL=4 ${PYTHON_EXECUTABLE} -m pip install -e .$(extras) --verbose
DEBUG=1 CMAKE_BUILD_PARALLEL_LEVEL=${NUM_THREADS} ${PYTHON_EXECUTABLE} -m pip install -e .$(extras) --verbose

python-test:
$(MAKE) python-build extras="[tests]"
Expand Down
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ def run(self):

def build_extension(self, ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
# Allow using a pre-built Velox library (for CI and development)
if "VELOX_BUILD_DIR" in os.environ:
velox_dir = os.path.abspath(os.environ["VELOX_BUILD_DIR"])

if not os.path.isdir(extdir):
os.symlink(velox_dir, os.path.dirname(extdir), target_is_directory=True)

return

# required for auto-detection of auxiliary "native" libs
if not extdir.endswith(os.path.sep):
Expand All @@ -126,7 +134,6 @@ def build_extension(self, ext):
f"-DCMAKE_BUILD_TYPE={cfg}",
f"-DCMAKE_INSTALL_PREFIX={extdir}",
"-DCMAKE_VERBOSE_MAKEFILE=ON",
"-DVELOX_BUILD_PYTHON_PACKAGE=ON",
f"-DPYTHON_EXECUTABLE={exec_path} ",
]
build_args = []
Expand All @@ -148,9 +155,9 @@ def build_extension(self, ext):
os.makedirs(self.build_temp)

subprocess.check_call(
["cmake", str(ROOT_DIR)] + cmake_args, cwd=self.build_temp
["cmake", str(os.path.join(ROOT_DIR, "pyvelox"))] + cmake_args,
cwd=self.build_temp,
)
print(self.build_temp)
subprocess.check_call(
["cmake", "--build", "."] + build_args, cwd=self.build_temp
)
Expand Down

0 comments on commit af6c64a

Please sign in to comment.