NuLL3rr0r

Building ZeroMQ statically for dll-binding with UDK

Dec 19th, 2012
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. 1. Open 'builds\msvc\msvc10.sln' in VC++ 2010
  2.  
  3. 2. Change both zmq.h and zmq_utils.h like this:
  4. /* Handle DSO symbol visibility */
  5. #if defined _WIN32
  6. # if defined DLL_EXPORT
  7. # define ZMQ_EXPORT __declspec(dllexport)
  8. # else
  9. # define ZMQ_EXPORT __declspec(dllimport)
  10. # endif
  11. #else
  12. # if defined __SUNPRO_C || defined __SUNPRO_CC
  13. # define ZMQ_EXPORT __global
  14. # elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
  15. # define ZMQ_EXPORT __attribute__ ((visibility("default")))
  16. # else
  17. # define ZMQ_EXPORT
  18. # endif
  19. #endif
  20. // TO
  21. /* Handle DSO symbol visibility */
  22. #if defined _WIN32
  23. # if defined ZMQ_STATIC
  24. # define DLL_EXPORT
  25. # endif
  26. # if defined DLL_EXPORT
  27. # define ZMQ_EXPORT __declspec(dllexport)
  28. # else
  29. # define ZMQ_EXPORT __declspec(dllimport)
  30. # endif
  31. #else
  32. # if defined __SUNPRO_C || defined __SUNPRO_CC
  33. # define ZMQ_EXPORT __global
  34. # elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
  35. # define ZMQ_EXPORT __attribute__ ((visibility("default")))
  36. # else
  37. # define ZMQ_EXPORT
  38. # endif
  39. #endif
  40.  
  41. 3. Use below settings for 'libzmq' project in both Debug and Release build modes:
  42. Debug:
  43. Configuration Properties > General > Target Name > $(ProjectName)_d
  44. Configuration Properties > General > Configuration Type > Static library (.lib)
  45. Configuration Properties > General > Character Set > Use Unicode Character Set
  46. Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions > ZMQ_STATIC
  47. Configuration Properties > C/C++ > Code Generation > Runtime Library > Multi-threaded Debug (/MTd)
  48. Configuration Properties > C/C++ > Code Generation > Struct Member Alignment > 4 Byte (/Zp4)
  49. Configuration Properties > C/C++ > Output Files > Program Database File Name > $(OutDir)$(ProjectName)_d.pdb
  50. Release:
  51. Configuration Properties > General > Configuration Type > Static library (.lib)
  52. Configuration Properties > General > Character Set > Use Unicode Character Set
  53. Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions > ZMQ_STATIC
  54. Configuration Properties > C/C++ > Code Generation > Runtime Library > Multi-threaded (/MT)
  55. Configuration Properties > C/C++ > Code Generation > Struct Member Alignment > 4 Byte (/Zp4)
  56. Configuration Properties > C/C++ > Output Files > Program Database File Name > $(OutDir)$(ProjectName).pdb
  57.  
  58. 4. Bulid 'libzmq' project then grab these files and copy them to our lib folder:
  59. Debug: bin\Win32\libzmq_d.lib bin\Win32\libzmq_d.pdb
  60. Release: bin\Win32\libzmq.lib bin\Win32\libzmq.pdb
  61.  
  62. 5. Don't forget to define ZMQ_STATIC in your own projects and add ws2_32.lib to your linker dependecies:
  63. Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions > ZMQ_STATIC
  64. Configuration Properties > Linker > Input > Additional Dependencies > ws2_32.lib
  65. // ALSO
  66. Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions > WIN32_LEAN_AND_MEAN
  67. // OR
  68. Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions > _WINSOCKAPI_
  69.  
  70. 6. For more info:
  71. http://lists.zeromq.org/pipermail/zeromq-dev/2010-November/007756.html
  72. http://lists.zeromq.org/pipermail/zeromq-dev/2011-September/013150.html
  73. http://lists.zeromq.org/pipermail/zeromq-dev/2010-September/005870.html
  74. http://lists.zeromq.org/pipermail/zeromq-dev/2012-June/017529.html
  75. http://grokbase.com/t/zeromq/zeromq-dev/124xdvs0en/linking-to-a-static-0mq-2-2-0-library-in-vs10
  76. https://zeromq.jira.com/browse/LIBZMQ-201
Advertisement
Add Comment
Please, Sign In to add comment