jvanstraten commented on a change in pull request #12457: URL: https://github.com/apache/arrow/pull/12457#discussion_r812239118
########## File path: cpp/src/arrow/engine/CMakeLists.txt ########## @@ -34,94 +28,32 @@ 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 SOURCES ${ARROW_ENGINE_SRCS} + $<TARGET_OBJECTS:substrait> Review comment: Looks like that's working, 577979b. I wasn't sure how generally-applicable linking static libraries with -fPIC into shared libraries would be. I'm also not sure why I still need to specify `PRIVATE_INCLUDES ${SUBSTRAIT_INCLUDES}` for the `add_arrow_lib` call (shouldn't CMake be propagating public include directories to dependent libraries?), but I couldn't get it to work without it. -- 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