Add Visual Studio 2017 support (#336)

pull/1/head
Nicolas Riebesel 7 years ago committed by mujx
parent b382579789
commit cce85f3ba8
  1. 5
      .gitignore
  2. 18
      CMakeLists.txt
  3. 38
      CMakeSettings.json
  4. 48
      README.md

5
.gitignore vendored

@ -68,6 +68,11 @@ Icon
.Trashes
.VolumeIcon.icns
# Visual Studio
.vs
build-vc
vcpkg
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop

@ -37,12 +37,7 @@ include(LMDB)
#
# Discover Qt dependencies.
#
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5Multimedia REQUIRED)
find_package(Qt5 COMPONENTS Core Widgets Network LinguistTools Concurrent Svg Multimedia REQUIRED)
if (APPLE)
find_package(Qt5MacExtras REQUIRED)
@ -58,20 +53,23 @@ endif(Qt5Widgets_FOUND)
#
# Set up compiler flags.
#
set(CMAKE_C_COMPILER gcc)
if (NOT MSVC)
set(CMAKE_C_COMPILER gcc)
endif(NOT MSVC)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include(CompilerFlags)
if(NOT CMAKE_BUILD_TYPE)
if(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
message("Setting build type to '${CMAKE_BUILD_TYPE}'")
else(NOT CMAKE_BUILD_TYPE)
else(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
message("Build type set to '${CMAKE_BUILD_TYPE}'")
endif(NOT CMAKE_BUILD_TYPE)
endif(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
find_program(GIT git)
if(GIT)

@ -0,0 +1,38 @@
{
"configurations": [
{
"name": "Debug",
"generator": "Visual Studio 15 2017 Win64",
"configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build-vc\\${name}",
"cmakeCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${workspaceRoot}\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" // <-- change vcpkg location here
},
{
"name": "Qt5_DIR",
"value": "C:\\Qt\\5.10.1\\msvc2017_64\\lib\\cmake\\Qt5" // <-- change qt location here
}
]
},
{
"name": "Release",
"generator": "Visual Studio 15 2017 Win64",
"configurationType": "Release",
"buildRoot": "${workspaceRoot}\\build-vc\\${name}",
"cmakeCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${workspaceRoot}\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" // <-- change vcpkg location here
},
{
"name": "Qt5_DIR",
"value": "C:\\Qt\\5.10.1\\msvc2017_64\\lib\\cmake\\Qt5" // <-- change qt location here
}
]
},
]
}

@ -115,6 +115,25 @@ brew update
brew install qt5 lmdb cmake llvm
```
##### Windows
1. Install Visual Studio 2017's "Desktop Development" and "Linux Development with C++"
(for the CMake integration) workloads.
2. Download the latest Qt for windows installer and install it somewhere.
Make sure to install the `MSVC 2017 64-bit` toolset for at least Qt 5.9
(lower versions does not support VS2017).
3. Install lmdb and openssl with `vcpkg`. You can simply clone it into a subfolder
of the root nheko source directory.
```powershell
git clone http:\\github.com\Microsoft\vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg install --triplet x64-windows lmdb openssl
```
### Building
Clone the repo and run
@ -161,6 +180,35 @@ in the project folder. This will output a binary to `result/bin/nheko`.
You can also install nheko by running `nix-env -f . -i`
#### Windows
After installing all dependencies, you need to edit the `CMakeSettings.json` to
be able to load and compile nheko within Visual Studio.
You need to fill out the paths for the `CMAKE_TOOLCHAIN_FILE` and the `Qt5_DIR`.
The toolchain file should point to the `vcpkg.cmake` and the Qt5 dir to the `lib\cmake\Qt5` dir.
Examples for the paths are:
- `C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake`
- `C:\\Qt\\5.10.1\\msvc2017_64\\lib\\cmake\\Qt5`
Now right click into the root nheko source directory and choose `Open in Visual Studio`.
You can choose the build type Release and Debug in the top toolbar.
After a successful CMake generation you can select the `nheko.exe` as the run target.
Now choose `Build all` in the CMake menu or press `F7` to compile the executable.
To be able to run the application the last step is to install the needed Qt dependencies next to the
nheko binary.
Start the "Qt x.xx.x 64-bit for Desktop (MSVC 2017)" command promt and run `windeployqt`.
```cmd
cd <path-to-nheko>\build-vc\Release\Release
windeployqt nheko.exe
```
The final binary will be located inside `build-vc\Release\Release` for the Release build
and `build-vc\Debug\Debug` for the Debug build.
### Contributing
See [CONTRIBUTING](.github/CONTRIBUTING.md)

Loading…
Cancel
Save