kou commented on a change in pull request #12457: URL: https://github.com/apache/arrow/pull/12457#discussion_r812392822
########## File path: cpp/src/arrow/engine/CMakeLists.txt ########## @@ -34,78 +28,15 @@ set(ARROW_ENGINE_SRCS substrait/relation_internal.cc substrait/type_internal.cc) -set(SUBSTRAIT_LOCAL_DIR "${CMAKE_CURRENT_BINARY_DIR}/substrait") -set(SUBSTRAIT_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") -set(SUBSTRAIT_PROTOS - capabilities - expression - extensions/extensions - function - parameterized_types - plan - relations - type - type_expressions) - -externalproject_add(substrait_ep - GIT_REPOSITORY "${ARROW_SUBSTRAIT_REPO}" - GIT_TAG "${ARROW_SUBSTRAIT_TAG}" - SOURCE_DIR "${SUBSTRAIT_LOCAL_DIR}" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "") - -set(SUBSTRAIT_SUPPRESSED_WARNINGS) -if(MSVC) - # Protobuf generated files trigger some spurious warnings on MSVC. - - # Implicit conversion from uint64_t to uint32_t: - list(APPEND SUBSTRAIT_SUPPRESSED_WARNINGS "/wd4244") - - # Missing dll-interface: - list(APPEND SUBSTRAIT_SUPPRESSED_WARNINGS "/wd4251") -endif() - -file(MAKE_DIRECTORY "${SUBSTRAIT_GEN_DIR}/substrait") - -set(SUBSTRAIT_PROTO_GEN_ALL) -foreach(SUBSTRAIT_PROTO ${SUBSTRAIT_PROTOS}) - set(SUBSTRAIT_PROTO_GEN "${SUBSTRAIT_GEN_DIR}/substrait/${SUBSTRAIT_PROTO}.pb") - - foreach(EXT h cc) - set_source_files_properties("${SUBSTRAIT_PROTO_GEN}.${EXT}" - PROPERTIES COMPILE_OPTIONS - "${SUBSTRAIT_SUPPRESSED_WARNINGS}" - GENERATED TRUE - SKIP_UNITY_BUILD_INCLUSION TRUE) - add_custom_command(OUTPUT "${SUBSTRAIT_PROTO_GEN}.${EXT}" - COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${SUBSTRAIT_LOCAL_DIR}/proto" - "--cpp_out=${SUBSTRAIT_GEN_DIR}" - "${SUBSTRAIT_LOCAL_DIR}/proto/substrait/${SUBSTRAIT_PROTO}.proto" - DEPENDS ${PROTO_DEPENDS} substrait_ep) - list(APPEND SUBSTRAIT_PROTO_GEN_ALL "${SUBSTRAIT_PROTO_GEN}.${EXT}") - endforeach() - - list(APPEND ARROW_ENGINE_SRCS "${SUBSTRAIT_PROTO_GEN}.cc") -endforeach() - -add_custom_target(substrait_gen ALL DEPENDS ${SUBSTRAIT_PROTO_GEN_ALL}) - -find_package(Git) -add_custom_target(substrait_gen_verify - COMMENT "Verifying that generated substrait accessors are consistent with \ - ARROW_SUBSTRAIT_REPO_AND_TAG='${ARROW_SUBSTRAIT_REPO_AND_TAG}'" - COMMAND ${GIT_EXECUTABLE} diff --exit-code ${SUBSTRAIT_GEN_DIR} - DEPENDS substrait_gen_clear - DEPENDS substrait_gen) - add_arrow_lib(arrow_engine CMAKE_PACKAGE_NAME ArrowEngine PKG_CONFIG_NAME arrow-engine OUTPUTS ARROW_ENGINE_LIBRARIES + DEPENDENCIES + substrait Review comment: It seems that this is a problem of our `add_arrow_lib()`: ```diff diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index 391c43e0ac..7517e4e806 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -374,6 +374,13 @@ function(ADD_ARROW_LIB LIB_NAME) "$<INSTALL_INTERFACE:${ARG_SHARED_INSTALL_INTERFACE_LIBS}>" LINK_PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS}) + if(USE_OBJLIB) + foreach(ARG_SHARED_LINK_LIB ${ARG_SHARED_LINK_LIBS}) + if(TARGET ${ARG_SHARED_LINK_LIB}) + add_dependencies(${LIB_NAME}_objlib ${ARG_SHARED_LINK_LIB}) + endif() + endforeach() + endif() if(ARROW_RPATH_ORIGIN) if(APPLE) @@ -449,6 +456,13 @@ function(ADD_ARROW_LIB LIB_NAME) if(ARG_STATIC_LINK_LIBS) target_link_libraries(${LIB_NAME}_static LINK_PRIVATE "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>") + if(USE_OBJLIB) + foreach(ARG_STATIC_LINK_LIB ${ARG_STATIC_LINK_LIBS}) + if(TARGET ${ARG_STATIC_LINK_LIB}) + add_dependencies(${LIB_NAME}_objlib ${ARG_STATIC_LINK_LIB}) + endif() + endforeach() + endif() endif() install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL} diff --git a/cpp/src/arrow/engine/CMakeLists.txt b/cpp/src/arrow/engine/CMakeLists.txt index 13d50b4244..edb878939f 100644 --- a/cpp/src/arrow/engine/CMakeLists.txt +++ b/cpp/src/arrow/engine/CMakeLists.txt @@ -35,8 +35,6 @@ add_arrow_lib(arrow_engine arrow-engine OUTPUTS ARROW_ENGINE_LIBRARIES - DEPENDENCIES - substrait SOURCES ${ARROW_ENGINE_SRCS} PRECOMPILED_HEADERS ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org