git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 4/4] cmake(install): include vcpkg dlls

From
DGDennis Ameling via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 29, 2021, 12:41 UTC
Message-ID
<f020cb517dfc48e2619815e09110d4044eed1ebe.1617021705.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.887.v2.git.1617021705.gitgitgadget@gmail.com>
From: Dennis Ameling <dennis@dennisameling.com>

Our CMake configuration generates not only build definitions, but also install definitions: After building Git using `msbuild git.sln`, the built artifacts can be installed via `msbuild INSTALL.vcxproj`.

To specify _where_ the files should be installed, the `-DCMAKE_INSTALL_PREFIX=<path>` option can be used when running CMake.

However, this process would really only install the files that were just built. On Windows, we need more than that: We also need the `.dll` files of the dependencies (such as libcurl). The `vcpkg` ecosystem, which we use to obtain those dependencies, can be asked to install said `.dll` files really easily, so let's do that.

This requires more than just the built `vcpkg` artifacts in the CI build definition; We now clone the `vcpkg` repository so that the relevant CMake scripts are available, in particular the ones related to defining the toolchain.

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 .github/workflows/main.yml          | 5 +++++
 contrib/buildsystems/CMakeLists.txt | 4 ++++
 2 files changed, 9 insertions(+)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f6885e88ee6b..c13afe2bf058 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -186,6 +186,11 @@ jobs:
         ## Unzip and remove the artifact
         unzip artifacts.zip
         rm artifacts.zip
+    - name: initialize vcpkg
+      uses: actions/checkout@v2
+      with:
+        repository: 'microsoft/vcpkg'
+        path: 'compat/vcbuild/vcpkg'
     - name: download vcpkg artifacts
       shell: powershell
       run: |
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 3b94b5f62109..485c7662dc58 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -58,6 +58,10 @@ if(WIN32)
 
 	# In the vcpkg edition, we need this to be able to link to libcurl
 	set(CURL_NO_CURL_CMAKE ON)
+
+	# Copy the necessary vcpkg DLLs (like iconv) to the install dir
+	set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
+	set(CMAKE_TOOLCHAIN_FILE ${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
 endif()
 
 find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin")
-- 
gitgitgadget
Previous: Dennis Ameling via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 11 of 12 in “cmake: learn to optionally skip linking dashed built-ins”
  1. 0/4 cmake: learn to optionally skip linking dashed built-insJohannes Schindelin via GitGitGadget, Mar 27, 2021
  2. 1/4 cmake: support SKIP_DASHED_BUILT_INSJohannes Schindelin via GitGitGadget, Mar 27, 2021
  3. 2/4 cmake(install): fix double .exe suffixesDennis Ameling via GitGitGadget, Mar 27, 2021
  4. 3/4 cmake: add a preparatory work-around to accommodate `vcpkg`Johannes Schindelin via GitGitGadget, Mar 27, 2021
  5. Đoàn Trần Công DanhMar 28, 2021
  6. Johannes SchindelinMar 29, 2021
  7. 4/4 cmake(install): include vcpkg dllsDennis Ameling via GitGitGadget, Mar 27, 2021
  8. 0/4 cmake: learn to optionally skip linking dashed built-insJohannes Schindelin via GitGitGadget, Mar 29, 2021
  9. 1/4 cmake: support SKIP_DASHED_BUILT_INSJohannes Schindelin via GitGitGadget, Mar 29, 2021
  10. 2/4 cmake(install): fix double .exe suffixesDennis Ameling via GitGitGadget, Mar 29, 2021
  11. 4/4 cmake(install): include vcpkg dllsDennis Ameling via GitGitGadget, Mar 29, 2021
  12. 3/4 cmake: add a preparatory work-around to accommodate `vcpkg`Johannes Schindelin via GitGitGadget, Mar 29, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.