diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 000000000000..f93facf00a8c --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +build --cxxopt=-std=c++14 diff --git a/CMakeLists.txt b/CMakeLists.txt index 345d7d05a491..b343c64e48ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,11 +32,11 @@ if(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE) get_filename_component(protobuf_SOURCE_DIR ${protobuf_SOURCE_DIR} DIRECTORY) endif() -# Add c++11 flags +# Add c++14 flags if (CYGWIN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14") else() - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) endif() @@ -187,7 +187,7 @@ set(protobuf_LINK_LIBATOMIC false) if (NOT MSVC) include(CheckCXXSourceCompiles) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++14) check_cxx_source_compiles(" #include int main() { diff --git a/WORKSPACE b/WORKSPACE index ebe53315f03c..20e7415a6296 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -9,11 +9,10 @@ local_repository( http_archive( name = "com_google_googletest", - sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", - strip_prefix = "googletest-release-1.10.0", + sha256 = "ea54c9845568cb31c03f2eddc7a40f7f83912d04ab977ff50ec33278119548dd", + strip_prefix = "googletest-4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774", urls = [ - "https://mirror.bazel.build/github.com/google/googletest/archive/release-1.10.0.tar.gz", - "https://github.com/google/googletest/archive/release-1.10.0.tar.gz", + "https://github.com/google/googletest/archive/4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774.tar.gz", ], ) diff --git a/examples/Makefile b/examples/Makefile index 2a64b64fe372..ef7a4ef58e94 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -41,11 +41,11 @@ protoc_middleman_dart: addressbook.proto add_person_cpp: add_person.cc protoc_middleman pkg-config --cflags protobuf # fails if protobuf is not installed - c++ -std=c++11 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf` + c++ -std=c++14 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf` list_people_cpp: list_people.cc protoc_middleman pkg-config --cflags protobuf # fails if protobuf is not installed - c++ -std=c++11 list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf` + c++ -std=c++14 list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf` add_person_dart: add_person.dart protoc_middleman_dart diff --git a/kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh b/kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh index 2880507539aa..7f07968d9a0c 100755 --- a/kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh +++ b/kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh @@ -4,5 +4,5 @@ set -ex -cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 . +cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 -Dprotobuf_BUILD_TESTS=OFF . make -j8 diff --git a/kokoro/linux/aarch64/python_crosscompile_aarch64.sh b/kokoro/linux/aarch64/python_crosscompile_aarch64.sh index 97d0a2403acc..a04c7e408c36 100755 --- a/kokoro/linux/aarch64/python_crosscompile_aarch64.sh +++ b/kokoro/linux/aarch64/python_crosscompile_aarch64.sh @@ -12,7 +12,7 @@ PYTHON="/opt/python/cp38-cp38/bin/python" git submodule update --init --recursive # Build protoc and libprotobuf -cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 . +cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 -Dprotobuf_BUILD_TESTS=OFF . make -j8 # create a simple shell wrapper that runs crosscompiled protoc under qemu diff --git a/python/setup.py b/python/setup.py index 283c99af607a..3364ba9f7ad2 100755 --- a/python/setup.py +++ b/python/setup.py @@ -331,7 +331,7 @@ def HasLibraryDirsOpt(): extra_compile_args.append('-Wno-invalid-offsetof') extra_compile_args.append('-Wno-sign-compare') extra_compile_args.append('-Wno-unused-variable') - extra_compile_args.append('-std=c++11') + extra_compile_args.append('-std=c++14') if sys.platform == 'darwin': extra_compile_args.append('-Wno-shorten-64-to-32') diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index ac9b420d5182..b5e1a5e44cd8 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -1073,16 +1073,6 @@ cc_test( ], ) -# Legacy target: all test sources used to be part of this rule. It is -# still kept around for now. -cc_test( - name = "protobuf_test", - srcs = [], - deps = [ - "@com_google_googletest//:gtest_main", - ], -) - ################################################################################ # Helper targets for Kotlin tests ################################################################################ diff --git a/third_party/googletest b/third_party/googletest index 5ec7f0c4a113..4c9a3bb62bf3 160000 --- a/third_party/googletest +++ b/third_party/googletest @@ -1 +1 @@ -Subproject commit 5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081 +Subproject commit 4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774