aboutsummaryrefslogtreecommitdiffhomepage
path: root/vsprojects
diff options
context:
space:
mode:
authorGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2008-09-30 00:09:40 +0000
committerGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2008-09-30 00:09:40 +0000
commit9b10f5845aabc791e2fef0e5a11656ca01cd7813 (patch)
tree63fdebf8dd5893de95d6470d000cd60e3a1a3c9c /vsprojects
parent0b3023fa6561f3b5abe43ac9e20d0ede43a56737 (diff)
* Fix build on MSVC.
* Switch to statically-linked libraries instead of DLLs on MSVC.
Diffstat (limited to 'vsprojects')
-rw-r--r--vsprojects/libprotobuf.vcproj30
-rw-r--r--vsprojects/libprotoc.vcproj30
-rw-r--r--vsprojects/readme.txt31
-rw-r--r--vsprojects/tests.vcproj32
4 files changed, 61 insertions, 62 deletions
diff --git a/vsprojects/libprotobuf.vcproj b/vsprojects/libprotobuf.vcproj
index a6808968..6edd8453 100644
--- a/vsprojects/libprotobuf.vcproj
+++ b/vsprojects/libprotobuf.vcproj
@@ -19,7 +19,7 @@
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
- ConfigurationType="2"
+ ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
@@ -60,19 +60,12 @@
Name="VCPreLinkEventTool"
/>
<Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
+ Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
- Name="VCManifestTool"
- />
- <Tool
Name="VCXDCMakeTool"
/>
<Tool
@@ -82,9 +75,6 @@
Name="VCFxCopTool"
/>
<Tool
- Name="VCAppVerifierTool"
- />
- <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
@@ -92,7 +82,7 @@
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
- ConfigurationType="2"
+ ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
@@ -130,21 +120,12 @@
Name="VCPreLinkEventTool"
/>
<Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
+ Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
- Name="VCManifestTool"
- />
- <Tool
Name="VCXDCMakeTool"
/>
<Tool
@@ -154,9 +135,6 @@
Name="VCFxCopTool"
/>
<Tool
- Name="VCAppVerifierTool"
- />
- <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
diff --git a/vsprojects/libprotoc.vcproj b/vsprojects/libprotoc.vcproj
index b1a6b984..4f686d02 100644
--- a/vsprojects/libprotoc.vcproj
+++ b/vsprojects/libprotoc.vcproj
@@ -19,7 +19,7 @@
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
- ConfigurationType="2"
+ ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
@@ -60,19 +60,12 @@
Name="VCPreLinkEventTool"
/>
<Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
+ Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
- Name="VCManifestTool"
- />
- <Tool
Name="VCXDCMakeTool"
/>
<Tool
@@ -82,9 +75,6 @@
Name="VCFxCopTool"
/>
<Tool
- Name="VCAppVerifierTool"
- />
- <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
@@ -92,7 +82,7 @@
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
- ConfigurationType="2"
+ ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
@@ -130,21 +120,12 @@
Name="VCPreLinkEventTool"
/>
<Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
+ Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
- Name="VCManifestTool"
- />
- <Tool
Name="VCXDCMakeTool"
/>
<Tool
@@ -154,9 +135,6 @@
Name="VCFxCopTool"
/>
<Tool
- Name="VCAppVerifierTool"
- />
- <Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
diff --git a/vsprojects/readme.txt b/vsprojects/readme.txt
index b79f6006..a0f5bc86 100644
--- a/vsprojects/readme.txt
+++ b/vsprojects/readme.txt
@@ -24,27 +24,37 @@ Compiling and Installing
build of libprotobuf.dll. Similarly, release builds must link against
release DLLs.
-DLLs and Distribution
-=====================
+DLLs vs. static linking
+=======================
+
+Static linking is now the default for the Protocol Buffer libraries. Due to
+issues with Win32's use of a separate heap for each DLL, as well as binary
+compatibility issues between different versions of MSVC's STL library, it is
+recommended that you use static linkage only. However, it is possible to
+build libprotobuf and libprotoc as DLLs if you really want. To do this,
+do the following:
+
+ 1) Open protobuf.sln in MSVC.
+ 2) For each of the projects libprotobuf and libprotoc, do the following:
+ 2a) Right-click the project and choose "properties".
+ 2b) From the side bar, choose "General", under "Configuration Properties".
+ 2c) Change the "Configuration Type" to "Dynamic Library (.dll)".
+ 2d) From the side bar, choose "Preprocessor", under "C/C++".
+ 2e) Add PROTOBUF_USE_DLLS to the list of preprocessor defines.
+ 3) When compiling your project, make sure to #define PROTOBUF_USE_DLLS.
When distributing your software to end users, we strongly recommend that you
do NOT install libprotobuf.dll or libprotoc.dll to any shared location.
Instead, keep these libraries next to your binaries, in your application's
own install directory. C++ makes it very difficult to maintain binary
compatibility between releases, so it is likely that future versions of these
-libraries will *not* be usable as drop-in replacements. The only reason we
-provide these libraries as DLLs rather than static libs is so that a program
-which is itself split into multiple DLLs can safely pass protocol buffer
-objects between them.
+libraries will *not* be usable as drop-in replacements.
If your project is itself a DLL intended for use by third-party software, we
recommend that you do NOT expose protocol buffer objects in your library's
public interface, and that you statically link protocol buffers into your
library.
-TODO(kenton): This sounds kind of scary. Maybe we should only provide static
- libraries?
-
Notes on Compiler Warnings
==========================
@@ -63,7 +73,8 @@ C4355 - 'this' : used in base member initializer list
C4800 - 'type' : forcing value to bool 'true' or 'false' (performance warning)
C4996 - 'function': was declared deprecated
-C4251 is of particular note. The protocol buffer library uses templates in
+C4251 is of particular note, if you are compiling the Protocol Buffer library
+as a DLL (see previous section). The protocol buffer library uses templates in
its public interfaces. MSVC does not provide any reasonable way to export
template classes from a DLL. However, in practice, it appears that exporting
templates is not necessary anyway. Since the complete definition of any
diff --git a/vsprojects/tests.vcproj b/vsprojects/tests.vcproj
index 9530557b..41480163 100644
--- a/vsprojects/tests.vcproj
+++ b/vsprojects/tests.vcproj
@@ -262,6 +262,10 @@
RelativePath=".\google\protobuf\unittest_embed_optimize_for.pb.h"
>
</File>
+ <File
+ RelativePath=".\google\protobuf\unittest_custom_options.pb.h"
+ >
+ </File>
</Filter>
<Filter
Name="Resource Files"
@@ -407,6 +411,10 @@
>
</File>
<File
+ RelativePath=".\google\protobuf\unittest_custom_options.pb.cc"
+ >
+ </File>
+ <File
RelativePath="..\src\google\protobuf\unknown_field_set_unittest.cc"
>
</File>
@@ -563,6 +571,30 @@
/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\src\google\protobuf\unittest_custom_options.proto"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating unittest_custom_options.pb.{h,cc}..."
+ CommandLine="Debug\protoc -I../src --cpp_out=. ../src/google/protobuf/unittest_custom_options.proto&#x0D;&#x0A;"
+ Outputs="google\protobuf\unittest_custom_options.pb.h;google\protobuf\unittest_custom_options.pb.cc"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generating unittest_custom_options.pb.{h,cc}..."
+ CommandLine="Release\protoc -I../src --cpp_out=. ../src/google/protobuf/unittest_custom_options.proto&#x0D;&#x0A;"
+ Outputs="google\protobuf\unittest_custom_options.pb.h;google\protobuf\unittest_custom_options.pb.cc"
+ />
+ </FileConfiguration>
+ </File>
</Files>
<Globals>
</Globals>