CMake: also find jconfig.h from libturbojpeg from arch-specific include directory#3640
CMake: also find jconfig.h from libturbojpeg from arch-specific include directory#3640illwieckz wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
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 <dev@illwieckz.net>
| endif() | ||
|
|
||
| if (NOT jconfig_header_file) | ||
| message(FATAL_ERROR "Cannot find jconfig.h from libturbojpeg") |
There was a problem hiding this comment.
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.
@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.
Sorry, I was busy and totally forgot about it. I'll look at it again.
There was a problem hiding this comment.
@illwieckz Ping -- can you please take a look here at my previous comment and offer an opinion?
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.
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.hInstead of:
/usr/include/jconfig.hThat 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.