Skip to content

Commit

Permalink
(#9988) fix windows clang compilation for ffi
Browse files Browse the repository at this point in the history
* fix windows clang compilation for ffi

* fix for windows/mingw
  • Loading branch information
AndreyMlashkin committed Apr 1, 2022
1 parent 105f60f commit 00dbcae
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions recipes/libffi/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,17 @@ def _patch_sources(self):
@contextlib.contextmanager
def _build_context(self):
extra_env_vars = {}
if self._is_msvc:
if tools.os_info.is_windows and (self._is_msvc or self.settings.compiler == "clang") :
msvcc = tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "msvcc.sh"))
msvcc_args = []
if self.settings.arch == "x86_64":
msvcc_args.append("-m64")
elif self.settings.arch == "x86":
msvcc_args.append("-m32")
if self._is_msvc:
if self.settings.arch == "x86_64":
msvcc_args.append("-m64")
elif self.settings.arch == "x86":
msvcc_args.append("-m32")
elif self.settings.compiler == "clang":
msvcc_args.append("-clang-cl")

if msvcc_args:
msvcc = "{} {}".format(msvcc, " ".join(msvcc_args))
extra_env_vars.update(tools.vcvars_dict(self.settings))
Expand Down Expand Up @@ -178,3 +182,4 @@ def package_info(self):
self.cpp_info.libs = ["{}ffi".format("lib" if self._is_msvc else "")]
if not self.options.shared:
self.cpp_info.defines = ["FFI_BUILDING"]

0 comments on commit 00dbcae

Please sign in to comment.