-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update build instructions for Visual Studio 2019 #4394
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,32 +170,43 @@ Until then, we advise Windows developers to use Visual Studio 2019. | |
|
||
## Prerequisites | ||
|
||
To build this package, you will need Python (>= 3.7), | ||
[Conan][] (>= 1.55), and [CMake][] (>= 3.16). | ||
|
||
> **Warning** | ||
> The commands in this document are not meant to be blindly copied and pasted. | ||
> The commands in this document are guidelines which cannot always be successfully copy and pasted. | ||
> This document is written for multiple audiences, | ||
> meaning that your particular circumstances may require some commands and not | ||
> others. | ||
> You should never run any commands without understanding what they do | ||
> and why you are running them. | ||
> It is recommended to fully understand what the following commands do before running them. | ||
> | ||
> These instructions assume a basic familiarity with Conan and CMake. | ||
> If you are unfamiliar with Conan, | ||
> then please read the [crash course](#a-crash-course-in-cmake-and-conan) | ||
> at the beginning of this document, | ||
> or the official [Getting Started][3] walkthrough. | ||
|
||
### All Platforms | ||
|
||
To build this package, you will need [Python][] (>= 3.7), | ||
[Conan][] (>= 1.52), and [CMake][] (>= 3.16). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not believe Conan 1.52 is sufficient any more. We should recommend the latest anyway given all the recent changes (1.58). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
If you are unfamiliar with Conan, | ||
there is a crash course at the end of this document. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Beginning of the document. Are these changes based off an old version of this document? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. I am not sure what version @justinr1234 based his changes on. |
||
|
||
[Conan]: https://conan.io/downloads.html | ||
[CMake]: https://cmake.org/download/ | ||
[Python]: https://www.python.org/downloads/ | ||
|
||
If you've never used Conan before, use autodetect to setup a default profile: | ||
|
||
``` | ||
conan profile new default --detect | ||
``` | ||
Comment on lines
+197
to
+201
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command is already in the crash course. This section assumes the person has installed and configured Python, Conan, and CMake. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not seem too bad to repeat that command. However, I'll be happy to remove it if you prefer. Please let me know. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally, I think it is good to repeat the command. Obviously, there is a balance (we wouldn't want to repeat it 5 times). But this looks ok to me. |
||
|
||
You'll need to compile in the C++20 dialect: | ||
|
||
``` | ||
conan profile update settings.compiler.cppstd=20 default | ||
conan profile update settings.cppstd=20 default | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the wrong command, from an old version of Conan. It was already updated in this document. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Fixed. |
||
``` | ||
|
||
### Linux | ||
Linux developers will commonly have a default Conan [profile][] that compiles | ||
with GCC and links with libstdc++. | ||
If you are linking with libstdc++ (see profile setting `compiler.libcxx`), | ||
|
@@ -205,6 +216,12 @@ then you will need to choose the `libstdc++11` ABI: | |
conan profile update settings.compiler.libcxx=libstdc++11 default | ||
``` | ||
|
||
### Windows | ||
|
||
[Visual Studio 2019]: https://visualstudio.microsoft.com/vs/older-downloads/ | ||
|
||
It is recommended to utilize PowerShell in administrator mode to run commands. See an [example script](./Builds/windows/install.ps1) that utilizes the [chocolately](https://chocolatey.org/) package manager. | ||
|
||
We find it necessary to use the x64 native build tools on Windows. | ||
An easy way to do that is to run the shortcut "x64 Native Tools Command | ||
Prompt" for the version of Visual Studio that you have installed. | ||
|
@@ -216,6 +233,8 @@ architecture: | |
conan profile update settings.arch=x86_64 default | ||
``` | ||
|
||
### A note about multiple compilers | ||
|
||
If you have multiple compilers installed on your platform, | ||
then you'll need to make sure that Conan and CMake select the one you want to | ||
use. | ||
|
@@ -235,40 +254,7 @@ conan profile update env.CC=<path> default | |
conan profile update env.CXX=<path> default | ||
``` | ||
|
||
|
||
## How to build and test | ||
|
||
Let's start with a couple of examples of common workflows. | ||
The first is for a single-configuration generator (e.g. Unix Makefiles) on | ||
Linux or MacOS: | ||
|
||
``` | ||
conan export external/rocksdb | ||
mkdir .build | ||
cd .build | ||
conan install .. --output-folder . --build missing --settings build_type=Release | ||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release .. | ||
cmake --build . | ||
./rippled --unittest | ||
``` | ||
|
||
The second is for a multi-configuration generator (e.g. Visual Studio) on | ||
Windows: | ||
|
||
``` | ||
conan export external/rocksdb | ||
mkdir .build | ||
cd .build | ||
conan install .. --output-folder . --build missing --settings build_type=Release --settings compiler.runtime=MT | ||
conan install .. --output-folder . --build missing --settings build_type=Debug --settings compiler.runtime=MTd | ||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake .. | ||
cmake --build . --config Release | ||
cmake --build . --config Debug | ||
./Release/rippled --unittest | ||
./Debug/rippled --unittest | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these instructions removed? To what steps do the numbered explanations correspond? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @justinr1234 probably removed them by mistake. I put them back. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was removed when there wasn’t a separate readme. As far as these instructions, it shouldn’t have Debug and Release together like that as both myself and @drlongle ran into issues with mixing debug and release builds back to back. |
||
|
||
Now to explain the individual steps in each example: | ||
## Explanation of build steps | ||
|
||
1. Export our [Conan recipe for RocksDB](./external/rocksdb). | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,12 @@ We do not recommend Windows for rippled production use at this time. Currently, | |
the Ubuntu platform has received the highest level of quality assurance, | ||
testing, and support. Additionally, 32-bit Windows versions are not supported. | ||
|
||
While there are several options for building `rippled` on Windows, we recommend using | ||
[Chocolatey, Conan, CMake and Visual Studio](README.md#build-using-chocolatey-conan-cmake-and-visual-studio-recommended). | ||
If using this option, you can skip the section [Install Software](README.md#install-software) | ||
because Conan automatically installs all dependencies for `rippled`. | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Editing this document reflects a totally different philosophy on how to present build instructions in this repo. I've got a waiting PR to remove this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it better to revert all changes for |
||
## Prerequisites | ||
|
||
To clone the source code repository, create branches for inspection or | ||
|
@@ -233,6 +239,64 @@ or | |
``` | ||
These paths are relative to your cloned git repository. | ||
|
||
# Build using Chocolatey, Conan, CMake and Visual Studio (Recommended) | ||
|
||
Open a PowerShell as Administrator and execute a | ||
[setup script](https://gist.github.com/ximinez/1678229f97831c602a9a42a1ea03c9c4). | ||
Alternatively, [install Chocolatey](https://chocolatey.org/install) and run the following commands | ||
in a PowerShell as Administrator: | ||
|
||
```powershell | ||
choco install -y git conan | ||
choco install -y cmake.install --installargs '"ADD_CMAKE_TO_PATH=System"' | ||
choco install -y visualstudio2019-workload-vctools | ||
choco install -y visualstudio2019community | ||
choco install -y visualstudio2019-workload-nativedesktop | ||
|
||
``` | ||
|
||
|
||
If you do not have a Conan profile already, create a default profile: | ||
|
||
```powershell | ||
conan profile new default --detect | ||
``` | ||
|
||
Set Conan options to compile in the C++20 dialect and for the x64 architecture: | ||
|
||
```powershell | ||
conan profile update settings.compiler.cppstd=20 default | ||
conan profile update settings.arch=x86_64 default | ||
``` | ||
|
||
Clone the `rippled` repository: | ||
```powershell | ||
git clone [email protected]:XRPLF/rippled.git | ||
cd rippled | ||
``` | ||
|
||
Run the following commands to create a release build: | ||
```powershell | ||
conan export external/rocksdb | ||
mkdir .build | ||
cd .build | ||
conan install .. --output-folder . --build missing --settings build_type=Release --settings compiler.runtime=MT | ||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake .. | ||
cmake --build . --config Release | ||
./Release/rippled --unittest | ||
``` | ||
|
||
Alternatively, run the following commands to create a debug build: | ||
```powershell | ||
conan export external/rocksdb | ||
mkdir .build | ||
cd .build | ||
conan install .. --output-folder . --build missing --settings build_type=Debug --settings compiler.runtime=MTd | ||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake .. | ||
cmake --build . --config Debug | ||
./Debug/rippled --unittest | ||
``` | ||
|
||
# Unity/No-Unity Builds | ||
|
||
The rippled build system defaults to using | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## To run these commands as a script, execution policy must be relaxed: | ||
#set-executionpolicy remotesigned | ||
## If running in admin powershell simply run: | ||
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | ||
choco install -y python3 | ||
choco install -y git conan | ||
choco install -y cmake.install --installargs '"ADD_CMAKE_TO_PATH=System"' | ||
|
||
## These workloads depend on and will install visualstudio<year>buildtools | ||
choco install -y visualstudio2022-workload-vctools visualstudio2019-workload-vctools | ||
## and for the IDEs *Be prepared to wait!* | ||
choco install -y visualstudio2019community | ||
choco install -y visualstudio2019-workload-nativedesktop | ||
choco install -y visualstudio2022community | ||
choco install -y visualstudio2022-workload-nativedesktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call them examples, not guidelines.
copy -> copied
or
copy and pasted -> copy-and-pasted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please break lines at 80 characters. Yes, even Markdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.