OLD | NEW |
1 This directory contains *CMake* files that can be used to build protobuf | 1 This directory contains *CMake* files that can be used to build protobuf |
2 with *MSVC* on *Windows*. You can build the project from *Command Prompt* | 2 with *MSVC* on *Windows*. You can build the project from *Command Prompt* |
3 and using an *Visual Studio* IDE. | 3 and using an *Visual Studio* IDE. |
4 | 4 |
5 You need to have [CMake](http://www.cmake.org), [Visual Studio](https://www.visu
alstudio.com) | 5 You need to have [CMake](http://www.cmake.org), [Visual Studio](https://www.visu
alstudio.com) |
6 and optionally [Git](http://git-scm.com) installed on your computer before proce
eding. | 6 and optionally [Git](http://git-scm.com) installed on your computer before proce
eding. |
7 | 7 |
8 Most of the instructions will be given to the *Сommand Prompt*, but the same | 8 Most of the instructions will be given to the *Сommand Prompt*, but the same |
9 actions can be performed using appropriate GUI tools. | 9 actions can be performed using appropriate GUI tools. |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64>cd C:\Path\
to | 22 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64>cd C:\Path\
to |
23 C:\Path\to> | 23 C:\Path\to> |
24 | 24 |
25 Where *C:\Path\to* is path to your real working directory. | 25 Where *C:\Path\to* is path to your real working directory. |
26 | 26 |
27 Create a folder where protobuf headers/libraries/binaries will be installed afte
r built: | 27 Create a folder where protobuf headers/libraries/binaries will be installed afte
r built: |
28 | 28 |
29 C:\Path\to>mkdir install | 29 C:\Path\to>mkdir install |
30 | 30 |
31 If *cmake* command is not avaliable from *Command Prompt*, add it to system *PAT
H* variable: | 31 If *cmake* command is not available from *Command Prompt*, add it to system *PAT
H* variable: |
32 | 32 |
33 C:\Path\to>set PATH=%PATH%;C:\Program Files (x86)\CMake\bin | 33 C:\Path\to>set PATH=%PATH%;C:\Program Files (x86)\CMake\bin |
34 | 34 |
35 If *git* command is not avaliable from *Command Prompt*, add it to system *PATH*
variable: | 35 If *git* command is not available from *Command Prompt*, add it to system *PATH*
variable: |
36 | 36 |
37 C:\Path\to>set PATH=%PATH%;C:\Program Files\Git\cmd | 37 C:\Path\to>set PATH=%PATH%;C:\Program Files\Git\cmd |
38 | 38 |
39 Good. Now you are ready to continue. | 39 Good. Now you are ready to continue. |
40 | 40 |
41 Getting Sources | 41 Getting Sources |
42 =============== | 42 =============== |
43 | 43 |
44 You can get the latest stable source packages from the | 44 You can get the latest stable source packages from the |
45 [releases](https://github.com/google/protobuf/releases) page. | 45 [releases](https://github.com/google/protobuf/releases) page. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 * Open the generated protobuf.sln file in Microsoft Visual Studio. | 151 * Open the generated protobuf.sln file in Microsoft Visual Studio. |
152 * Choose "Debug" or "Release" configuration as desired. | 152 * Choose "Debug" or "Release" configuration as desired. |
153 * From the Build menu, choose "Build Solution". | 153 * From the Build menu, choose "Build Solution". |
154 | 154 |
155 And wait for the compilation to finish. | 155 And wait for the compilation to finish. |
156 | 156 |
157 Testing | 157 Testing |
158 ======= | 158 ======= |
159 | 159 |
160 To run unit-tests: | 160 To run unit-tests, first you must compile protobuf as described above. |
| 161 Then run: |
161 | 162 |
162 C:\Path\to\protobuf\cmake\build\release>nmake check | 163 C:\Path\to\protobuf\cmake\build\release>nmake check |
163 | 164 |
164 or | 165 or |
165 | 166 |
166 C:\Path\to\protobuf\cmake\build\debug>nmake check | 167 C:\Path\to\protobuf\cmake\build\debug>nmake check |
167 | 168 |
168 You can also build project *check* from Visual Studio solution. | 169 You can also build project *check* from Visual Studio solution. |
169 Yes, it may sound strange, but it works. | 170 Yes, it may sound strange, but it works. |
170 | 171 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 212 |
212 or | 213 or |
213 | 214 |
214 C:\Path\to\protobuf\cmake\build\debug>nmake install | 215 C:\Path\to\protobuf\cmake\build\debug>nmake install |
215 | 216 |
216 You can also build project *INSTALL* from Visual Studio solution. | 217 You can also build project *INSTALL* from Visual Studio solution. |
217 It sounds not so strange and it works. | 218 It sounds not so strange and it works. |
218 | 219 |
219 This will create the following folders under the *install* location: | 220 This will create the following folders under the *install* location: |
220 * bin - that contains protobuf *protoc.exe* compiler; | 221 * bin - that contains protobuf *protoc.exe* compiler; |
221 * inclue - that contains C++ headers and protobuf *.proto files; | 222 * include - that contains C++ headers and protobuf *.proto files; |
222 * lib - that contains linking libraries and *CMake* configuration files for *p
rotobuf* package. | 223 * lib - that contains linking libraries and *CMake* configuration files for *p
rotobuf* package. |
223 | 224 |
224 Now you can if needed: | 225 Now you can if needed: |
225 * Copy the contents of the include directory to wherever you want to put heade
rs. | 226 * Copy the contents of the include directory to wherever you want to put heade
rs. |
226 * Copy protoc.exe wherever you put build tools (probably somewhere in your PAT
H). | 227 * Copy protoc.exe wherever you put build tools (probably somewhere in your PAT
H). |
227 * Copy linking libraries libprotobuf[d].lib, libprotobuf-lite[d].lib, and libp
rotoc[d].lib wherever you put libraries. | 228 * Copy linking libraries libprotobuf[d].lib, libprotobuf-lite[d].lib, and libp
rotoc[d].lib wherever you put libraries. |
228 | 229 |
229 To avoid conflicts between the MSVC debug and release runtime libraries, when | 230 To avoid conflicts between the MSVC debug and release runtime libraries, when |
230 compiling a debug build of your application, you may need to link against a | 231 compiling a debug build of your application, you may need to link against a |
231 debug build of libprotobufd.lib with "d" postfix. Similarly, release builds sho
uld link against | 232 debug build of libprotobufd.lib with "d" postfix. Similarly, release builds sho
uld link against |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 its public interfaces. MSVC does not provide any reasonable way to export | 327 its public interfaces. MSVC does not provide any reasonable way to export |
327 template classes from a DLL. However, in practice, it appears that exporting | 328 template classes from a DLL. However, in practice, it appears that exporting |
328 templates is not necessary anyway. Since the complete definition of any | 329 templates is not necessary anyway. Since the complete definition of any |
329 template is available in the header files, anyone importing the DLL will just | 330 template is available in the header files, anyone importing the DLL will just |
330 end up compiling instances of the templates into their own binary. The | 331 end up compiling instances of the templates into their own binary. The |
331 Protocol Buffer implementation does not rely on static template members being | 332 Protocol Buffer implementation does not rely on static template members being |
332 unique, so there should be no problem with this, but MSVC prints warning | 333 unique, so there should be no problem with this, but MSVC prints warning |
333 nevertheless. So, we disable it. Unfortunately, this warning will also be | 334 nevertheless. So, we disable it. Unfortunately, this warning will also be |
334 produced when compiling code which merely uses protocol buffers, meaning you | 335 produced when compiling code which merely uses protocol buffers, meaning you |
335 may have to disable it in your code too. | 336 may have to disable it in your code too. |
OLD | NEW |