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

- [libgettext] fix clang-cl #9994

Merged
merged 1 commit into from
Apr 9, 2022
Merged
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
23 changes: 15 additions & 8 deletions recipes/libgettext/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def _source_subfolder(self):
def _is_msvc(self):
return str(self.settings.compiler) in ["Visual Studio", "msvc"]

@property
def _is_clang_cl(self):
return str(self.settings.compiler) in ["clang"] and str(self.settings.os) in ["Windows"]

@property
def _gettext_folder(self):
return "gettext-tools"
Expand Down Expand Up @@ -71,7 +75,7 @@ def _user_info_build(self):
def build_requirements(self):
if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"):
self.build_requires("msys2/cci.latest")
if self._is_msvc:
if self._is_msvc or self._is_clang_cl:
self.build_requires("automake/1.16.4")

def source(self):
Expand Down Expand Up @@ -102,7 +106,7 @@ def build(self):
args.extend(["--disable-static", "--enable-shared"])
else:
args.extend(["--disable-shared", "--enable-static"])
if self._is_msvc:
if self._is_msvc or self._is_clang_cl:
# INSTALL.windows: Native binaries, built using the MS Visual C/C++ tool chain.
build = False
if self.settings.arch == "x86":
Expand All @@ -111,16 +115,19 @@ def build(self):
elif self.settings.arch == "x86_64":
host = "x86_64-w64-mingw32"
rc = "windres --target=pe-x86-64"
args.extend(["CC=%s cl -nologo" % tools.unix_path(self._user_info_build["automake"].compile),
"LD=link",
cl = "cl" if self._is_msvc else os.environ.get("CC", 'clang-cl')
lib = "lib" if self._is_msvc else os.environ.get('AR', "llvm-lib")
link = "link" if self._is_msvc else os.environ.get("LD", "lld-link")
args.extend(["CC=%s %s -nologo" % (tools.unix_path(self._user_info_build["automake"].compile), cl),
"LD=%s" % link,
"NM=dumpbin -symbols",
"STRIP=:",
"AR=%s lib" % tools.unix_path(self._user_info_build["automake"].ar_lib),
"AR=%s %s" % (tools.unix_path(self._user_info_build["automake"].ar_lib), lib),
"RANLIB=:"])
if rc:
args.extend(['RC=%s' % rc, 'WINDRES=%s' % rc])
with tools.vcvars(self.settings) if self._is_msvc else tools.no_op():
with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op():
with tools.vcvars(self.settings) if (self._is_msvc or self._is_clang_cl) else tools.no_op():
with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if (self._is_msvc or self._is_clang_cl) else tools.no_op():
with tools.chdir(os.path.join(self._source_subfolder, self._gettext_folder)):
env_build = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
if self._is_msvc:
Expand All @@ -140,7 +147,7 @@ def package(self):
self.copy(pattern="*libgnuintl.h", dst="include", src=self._source_subfolder, keep_path=False)
tools.rename(os.path.join(self.package_folder, "include", "libgnuintl.h"),
os.path.join(self.package_folder, "include", "libintl.h"))
if self._is_msvc and self.options.shared:
if (self._is_msvc or self._is_clang_cl) and self.options.shared:
tools.rename(os.path.join(self.package_folder, "lib", "gnuintl.dll.lib"),
os.path.join(self.package_folder, "lib", "gnuintl.lib"))

Expand Down