-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[libjpeg-turbo] Fixes cross compilation for armv8 #3392
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,9 @@ class LibjpegTurboConan(ConanFile): | |
"mem_src_dst": [True, False], | ||
"turbojpeg": [True, False], | ||
"java": [True, False], | ||
"enable12bit": [True, False]} | ||
"enable12bit": [True, False], | ||
"keep_binaries": [True, False], | ||
} | ||
default_options = {"shared": False, | ||
"fPIC": True, | ||
"SIMD": True, | ||
|
@@ -36,7 +38,9 @@ class LibjpegTurboConan(ConanFile): | |
"mem_src_dst": True, | ||
"turbojpeg": True, | ||
"java": False, | ||
"enable12bit": False} | ||
"enable12bit": False, | ||
"keep_binaries" : False, | ||
} | ||
|
||
_cmake = None | ||
|
||
|
@@ -89,11 +93,16 @@ def build_requirements(self): | |
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename(self.name + "-" + self.version, self._source_subfolder) | ||
if tools.cross_building(self.settings): | ||
tools.replace_in_file(os.path.join(self._source_subfolder,"CMakeLists.txt"),"CMAKE_SYSTEM_PROCESSOR","CMAKE_SYSTEM_PROCESSOR_TARGET") | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self._cmake = CMake(self, set_cmake_flags=True) | ||
if tools.cross_building(self.settings): | ||
if self.settings.arch == "armv8": | ||
self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR_TARGET"] = "aarch64" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure why the only armv8 is affected? maybe there is a wider conan issue? /cc @jgsogo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm with @SpaceIm , I don't know what is CMAKE_SYSTEM_PROCESSOR_TARGET, I cannot find it in CMake docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The OP is replacing the standard variable with a custom one for the recipe |
||
self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared | ||
self._cmake.definitions["ENABLE_SHARED"] = self.options.shared | ||
self._cmake.definitions["WITH_SIMD"] = self.options.get_safe("SIMD", False) | ||
|
@@ -134,9 +143,10 @@ def package(self): | |
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
tools.rmdir(os.path.join(self.package_folder, "doc")) | ||
# remove binaries and pdb files | ||
for pattern_to_remove in ["cjpeg*", "djpeg*", "jpegtran*", "tjbench*", "wrjpgcom*", "rdjpgcom*", "*.pdb"]: | ||
for bin_file in glob.glob(os.path.join(self.package_folder, "bin", pattern_to_remove)): | ||
os.remove(bin_file) | ||
if not self.options.keep_binaries: | ||
for pattern_to_remove in ["cjpeg*", "djpeg*", "jpegtran*", "tjbench*", "wrjpgcom*", "rdjpgcom*", "*.pdb"]: | ||
for bin_file in glob.glob(os.path.join(self.package_folder, "bin", pattern_to_remove)): | ||
os.remove(bin_file) | ||
Comment on lines
+146
to
+149
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't keep pdb files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this is unrelated change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the executables are already generated, why removing them from the package? I would say that storage is not an issue nowadays (at least, it isn't for us in ConanCenter). I would remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KristianJerpetjon |
||
|
||
def package_info(self): | ||
self.cpp_info.components["jpeg"].names["pkg_config"] = "libjpeg" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patch in
build()
instead ofsource()
please.What is
CMAKE_SYSTEM_PROCESSOR_TARGET
?CMAKE_SYSTEM_PROCESSOR
is already the target architecture.