From 811cb0cc387d786b30d216d6d5c3a4e6df7491c2 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Tue, 7 Jul 2020 22:08:09 -0700 Subject: [PATCH] [vcpkg README] Fix links (#12317) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: JackBoosY --- README.md | 31 ++++++------- README_zh_CN.md | 115 ++++++++++++++++++++++++------------------------ 2 files changed, 74 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 807d3a18b4ff95..1764b5a1137a9b 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,9 @@ First, follow the quick start guide for either [Windows](#quick-start-windows), or [macOS and Linux](#quick-start-unix), depending on what you're using. -For more information, see [Installing and Using Packages][getting-vcpkg:using-a-package]. +For more information, see [Installing and Using Packages][getting-started:using-a-package]. If a library you need is not present in the vcpkg catalog, -you can [open an issue on the GitHub repo][getting-vcpkg:open-issue] +you can [open an issue on the GitHub repo][contributing:submit-issue] where the vcpkg team and community can see it, and potentially add the port to vcpkg. @@ -64,8 +64,8 @@ so try it out and [open all the issues][contributing:submit-issue]! Prerequisites: - Windows 7 or newer -- [Git][quick-start:git] -- [Visual Studio][quick-start:visual-studio] 2015 Update 3 or greater with the English language pack +- [Git][getting-started:git] +- [Visual Studio][getting-started:visual-studio] 2015 Update 3 or greater with the English language pack First, download and bootstrap vcpkg itself; it can be installed anywhere, but generally we recommend using vcpkg as a submodule for CMake projects, @@ -107,7 +107,7 @@ continue [here](#vcpkg-with-visual-studio-cmake-projects). In order to use vcpkg with CMake outside of an IDE, you can use the toolchain file: -``` +```cmd > cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake > cmake --build [build directory] ``` @@ -117,19 +117,19 @@ Check out the [CMake section](#using-vcpkg-with-cmake) for more information, including on using CMake with an IDE. For any other tools, including Visual Studio Code, -check out the [integration guide][quick-start:integration]. +check out the [integration guide][getting-started:integration]. ## Quick Start: Unix Prerequisites for Linux: -- [Git][quick-start:git] -- [g++][quick-start:linux-gcc] >= 6 +- [Git][getting-started:git] +- [g++][getting-started:linux-gcc] >= 6 Prerequisites for macOS: -- [Apple Developer Tools][quick-start:apple-developer-tools] +- [Apple Developer Tools][getting-started:macos-dev-tools] - On macOS 10.14 or below, you will also need: - - [Homebrew][quick-start:homebrew] - - [g++][quick-start:macos-gcc] >= 6 from Homebrew + - [Homebrew][getting-started:macos-brew] + - [g++][getting-started:macos-gcc] >= 6 from Homebrew First, download and bootstrap vcpkg itself; it can be installed anywhere, but generally we recommend using vcpkg as a submodule for CMake projects. @@ -153,9 +153,9 @@ $ ./vcpkg/vcpkg search [search term] In order to use vcpkg with CMake, you can use the toolchain file: -``` -> cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake -> cmake --build [build directory] +```sh +$ cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake +$ cmake --build [build directory] ``` With CMake, you will still need to `find_package` and the like to use the libraries. @@ -163,7 +163,7 @@ Check out the [CMake section](#using-vcpkg-with-cmake) for more information on how best to use vcpkg with CMake, and CMake Tools for VSCode. -For any other tools, check out the [integration guide][quick-start:integration]. +For any other tools, check out the [integration guide][getting-started:integration]. ## Installing Linux Developer Tools @@ -325,6 +325,7 @@ For more information, check out the [manifest][getting-started:manifest-spec] specification. [getting-started:using-a-package]: docs/examples/intalling-and-using-packages.md +[getting-started:integration]: docs/users/integration.md [getting-started:git]: https://git-scm.com/downloads [getting-started:cmake-tools]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools [getting-started:linux-gcc]: #installing-linux-developer-tools diff --git a/README_zh_CN.md b/README_zh_CN.md index 1521c702a90552..286976dc832dbe 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -4,7 +4,7 @@ Vcpkg 可帮助您在 Windows、 Linux 和 MacOS 上管理 C 和 C++ 库。 这个工具和生态链正在不断发展,我们一直期待您的贡献! -若您从未使用过vcpkg或希望了解如何使用vcpkg,请查阅[快速开始](#getting-started)章节。 +若您从未使用过vcpkg或希望了解如何使用vcpkg,请查阅[快速开始](#入门)章节。 如需获取有关可用命令的简短描述,请在编译vcpkg后执行 `vcpkg help` 或执行 `vcpkg help [command]` 来获取具体的帮助信息。 @@ -18,42 +18,42 @@ Vcpkg 可帮助您在 Windows、 Linux 和 MacOS 上管理 C 和 C++ 库。 # 目录 - [Vcpkg 总览](#vcpkg-总览) - * [概要](#概要) + - [概要](#概要) - [目录](#目录) - [入门](#入门) - * [快速开始: Windows](#快速开始-windows) - * [快速开始: Unix](#快速开始-unix) - * [安装 Linux Developer Tools](#安装-linux-developer-tools) - * [安装 macOS Developer Tools](#安装-macos-developer-tools) - + [在 macOS 10.15 之前版本中安装 GCC](#在-macos-1015-之前版本中安装-gcc) - * [在 CMake 中使用 vcpkg](#在-cmake-中使用-vcpkg) - + [Visual Studio Code 中的 CMake Tools](#visual-studio-code-中的-cmake-tools) - + [Visual Studio CMake 工程中使用 vcpkg](#visual-studio-cmake-工程中使用-vcpkg) - + [CLion 中使用 vcpkg](#clion-中使用-vcpkg) - + [将 vcpkg 作为一个子模块](#将-vcpkg-作为一个子模块) - * [快速开始: 清单](#快速开始-清单) + - [快速开始: Windows](#快速开始-windows) + - [快速开始: Unix](#快速开始-unix) + - [安装 Linux Developer Tools](#安装-linux-developer-tools) + - [安装 macOS Developer Tools](#安装-macos-developer-tools) + - [在 macOS 10.15 之前版本中安装 GCC](#在-macos-1015-之前版本中安装-gcc) + - [在 CMake 中使用 vcpkg](#在-cmake-中使用-vcpkg) + - [Visual Studio Code 中的 CMake Tools](#visual-studio-code-中的-cmake-tools) + - [Visual Studio CMake 工程中使用 vcpkg](#visual-studio-cmake-工程中使用-vcpkg) + - [CLion 中使用 vcpkg](#clion-中使用-vcpkg) + - [将 vcpkg 作为一个子模块](#将-vcpkg-作为一个子模块) + - [快速开始: 清单](#快速开始-清单) - [Tab补全/自动补全](#tab补全自动补全) - * [示例](#示例) - * [贡献者](#贡献者) + - [示例](#示例) + - [贡献者](#贡献者) - [License](#license) - [数据收集](#数据收集) # 入门 -首先,请遵循以下任一方面的快速入门指南: -[Windows](#quick-start-windows) 或 [macOS和Linux](#quick-start-unix), +首先,请阅读以下任一方面的快速入门指南: +[Windows](#快速开始-windows) 或 [macOS和Linux](#快速开始-unix), 这取决于您使用的是什么平台。 -有关更多信息,请参见 [安装和使用软件包] [getting-vcpkg:using-a-package]。 +有关更多信息,请参见 [安装和使用软件包][getting-started:using-a-package]。 如果vcpkg目录中没有您需要的库, -您可以 [在GitHub上打开问题] [getting-vcpkg:open-issue] -vcpkg团队和社区可以看到它的地方, +您可以 [在GitHub上打开问题][contributing:submit-issue]。 +vcpkg团队和贡献者可以看到它的地方, 并可能将这个库添加到vcpkg。 安装并运行vcpkg后, -您可能希望将 [TAB补全](#tab-completionauto-completion) 添加到您的Shell中。 +您可能希望将 [TAB补全](#tab补全自动补全) 添加到您的Shell中。 -最后,如果您对vcpkg的未来感兴趣,请查看 [清单](#quick-start-manifest)! +最后,如果您对vcpkg的未来感兴趣,请查看 [清单](#快速开始-清单)! 这是一项实验性功能,可能会出现错误。 因此,请尝试一下并[打开所有问题][contributing:submit-issue]! @@ -61,11 +61,11 @@ vcpkg团队和社区可以看到它的地方, 需求: - Windows 7 或更新的版本 -- [Git][quick-start:git] -- [Visual Studio][quick-start:visual-studio] 2015 Update 3 或更新的版本(包含英文语言包) +- [Git][getting-started:git] +- [Visual Studio 2015 Update 3][getting-started:visual-studio] 或更新的版本(包含英文语言包) -首先,请下载vcpkg并执行bootstrap.bat脚本。 -它可以安装在任何地方,但是通常我们建议您使用 vcpkg 作为 CMake 项目的子模块,并为 Visual Studio 项目在全局安装它。 +首先,请下载vcpkg并执行 bootstrap.bat 脚本。 +它可以安装在任何地方,但是通常我们建议您使用 vcpkg 作为 CMake 项目的子模块,并将其全局安装到 Visual Studio 项目中。 我们建议您使用例如 `C:\src\vcpkg` 或 `C:\dev\vcpkg` 的安装目录,否则您可能遇到某些库构建系统的路径问题。 ```cmd @@ -73,7 +73,7 @@ vcpkg团队和社区可以看到它的地方, > .\vcpkg\bootstrap-vcpkg.bat ``` -使用以下命令为您的项目安装需要的库: +使用以下命令安装您的项目所需要的库: ```cmd > .\vcpkg\vcpkg install [packages to install] @@ -94,7 +94,7 @@ vcpkg团队和社区可以看到它的地方, 在此之后, 您可以创建一个非cmake项目 (或打开已有的项目)。 在您的项目中,所有已安装的库均可立即使用 `#include` 包含您需使用的库的头文件并无需添加额外配置。 -若您在 Visual Studio 中使用cmake工程,请查阅[这里](#vcpkg-with-visual-studio-cmake-projects)。 +若您在 Visual Studio 中使用cmake工程,请查阅[这里](#visual-studio-cmake-工程中使用-vcpkg)。 为了在IDE以外在cmake中使用vcpkg, 您需要使用以下工具链文件: @@ -104,24 +104,24 @@ vcpkg团队和社区可以看到它的地方, ``` 在cmake中,您仍需通过 `find_package` 来使用第三方库。 -请查阅 [CMake 章节](#using-vcpkg-with-cmake) 获取更多信息,其中包含了在IDE中使用cmake的内容。 +请查阅 [CMake 章节](#在-cmake-中使用-vcpkg) 获取更多信息,其中包含了在IDE中使用cmake的内容。 -对于其他工具 (包括Visual Studio Code),请查阅 [集成指南][quick-start:integration]。 +对于其他工具 (包括Visual Studio Code),请查阅 [集成指南][getting-started:integration]。 ## 快速开始: Unix Linux平台的使用需求: -- [Git][quick-start:git] -- [g++][quick-start:linux-gcc] >= 6 +- [Git][getting-started:git] +- [g++][getting-started:linux-gcc] >= 6 macOS平台的使用需求: -- [Apple Developer Tools][quick-start:apple-developer-tools] +- [Apple Developer Tools][getting-started:macos-dev-tools] - macOS 10.14 或更低版本中,您也需要: - - [Homebrew][quick-start:homebrew] - - Homebrew 中 [g++][quick-start:macos-gcc] >= 6 + - [Homebrew][getting-started:macos-brew] + - Homebrew 中 [g++][getting-started:macos-gcc] >= 6 -首先,请下载vcpkg并执行bootstrap.sh脚本。 -我们总体上建议您将vcpkg作为cmake项目的子模块使用。 +首先,请下载vcpkg并执行 bootstrap.sh 脚本。 +我们建议您将vcpkg作为cmake项目的子模块使用。 ```sh $ git clone https://github.com/microsoft/vcpkg @@ -134,7 +134,7 @@ $ ./vcpkg/bootstrap-vcpkg.sh $ ./vcpkg/vcpkg install [packages to install] ``` -您也可以使用 `search` 子命令来查找vcpkg中集成的库: +您也可以使用 `search` 子命令来查找vcpkg中已集成的库: ```sh $ ./vcpkg/vcpkg search [search term] @@ -149,10 +149,10 @@ $ ./vcpkg/vcpkg search [search term] 在cmake中,您仍需通过 `find_package` 来使用第三方库。 为了您更好的在cmake或 VSCode CMake Tools 中使用vcpkg, -请查阅 [CMake 章节](#using-vcpkg-with-cmake) 获取更多信息, +请查阅 [CMake 章节](#在-cmake-中使用-vcpkg) 获取更多信息, 其中包含了在IDE中使用cmake的内容。 -对于其他工具,请查阅 [集成指南][quick-start:integration]。 +对于其他工具,请查阅 [集成指南][getting-started:integration]。 ## 安装 Linux Developer Tools @@ -191,7 +191,7 @@ $ xcode-select --install ### 在 macOS 10.15 之前版本中安装 GCC -此条_只_在您的macOS版本低于 10.15 时是必须的。 +此条只在您的macOS版本低于 10.15 时是必须的。 安装homebrew应当很轻松, 请查阅 以获取更多信息。 为了更简便,请使用以下命令: @@ -205,7 +205,7 @@ $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/ $ brew install gcc ``` -此时,您就可以使用 bootstarp.sh 编译vcpkg了。 请参阅 [quick start guide](#quick-start-unix) +此时,您就可以使用 bootstrap.sh 编译vcpkg了。 请参阅 [快速开始](#快速开始-unix) ## 在 CMake 中使用 vcpkg @@ -213,7 +213,7 @@ $ brew install gcc ### Visual Studio Code 中的 CMake Tools -将以下内容添加到您的工作区 `settings.json` 中将使CMake Tools自动使用vcpkg中的第三方库: +将以下内容添加到您的工作区的 `settings.json` 中将使CMake Tools自动使用vcpkg中的第三方库: ```json { @@ -255,17 +255,17 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/ CACHE STRING "Vcpkg toolchain file") ``` -这仍然允许您不通过直接传递 `CMAKE_TOOLCHAIN_FILE` 来使用vcpkg,但这会使配置构建步骤稍微容易一些。 +使用此种方式可无需设置 `CMAKE_TOOLCHAIN_FILE` 即可使用vcpkg,且更容易完成配置工作。 ## 快速开始: 清单 如果您期待vcpkg在未来会更好,我们真的很感激😄。 -但是,首先要警告: vcpkg中的清单支持仍处于beta中! -通常,它应该可以正常工作,但您很可能会在这种模式下使用vcpkg时遇到至少一个或两个错误。 -另外,我们可能会在稳定之前破坏行为,因此请提前警告。 -如果您遇到任何错误,请 [提交一个issue][contributing:submit-issue]! +但是,首先要警告:vcpkg中的清单支持仍处于beta中! +通常,vcpkg可以正常工作,但您很可能会在使用时遇到至少一个或两个错误。 +另外,我们可能会在稳定之前更改vcpkg的各个功能,请提前知悉。 +如果您遇到任何错误,请[提交一个issue][contributing:submit-issue]! -首先,为 [Windows](#quick-start-windows) 正常安装vcpkg或 [Unix](#quick-start-unix)。 +首先,在 [Windows](#快速开始-windows) 或 [Unix](#快速开始-unix) 正常安装vcpkg。 您可能希望将vcpkg安装在常用的位置,由于安装的目录位于本地,并且可以从同一vcpkg目录中同时运行多个vcpkg命令。 然后,您必须通过将 `manifests` 添加到以逗号分隔的 `--feature-flags` 选项中来打开 `manifests` vcpkg功能标记, @@ -287,13 +287,14 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/ ``` 您所安装的库将生成在 `vcpkg_installed` 文件夹中,并与您的 `vcpkg.json` 所在的文件夹相同。 -如果您可以使用常规的CMake toolchain 或 Visual Studio / MSBuild 集成, -它将自动安装依赖项,尽管您需要将MSBuild的 `VcpkgManifestEnabled` 设置为 `On`。 -如果您希望不使用CMake或MSBuild来安装依赖项,您可以使用命令 `vcpkg install --feature-flags = manifests` 。 +如果您可以使用常规的 CMake toolchain 或 Visual Studio / MSBuild 集成, +它将自动安装依赖项,您需要将MSBuild的 `VcpkgManifestEnabled` 设置为 `On`。 +如果您希望不使用 CMake 或 MSBuild 来安装依赖项,您可以使用命令 `vcpkg install --feature-flags = manifests` 。 请查阅 [清单][getting-started:manifest-spec] 获取更多信息。 [getting-started:using-a-package]: docs/examples/intalling-and-using-packages.md +[getting-started:integration]: docs/users/integration.md [getting-started:git]: https://git-scm.com/downloads [getting-started:cmake-tools]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools [getting-started:linux-gcc]: #installing-linux-developer-tools @@ -306,7 +307,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/ # Tab补全/自动补全 `vcpkg` 支持命令,包名称,以及 Powershell 和 Bash 中的选项。 -要在您选择的 shell 中启用Tab补全功能,请运行: +若您需要在指定的 shell 中启用Tab补全功能,请依据您使用的shell运行: ```pwsh > .\vcpkg integrate powershell @@ -318,14 +319,14 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/ $ ./vcpkg integrate bash ``` -这依据您使用的shell,然后重新启动控制台。 +然后重新启动控制台。 ## 示例 -请查看 [文档](docs/index.md)获取具体示例, +请查看 [文档](docs/index.md) 获取具体示例, 其包含 [安装并使用包](docs/examples/installing-and-using-packages.md), -[使用压缩文件添加包](docs/examples/packaging-zipfiles.md), -与 [从GitHub源中添加一个包](docs/examples/packaging-github-repos.md)。 +[使用压缩文件添加包](docs/examples/packaging-zipfiles.md) +和 [从GitHub源中添加一个包](docs/examples/packaging-github-repos.md)。 我们的文档现在也可以从 [ReadTheDocs](https://vcpkg.readthedocs.io/) 在线获取。