pitrou commented on a change in pull request #12457:
URL: https://github.com/apache/arrow/pull/12457#discussion_r814111637
##########
File path: cpp/cmake_modules/BuildUtils.cmake
##########
@@ -375,6 +375,14 @@ function(ADD_ARROW_LIB LIB_NAME)
LINK_PRIVATE
${ARG_SHARED_PRIVATE_LINK_LIBS})
+ if(USE_OBJLIB)
Review comment:
Can you add a comment explaining this snippet?
##########
File path: cpp/cmake_modules/ThirdpartyToolchain.cmake
##########
@@ -1605,6 +1623,87 @@ if(ARROW_WITH_PROTOBUF)
message(STATUS "Found protobuf headers: ${PROTOBUF_INCLUDE_DIR}")
endif()
+# ----------------------------------------------------------------------
+# Substrait (required by compute engine)
+
+macro(build_substrait)
+ message("Building Substrait from source")
+
+ set(SUBSTRAIT_PROTOS
+ capabilities
+ expression
+ extensions/extensions
+ function
+ parameterized_types
+ plan
+ relations
+ type
+ type_expressions)
+
+ externalproject_add(substrait_ep
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ URL ${SUBSTRAIT_SOURCE_URL}
+ URL_HASH
"SHA256=${ARROW_SUBSTRAIT_BUILD_SHA256_CHECKSUM}")
+
+ externalproject_get_property(substrait_ep SOURCE_DIR)
+ set(SUBSTRAIT_LOCAL_DIR ${SOURCE_DIR})
+
+ set(SUBSTRAIT_CPP_DIR "${CMAKE_CURRENT_BINARY_DIR}/substrait_ep-generated")
+
+ 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()
+
+ set(SUBSTRAIT_SOURCES)
+ set(SUBSTRAIT_PROTO_GEN_ALL)
+ foreach(SUBSTRAIT_PROTO ${SUBSTRAIT_PROTOS})
+ set(SUBSTRAIT_PROTO_GEN
"${SUBSTRAIT_CPP_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_CPP_DIR}"
+
"${SUBSTRAIT_LOCAL_DIR}/proto/substrait/${SUBSTRAIT_PROTO}.proto"
+ DEPENDS ${PROTO_DEPENDS} substrait_ep)
Review comment:
It seems like it compiles each proto file twice (once per extension)? Is
that desired?
##########
File path: cpp/cmake_modules/BuildUtils.cmake
##########
@@ -375,6 +375,14 @@ function(ADD_ARROW_LIB LIB_NAME)
LINK_PRIVATE
${ARG_SHARED_PRIVATE_LINK_LIBS})
+ if(USE_OBJLIB)
+ foreach(ARG_SHARED_LINK_LIB ${ARG_SHARED_LINK_LIBS})
Review comment:
Minor, but naming `ARG_SOMETHING` a variable that is not one of the
original function arguments is confusing.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]