aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2015-06-17 15:03:47 +0100
committerJon Skeet <skeet@pobox.com>2015-06-17 15:03:47 +0100
commite2acd854250b449a3fdeef2ad52402c4c5d78259 (patch)
treea08126762b6c76d56fde8ce443f8dff36408b6e0 /cmake
parentd9dc05e500807a6f0cd10d4637c599acc9a6aecf (diff)
parentb36395b2bac88f70070544c325bc09234cb1f1a6 (diff)
downloadprotobuf-e2acd854250b449a3fdeef2ad52402c4c5d78259.tar.gz
protobuf-e2acd854250b449a3fdeef2ad52402c4c5d78259.tar.bz2
protobuf-e2acd854250b449a3fdeef2ad52402c4c5d78259.zip
Merged master
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt22
-rw-r--r--cmake/README.md36
-rw-r--r--cmake/config.h.in4
-rw-r--r--cmake/extract_includes.bat.in105
-rw-r--r--cmake/find_hash_map.cmake119
-rw-r--r--cmake/pbconfig.h.in9
-rw-r--r--cmake/tests.cmake1
-rwxr-xr-x[-rw-r--r--]cmake/update_file_lists.sh27
8 files changed, 161 insertions, 162 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 02bba4c9..d36292df 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -8,11 +8,11 @@ if (MSVC)
option(ZLIB "Build with zlib support" OFF)
endif (MSVC)
+add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD)
+
find_package(Threads REQUIRED)
if (CMAKE_USE_PTHREADS_INIT)
- set(HAVE_PTHREAD 1)
-else (CMAKE_USE_PTHREADS_INIT)
- set(HAVE_PTHREAD 0)
+ add_definitions(-DHAVE_PTHREAD)
endif (CMAKE_USE_PTHREADS_INIT)
if (MSVC)
@@ -36,6 +36,10 @@ else (MSVC)
endif (ZLIB_FOUND)
endif (MSVC)
+if (HAVE_ZLIB)
+ add_definitions(-DHAVE_ZLIB)
+endif (HAVE_ZLIB)
+
if (MSVC)
if (BUILD_SHARED_LIBS)
add_definitions(-DPROTOBUF_USE_DLLS)
@@ -43,10 +47,11 @@ if (MSVC)
add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305)
endif (MSVC)
-include(find_hash_map.cmake)
-
-configure_file(config.h.in config.h)
-configure_file(pbconfig.h.in google/protobuf/stubs/pbconfig.h)
+if (MSVC)
+ string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
+ string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
+ configure_file(extract_includes.bat.in extract_includes.bat)
+endif (MSVC)
get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH)
@@ -67,6 +72,7 @@ endif (MSVC)
include(libprotobuf-lite.cmake)
include(libprotobuf.cmake)
include(libprotoc.cmake)
+include(protoc.cmake)
if (BUILD_TESTING)
- include(protoc.cmake)
+ include(tests.cmake)
endif (BUILD_TESTING)
diff --git a/cmake/README.md b/cmake/README.md
index 02798b63..1d5c8bc1 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -5,15 +5,21 @@ on your computer before proceeding.
Compiling and Installing
========================
-1. Check whether a gtest directory exists in the upper level directory. If
- you checkout the code from github via "git clone", this gtest directory
- won't exist and you won't be able to build the tests described below. To
- avoid this problem consider downloading one of the release tar balls which
- contains gtest already and copying the gest directory from there to your
- protobuf directory:
+1. Check whether a gtest directory exists in the upper level directory. If you
+ checkout the code from github via "git clone", this gtest directory won't
+ exist and you won't be able to build protobuf unit-tests. Consider using one
+ of the release tar balls instead:
https://github.com/google/protobuf/releases
+ These release tar balls are more stable versions of protobuf and already
+ have the gtest directory included.
+
+ You can also download gtest by yourself and put it in the right place.
+
+ If you absolutely don't want to build and run protobuf unit-tests, skip
+ this step and use protobuf at your own risk.
+
2. Use cmake to generate MSVC project files. Running the following commands
in a command shell will generate project files for Visual Studio 2008 in
a sub-directory named "build".
@@ -23,21 +29,27 @@ Compiling and Installing
$ cd build
$ cmake -G "Visual Studio 9 2008" ..
+ If you don't have gtest, skip the build of tests by turning off the
+ BUILD_TESTING option:
+
+ $ cmake -G "Visutal Studio 9 2008" -DBUILD_TESTING=OFF ..
+
3. Open the generated protobuf.sln file in Microsoft Visual Studio.
4. Choose "Debug" or "Release" configuration as desired.
5. From the Build menu, choose "Build Solution". Wait for compiling to finish.
-6. From a command shell, run tests.exe and lite-test.exe and check that all
- tests pass. Make sure you have changed the working directory to the output
- directory because tests.exe will try to find and run test_plugin.exe
- in the working directory.
+6. If you have built tests, run tests.exe and lite-test.exe from a command
+ shell and check that all tests pass. Make sure you have changed the working
+ directory to the output directory because tests.exe will try to find and run
+ test_plugin.exe in the working directory.
7. Run extract_includes.bat to copy all the public headers into a separate
- "include" directory (under the top-level package directory).
+ "include" directory. This batch script can be found along with the generated
+ protobuf.sln file in the same directory.
8. Copy the contents of the include directory to wherever you want to put
headers.
9. Copy protoc.exe wherever you put build tools (probably somewhere in your
PATH).
10. Copy libprotobuf.lib, libprotobuf-lite.lib, and libprotoc.lib wherever you
- put libraries.
+ put libraries.
To avoid conflicts between the MSVC debug and release runtime libraries, when
compiling a debug build of your application, you may need to link against a
diff --git a/cmake/config.h.in b/cmake/config.h.in
deleted file mode 100644
index bca1cbba..00000000
--- a/cmake/config.h.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#define GOOGLE_PROTOBUF_CMAKE_BUILD
-
-#define HAVE_PTHREAD ${HAVE_PTHREAD}
-#define HAVE_ZLIB ${HAVE_ZLIB}
diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in
new file mode 100644
index 00000000..b2e9444d
--- /dev/null
+++ b/cmake/extract_includes.bat.in
@@ -0,0 +1,105 @@
+mkdir include
+mkdir include\google
+mkdir include\google\protobuf
+mkdir include\google\protobuf\compiler
+mkdir include\google\protobuf\compiler\cpp
+mkdir include\google\protobuf\compiler\csharp
+mkdir include\google\protobuf\compiler\java
+mkdir include\google\protobuf\compiler\javanano
+mkdir include\google\protobuf\compiler\objectivec
+mkdir include\google\protobuf\compiler\python
+mkdir include\google\protobuf\compiler\ruby
+mkdir include\google\protobuf\io
+mkdir include\google\protobuf\stubs
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.h include\google\protobuf\any.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.pb.h include\google\protobuf\any.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h include\google\protobuf\api.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h include\google\protobuf\arena.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h include\google\protobuf\arenastring.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h include\google\protobuf\compiler\code_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h include\google\protobuf\compiler\command_line_interface.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h include\google\protobuf\compiler\cpp\cpp_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h include\google\protobuf\compiler\csharp\csharp_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h include\google\protobuf\compiler\importer.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h include\google\protobuf\compiler\java\java_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h include\google\protobuf\compiler\java\java_names.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\javanano\javanano_generator.h include\google\protobuf\compiler\javanano\javanano_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h include\google\protobuf\compiler\objectivec\objectivec_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h include\google\protobuf\compiler\objectivec\objectivec_helpers.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h include\google\protobuf\compiler\parser.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h include\google\protobuf\compiler\plugin.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h include\google\protobuf\compiler\plugin.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h include\google\protobuf\compiler\python\python_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h include\google\protobuf\compiler\ruby\ruby_generator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h include\google\protobuf\descriptor.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.pb.h include\google\protobuf\descriptor.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h include\google\protobuf\descriptor_database.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h include\google\protobuf\duration.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h include\google\protobuf\dynamic_message.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h include\google\protobuf\empty.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h include\google\protobuf\extension_set.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h include\google\protobuf\field_mask.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h include\google\protobuf\generated_enum_reflection.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h include\google\protobuf\generated_enum_util.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h include\google\protobuf\generated_message_reflection.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h include\google\protobuf\generated_message_util.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h include\google\protobuf\io\coded_stream.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h include\google\protobuf\io\gzip_stream.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h include\google\protobuf\io\printer.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\strtod.h include\google\protobuf\io\strtod.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\tokenizer.h include\google\protobuf\io\tokenizer.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream.h include\google\protobuf\io\zero_copy_stream.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl.h include\google\protobuf\io\zero_copy_stream_impl.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl_lite.h include\google\protobuf\io\zero_copy_stream_impl_lite.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map.h include\google\protobuf\map.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry.h include\google\protobuf\map_entry.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry_lite.h include\google\protobuf\map_entry_lite.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field.h include\google\protobuf\map_field.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_inl.h include\google\protobuf\map_field_inl.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_lite.h include\google\protobuf\map_field_lite.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_type_handler.h include\google\protobuf\map_type_handler.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h include\google\protobuf\message.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h include\google\protobuf\message_lite.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h include\google\protobuf\metadata.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h include\google\protobuf\reflection.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h include\google\protobuf\reflection_ops.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h include\google\protobuf\repeated_field.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field_reflection.h include\google\protobuf\repeated_field_reflection.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h include\google\protobuf\service.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h include\google\protobuf\source_context.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h include\google\protobuf\struct.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomic_sequence_num.h include\google\protobuf\stubs\atomic_sequence_num.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops.h include\google\protobuf\stubs\atomicops.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_aix.h include\google\protobuf\stubs\atomicops_internals_aix.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm64_gcc.h include\google\protobuf\stubs\atomicops_internals_arm64_gcc.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_gcc.h include\google\protobuf\stubs\atomicops_internals_arm_gcc.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_qnx.h include\google\protobuf\stubs\atomicops_internals_arm_qnx.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_atomicword_compat.h include\google\protobuf\stubs\atomicops_internals_atomicword_compat.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_gcc.h include\google\protobuf\stubs\atomicops_internals_generic_gcc.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_macosx.h include\google\protobuf\stubs\atomicops_internals_macosx.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_mips_gcc.h include\google\protobuf\stubs\atomicops_internals_mips_gcc.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_pnacl.h include\google\protobuf\stubs\atomicops_internals_pnacl.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_solaris.h include\google\protobuf\stubs\atomicops_internals_solaris.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_tsan.h include\google\protobuf\stubs\atomicops_internals_tsan.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_gcc.h include\google\protobuf\stubs\atomicops_internals_x86_gcc.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_msvc.h include\google\protobuf\stubs\atomicops_internals_x86_msvc.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h include\google\protobuf\stubs\casts.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h include\google\protobuf\stubs\common.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h include\google\protobuf\stubs\fastmem.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h include\google\protobuf\stubs\hash.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h include\google\protobuf\stubs\platform_macros.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\shared_ptr.h include\google\protobuf\stubs\shared_ptr.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h include\google\protobuf\stubs\singleton.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h include\google\protobuf\stubs\stl_util.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h include\google\protobuf\stubs\template_util.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\type_traits.h include\google\protobuf\stubs\type_traits.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h include\google\protobuf\text_format.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h include\google\protobuf\timestamp.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h include\google\protobuf\type.pb.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\unknown_field_set.h include\google\protobuf\unknown_field_set.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h include\google\protobuf\wire_format.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h include\google\protobuf\wire_format_lite.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite_inl.h include\google\protobuf\wire_format_lite_inl.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h include\google\protobuf\wrappers.pb.h
+copy ${PROTOBUF_BINARY_WIN32_PATH}\google\protobuf\stubs\pbconfig.h include\google\protobuf\stubs\pbconfig.h
diff --git a/cmake/find_hash_map.cmake b/cmake/find_hash_map.cmake
deleted file mode 100644
index 22796fb8..00000000
--- a/cmake/find_hash_map.cmake
+++ /dev/null
@@ -1,119 +0,0 @@
-include(CheckCXXSourceCompiles)
-
-function(find_hash_map)
- set(HAVE_HASH_MAP 1 PARENT_SCOPE)
- set(HAVE_HASH_SET 1 PARENT_SCOPE)
- # Search for hash_map in the following order:
- # 1. <unordered_map> ::std::unordered_map
- # 2. <tr1/unordered_map> ::std::tr1::unordered_map
- # 3. <hash_map> ::hash_map
- # 4. <hash_map> ::stdext::hash_map
- # 5. <ext/hash_map> ::std::hash_map
- # 6. <ext/hash_map> ::__gnu_cxx::hash_map
- check_cxx_source_compiles("
- #include <unordered_map>
- int main() { ::std::unordered_map<int, int> v; return v[0]; }
- " HAS_STD_UNORDERED_MAP)
- if (HAS_STD_UNORDERED_MAP)
- set(HASH_NAMESPACE ::std PARENT_SCOPE)
- set(HASH_MAP_H <unordered_map> PARENT_SCOPE)
- set(HASH_MAP_CLASS unordered_map PARENT_SCOPE)
- set(HASH_SET_H <unordered_set> PARENT_SCOPE)
- set(HASH_SET_CLASS unordered_set PARENT_SCOPE)
- return()
- endif (HAS_STD_UNORDERED_MAP)
-
- check_cxx_source_compiles("
- #include <tr1/unordered_map>
- int main() { ::std::tr1::unordered_map<int, int> v; return v[0]; }
- " HAS_STD_TR1_UNORDERED_MAP)
- if (HAS_STD_TR1_UNORDERED_MAP)
- set(HASH_NAMESPACE ::std::tr1 PARENT_SCOPE)
- set(HASH_MAP_H <tr1/unordered_map> PARENT_SCOPE)
- set(HASH_MAP_CLASS unordered_map PARENT_SCOPE)
- set(HASH_SET_H <tr1/unordered_set> PARENT_SCOPE)
- set(HASH_SET_CLASS unordered_set PARENT_SCOPE)
- return()
- endif (HAS_STD_TR1_UNORDERED_MAP)
-
- check_cxx_source_compiles("
- #include <hash_map>
- int main() { ::hash_map<int, int> v; return v[0]; }
- " HAS_HASH_MAP)
- if (HAS_HASH_MAP)
- set(HASH_NAMESPACE :: PARENT_SCOPE)
- set(HASH_MAP_H <hash_map> PARENT_SCOPE)
- set(HASH_MAP_CLASS hash_map PARENT_SCOPE)
- set(HASH_SET_H <hash_set> PARENT_SCOPE)
- set(HASH_SET_CLASS hash_set PARENT_SCOPE)
- return()
- endif (HAS_HASH_MAP)
-
- check_cxx_source_compiles("
- #include <hash_map>
- int main() { ::stdext::hash_map<int, int> v; return v[0]; }
- " HAS_STDEXT_HASH_MAP)
- if (HAS_STDEXT_HASH_MAP)
- set(HASH_NAMESPACE ::stdext PARENT_SCOPE)
- set(HASH_MAP_H <hash_map> PARENT_SCOPE)
- set(HASH_MAP_CLASS hash_map PARENT_SCOPE)
- set(HASH_SET_H <hash_set> PARENT_SCOPE)
- set(HASH_SET_CLASS hash_set PARENT_SCOPE)
- return()
- endif (HAS_STDEXT_HASH_MAP)
-
- check_cxx_source_compiles("
- #include <ext/hash_map>
- int main() { ::std::hash_map<int, int> v; return v[0]; }
- " HAS_STD_HASH_MAP)
- if (HAS_STD_HASH_MAP)
- set(HASH_NAMESPACE ::std PARENT_SCOPE)
- set(HASH_MAP_H <ext/hash_map> PARENT_SCOPE)
- set(HASH_MAP_CLASS hash_map PARENT_SCOPE)
- set(HASH_SET_H <ext/hash_set> PARENT_SCOPE)
- set(HASH_SET_CLASS hash_set PARENT_SCOPE)
- return()
- endif (HAS_STD_HASH_MAP)
-
- check_cxx_source_compiles("
- #include <ext/hash_map>
- int main() { ::__gnu_cxx::hash_map<int, int> v; return v[0]; }
- " HAS_GNU_CXX_HASH_MAP)
- if (HAS_GNU_CXX_HASH_MAP)
- set(HASH_NAMESPACE ::gnu_cxx PARENT_SCOPE)
- set(HASH_MAP_H <ext/hash_map> PARENT_SCOPE)
- set(HASH_MAP_CLASS hash_map PARENT_SCOPE)
- set(HASH_SET_H <ext/hash_set> PARENT_SCOPE)
- set(HASH_SET_CLASS hash_set PARENT_SCOPE)
- return()
- endif (HAS_GNU_CXX_HASH_MAP)
-
- set(HAVE_HASH_MAP 0 PARENT_SCOPE)
- set(HAVE_HASH_SET 0 PARENT_SCOPE)
-endfunction()
-
-function(find_hash_compare)
- if (MSVC)
- check_cxx_source_compiles("
- #include ${HASH_MAP_H}
- int main() { ::std::hash_compare<int> cp; return cp(0); }
- " HAS_STD_HASH_COMPARE)
- if (HAS_STD_HASH_COMPARE)
- set(HASH_COMPARE ::std::hash_compare PARENT_SCOPE)
- return()
- endif (HAS_STD_HASH_COMPARE)
-
- check_cxx_source_compiles("
- #include ${HASH_MAP_H}
- int main() { ::stdext::hash_compare<int> cp; return cp(0); }
- " HAS_STDEXT_HASH_COMPARE)
- if (HAS_STDEXT_HASH_COMPARE)
- set(HASH_COMPARE ::stdext::hash_compare PARENT_SCOPE)
- return()
- endif (HAS_STDEXT_HASH_COMPARE)
- endif (MSVC)
- set(HASH_COMPARE PARENT_SCOPE)
-endfunction()
-
-find_hash_map()
-find_hash_compare()
diff --git a/cmake/pbconfig.h.in b/cmake/pbconfig.h.in
deleted file mode 100644
index fdc59686..00000000
--- a/cmake/pbconfig.h.in
+++ /dev/null
@@ -1,9 +0,0 @@
-#define GOOGLE_PROTOBUF_HAVE_HASH_MAP ${HAVE_HASH_MAP}
-#define GOOGLE_PROTOBUF_HAVE_HASH_SET ${HAVE_HASH_MAP}
-
-#define GOOGLE_PROTOBUF_HASH_NAMESPACE ${HASH_NAMESPACE}
-#define GOOGLE_PROTOBUF_HASH_MAP_H ${HASH_MAP_H}
-#define GOOGLE_PROTOBUF_HASH_MAP_CLASS ${HASH_MAP_CLASS}
-#define GOOGLE_PROTOBUF_HASH_SET_H ${HASH_SET_H}
-#define GOOGLE_PROTOBUF_HASH_SET_CLASS ${HASH_SET_CLASS}
-#define GOOGLE_PROTOBUF_HASH_COMPARE ${HASH_COMPARE}
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index 24891521..8fb5eef1 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -25,6 +25,7 @@ set(tests_protos
google/protobuf/unittest_drop_unknown_fields.proto
google/protobuf/unittest_embed_optimize_for.proto
google/protobuf/unittest_empty.proto
+ google/protobuf/unittest_enormous_descriptor.proto
google/protobuf/unittest_import.proto
google/protobuf/unittest_import_public.proto
google/protobuf/unittest_lite_imports_nonlite.proto
diff --git a/cmake/update_file_lists.sh b/cmake/update_file_lists.sh
index d64eb4ae..4466c021 100644..100755
--- a/cmake/update_file_lists.sh
+++ b/cmake/update_file_lists.sh
@@ -39,8 +39,8 @@ set_variable_value() {
/^set\\($VARNAME/ {
start = 1;
print \$0;
- split(values, vlist, \" \");
- for (i = 1; i <= length(vlist); ++i) {
+ len = split(values, vlist, \" \");
+ for (i = 1; i <= len; ++i) {
printf(\" %s%s\\n\", prefix, vlist[i]);
}
next;
@@ -58,12 +58,12 @@ set_variable_value() {
sort_files() {
for FILE in $@; do
echo $FILE
- done | sort | uniq
+ done | LC_ALL=C sort | uniq
}
MAKEFILE=../src/Makefile.am
CMAKE_DIR=.
-EXTRACT_INCLUDES_BAT=../vsprojects/extract_includes.bat
+EXTRACT_INCLUDES_BAT=extract_includes.bat.in
[ -f "$MAKEFILE" ] || {
echo "Cannot find: $MAKEFILE"
@@ -105,10 +105,17 @@ set_variable_value $CMAKE_DIR/tests.cmake tests_files $COMMON_PREFIX $TEST_SOURC
set_variable_value $CMAKE_DIR/tests.cmake lite_test_files $COMMON_PREFIX $LITE_TEST_SOURCES
# Generate extract_includes.bat
-for HEADER in $HEADERS; do
- echo $(dirname $HEADER) | sed "s/\\//\\\\/g"
-done | sort | uniq | sed "s/^/mkdir include\\\\/" > $EXTRACT_INCLUDES_BAT
-for HEADER in $HEADERS; do
- WINPATH=$(echo $HEADER | sed 's;/;\\\\;g')
- echo "copy ..\\src\\$WINPATH include\\$WINPATH" >> $EXTRACT_INCLUDES_BAT
+echo "mkdir include" > $EXTRACT_INCLUDES_BAT
+for HEADER in $PUBLIC_HEADERS; do
+ HEADER_DIR=$(dirname $HEADER)
+ while [ ! "$HEADER_DIR" = "." ]; do
+ echo $HEADER_DIR | sed "s/\\//\\\\/g"
+ HEADER_DIR=$(dirname $HEADER_DIR)
+ done
+done | sort | uniq | sed "s/^/mkdir include\\\\/" >> $EXTRACT_INCLUDES_BAT
+for HEADER in $PUBLIC_HEADERS; do
+ WINPATH=$(echo $HEADER | sed 's;/;\\;g')
+ echo "copy \${PROTOBUF_SOURCE_WIN32_PATH}\\..\\src\\$WINPATH include\\$WINPATH" >> $EXTRACT_INCLUDES_BAT
done
+# Add pbconfig.h.
+echo "copy \${PROTOBUF_BINARY_WIN32_PATH}\\google\\protobuf\\stubs\\pbconfig.h include\\google\\protobuf\\stubs\\pbconfig.h" >> $EXTRACT_INCLUDES_BAT