问题
In the past I’ve used the Visual Studio solution files to build zeromq (libzmq) on Windows. I just noticed that the Visual Studio solutions have been deprecated because they are too difficult to maintain.
The alternative is to use CMake; trouble is I’ve no experience of how to invoke the build this way. Is anyone please able to demonstrate the necessary commands, step-by-step?
I’d like to achieve 32 & 64bit libzmq binaries using libsodium and compiled with VS2015 on Windows 10. (I’ve installed CMake 64bit and allowed it to add to the system path at installation.)
Thanks
回答1:
So eventually I managed to build zeromq
on Windows 10
from source using CMake
.
CMake
is used to set the various zeromq project options; in this case to use the libsodium library for cryptography and to provide the necessary include
& linker
paths for the build. Once the options are configured CMake is used to generate a Visual Studio solution from which to build the libzmq binaries.
Briefly this is how I did it using the CMake GUI:
Specify to where the libzmq source code was cloned and tell CMake where to build the binaries. Hint; make a separate folder for each Visual Studio version & 32/64bit as necessary, see screenshot below.
Click Configure to load the project options. From the pop up window choose the compiler you wish to use from the list. Set the necessary project options and click Configure again.
If all is well click Generate to create the Visual Studio files.
Click Open Project; once loaded in Visual Studio choose Debug/Release as you need and click Build Solution.
Repeat the process for other architectures eg. choose the 32bit compiler as you require. Remember to adjust build output location & libsodium
linker
path to reflect that architecture.
Screenshot:
回答2:
VS2015 Toolbar -> Open -> CMake -> ZMQ folder
Toolbar -> CMake -> Cache -> Generate -> ZeroMQ
Toolbar -> CMake -> Install -> ZeroMQ
You can find builds in /Users/UserName/CMakeBuilds/...
来源:https://stackoverflow.com/questions/52056577/build-zeromq-on-windows-10-with-cmake