Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
assignUser committed May 6, 2024
1 parent 6c0bcb4 commit 6b5883e
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 9 deletions.
11 changes: 6 additions & 5 deletions CMake/resolve_dependency_modules/gflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,23 @@ FetchContent_Declare(
URL_HASH ${VELOX_GFLAGS_BUILD_SHA256_CHECKSUM}
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/gflags/gflags-config.patch)

set(GFLAGS_BUILD_STATIC_LIBS ON)
set(GFLAGS_BUILD_SHARED_LIBS ON)
set(GFLAGS_BUILD_gflags_LIB ON)
set(GFLAGS_BUILD_gflags_nothreads_LIB ON)
set(GFLAGS_IS_SUBPROJECT ON)
# glog relies on the old `google` namespace
set(GFLAGS_NAMESPACE "google;gflags")

unset(BUILD_SHARED_LIBS)
FetchContent_MakeAvailable(gflags)
set(BUILD_SHARED_LIBS ON)

# the flag has to be added to each target we build so adjust to settings choosen
# above
target_compile_options(gflags_static PRIVATE -Wno-cast-function-type)
target_compile_options(gflags_nothreads_static PRIVATE -Wno-cast-function-type)
target_compile_options(gflags_shared PRIVATE -Wno-cast-function-type)
target_compile_options(gflags_nothreads_shared PRIVATE -Wno-cast-function-type)

# this causes find_package(gflags) to search in the build directory and prevents
# the system gflags from being found
set(gflags_DIR ${gflags_BINARY_DIR})
set(gflags_LIBRARY gflags_static)
set(gflags_LIBRARY gflags::gflags)
set(gflags_INCLUDE_DIR ${gflags_BINARY_DIR}/include)
28 changes: 28 additions & 0 deletions CMake/resolve_dependency_modules/gflags/gflags-fix-options.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -65,16 +65,18 @@ macro (gflags_define type varname docstring default)
message (FATAL_ERROR "gflags_variable: Too many macro arguments")
endif ()
if (NOT DEFINED GFLAGS_${varname})
- if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5)
- set (GFLAGS_${varname} "${ARGV4}")
+ if (DEFINED ${varname})
+ set(GFLAGS_${varname} "${${varname}}")
else ()
- set (GFLAGS_${varname} "${default}")
+ if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5)
+ set (GFLAGS_${varname} "${ARGV4}")
+ else ()
+ set (GFLAGS_${varname} "${default}")
+ endif ()
endif ()
endif ()
if (GFLAGS_IS_SUBPROJECT)
- if (NOT DEFINED ${varname})
- set (${varname} "${GFLAGS_${varname}}")
- endif ()
+ set (${varname} "${GFLAGS_${varname}}")
else ()
set (${varname} "${GFLAGS_${varname}}" CACHE ${type} "${docstring}")
endif ()

2 changes: 1 addition & 1 deletion CMake/resolve_dependency_modules/glog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(BUILD_TESTING OFF)
FetchContent_MakeAvailable(glog)
unset(BUILD_TESTING)
unset(BUILD_SHARED_LIBS)
add_dependencies(glog gflags_static)
add_dependencies(glog gflags::gflags)

list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/glog)
set(glog_INCLUDE_DIR ${glog_BINARY_DIR})
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ endif()
if(VELOX_ENABLE_BENCHMARKS_BASIC)
set(VELOX_BUILD_TEST_UTILS ON)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(VELOX_BUILD_TESTING OR VELOX_BUILD_TEST_UTILS)
set(cpr_SOURCE BUNDLED)
Expand All @@ -167,6 +168,7 @@ if(VELOX_BUILD_TESTING OR VELOX_BUILD_TEST_UTILS)
set(VELOX_ENABLE_PARSE ON)
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
if(${VELOX_ENABLE_EXAMPLES})
set(VELOX_ENABLE_EXPRESSION ON)
endif()
Expand Down Expand Up @@ -566,4 +568,7 @@ if("${TREAT_WARNINGS_AS_ERRORS}")
endif()

add_subdirectory(third_party)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(BUILD_SHARED_LIBS ON)
add_subdirectory(velox)
11 changes: 9 additions & 2 deletions velox/common/process/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

add_library(velox_process ProcessBase.cpp Profiler.cpp StackTrace.cpp
add_library(velox_process ProcessBase.cpp StackTrace.cpp
ThreadDebugInfo.cpp TraceContext.cpp TraceHistory.cpp)

target_link_libraries(
velox_process
PUBLIC velox_file velox_flag_definitions Folly::folly
PUBLIC velox_flag_definitions Folly::folly
PRIVATE fmt::fmt gflags::gflags glog::glog)

add_library(velox_profiler Profiler.cpp)

target_link_libraries(
velox_profiler
PUBLIC velox_file velox_flag_definitions Folly::folly
PRIVATE gflags::gflags glog::glog)

if(${VELOX_BUILD_TESTING})
add_subdirectory(tests)
endif()
2 changes: 1 addition & 1 deletion velox/common/process/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ add_executable(velox_process_test ProfilerTest.cpp ThreadLocalRegistryTest.cpp

add_test(velox_process_test velox_process_test)

target_link_libraries(velox_process_test PRIVATE velox_process fmt::fmt gtest
target_link_libraries(velox_process_test PRIVATE velox_process velox_profiler fmt::fmt gtest
velox_time gtest_main)
2 changes: 2 additions & 0 deletions velox/dwio/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ target_include_directories(velox_dwio_common PRIVATE ${Protobuf_INCLUDE_DIRS})

target_link_libraries(
velox_dwio_common
velox_exec
velox_buffer
velox_caching
velox_common_io
Expand All @@ -75,6 +76,7 @@ target_link_libraries(
velox_exception
velox_expression
velox_memory
${Protobuf_LIBRARIES}
Boost::regex
Folly::folly
glog::glog)
1 change: 1 addition & 0 deletions velox/exec/tests/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ add_library(
target_link_libraries(
velox_exec_test_lib
velox_vector_test_lib
velox_vector_fuzzer
velox_temp_path
velox_core
velox_exception
Expand Down

0 comments on commit 6b5883e

Please sign in to comment.