-
Notifications
You must be signed in to change notification settings - Fork 8
update windows build doc #44
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
base: main
Are you sure you want to change the base?
Changes from all 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 |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
# Build directories | ||
build* | ||
!buildtools | ||
.cache | ||
|
||
# Emacs auto-save files | ||
*~ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,57 @@ | ||
# Building with Visual Studio | ||
# Building with Visual Studio/VSCode | ||
|
||
It is possible to build the examples and test programs using Visual Studio. | ||
It is possible to build the examples and test programs using Visual Studio/VSCode. | ||
|
||
You first have to install vcpkg. | ||
## *Required*: Install dependencies | ||
|
||
You open the cmake folder from Visual Studio, and make use of [vcpkg](https://github.com/microsoft/vcpkg) to get dependencies in place. There is a vcpkg.json file in the repository at [vcpkg/vcpkg.json](https://github.com/sebsjames/mathplot/blob/main/vcpkg/vcpkg.json). | ||
### Install vcpkg | ||
vcpkg is a package manager for C++ libraries. It can be used to download and install the required dependencies for the examples and test programs. | ||
|
||
To install vcpkg, follow the instructions at [vcpkg](https://github.com/microsoft/vcpkg). | ||
|
||
After vcpkg is installed, you need to set the environment variable `VCPKG_ROOT` to the path where vcpkg is installed, then set the `CMAKE_TOOLCHAIN_FILE` variable to the path of the vcpkg toolchain file. | ||
|
||
In Visual Studio, you can follow [Customize CMake build settings](https://learn.microsoft.com/en-us/cpp/build/customize-cmake-settings?view=msvc-170) to set `CMAKE_TOOLCHAIN_FILE`. | ||
|
||
In VSCode, you can set these variables in the `settings.json`: | ||
```json | ||
{ | ||
"cmake.configureSettings": { | ||
"CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" | ||
}, | ||
} | ||
``` | ||
|
||
### Install dependencies with vcpkg | ||
|
||
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.
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 didn't use this command 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. Yes, that's when setting up an application to use vcpkg. I understand that this is not the right command to use in this case. |
||
#### Mainfest mode(recommended) | ||
|
||
When `vcpkg.json` is in the root directory of the project, vcpkg will automatically install the required dependencies when you run the CMake configuration step. | ||
|
||
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.
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. yes, vcpkg will auto install if vcpkg.json in root dir 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 there another step? To run the vcpkg install step from inside Visual Studio? 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 didn't use the vcpkg from visual studio, I clone the repo https://github.com/microsoft/vcpkg and run 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. Do you run bootstrap-vcpkg.bat from inside mathplot/ ? 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. no, this bat file just download the vcpkg executable, it only need to run once |
||
#### Classic mode | ||
|
||
To install the required dependencies, run the following command in the terminal: | ||
|
||
``` | ||
vcpkg install armadillo freetype glfw3 hdf5 nlohmann-json opengl rapidxml | ||
``` | ||
|
||
### Install Qt5 | ||
|
||
To use Qt, you need to install the Qt SDK using the [official installer](https://download.qt.io/official_releases/online_installers/). | ||
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. Official installer shows only version 6.9.x. I assume you installed 5.15.x, by drilling down into the menus? 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. 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'll figure out precisely which options to check and add this to the description (I don't have 50 GB to install everything for Qt 5.15!) |
||
|
||
Then add the Qt bin directory to the system PATH environment variable, and set the environment variable `QT5_DIR` to the Qt installation directory. | ||
|
||
### Build the examples and test programs | ||
|
||
You can build the examples and test programs using the Visual Studio/VSCode(with cmake plugins). | ||
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'm trying to do this. I open the mathplot folder from Visual Studio and it tries to run the cmake process, which fails when it attempts to find glfw3. I think I didn't correctly install glfw3 with vcpkg first, but I don't know how. 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. can I see the output of vscode console? 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.
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. if the vcpkg.json file is in the root folder, maybe you didn't install vcpkg right, or remove the build folder and reconfig 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. I think I figured this process out for morphologica (which still opens ok on my Windows laptop) but I have forgotten it! I think it might be necessary to open a Developer PowerShell from inside Visual Studio and run When I did this (and vcpkg.json was in my project root) I got a vcpkg_installed folder containing the libraries. However, mathplot still didn't build. I'll try later. |
||
|
||
Or you can build in terminal: | ||
|
||
``` cmake | ||
cmake -B build | ||
cmake --build build --config Release | ||
``` | ||
|
||
# Building on Windows Subsystem for Linux | ||
|
||
|
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 add this to cmake, so if
VCPKG_ROOT
env is set, it will setCMAKE_TOOLCHAIN_FILE
automaticallyUh oh!
There was an error while loading. Please reload this page.
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 see, so that refers to the VCPKG_ROOT env var, and side-steps the built-in Visual Studio vcpkg (which I think is what I used before with my morphologica build)