Skip to content

Commit c04acfd

Browse files
rrrooommmaaaronaldtse
authored andcommitted
Added instructions to build with MSVC as well as update CmakeSettings.json file for the IDE
rnpgp#1386
1 parent 8ba6edd commit c04acfd

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed

CMakeSettings.json

+30-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"buildCommandArgs": "",
1212
"ctestCommandArgs": "",
1313
"variables": [],
14-
"cmakeToolchain": "${env.VCPKG_DIR}\\scripts\\buildsystems\\vcpkg.cmake",
14+
"cmakeToolchain": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
1515
"intelliSenseMode": "windows-msvc-x64"
1616
},
1717
{
@@ -23,7 +23,35 @@
2323
"cmakeCommandArgs": "-DCMAKE_FIND_DEBUG_MODE=ON",
2424
"buildCommandArgs": "",
2525
"ctestCommandArgs": "",
26-
"cmakeToolchain": "${env.VCPKG_DIR}\\scripts\\buildsystems\\vcpkg.cmake",
26+
"cmakeToolchain": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
27+
"inheritEnvironments": [ "msvc_x86" ],
28+
"variables": [],
29+
"intelliSenseMode": "windows-msvc-x64"
30+
},
31+
{
32+
"name": "x64-Release",
33+
"generator": "Visual Studio 16 2019 Win64",
34+
"configurationType": "Release",
35+
"inheritEnvironments": [ "msvc_x64_x64" ],
36+
"buildRoot": "${projectDir}\\..\\${name}",
37+
"installRoot": "${projectDir}\\..\\install\\${name}",
38+
"cmakeCommandArgs": "",
39+
"buildCommandArgs": "",
40+
"ctestCommandArgs": "",
41+
"variables": [],
42+
"cmakeToolchain": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
43+
"intelliSenseMode": "windows-msvc-x64"
44+
},
45+
{
46+
"name": "x32-Release",
47+
"generator": "Visual Studio 16 2019",
48+
"configurationType": "Release",
49+
"buildRoot": "${projectDir}\\..\\${name}",
50+
"installRoot": "${projectDir}\\..\\install\\${name}",
51+
"cmakeCommandArgs": "",
52+
"buildCommandArgs": "",
53+
"ctestCommandArgs": "",
54+
"cmakeToolchain": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
2755
"inheritEnvironments": [ "msvc_x86" ],
2856
"variables": [],
2957
"intelliSenseMode": "windows-msvc-x64"

docs/installation.adoc

+27-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=on -DBUILD_TESTING=o
8383
make install
8484
----
8585

86-
== On Windows using MSYS/MinGW
86+
== On Windows
87+
88+
=== Using MSYS/MinGW
8789

8890
Having the clean MSYS2 installation, you'll first need to update pacman and install needed packages via msys console:
8991

@@ -109,5 +111,28 @@ cmake -DBUILD_SHARED_LIBS=yes -G "MSYS Makefiles" ../rnp
109111
make && make install
110112
----
111113

112-
Depending on how do you run rnp.exe and rnpkeys.exe you'll need to make sure that librnp-0.dll is on path or in the same folder as well as all dependencies.
114+
=== Using Microsoft Visual Studio 2019
115+
116+
Install `vcpkg` using these instructions https://docs.microsoft.com/en-us/cpp/build/install-vcpkg?view=msvc-160&tabs=windows
117+
118+
Set VCPKG_ROOT environment variable to `vcpkg` root folder.
119+
120+
`vcpkg install bzip2 zlib botan json-c getopt dirent python3[core,enable-shared]`
121+
122+
When opening in MSVC IDE, it will pick up `CMakeSettings.json` to find `vcpkg` path using `VCPKG_ROOT` environment variable
123+
124+
For console build:
125+
[source, console]
126+
----
127+
# CMake encourages out-of source builds.
128+
mkdir rnp-build
129+
cd rnp-build
130+
cmake -B . -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release ../rnp
131+
cmake --build . --config Release
132+
cmake --install .
133+
----
134+
135+
Depending on how do you run rnp.exe and rnpkeys.exe you'll need to make sure that
136+
librnp-0.dll, botan.dll, bz2.dll, getopt.dll, json-c.dll and zlib1.dll are on path
137+
or in the same folder as well as all dependencies.
113138
You may check dependenices and their pathes via ntldd.exe in MSYS command prompt.

0 commit comments

Comments
 (0)