From 8d5c43272e8e5b9fa5b4fb5e29933f1f1d098e1d Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 25 Nov 2021 14:03:53 -0500 Subject: [PATCH] doc: update instructions for macOS (#7668) --- ...wto-guide-setup-development-workstation.md | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/doc/contributor/howto-guide-setup-development-workstation.md b/doc/contributor/howto-guide-setup-development-workstation.md index da9839a3ca38e..1b7b3ae8334f4 100644 --- a/doc/contributor/howto-guide-setup-development-workstation.md +++ b/doc/contributor/howto-guide-setup-development-workstation.md @@ -304,31 +304,28 @@ git clone git@github.com:/google-cloud-cpp.git cd google-cloud-cpp ``` -### Running the CI scripts +### Manual builds with CMake -The CI scripts follow a similar pattern to the scripts for Linux and Windows: +The [guide](/doc/contributor/howto-guide-setup-cmake-environment.md) generally +works for macOS too. We recommend using `Ninja` and `vcpkg` for development. +When using `vcpkg` you should disable the OpenSSL checks: ```shell -./ci/kokoro/macos/build.sh bazel # <-- Run the `bazel` CI build -./ci/kokoro/macos/build.sh cmake-vcpkg # <-- Build with CMake +git clone -C $HOME https://github.com/microsoft/vcpkg.git +env VCPKG_ROOT=$HOME/vcpkg $HOME/vcpkg/bootstrap-vcpkg.sh +cmake -GNinja -S. -Bcmake-out/ \ + -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DGOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK=OFF +cmake --build cmake-out ``` -### Manual builds with CMake +### Running the CI scripts -The [guide](/doc/contributor/howto-guide-setup-cmake-environment.md) generally -works for macOS too. The only difference is the configuration for OpenSSL. The -native OpenSSL library on macOS does not work, but the one distributed by -`homebrew` does. You **must** set the `OPENSSL_ROOT_DIR` environment variable -before configuring CMake, so CMake can use this alternative version. You cannot -just pass this as a `-D` option to CMake, because the value must recurse to all -the external projects. There is an example of this in the -[vcpkg build script](/ci/kokoro/macos/builds/cmake-vcpkg.sh). +The CI scripts follow a similar pattern to the scripts for Linux and Windows: ```shell -git clone -C $HOME https://github.com/microsoft/vcpkg.git -env VCPKG_ROOT=$HOME/vcpkg $HOME/vcpkg/bootstrap-vcpkg.sh -cmake -H. -Bcmake-out/ -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake -cmake --build cmake-out -- -j $(nproc) +./ci/kokoro/macos/build.sh bazel # <-- Run the `bazel` CI build +./ci/kokoro/macos/build.sh cmake-vcpkg # <-- Build with CMake ``` ## Appendix: Linux VM on Google Compute Engine