-
Notifications
You must be signed in to change notification settings - Fork 597
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
CMake: also find jconfig.h from libturbojpeg from arch-specific include directory #3640
base: main
Are you sure you want to change the base?
CMake: also find jconfig.h from libturbojpeg from arch-specific include directory #3640
Conversation
…de directory This header file is architecture-dependent and can be stored as: - /usr/include/i386-linux-gnu/jconfig.h - /usr/include/x86_64-linux-gnu/jconfig.h Instead of: - /usr/include/jconfig.h Signed-off-by: Thomas Debesse <[email protected]>
endif() | ||
|
||
if (NOT jconfig_header_file) | ||
message(FATAL_ERROR "Cannot find jconfig.h from libturbojpeg") |
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.
I'm not so sure about the FATAL_ERROR here -- if this header can't be found, I think we want only the find_package(JPEGTurbo) to not succeed, and then to fall back on regular find_package(JPEG). We don't want the entire cmake build to fail.
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.
@illwieckz Any comment or further action on this? In general, I think it's fine except for the FATAL_ERROR part.
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.
Sorry, I was busy and totally forgot about it. I'll look at it again.
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.
@illwieckz Ping -- can you please take a look here at my previous comment and offer an opinion?
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.
Changed to a WARNING
.
c5c393c
to
dd08cd8
Compare
file(STRINGS "${jconfig_header_file}" | ||
jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*") |
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.
This line file(STRINGS ...)
needs to be inside an if (jconfig_header_file)
conditional. If the header is not found, trying to extract strings from it results in a build-breaking cmake error, as you can see from the windows CI job.
Starting with version 2.1.0 libjpeg-turbo provides it's own cmake config files, but they are named different to what is used in oiio cmake files.
Should be changed to:
so that distro provided library is detected if present. |
That's interesting, @domin144. I'm tempted to advise abandoning this PR entirely and instead simply removing FindJPEGTurbo.cmake entirely, relying on jpeg-turbo's exported config, and calling it a day. That will mean that we are raising the floor of JPEG-turbo that we support to 2.1. But since that's still 2.5 years old and this is not a required dependency (we can automatically fall back to libjpeg), I think that would be acceptable. Opinions? |
I tried the other strategy here: #3987 What do people think of that proposal, which would obviate the need for this one here? |
Description
This header file is architecture-dependent and can be stored as:
/usr/include/i386-linux-gnu/jconfig.h
/usr/include/x86_64-linux-gnu/jconfig.h
Instead of:
/usr/include/jconfig.h
That fixes build errors like this:
Checklist:
If this is more extensive than a small change to existing code, Ihave previously submitted a Contributor License Agreement
(individual, and if there is any way my
employers might think my programming belongs to them, then also
corporate).
This change is too small and not original enough to be subject to copyright.
I have updated the documentation, if applicable.Not applicable.
I have ensured that the change is tested somewhere in the testsuite(adding new test cases if necessary).
Not applicable.