Skip to content

Fix: interface_library should be used with shared_library on Windows - #11355

Merged
lasote merged 1 commit into
conan-io:developfrom
kkpattern:fix/shared-lib-on-windows-should-use-interface
May 31, 2022
Merged

lasote merged 1 commit into
conan-io:developfrom
kkpattern:fix/shared-lib-on-windows-should-use-interface

Conversation

@kkpattern

@kkpattern kkpattern commented May 28, 2022

Copy link
Copy Markdown
Contributor

Changelog: Fix: Use interface_library with shared_library on Windows in BazelDeps.
Docs: omit
Close: #11347

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.

When importing shared libraries, check if there is a corresponding DLL file in the bin directory. If the DLL file exists, we should use cc_import of the form:

cc_import(
    name = "libname",
    interface_library = "lib/libname.lib",
    shared_library = "bin/libname.dll",
)

Bazel doc here.

I also added a new MockConanFileDeps to avoid the infinite loop in unittest(No need to patch the conans.ConanFile.dependecies for all).

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

@kkpattern
kkpattern force-pushed the fix/shared-lib-on-windows-should-use-interface branch from 0f433c5 to 154d301 Compare May 28, 2022 14:29
@kkpattern
kkpattern force-pushed the fix/shared-lib-on-windows-should-use-interface branch from 154d301 to 48fcc63 Compare May 29, 2022 11:52

@memsharded memsharded left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is looking nice and clean (despite the problem is intrinsically a bit complex, given the context information), so thanks very much for contributing it.

@memsharded memsharded added this to the 1.49 milestone May 29, 2022
@memsharded
memsharded requested a review from lasote May 31, 2022 10:58
@lasote
lasote merged commit a98bb36 into conan-io:develop May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Bazeldeps: build file is not correct for shared libary on Windows platform

4 participants