jvanstraten commented on a change in pull request #12457:
URL: https://github.com/apache/arrow/pull/12457#discussion_r812375171



##########
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 doesn't build (multithreaded) without it. I think it ensures that 
`substrait` is built completely prior to compilation of `arrow_engine`, rather 
than just prior to linking, which matters because `arrow_engine` uses generated 
code. Making it depend on `substrait_gen` would also work, if you prefer that 
option (IMO, the less `arrow_engine` depends on implementation details of 
`ThirdpartyToolchain.cmake` the better, so I set it to just `substrait`).




-- 
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


Reply via email to