Skip to content

Commit 541ea52

Browse files
authored
Merge pull request #731 from OpenSimulationInterface/fix/install-instructions-vcpkg
Move missing vcpkg information to prerequisites
2 parents 4f63bb1 + 048bea2 commit 541ea52

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

doc/setup/installing_prerequisites.adoc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ Therefore, it could make sense to still dynamically link against the C Runtime w
3131

3232
The easiest way to achieve static linking on Windows without setting all the stuff manually in Cmake and building _protobuf_ is to actually **install static _protobuf_ with dynamic c-runtime with vcpkg**:
3333

34+
Install vcpkg as per the vcpkg documentation.
35+
Create a new triplet file for the required combination of static library linking with dynamic runtime (usually needed for dynamic linking to still work):
36+
Create a file named x64-windows-static-md.cmake in the triplets directory with the following content:
37+
3438
----
35-
vcpkg install --triplet=x64-windows-static-md protobuf
39+
set(VCPKG_TARGET_ARCHITECTURE x64)
40+
set(VCPKG_CRT_LINKAGE dynamic)
41+
set(VCPKG_LIBRARY_LINKAGE static)
3642
----
3743

38-
Build::
39-
40-
For the cmake configuration, we can directly specify our vcpkg installation:
44+
Now the protobuf libraries can be built automatically using:
4145
----
42-
cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DCMAKE_TOOLCHAIN_FILE=C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake -A x64
43-
cmake --build . --config Release
46+
vcpkg install --triplet=x64-windows-static-md protobuf
4447
----
4548

4649
== Linux

doc/setup/installing_windows_cpp.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ cd build
4343
cmake .. [-G <generator>] [-DCMAKE_INSTALL_PREFIX=<osi-install-directory>]
4444
----
4545
+
46+
If you used vcpkg to install protobuf, then provide the target and toolchain file information, as follows
47+
+
48+
----
49+
cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DCMAKE_TOOLCHAIN_FILE=C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake -A x64 [-G <generator>] [-DCMAKE_INSTALL_PREFIX=<osi-install-directory>]
50+
----
51+
4652
. Build and install OSI.
4753
+
4854
----

0 commit comments

Comments
 (0)