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

[bugfix] Shared libraries in Windows (.dll.lib not found as interface) #529

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions hooks/yaml_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import subprocess

from conans.errors import ConanException
from conans.tools import logger


CONAN_HOOK_YAMLLINT_WERR = "CONAN_YAMLLINT_WERR"

Expand Down
28 changes: 28 additions & 0 deletions tests/test_hooks/conan-center/test_packaging_static_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@ def package_info(self):
self.cpp_info.libs = ["foo"]
""")

conanfile_test_shared_windows = textwrap.dedent("""\
from conan import ConanFile
import os

class AConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {"shared": False}

def package(self):
libdir = os.path.join(self.package_folder, "lib")
bindir = os.path.join(self.package_folder, "bin")
os.makedirs(libdir)
os.makedirs(bindir)
# Issue related: https://github.com/conan-io/hooks/issues/528
open(os.path.join(libdir, "libfoo.dll.lib"), "w")
open(os.path.join(bindir, "libfoo.dll"), "w")

def package_info(self):
self.cpp_info.libs = ["foo"]
""")
def _get_environ(self, **kwargs):
kwargs = super(TestPackagingStaticSharedLibraries, self)._get_environ(**kwargs)
kwargs.update({
Expand Down Expand Up @@ -106,3 +127,10 @@ def test_either_shared_or_static(self, shared, hook_ok):
self.assertIn("[EITHER STATIC OR SHARED OF EACH LIB (KB-H076)] OK", output)
else:
self.assertIn("ERROR: [EITHER STATIC OR SHARED OF EACH LIB (KB-H076)] Package contains both shared and static flavors of these libraries: libfoo, libfoobar", output)

def test_shared_windows(self):
tools.save("conanfile.py", content=self.conanfile_test_shared_windows)
output = self.conan([
"create", ".", "name/version@user/test", "-o", "shared=True"])
self.assertNotIn("[LIBRARY DOES NOT EXIST (KB-H054)] Component name::name library 'foo' is listed in the "
"recipe, but not found installed at self.cpp_info.libdirs", output)
3 changes: 2 additions & 1 deletion tests/utils/test_cases/conan_client_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import uuid
import subprocess

from conan.cli.exit_codes import SUCCESS
from conans.cli.exit_codes import SUCCESS

from tests.utils.environ_vars import context_env


Expand Down