-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Monolithic build #9948
Enable Monolithic build #9948
Changes from 31 commits
288f938
e48154f
2e92338
ca62163
9c7864c
c35e0ce
19a3f29
77994c6
9dde860
28988ce
9ca08f3
96b6689
98e1b7c
0be9278
b7d81b1
794669c
1dcab39
761a3f0
7fde145
ca6daf7
533695f
2baa9cf
9d6b408
c957082
a66a770
f14944a
afddbd1
ad6b114
8acafaf
ba65ca3
f7ad166
6298482
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
assignUser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
endif() | ||
else() | ||
# Create a library for each invocation. | ||
velox_base_add_library(${TARGET} ${library_type} ${ARGN}) | ||
endif() | ||
velox_install_library_headers() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesnt velox_base_add_library 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() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: instead of MONO should we call it MONOLITHIC or UNIFIED (I prefer monolithic) . Unfortunately there are many projects called mono and saying MONOLITHIC just makes it very explicit. |
||
|
||
# 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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default for this is six which I think is just a bit too much as it get's hard to read.