From 80eaca4087529bfe415e005f66c86c28b32b5548 Mon Sep 17 00:00:00 2001 From: DDoSolitary Date: Fri, 26 Jun 2020 00:54:28 +0800 Subject: [PATCH] Update build instructions in readme. --- README.md | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d6e40d7..6f8f6e1 100644 --- a/README.md +++ b/README.md @@ -42,27 +42,54 @@ Run `LxRunOffline` for available actions and run `LxRunOffline ` fo # Build -### Visual Studio +This project uses CMake as its build system. MinGW GCC and Visual C++ compilers are supported. -Visual Studio 2017 and Windows SDK 10.0.17134 are required. +### Visual C++ -Install [vcpkg and its VS integration](https://github.com/Microsoft/vcpkg) (if you haven't) and install dependencies. +1. Install Visual Studio 2019, latest Windows SDK, CMake and [vcpkg](https://github.com/Microsoft/vcpkg). + +2. Install dependencies. ``` vcpkg install --triplet x64-windows-static libarchive boost-program-options boost-format tinyxml2 ``` -Then build with Visual Studio or MSBuild. +3. Open "x64 Native Tools Command Prompt" from Start Menu and build. + +```cmd +mkdir build +cd build +cmake .. \ + -G "NMake Makefiles" \ + -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-windows-static +nmake +``` + +### MinGW -### MSYS2 +1. Install MSYS2. -Open the "MSYS2 MinGW 64-bit" shell, and install necessary packages. +2. Open the "MSYS2 MinGW 64-bit" shell from Start menu, and install dependencies. +```bash +pacman -Sy --needed --noconfirm base-devel git mingw-w64-x86_64-{toolchain,cmake,libarchive,boost,tinyxml2} ``` -pacman -Sy --needed --noconfirm base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-libarchive mingw-w64-x86_64-boost mingw-w64-x86_64-tinyxml2 + +3. Build. + +```bash +mkdir build +cd build +cmake .. -G "MSYS Makefiles" +make ``` -Then run `make`. +### Notes + +- Other CMake generators like Visual Studio and Ninja may also work, but they're neither tested nor officially supported by this project. +- Static linking is used by default. However, you can define `-DLXRUNOFFLINE_STATIC=OFF` to switch to dynamic linking. If you're building with Visual C++, you also need to change vcpkg's triplet to `x64-windows` when installing dependencies and invoking CMake. +- The build script in [CI configuration](https://github.com/DDoSolitary/LxRunOffline/blob/master/.github/workflows/build.yml) can be used as an example of how to build this project. # Compatibility @@ -70,4 +97,4 @@ Then run `make`. - **v2.x**: Only Windows 10 Fall Creators Update (v1709) or later. - **v3.x**: Only Windows 10 April 2018 Update (v1803) or later. -It is strongly recommended to install the April 2018 Update and use v3.x releases. +It is strongly recommended to install the April 2018 Update or later and use v3.x releases.