Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I build DLLs from vcpkg into CPacked installer? #18943

Closed
SamuelMarks opened this issue Jul 14, 2021 · 7 comments
Closed

How do I build DLLs from vcpkg into CPacked installer? #18943

SamuelMarks opened this issue Jul 14, 2021 · 7 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support category:question This issue is a question

Comments

@SamuelMarks
Copy link
Contributor

SamuelMarks commented Jul 14, 2021

The cpack executable is the CMake packaging program. It generates installers and source packages in a variety of formats.

I'm using cpack -G WIX -C Debug on my SamuelMarks/cmake-example-with-vcpkg. Which produces a nice installer, but it doesn't copy/install zlibd1.dll (from vcpkg).

How is this meant to work?

@NancyLi1013 NancyLi1013 added the category:question This issue is a question label Jul 14, 2021
@jakoch
Copy link

jakoch commented Jul 18, 2021

Hey!
Copying the dependencies automatically is still experimental, but you can try setting X_VCPKG_APPLOCAL_DEPS_INSTALL to ON.
That should copy dependencies into the install target directory for executables.

Add to CMakeLists.txt:

    # X_VCPKG_APPLOCAL_DEPS_INSTALL depends on CMake policy CMP0087 and requires CMake 3.14
    if(POLICY CMP0087)
        cmake_policy(SET CMP0087 NEW)
    endif()

    set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)

Referencing: #1653 + #16557

@SamuelMarks
Copy link
Contributor Author

Thanks I added that but it didn't copy the DLLs over. Is it CPack compatible?

@dg0yt
Copy link
Contributor

dg0yt commented Jul 19, 2021

CPack relies on CMake install comands and additional staging directories. I have no ideas if this works with vcpkg's staging, install, and applocal install. For cross-platform deployment of DLLs without vcpkg, I normally use CMake's BundleUtilities. IIUC parts of these functions now even became part of the file command (https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies).

@SamuelMarks
Copy link
Contributor Author

@JackBoosY
Copy link
Contributor

Thanks I added that but it didn't copy the DLLs over. Is it CPack compatible?

Did you run cmake install command?

@dg0yt
Copy link
Contributor

dg0yt commented Jul 19, 2021

Thanks I added that but it didn't copy the DLLs over. Is it CPack compatible?

Did you run cmake install command?

CPack is running cmake install.

it doesn't copy/install zlibd1.dll (from vcpkg).

  • Note that the wrapper for zlib is missing, [zlib] Add cmake wrapper #18914, which may cause some strange effects.
  • If not using a multi-config generator, don't let CMAKE_BUILD_TYPE be unset, or there will be strange effects.

@JackBoosY JackBoosY added the category:port-bug The issue is with a library, which is something the port should already support label Jul 19, 2021
@JackBoosY
Copy link
Contributor

We hope your question was answered to your satisfaction; if it wasn't, you can reopen with more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

5 participants