diff options
author | Benjamin Barenblat <bbaren@google.com> | 2020-05-19 11:55:11 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2020-05-19 11:55:11 -0400 |
commit | acf588f5a22eafd7d21de55b954e8641d4b06568 (patch) | |
tree | ee689a9ef34982825e511f997f7b5b9ccb3d2b08 /debian/patches | |
parent | f9adb234861d1321e0b8774db9aed57ebc6161f0 (diff) |
Enable CMake support
Install Abseil’s CMake support files. Some of these files are
autogenerated, and the generator produces files with a googletest
dependency if Abseil is built with unit tests enabled; to prevent this,
turn off unit tests.
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/series | 2 | ||||
-rw-r--r-- | debian/patches/use_local_gtest.diff | 130 | ||||
-rw-r--r-- | debian/patches/use_local_gtest2.diff | 21 |
3 files changed, 0 insertions, 153 deletions
diff --git a/debian/patches/series b/debian/patches/series index 0d0ecdd4..f99c8e0c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,4 +1,2 @@ license.diff -use_local_gtest.diff -use_local_gtest2.diff configure.diff diff --git a/debian/patches/use_local_gtest.diff b/debian/patches/use_local_gtest.diff deleted file mode 100644 index 9ccd2316..00000000 --- a/debian/patches/use_local_gtest.diff +++ /dev/null @@ -1,130 +0,0 @@ -From: Benjamin Barenblat <bbaren@google.com> -Subject: Support testing with a local googletest checkout -Forwarded: yes -Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/bcefbdcdf6ad85046ccacee0aeffba5404d3e528 - -Debian likes doing dependency management manually, so add support for -testing against a local googletest checkout rather than one downloaded -from GitHub. Add an ABSL_LOCAL_GOOGLETEST_DIR variable that can be used -in conjunction with -DABSL_RUN_TESTS=ON -DABSL_USE_GOOGLETEST_HEAD=OFF -to specify the googletest location manually, and do a bit of related -cleanup. - -This patch was originally submitted as -https://github.com/abseil/abseil-cpp/pull/628. Since the author works at -Google, upstream requested that he submit it internally. It was applied -as Piper revision 297677173 and exported to GitHub; the Applied-Upstream -URL above points to the exported commit. - ---- a/CMake/Googletest/CMakeLists.txt.in -+++ b/CMake/Googletest/CMakeLists.txt.in -@@ -1,15 +1,26 @@ - cmake_minimum_required(VERSION 2.8.2) - --project(googletest-download NONE) -+project(googletest-external NONE) - - include(ExternalProject) --ExternalProject_Add(googletest -- GIT_REPOSITORY https://github.com/google/googletest.git -- GIT_TAG master -- SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" -- BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" -- CONFIGURE_COMMAND "" -- BUILD_COMMAND "" -- INSTALL_COMMAND "" -- TEST_COMMAND "" --) -\ No newline at end of file -+if(${ABSL_USE_GOOGLETEST_HEAD}) -+ ExternalProject_Add(googletest -+ GIT_REPOSITORY https://github.com/google/googletest.git -+ GIT_TAG master -+ SOURCE_DIR "${absl_gtest_src_dir}" -+ BINARY_DIR "${absl_gtest_build_dir}" -+ CONFIGURE_COMMAND "" -+ BUILD_COMMAND "" -+ INSTALL_COMMAND "" -+ TEST_COMMAND "" -+ ) -+else() -+ ExternalProject_Add(googletest -+ SOURCE_DIR "${absl_gtest_src_dir}" -+ BINARY_DIR "${absl_gtest_build_dir}" -+ CONFIGURE_COMMAND "" -+ BUILD_COMMAND "" -+ INSTALL_COMMAND "" -+ TEST_COMMAND "" -+ ) -+endif() -\ No newline at end of file ---- a/CMake/Googletest/DownloadGTest.cmake -+++ b/CMake/Googletest/DownloadGTest.cmake -@@ -1,10 +1,11 @@ --# Downloads and unpacks googletest at configure time. Based on the instructions --# at https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project -+# Integrates googletest at configure time. Based on the instructions at -+# https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project - --# Download the latest googletest from Github master -+# Set up the external googletest project, downloading the latest from Github -+# master if requested. - configure_file( - ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in -- ${CMAKE_BINARY_DIR}/googletest-download/CMakeLists.txt -+ ${CMAKE_BINARY_DIR}/googletest-external/CMakeLists.txt - ) - - set(ABSL_SAVE_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -@@ -14,17 +15,17 @@ if (BUILD_SHARED_LIBS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_CREATE_SHARED_LIBRARY=1") - endif() - --# Configure and build the downloaded googletest source -+# Configure and build the googletest source. - execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . - RESULT_VARIABLE result -- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) -+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-external ) - if(result) - message(FATAL_ERROR "CMake step for googletest failed: ${result}") - endif() - - execute_process(COMMAND ${CMAKE_COMMAND} --build . - RESULT_VARIABLE result -- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download) -+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-external) - if(result) - message(FATAL_ERROR "Build step for googletest failed: ${result}") - endif() -diff --git a/CMakeLists.txt b/CMakeLists.txt -index fdfb2cf..74b5cd9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -84,6 +84,10 @@ - option(ABSL_USE_GOOGLETEST_HEAD - "If ON, abseil will download HEAD from googletest at config time." OFF) - -+set(ABSL_LOCAL_GOOGLETEST_DIR "/usr/src/googletest" CACHE PATH -+ "If ABSL_USE_GOOGLETEST_HEAD is OFF, specifies the directory of a local googletest checkout." -+ ) -+ - option(ABSL_RUN_TESTS "If ON, Abseil tests will be run." OFF) - - if(${ABSL_RUN_TESTS}) -@@ -96,11 +100,13 @@ - ## check targets - if(BUILD_TESTING) - -+ set(absl_gtest_build_dir ${CMAKE_BINARY_DIR}/googletest-build) - if(${ABSL_USE_GOOGLETEST_HEAD}) -- include(CMake/Googletest/DownloadGTest.cmake) - set(absl_gtest_src_dir ${CMAKE_BINARY_DIR}/googletest-src) -- set(absl_gtest_build_dir ${CMAKE_BINARY_DIR}/googletest-build) -+ else() -+ set(absl_gtest_src_dir ${ABSL_LOCAL_GOOGLETEST_DIR}) - endif() -+ include(CMake/Googletest/DownloadGTest.cmake) - - check_target(gtest) - check_target(gtest_main) diff --git a/debian/patches/use_local_gtest2.diff b/debian/patches/use_local_gtest2.diff deleted file mode 100644 index 37f3e7d0..00000000 --- a/debian/patches/use_local_gtest2.diff +++ /dev/null @@ -1,21 +0,0 @@ -From: Benjamin Barenblat <bbaren@google.com> -Subject: Support testing with a local googletest checkout, part 2 -Forwarded: yes -Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/79e0dc11514df035a8d07a356f9ee1800fb2160c - -use_local_gtest.diff missed a necessary line; add it. - -The author works at Google. Upstream applied this patch as Piper revision -302947488 and exported it to GitHub; the Applied-Upstream URL above points to -the exported commit. - ---- a/CMake/Googletest/DownloadGTest.cmake -+++ b/CMake/Googletest/DownloadGTest.cmake -@@ -38,6 +38,4 @@ - - # Add googletest directly to our build. This defines the gtest and gtest_main - # targets. --add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src -- ${CMAKE_BINARY_DIR}/googletest-build -- EXCLUDE_FROM_ALL) -+add_subdirectory(${absl_gtest_src_dir} ${absl_gtest_build_dir} EXCLUDE_FROM_ALL) |