Windows下编译xmr-stak

第一步:安装依赖

准备

  • 运行中输入 cmd 启动命令行
  • 命令行中执行 mkdir C:\xmr-stak-dep

Visual Studio 2017 Community

  • 下载 VS2017 Community并安装
  • 安装过程中选择如下组件
    • Desktop development with C++ (left side)
    • VC++ 2015.3 v140 toolset for desktop (right side)

64位CMake

  • 下载安装最新版cmake
  • 通过测试的版本: cmake 3.9
  • 安装过程中选择选项 Add CMake to the system PATH for all users

(注:VS2017中也带了CMake,但没加入Path,在C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe,可直接使用)

Cuda 8.0+ (only needed to use NVIDIA GPUs)

  • donwload and install https://developer.nvidia.com/cuda-downloads
  • for minimal install choose Custom installation options during the install and select
    • CUDA/Develpment
    • CUDA/Visual Studio Integration (ignore the warning during the install that VS2017 is not supported)
    • CUDA/Runtime
    • Driver components

AMD APP SDK 3.0 (仅在AMD GPU上需要)

  • 下载安装最新的amd-accelerated-parallel-processing-app-sdk

Dependencies OpenSSL/Hwloc and Microhttpd

for CUDA 8*:

  • download the version 1 of the precompiled binary from https://github.com/fireice-uk/xmr-stak-dep/releases/download/v1/xmr-stak-dep.zip
  • version 1 of the pre-compiled dependencies is not compatible with Visual Studio Toolset v141

对CUDA 9 或 AMD GPUs, CPU:

  • 下载第二版预编译依赖
  • 所有东西解压到 C:\xmr-stak-dep

检验依赖文件夹

  • open a command line cmd

  • run

    cd c:\xmr-stak-dep
    tree .
    
    
  • 结果应该如下

      C:\xmr-stak-dep>tree .
      Folder PATH listing for volume Windows
      Volume serial number is XX02-XXXX
      C:\XMR-STAK-DEP
      ├───hwloc
      │   ├───include
      │   │   ├───hwloc
      │   │   │   └───autogen
      │   │   └───private
      │   │       └───autogen
      │   └───lib
      ├───libmicrohttpd
      │   ├───include
      │   └───lib
      └───openssl
          ├───bin
          ├───include
          │   └───openssl
          └───lib
    
    

编译

  • 下载解压 xmr-stak

  • 打开命令行 cmd

  • cd 到解压的源代码目录

  • 执行下面的命令 (注意: VS2017 安装目录可能不同)

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat"
    set CMAKE_PREFIX_PATH=C:\xmr-stak-dep\hwloc;C:\xmr-stak-dep\libmicrohttpd;C:\xmr-stak-dep\openssl
    mkdir build
    cd build
    
    • for CUDA 8*

      cmake -G "Visual Studio 15 2017 Win64" -T v140,host=x64 ..
      
      
    • for CUDA 9 或 AMD GPUs, CPU

      cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 ..
      
      

最后:

```
cmake --build . --config Release --target install
cd bin\Release
copy C:\xmr-stak-dep\openssl\bin\* .
```

你可能感兴趣的:(Windows下编译xmr-stak)