README.win32 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. Read the README file first.
  2. As of version 0.6.0 curlpp has been built and run on win32.
  3. Information contained in this file does not apply to cygwin builds.
  4. curlpp has been tested on
  5. Microsoft Visual C++ 7.1 (2003), (by Giuseppe "Cowo" Corbelli)
  6. Microsoft Visual C++ 8.0 (2005), (by Andrei Korostelev)
  7. Microsoft Visual C++ 9.0 (2008), (by Piotr Dobrogost)
  8. but any modern C++ compiler should do the job.
  9. BUILDING CURLPP WITH MSVC
  10. -------------------------
  11. BUILDING CURLPP
  12. You can build curlpp in three different ways
  13. A. from within MS Visual Studio IDE
  14. B. using msbuild tool and solution files
  15. C. using namke and makefile
  16. A. and B.
  17. In case of A. and B. first you have to create solution files for your version of MS Visual Studio.
  18. To do this use win32\create-vc-solution.bat batch file with one of the following parameters:
  19. 7.1, for Visual Studio 2003
  20. 8, for Visual Studio 2005
  21. 9, for Visual Studio 2008
  22. This batch file needs sed to be run successfully. You can download sed for win32 platform here
  23. http://gnuwin32.sourceforge.net/packages/sed.htm
  24. A. Building from within IDE
  25. Choosing configuration
  26. Choose configuration you would like to build. What configuration you want depens on three aspects.
  27. 1. Weather you want to build dynamic library (dll) or static library (lib).
  28. Choose configuration with DynamicLib or StaticLib prefix.
  29. 2. Weather you want to build debug or release version of the library.
  30. Choose configuration with Debug or Release infix.
  31. 3. Weather you want static runtime library (RTL) to be used by curlpp or dynamic one.
  32. Choose configuration with StaticRTL or DynamicRTL suffix.
  33. Names' suffixes of output .lib and .dll files depend on the all three choices.
  34. MTd - dynamic, debug, static RTL
  35. MT - dynamic, release, static RTL
  36. MDd - dynamic, debug, dynamic RTL
  37. MD - dynamic, release, dynamic RTL
  38. staticMTd - static, debug, static RTL
  39. staticMT - static, release, static RTL
  40. staticMDd - static, debug, dynamic RTL
  41. staticMD - static, release, dynamic RTL
  42. We will refer to these suffixes and types of libraries as "build category" further in this document.
  43. Setting include directory
  44. If you are building curlpp using the original directory structure then you don't need to set value of user macro
  45. CURLPP_INCLUDE_PATH (by default ".\include"). If however you modified the original directory structure you have
  46. to set value of this macro to the path, where you have curlpp source files.
  47. Setting output directory
  48. The output files will be placed in a directory set in CURLPP_LIB_PATH user macro (by default ".out\lib").
  49. B. Building using msbuild
  50. Open a command prompt and change folder to the root of curlpp tree.
  51. set LIBCURL_PATH=/where/curl/is/installed
  52. set OPENSSL_PATH=/where/openssl/is/installed (only if you have libcurl with ssl support and ssl installed)
  53. msbuild curlpp.sln /t:Rebuild /p:Configuration=<Configuration>
  54. where <Configuration> is one of
  55. - DynamicLibDebugDynamicRTL
  56. - DynamicLibDebugStaticRTL
  57. - DynamicLibReleaseDynamicRTL
  58. - DynamicLibReleaseStaticRTL
  59. - StaticLibDebugDynamicRTL
  60. - StaticLibDebugStaticRTL
  61. - StaticLibReleaseDynamicRTL
  62. - StaticLibReleaseStaticRTL
  63. Output files will be placed in a directory set in CURLPP_LIB_PATH.
  64. Any of DynamicLib* configurations will build a .dll library file and a .lib library import file.
  65. Any of StaticLib* configurations will build the .lib static (inline) library.
  66. Any of *Debug* configurations will in addition build a .pdb Program Database file.
  67. C. Building using nmake
  68. Open a command prompt and change folder to the root of curlpp tree.
  69. Run nmake /f makefile with the following parameters
  70. BUILD_CFG=[dynamic|static]-[debug|release]
  71. RTLIB_CFG=[dynamic|static]-[debug|release]
  72. LIBCURL_CFG=[dynamic|static]-[debug|release]
  73. All options are optional.
  74. Default for BUILD_CFG is dynamic-release.
  75. Default for others is the value of BUILD_CFG.
  76. Edit the LIBCURL_PATH or set LIBCURL_PATH envvar!
  77. NOTES
  78. Linking with libcurl
  79. All versions of this library need libcurl (c library) include files to compile and lib file to link successfully.
  80. To build curlpp you first have to set value of LIBCURL_PATH user macro to your installation of libcurl.
  81. This macro is used in the project file for VC9 to find include and lib files of libcurl.
  82. Steps to set user macro. Select View/Property Manager, double-click curlpp property sheet, go to
  83. Common Properties/User Macros/, double-click name of macro you want to modify, modify it and click OK.
  84. Filename of libcurl's lib file should be in the form libcurlX.lib where X denotes build category chosen for curlpp.
  85. (see Linking with RTL)
  86. If it has different name you have to change .lib filename in
  87. Project properties\Librarian\Additional Dependencies (when building static library)
  88. or
  89. Project properties\Linker\Input\Additional Dependencies (when building dynamic library).
  90. Linking with static libcurl
  91. If you are not going to use libcurl as a dll and you would like to include it into your library/executable by
  92. linking to static version of libcurl you have to define preprocessor symbol CURL_STATICLIB. You can do it in
  93. Project/Properties/C/C++/Preprocessor/Preprocessor Definitions.
  94. By default all StaticLib* configurations define this symbol. If for some reason you would like to build static
  95. curlpp library which links do dynamic libcurl library you have to remove CURL_STATICLIB define.
  96. Linking with RTL
  97. You have to link with libcurl which uses RTL in the same way as you are going to use RTL in curlpp lib.
  98. Refering to build categories defined earlier in section "Choosing configuration" both libcurl and curlpp
  99. must have the same build category.
  100. If you are going to use dynamic RTL in curlpp (MD[x]), use libcurl which also uses dynamic RTL (MD[x]).
  101. If you are going to use static RTL in curlpp (MT[x]), use libcurl which also uses static RTL (MT[x]).
  102. You can use debug build of libcurl (MDd or MTd) in the release build of curlpp (MD or MT) and
  103. you can use release build of libcurl (MD or MT) in the debug build of curlpp (MDd or MTd).
  104. However you shouldn't do this.
  105. Building self-contained version of the library
  106. curlpp is mostly a template library. For this reason during build of it, only non template entities are placed in the
  107. .lib and .dll files. Most of the library's features used in your application causes code generation during compilation
  108. of _your project_ and the code is placed in your executable. This is often not desirable. If you want to build
  109. the curlpp as self-contained library (one which has all code called by clients in its .lib and .dll files) you can
  110. define preprocesor symbol CURL_SELF_CONTAINED. In this case curlpp uses explicit template instantiation (all such
  111. instantiantions are placed in separte .ins files) to force generating code into .lib and .dll files. You have to
  112. define this preprocesor symbol during build of your application to avoid including templates' definitions as they
  113. are not needed in this phase. If you get linker errors connected with curlpp features when using self-contained
  114. version of the library it's because there are some missing explicit instantiantions. Please let us know if it happens.
  115. Using curlpp in .NET applications
  116. If you are going to use curlpp library in a .NET project you have to use dynamic RTL.
  117. This is because all .NET applications must use dynamic RTL and if your application uses curlpp,
  118. the library itself has to use dynamic RTL as well.
  119. Additional dependencies
  120. To build examples (and your project as well) you need the following Windows lib files to link successfully
  121. WSock32.lib, Wldap32.lib
  122. These files comes with WindowsSDK. Macro $(WIN_SDK_DIR) (by default $(WindowsSdkDir)) is used in the properties
  123. sheet file curlpp.examples.VC9.vsprops by VC9 solution to find these libraries.
  124. Linking with OpenSSL
  125. If you have libcurl compiled with OpenSSL support and want to have support for OpenSSL in curlpp as well
  126. you have to set value of OPENSSL_PATH user macro to your installation of OpenSSL before building curlpp.
  127. This variable is used in the project file for VC9 to find include and lib files of OpenSSL.
  128. Steps to set user macro. Select View/Property Manager, double-click curlpp property sheet, go to
  129. Common Properties/User Macros/, double-click name of macro you want to modify, modify it and click OK.
  130. You have to link with OpenSSL which uses RTL in the same way as you are going to use RTL in curlpp lib.
  131. Refering to build categories defined earlier in section "Choosing configuration" both OpenSSL and curlpp
  132. must have the same build category.
  133. Filenames of OpenSSL lib files should be in the form libeay32X.lib and ssleay32X.lib, where X denotes
  134. build category chosen for curlpp. You have to add both this filenames to
  135. Project properties\Librarian\Additional Dependencies (when building static library)
  136. or
  137. Project properties\Linker\Input\Additional Dependencies (when building dynamic library).
  138. If you need OpenSSL for Windows platform take a look at http://www.slproweb.com/products/Win32OpenSSL.html
  139. If you installed OpenSSL downloaded from the above link you'll find .lib files of all four build categories
  140. in the /lib/vc directory.
  141. Building with support for Boost
  142. curlpp has ability to use some features from the Boost library. If you want to build curlpp with support for Boost
  143. you have to set value of BOOST_PATH user macro to your installation of Boost before building curlpp.
  144. This variable is used in the project file for VC9 to find include files of Boost.
  145. You also have to define preprocessor symbol HAVE_BOOST. You can do it in
  146. Project/Properties/C/C++/Preprocessor/Preprocessor Definitions.
  147. Project propery sheets
  148. All user macros like LIBCURL_PATH, OPENSSL_PATH, BOOST_PATH, CURLPP_INCLUDE_PATH, CURLPP_LIB_PATH, WIN_SDK_DIR,
  149. CURLPP_EXAMPLES_OUT_DIR, etc.
  150. are defined in project property sheet files named
  151. curlpp.common.vsprops - options and macros used during build of library itself and during build of examples
  152. curlpp.lib.vsprops - options and macros used during build of library itself
  153. curlpp.examples.vsprops - options and macros used during build of examples
  154. Compiler warnings
  155. There are a few kinds of compiler warnings which we haven't managed to remove.
  156. warning C4251: class X needs to have dll-interface to be used by clients of class Y
  157. warning C4275: non dll-interface class X used as base for dll-interface class Y
  158. warning C4512: X : assignment operator could not be generated
  159. warning C4661: methodX : no suitable definition provided for explicit template instantiation request
  160. BUILDING CURLPP EXAMPLES
  161. Your can either build the examples from MS Visual Studio IDE or from the command line from within examples folder:
  162. nmake -f Makefile.msvc all
  163. or
  164. nmake -f Makefile.msvc exampleXY
  165. to build example XY
  166. Giuseppe "Cowo" Corbelli, cowo at lugbs dot linux dot it
  167. Andrei Korostelev, andrei at korostelev dot net
  168. Piotr Dobrogost, pd.curlpp.org (November 2008 - March 2009)