From b3bcd8e323773c3ede84ec1fe7ab7e4df045e063 Mon Sep 17 00:00:00 2001 From: Sebastien Rombauts Date: Sun, 24 Feb 2013 15:44:14 +0100 Subject: [PATCH] Static Library Linking for Windows - New ZMQ_STATIC flag to enable "libzmq.lib" Windows static library (or "libzmq_d.lib" in Debug mode). - ZMQ_STATIC needs also to be defined by projects using static linking against "libzmq.lib" - New StaticDebug & StaticRelease configurations for libzmq Win32 projects under MSVC 2008 & 2010 - Tested with Visual Studio 2008 Express under Windows 7, and Visual Studio 2010 Express under Windows 8. --- builds/msvc/Makefile.am | 4 +- builds/msvc/libzmq/libzmq.vcproj | 1776 ++++++++++++++------------- builds/msvc/libzmq/libzmq.vcxproj | 40 +- builds/msvc/msvc.sln | 6 + builds/msvc/msvc10.sln | 6 + builds/msvc/properties/ZeroMQ.props | 1 - include/zmq.h | 4 +- include/zmq_utils.h | 4 +- 8 files changed, 1013 insertions(+), 828 deletions(-) diff --git a/builds/msvc/Makefile.am b/builds/msvc/Makefile.am index 52331cbb..83260ea1 100644 --- a/builds/msvc/Makefile.am +++ b/builds/msvc/Makefile.am @@ -21,11 +21,13 @@ PROPERTIES_DIST = properties/Common.props \ properties/Executable.props \ properties/Precompiled.props \ properties/Release.props \ + properties/Static.props \ properties/Win32.props \ properties/Win32_Release.props \ properties/WithOpenPGM.props \ properties/x64.props \ - properties/ZeroMQ.props + properties/ZeroMQ.props \ + properties/ZeroMQ_Static.props PRECOMPILED_DIST = ../../src/precompiled.hpp \ ../../src/precompiled.cpp diff --git a/builds/msvc/libzmq/libzmq.vcproj b/builds/msvc/libzmq/libzmq.vcproj index 82a1dd0a..8e161519 100644 --- a/builds/msvc/libzmq/libzmq.vcproj +++ b/builds/msvc/libzmq/libzmq.vcproj @@ -1,823 +1,953 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/builds/msvc/libzmq/libzmq.vcxproj b/builds/msvc/libzmq/libzmq.vcxproj index a4fdaf8f..d451f17b 100644 --- a/builds/msvc/libzmq/libzmq.vcxproj +++ b/builds/msvc/libzmq/libzmq.vcxproj @@ -17,6 +17,14 @@ Release x64 + + StaticDebug + Win32 + + + StaticRelease + Win32 + WithOpenPGM Win32 @@ -59,6 +67,15 @@ DynamicLibrary MultiByte + + StaticLibrary + MultiByte + true + + + StaticLibrary + MultiByte + @@ -97,6 +114,17 @@ + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 @@ -122,6 +150,16 @@ copy ..\platform.hpp ..\..\..\src + + + copy ..\platform.hpp ..\..\..\src + + + + + copy ..\platform.hpp ..\..\..\src + + @@ -273,4 +311,4 @@ - + \ No newline at end of file diff --git a/builds/msvc/msvc.sln b/builds/msvc/msvc.sln index a79ec654..f73fb883 100644 --- a/builds/msvc/msvc.sln +++ b/builds/msvc/msvc.sln @@ -37,6 +37,8 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 + StaticDebug|Win32 = StaticDebug|Win32 + StaticRelease|Win32 = StaticRelease|Win32 WithOpenPGM|Win32 = WithOpenPGM|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution @@ -44,6 +46,10 @@ Global {641C5F36-32EE-4323-B740-992B651CF9D6}.Debug|Win32.Build.0 = Debug|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.ActiveCfg = Release|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.Build.0 = Release|Win32 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticDebug|Win32.ActiveCfg = StaticDebug|Win32 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticDebug|Win32.Build.0 = StaticDebug|Win32 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticRelease|Win32.ActiveCfg = StaticRelease|Win32 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticRelease|Win32.Build.0 = StaticRelease|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.WithOpenPGM|Win32.ActiveCfg = WithOpenPGM|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.WithOpenPGM|Win32.Build.0 = WithOpenPGM|Win32 {4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}.Debug|Win32.ActiveCfg = Debug|Win32 diff --git a/builds/msvc/msvc10.sln b/builds/msvc/msvc10.sln index a7077b21..a10622e0 100644 --- a/builds/msvc/msvc10.sln +++ b/builds/msvc/msvc10.sln @@ -21,6 +21,8 @@ Global Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 + StaticDebug|Win32 = StaticDebug|Win32 + StaticRelease|Win32 = StaticRelease|Win32 WithOpenPGM|Win32 = WithOpenPGM|Win32 WithOpenPGM|x64 = WithOpenPGM|x64 EndGlobalSection @@ -33,6 +35,10 @@ Global {641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.Build.0 = Release|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.Release|x64.ActiveCfg = Release|x64 {641C5F36-32EE-4323-B740-992B651CF9D6}.Release|x64.Build.0 = Release|x64 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticDebug|Win32.ActiveCfg = StaticDebug|Win32 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticDebug|Win32.Build.0 = StaticDebug|Win32 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticRelease|Win32.ActiveCfg = StaticRelease|Win32 + {641C5F36-32EE-4323-B740-992B651CF9D6}.StaticRelease|Win32.Build.0 = StaticRelease|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.WithOpenPGM|Win32.ActiveCfg = WithOpenPGM|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.WithOpenPGM|Win32.Build.0 = WithOpenPGM|Win32 {641C5F36-32EE-4323-B740-992B651CF9D6}.WithOpenPGM|x64.ActiveCfg = WithOpenPGM|x64 diff --git a/builds/msvc/properties/ZeroMQ.props b/builds/msvc/properties/ZeroMQ.props index 517ca9e9..c326486b 100644 --- a/builds/msvc/properties/ZeroMQ.props +++ b/builds/msvc/properties/ZeroMQ.props @@ -14,7 +14,6 @@ _CRT_SECURE_NO_WARNINGS;DLL_EXPORT;FD_SETSIZE=1024;%(PreprocessorDefinitions) - 4355 Ws2_32.lib;Rpcrt4.lib;%(AdditionalDependencies) diff --git a/include/zmq.h b/include/zmq.h index 9f7093f2..d9b823fb 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -38,7 +38,9 @@ extern "C" { /* Handle DSO symbol visibility */ #if defined _WIN32 -# if defined DLL_EXPORT +# if defined ZMQ_STATIC +# define ZMQ_EXPORT +# elif defined DLL_EXPORT # define ZMQ_EXPORT __declspec(dllexport) # else # define ZMQ_EXPORT __declspec(dllimport) diff --git a/include/zmq_utils.h b/include/zmq_utils.h index 341d6399..c137d329 100644 --- a/include/zmq_utils.h +++ b/include/zmq_utils.h @@ -27,7 +27,9 @@ extern "C" { /* Handle DSO symbol visibility */ #if defined _WIN32 -# if defined DLL_EXPORT +# if defined ZMQ_STATIC +# define ZMQ_EXPORT +# elif defined DLL_EXPORT # define ZMQ_EXPORT __declspec(dllexport) # else # define ZMQ_EXPORT __declspec(dllimport)