Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions dev/archery/archery/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _apply_options(cmd, options):
help="Specify Arrow source directory")
# toolchain
@cpp_toolchain_options
@click.option("--build-type", default="release", type=build_type,
@click.option("--build-type", default=None, type=build_type,
help="CMake's CMAKE_BUILD_TYPE")
@click.option("--warn-level", default="production", type=warn_level_type,
help="Controls compiler warnings -W(no-)error.")
Expand All @@ -137,7 +137,9 @@ def _apply_options(cmd, options):
help="Build with tests.")
@click.option("--with-benchmarks", default=False, type=BOOL,
help="Build with benchmarks.")
@click.option("--with-python", default=True, type=BOOL,
@click.option("--with-examples", default=False, type=BOOL,
help="Build with examples.")
@click.option("--with-python", default=False, type=BOOL,
help="Build with python extension.")
@click.option("--with-parquet", default=False, type=BOOL,
help="Build with parquet file support.")
Expand All @@ -147,6 +149,16 @@ def _apply_options(cmd, options):
help="Build with Plasma object store support.")
@click.option("--with-flight", default=False, type=BOOL,
help="Build with Flight rpc support.")
@click.option("--with-compute", default=True, type=BOOL,
help="Build with compute kernels support.")
@click.option("--with-dataset", default=False, type=BOOL,
help="Build with dataset support.")
@click.option("--use-sanitizers", default=False, type=BOOL,
help="Toggles ARROW_USE_*SAN sanitizers.")
@click.option("--with-fuzzing", default=False, type=BOOL,
help="Toggles ARROW_FUZZING.")
@click.option("--use-gold-linker", default=True, type=BOOL,
help="Toggles ARROW_USE_LD_GOLD option.")
@click.option("--cmake-extras", type=str, multiple=True,
help="Extra flags/options to pass to cmake invocation. "
"Can be stacked")
Expand Down
79 changes: 68 additions & 11 deletions dev/archery/archery/lang/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,93 @@ def or_else(value, default):
return value if value else default


LLVM_VERSION = 7


class CppConfiguration:

def __init__(self,
# toolchain
cc=None, cxx=None, cxx_flags=None,
build_type=None, warn_level=None,
cpp_package_prefix=None, install_prefix=None, use_conda=None,
# components
with_tests=True, with_benchmarks=False, with_python=True,
with_parquet=False, with_gandiva=False, with_plasma=False,
with_flight=False, with_compute=False, with_dataset=False,
# tests & examples
with_tests=True, with_benchmarks=False, with_examples=False,
# Langauges support
with_python=True,
# Format support
with_parquet=False,
# Components
with_gandiva=False, with_compute=False, with_dataset=False,
with_plasma=False, with_flight=False,
# extras
with_lint_only=False,
with_lint_only=False, with_fuzzing=False,
use_gold_linker=True, use_sanitizers=True,
cmake_extras=None):
self.cc = cc
self.cxx = cxx
self._cc = cc
self._cxx = cxx
self.cxx_flags = cxx_flags

self.build_type = build_type
self._build_type = build_type
self.warn_level = warn_level
self._install_prefix = install_prefix
self._package_prefix = cpp_package_prefix
self._use_conda = use_conda

self.with_tests = with_tests
self.with_benchmarks = with_benchmarks
self.with_examples = with_examples
self.with_python = with_python
self.with_parquet = with_parquet
self.with_parquet = with_parquet or with_dataset
self.with_gandiva = with_gandiva
self.with_plasma = with_plasma
self.with_flight = with_flight
self.with_compute = with_compute
self.with_dataset = with_dataset

self.with_lint_only = with_lint_only
self.with_fuzzing = with_fuzzing
self.use_gold_linker = use_gold_linker
self.use_sanitizers = use_sanitizers

self.cmake_extras = cmake_extras

@property
def build_type(self):
if self._build_type:
return self._build_type

if self.with_fuzzing:
return "relwithdebinfo"

return "release"

@property
def cc(self):
if self._cc:
return self._cc

if self.with_fuzzing:
return f"clang-{LLVM_VERSION}"

return None

@property
def cxx(self):
if self._cxx:
return self._cxx

if self.with_fuzzing:
return f"clang++-{LLVM_VERSION}"

return None

def _gen_defs(self):
if self.cxx_flags:
yield ("ARROW_CXXFLAGS", self.cxx_flags)

yield ("CMAKE_EXPORT_COMPILE_COMMANDS", truthifier(True))
yield ("CMAKE_BUILD_TYPE", or_else(self.build_type, "debug"))
yield ("CMAKE_BUILD_TYPE", self.build_type)

if not self.with_lint_only:
yield ("BUILD_WARNING_LEVEL",
Expand All @@ -90,16 +133,30 @@ def _gen_defs(self):

yield ("ARROW_BUILD_TESTS", truthifier(self.with_tests))
yield ("ARROW_BUILD_BENCHMARKS", truthifier(self.with_benchmarks))
yield ("ARROW_BUILD_EXAMPLES", truthifier(self.with_examples))

yield ("ARROW_PYTHON", truthifier(self.with_python))
yield ("ARROW_PARQUET", truthifier(self.with_parquet))

if self.with_parquet:
yield ("ARROW_PARQUET", truthifier(self.with_parquet))
yield ("ARROW_WITH_BROTLI", "ON")
yield ("ARROW_WITH_SNAPPY", "ON")

yield ("ARROW_GANDIVA", truthifier(self.with_gandiva))
yield ("ARROW_PLASMA", truthifier(self.with_plasma))
yield ("ARROW_FLIGHT", truthifier(self.with_flight))
yield ("ARROW_COMPUTE", truthifier(self.with_compute))
yield ("ARROW_DATASET", truthifier(self.with_dataset))

if self.use_sanitizers or self.with_fuzzing:
yield ("ARROW_USE_ASAN", "ON")
yield ("ARROW_USE_UBSAN", "ON")

yield ("ARROW_LINT_ONLY", truthifier(self.with_lint_only))
yield ("ARROW_FUZZING", truthifier(self.with_fuzzing))

if self.use_gold_linker and not self.with_fuzzing:
yield ("ARROW_USE_LD_GOLD", truthifier(self.use_gold_linker))

# Detect custom conda toolchain
if self.use_conda:
Expand Down