Skip to content

fix: install DLL to bin directory on Windows - #408

Merged
BLumia merged 1 commit into
linuxdeepin:masterfrom
kt286:fix/windows-cmake
Aug 21, 2026
Merged

BLumia merged 1 commit into
linuxdeepin:masterfrom
kt286:fix/windows-cmake

Conversation

@kt286

@kt286 kt286 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Replace compiler-specific -Wl,--export-all-symbols linker flag with the cmake target property WINDOWS_EXPORT_ALL_SYMBOLS ON. This is the recommended cross-platform approach and avoids polluting global linker flags.

Also split the install(TARGETS) command into per-component destinations (LIBRARY, ARCHIVE, RUNTIME) so that DLL files are installed to the bin directory on Windows, which is required by the Windows runtime loader.

fix: 在 Windows 上使用 WINDOWS_EXPORT_ALL_SYMBOLS 并修复 DLL 安装路径

用 CMake target 属性 WINDOWS_EXPORT_ALL_SYMBOLS ON 替代编译器特定的 -Wl,--export-all-symbols 链接器标志,这是推荐的跨平台做法,避免污染
全局链接器标志。

同时将 install(TARGETS) 拆分为按组件指定安装目录(LIBRARY、ARCHIVE、 RUNTIME),使 DLL 文件在 Windows 上安装到 bin 目录,符合 Windows 运行时 加载器的要求。

Summary by Sourcery

Fix Windows symbol exports and ensure runtime libraries are installed in the correct directory.

Bug Fixes:

  • Install Windows DLL runtime files to the binary installation directory so they can be located by the Windows runtime loader.

Enhancements:

  • Use the CMake target property for exporting all symbols instead of a compiler-specific global linker flag.

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Hi @kt286. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@github-actions

Copy link
Copy Markdown
Contributor
  • 检测到敏感词export变动
详情
    {
    "export": {
        "dtkgui.cmake": {
            "a": [
                "  set(CMAKE_SHARED_LINKER_FLAGS \"${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols\")"
            ]
        }
    }
}

@sourcery-ai

sourcery-ai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates Windows symbol export handling and fixes DLL installation paths by replacing a global linker flag hack with proper CMake target properties and by splitting install destinations per component so Windows runtime binaries land in the correct directory.

File-Level Changes

Change Details Files
Adjust Windows symbol export handling to avoid compiler-specific global linker flags.
  • Broaden the WIN32 condition so it no longer excludes MSVC builds
  • Continue defining LIBDTKGUI_LIBRARY for Windows builds to mark the shared library
  • Keep using the existing -Wl,--export-all-symbols mechanism under the updated condition
dtkgui.cmake
Correct installation layout for the GUI library so DLLs are installed to the Windows runtime bin directory while libraries and archives remain in the library directory.
  • Replace single DESTINATION-based install(TARGETS) with component-specific destinations
  • Configure LIBRARY and ARCHIVE components to install into the library install directory
  • Configure RUNTIME component (DLLs/EXEs) to install into CMAKE_INSTALL_BINDIR for proper Windows loading
src/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider scoping WINDOWS_EXPORT_ALL_SYMBOLS under a WIN32 condition so the intent that this is a Windows-specific behavior is clearer to future readers, even if it is currently harmless on other platforms.
  • You moved LIBDTKGUI_LIBRARY from a global add_definitions to target_compile_definitions on ${LIB_NAME}; double-check whether any other targets in this project relied on that definition and, if so, set it on those specific targets as well.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider scoping `WINDOWS_EXPORT_ALL_SYMBOLS` under a `WIN32` condition so the intent that this is a Windows-specific behavior is clearer to future readers, even if it is currently harmless on other platforms.
- You moved `LIBDTKGUI_LIBRARY` from a global `add_definitions` to `target_compile_definitions` on `${LIB_NAME}`; double-check whether any other targets in this project relied on that definition and, if so, set it on those specific targets as well.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@kt286
kt286 force-pushed the fix/windows-cmake branch from b0c11b6 to 2ede452 Compare August 20, 2026 06:12
@github-actions

Copy link
Copy Markdown
Contributor
  • 检测到敏感词export变动
详情
    {
    "export": {
        "dtkgui.cmake": {
            "a": [
                "  set(CMAKE_SHARED_LINKER_FLAGS \"${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols\")"
            ]
        }
    }
}

@kt286
kt286 marked this pull request as draft August 20, 2026 06:16
@kt286
kt286 force-pushed the fix/windows-cmake branch 2 times, most recently from 0aee093 to fc0bcee Compare August 20, 2026 12:53
@kt286
kt286 marked this pull request as ready for review August 20, 2026 12:55

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The description mentions switching to WINDOWS_EXPORT_ALL_SYMBOLS, but the code change still relies on the global CMAKE_SHARED_LINKER_FLAGS with -Wl,--export-all-symbols; consider using the target property WINDOWS_EXPORT_ALL_SYMBOLS on the relevant targets instead to align with the stated intent and avoid global flag pollution.
  • The if(WIN32) block now applies -Wl,--export-all-symbols even when using MSVC, which does not understand -Wl options; you may want to keep the NOT MSVC guard or conditionally apply this only for MinGW-like toolchains.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The description mentions switching to `WINDOWS_EXPORT_ALL_SYMBOLS`, but the code change still relies on the global `CMAKE_SHARED_LINKER_FLAGS` with `-Wl,--export-all-symbols`; consider using the target property `WINDOWS_EXPORT_ALL_SYMBOLS` on the relevant targets instead to align with the stated intent and avoid global flag pollution.
- The `if(WIN32)` block now applies `-Wl,--export-all-symbols` even when using MSVC, which does not understand `-Wl` options; you may want to keep the `NOT MSVC` guard or conditionally apply this only for MinGW-like toolchains.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Separate install destinations for LIBRARY, ARCHIVE and RUNTIME to ensure
DLL files are installed to the bin directory on Windows instead of lib.

fix: Windows 平台 DLL 安装到 bin 目录

分离 LIBRARY、ARCHIVE 和 RUNTIME 的安装路径,确保 Windows 平台的 DLL
文件安装到 bin 目录而非 lib 目录。
@kt286
kt286 force-pushed the fix/windows-cmake branch from fc0bcee to 03de8de Compare August 21, 2026 06:16
@kt286 kt286 changed the title fix: use WINDOWS_EXPORT_ALL_SYMBOLS and fix DLL install path on Windows fix: install DLL to bin directory on Windows Aug 21, 2026
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, kt286

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@BLumia
BLumia merged commit a3fb98e into linuxdeepin:master Aug 21, 2026
21 checks passed
@kt286
kt286 deleted the fix/windows-cmake branch August 21, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants