Skip to content

Commit

Permalink
Add custom target libch to avoid name conflict(due to ClickHouse/Clic…
Browse files Browse the repository at this point in the history
…kHouse#58609)

(cherry picked from commit 0f6281d)
  • Loading branch information
baibaichen committed Feb 23, 2024
1 parent fdf1869 commit 46c4f8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpp-ch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ add_custom_command(
-DENABLE_CLICKHOUSE_ALL=OFF
-DCOMPILER_FLAGS='-fvisibility=hidden -fvisibility-inlines-hidden'
-S ${CH_SOURCE_DIR} -G Ninja -B ${CH_BINARY_DIR} &&
cmake --build ${CH_BINARY_DIR} --target ch\"
cmake --build ${CH_BINARY_DIR} --target libch\"
OUTPUT _build_ch)
endif()

Expand Down
17 changes: 15 additions & 2 deletions cpp-ch/local-engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ include(UseJava)
include(FindJNI)

#set(JNI_NATIVE_SOURCES local_engine_jni.cpp)
set(LOCALENGINE_SHARED_LIB ch)
set (ENABLE_CURL_BUILD OFF)
set(LOCALENGINE_SHARED_LIB _gluten_ch)

add_subdirectory(proto)

Expand Down Expand Up @@ -149,6 +148,20 @@ else()
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libch-hide-jemalloc.map)
endif()

if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
set(LOCALENGINE_SHARED_LIB_NAME "libchd.so")
else ()
set(LOCALENGINE_SHARED_LIB_NAME "libch.so")
endif ()

add_custom_command(
OUTPUT ${LOCALENGINE_SHARED_LIB_NAME}
COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:${LOCALENGINE_SHARED_LIB}> ${LOCALENGINE_SHARED_LIB_NAME}
COMMENT "Renaming $<TARGET_FILE:${LOCALENGINE_SHARED_LIB}> to ${LOCALENGINE_SHARED_LIB_NAME}"
DEPENDS ${LOCALENGINE_SHARED_LIB})

add_custom_target(libch ALL DEPENDS ${LOCALENGINE_SHARED_LIB_NAME})

add_subdirectory(tests)

if (ENABLE_EXAMPLES)
Expand Down

0 comments on commit 46c4f8f

Please sign in to comment.