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

Fix libjpeg-turbo build for Android #8592

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions recipes/libjpeg-turbo/all/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ project(cmake_wrapper)
include(conanbuildinfo.cmake)
conan_basic_setup(NO_OUTPUT_DIRS)

if(NOT CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CONAN_LIBJPEG_SYSTEM_PROCESSOR})
endif()
Comment on lines +8 to +10
Copy link
Contributor

@SpaceIm SpaceIm Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some experimentations in libpng and using the same trick, I've found it should be:

if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR STREQUAL "")
    set(CMAKE_SYSTEM_PROCESSOR ${CONAN_LIBJPEG_SYSTEM_PROCESSOR})
endif()

Indeed, CMAKE_SYSTEM_PROCESSOR seems to always be defined, just empty by default if cross-building.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, no it's fine, it doesn't check if CMAKE_SYSTEM_PROCESSOR is defined, so it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"STREQUAL" check is surely more strict, but I can't imagine any sane value for this variable which could be rejected by simple "NOT".

However there are cases in CMake when its necessary to check a variable for emptiness. It's done simply by taking it's value in the quotes:

if("${VAR}" STREQUAL "")

There's no need to check if it's defined.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this check is perfectly fine, my bad, I thought the check was if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really, I tried NOT DEFINED first, but it didn't work, so I switched to just NOT.



add_subdirectory("source_subfolder")
2 changes: 1 addition & 1 deletion recipes/libjpeg-turbo/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _configure_cmake(self):
"armv8": "aarch64",
"armv8.3": "aarch64",
}.get(str(self.settings.arch), str(self.settings.arch))
self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor
self._cmake.definitions["CONAN_LIBJPEG_SYSTEM_PROCESSOR"] = cmake_system_processor

self._cmake.configure()
return self._cmake
Expand Down