Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Abseil dependency from CMake build #10056

Merged
merged 2 commits into from
May 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# These are fetched as external repositories.
third_party/abseil-cpp
third_party/benchmark
third_party/googletest
_build/
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -5,7 +5,3 @@
path = third_party/googletest
url = https://github.com/google/googletest.git
ignore = dirty
[submodule "third_party/abseil-cpp"]
path = third_party/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
branch = lts_2021_11_02
13 changes: 0 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -162,15 +162,6 @@ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map)

find_package(Threads REQUIRED)

# We can install dependencies from submodules if we're running
# CMake v3.13 or newer.
if(CMAKE_VERSION VERSION_LESS 3.13)
set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE OFF)
else()
set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE ON)
endif()


set(_protobuf_FIND_ZLIB)
if (protobuf_WITH_ZLIB)
find_package(ZLIB)
@@ -313,10 +304,6 @@ if (protobuf_UNICODE)
add_definitions(-DUNICODE -D_UNICODE)
endif (protobuf_UNICODE)

set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library")
set_property(CACHE protobuf_ABSL_PROVIDER PROPERTY STRINGS "module" "package")

include(${protobuf_SOURCE_DIR}/cmake/abseil-cpp.cmake)
include(${protobuf_SOURCE_DIR}/cmake/libprotobuf-lite.cmake)
include(${protobuf_SOURCE_DIR}/cmake/libprotobuf.cmake)
if (protobuf_BUILD_LIBPROTOC)
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1212,7 +1212,6 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
build_files_updated_unittest.sh \
cmake/CMakeLists.txt \
cmake/README.md \
cmake/abseil-cpp.cmake \
cmake/conformance.cmake \
cmake/examples.cmake \
cmake/extract_includes.bat.in \
31 changes: 0 additions & 31 deletions cmake/abseil-cpp.cmake

This file was deleted.

3 changes: 0 additions & 3 deletions cmake/libprotobuf-lite.cmake
Original file line number Diff line number Diff line change
@@ -98,9 +98,6 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
endif()
target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(libprotobuf-lite
PRIVATE ${ABSL_ROOT_DIR}
)
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf-lite PRIVATE atomic)
endif()
3 changes: 0 additions & 3 deletions cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
@@ -111,9 +111,6 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map)
endif()
target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(libprotobuf
PRIVATE ${ABSL_ROOT_DIR}
)
if(protobuf_WITH_ZLIB)
target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES})
endif()
3 changes: 0 additions & 3 deletions cmake/libprotoc.cmake
Original file line number Diff line number Diff line change
@@ -122,9 +122,6 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map)
endif()
target_link_libraries(libprotoc PRIVATE libprotobuf)
target_include_directories(libprotoc
PRIVATE ${ABSL_ROOT_DIR}
)
if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libprotoc
PUBLIC PROTOBUF_USE_DLLS
1 change: 0 additions & 1 deletion cmake/protobuf-config.cmake.in
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake")

# Depend packages
@_protobuf_FIND_ZLIB@
@_protobuf_FIND_ABSL@

# Imported targets
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake")
1 change: 0 additions & 1 deletion cmake/protoc.cmake
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ add_executable(protoc ${protoc_files} ${protobuf_version_rc_file})
target_link_libraries(protoc
libprotoc
libprotobuf
${protobuf_ABSL_USED_TARGETS}
)
add_executable(protobuf::protoc ALIAS protoc)

17 changes: 2 additions & 15 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ else()
set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock")
set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest")
include_directories(
${ABSL_ROOT_DIR}
${googlemock_source_dir}
${googletest_source_dir}
${googletest_source_dir}/include
@@ -255,14 +254,7 @@ if (MSVC)
/wd4146 # unary minus operator applied to unsigned type, result still unsigned
)
endif()
target_link_libraries(tests
protobuf-lite-test-common
protobuf-test-common
libprotoc
libprotobuf
GTest::gmock_main
${protobuf_ABSL_USED_TARGETS}
)
target_link_libraries(tests protobuf-lite-test-common protobuf-test-common libprotoc libprotobuf GTest::gmock_main)

set(test_plugin_files
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
@@ -272,12 +264,7 @@ set(test_plugin_files
)

add_executable(test_plugin ${test_plugin_files})
target_link_libraries(test_plugin
libprotoc
libprotobuf
GTest::gmock
${protobuf_ABSL_USED_TARGETS}
)
target_link_libraries(test_plugin libprotoc libprotobuf GTest::gmock)

set(lite_test_files
${protobuf_SOURCE_DIR}/src/google/protobuf/lite_unittest.cc
2 changes: 1 addition & 1 deletion kokoro/release/python/linux/build_artifacts.sh
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ git clone https://github.com/matthew-brett/multibuild.git
# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180).
# IMPORTANT: always pin multibuild at the same commit for:
# - linux/build_artifacts.sh
# - macos/build_artifacts.sh
# - linux/build_artifacts.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should NOT have been reverted same below

# - windows/build_artifacts.bat
(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313)
cp kokoro/release/python/linux/config.sh config.sh
2 changes: 1 addition & 1 deletion kokoro/release/python/macos/build_artifacts.sh
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ git clone https://github.com/matthew-brett/multibuild.git
# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180).
# IMPORTANT: always pin multibuild at the same commit for:
# - linux/build_artifacts.sh
# - macos/build_artifacts.sh
# - linux/build_artifacts.sh
# - windows/build_artifacts.bat
(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313)
cp kokoro/release/python/macos/config.sh config.sh
7 changes: 1 addition & 6 deletions kokoro/release/python/windows/build_artifacts.bat
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ REM Pin multibuild scripts at a known commit to avoid potentially unwanted futur
REM silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180).
REM IMPORTANT: always pin multibuild at the same commit for:
REM - linux/build_artifacts.sh
REM - macos/build_artifacts.sh
REM - linux/build_artifacts.sh
REM - windows/build_artifacts.bat
cd multibuild
git checkout b89bb903e94308be79abefa4f436bf123ebb1313
@@ -34,11 +34,6 @@ SET ZLIB_ROOT=%cd%\zlib
del /Q zlib.zip
del /Q zlib-src.zip

REM Update Submodules
REM This is needed because this build uses CMake <3.13.
git submodule update --init --recursive
SET ABSL_ROOT_DIR=%cd%\third_party\abseil-cpp

REM Create directory for artifacts
SET ARTIFACT_DIR=%cd%\artifacts
mkdir %ARTIFACT_DIR%
2 changes: 1 addition & 1 deletion kokoro/release/python/windows/build_single_artifact.bat
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ mkdir src\.libs

mkdir vcprojects
pushd vcprojects
cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF -DABSL_ROOT_DIR=%ABSL_ROOT_DIR% ../cmake || goto :error
cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF ../cmake || goto :error
msbuild protobuf.sln /p:Platform=%vcplatform% /p:Configuration=Release || goto :error
dir /s /b
popd
1 change: 0 additions & 1 deletion third_party/abseil-cpp
Submodule abseil-cpp deleted from 8c6e53