Skip to content

Commit

Permalink
Now working build with protobuf being provided externally if necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
EpsilonPrime committed Feb 21, 2024
1 parent 56346b6 commit 7853b51
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
21 changes: 14 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,22 @@ else()
else()
message(STATUS "Fetching external protobuf library.")
include(third_party/protobuf.cmake)
find_package(Protobuf CONFIG REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})
#find_package(Protobuf CONFIG REQUIRED)
#include_directories(${Protobuf_INCLUDE_DIRS})
set(ABSL_INCLUDED_WITH_PROTOBUF ON)
set(GOOGLETEST_INCLUDED_WITH_ABSL ON)
find_package(GTest REQUIRED)
find_library(GMOCK_LIB GTest::gmock)
if(NOT GMOCK_LIB)
message(FATAL_ERROR "GMock was not built as part of GoogleTest.")
endif()
#find_package(GTest)
#if(NOT {$GTest_FOUND})
# message(FATAL_ERROR "GTest package not found.")
#endif()
#find_library(GTEST_LIB GTest)
#if(NOT GTEST_LIB)
# message(FATAL_ERROR "GTest was unexpectedly not included in Protobuf.")
#endif()
#find_library(GMOCK_LIB GTest::gmock)
#if(NOT GMOCK_LIB)
# message(FATAL_ERROR "GMock was not built as part of GoogleTest.")
#endif()
endif()
endif()

Expand Down
6 changes: 3 additions & 3 deletions export/planloader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: Apache-2.0

if(NOT BUILD_SUBDIR_NAME EQUAL "release")
if(CMAKE_BUILD_TYPE MATCHES Debug)
message(
SEND_ERROR,
"The planloader library does not work in Debug mode due to its dependencies."
WARNING
"The planloader library does not work well in Debug mode due to bundled heap checking."
)
endif()

Expand Down
3 changes: 2 additions & 1 deletion src/substrait/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ foreach(PROTO_FILE IN LISTS PROTOBUF_FILELIST)
set(PROTO_SRC ${PROTO_OUTPUT_PARENT_DIR}/proto/${RELATIVE_PROTO_PATH}.pb.cc)
add_custom_command(
OUTPUT ${PROTO_SRC} ${PROTO_HDR}
COMMAND protobuf::protoc "--proto_path=${GENERATED_PROTO_TOPLEVEL_DIR}"
COMMAND protobuf::protoc
"--proto_path=${GENERATED_PROTO_TOPLEVEL_DIR}:${protobuf_SOURCE_DIR}/src"
"--cpp_out=${PROTO_OUTPUT_MIDLEVEL_DIR}" ${GENERATED_PROTO_FILE}
DEPENDS ${GENERATED_PROTOBUF_LIST} protobuf::protoc
COMMENT "Generated C++ protobuf module for ${PROTO_FILE}"
Expand Down
13 changes: 10 additions & 3 deletions third_party/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ include_guard(GLOBAL)
set(ABSL_PROPAGATE_CXX_STD ON)

include(FetchContent)
FetchContent_Declare(GTest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
OVERRIDE_FIND_PACKAGE
)
FetchContent_Declare(Protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG v4.25.3
GIT_TAG v23.4
#SOURCE_SUBDIR cmake
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(Protobuf)
)
set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(Protobuf GTest)

0 comments on commit 7853b51

Please sign in to comment.