Skip to content

Commit

Permalink
Attempt to build properly on windows and mac
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Jun 16, 2024
1 parent 5c33c20 commit 3804deb
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions recipes/libiconv/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,26 @@ def generate(self):
}[self.settings.get_safe("arch")]
api_level = self.settings.os.get_safe("api_level")

# @TODO: this toolchain path probably doesn't work on anything that is not x86_64 linux
toolchain = os.path.join(android_ndk_home, "toolchains", "llvm", "prebuilt", "linux-x86_64", "bin")

# @TODO: binary names may be wrong for older NDK versions too
env.define("AR", os.path.join(toolchain, "llvm-ar"))
env.define("AS", os.path.join(toolchain, "llvm-as"))
env.define("RANLIB", os.path.join(toolchain, "llvm-ranlib"))
env.define("CC", os.path.join(toolchain, "{}{}-clang".format(target_host_triple, api_level)))
env.define("CXX", os.path.join(toolchain, "{}{}-clang++".format(target_host_triple, api_level)))
env.define("LD", os.path.join(toolchain, "ld"))
env.define("STRIP", os.path.join(toolchain, "llvm-strip"))
build_machine = "{}-x86_64".format({
"Linux": "linux",
"Macos": "darwin",
"Windows": "windows",
}[self.settings_build.os])

toolchain = os.path.join(android_ndk_home, "toolchains", "llvm", "prebuilt", build_machine, "bin")

if self.settings_build.os == "Windows":
executable_suffix = ".exe"
else:
executable_suffix = ""

env.define("AR", os.path.join(toolchain, "llvm-ar" + executable_suffix))
env.define("AS", os.path.join(toolchain, "llvm-as" + executable_suffix))
env.define("RANLIB", os.path.join(toolchain, "llvm-ranlib" + executable_suffix))
env.define("CC", os.path.join(toolchain, "{}{}-clang{}".format(target_host_triple, api_level, executable_suffix)))
env.define("CXX", os.path.join(toolchain, "{}{}-clang++{}".format(target_host_triple, api_level, executable_suffix)))
env.define("LD", os.path.join(toolchain, "ld" + executable_suffix))
env.define("STRIP", os.path.join(toolchain, "llvm-strip" + executable_suffix))

tc.generate(env)

Expand Down

0 comments on commit 3804deb

Please sign in to comment.