-
Notifications
You must be signed in to change notification settings - Fork 604
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
build: Use target_compile_options #4556
build: Use target_compile_options #4556
Conversation
|
This looks reasonable, thanks for the fix. |
When using pkgconfig the value of `<NAME>_CFLAGS_OTHER` can contain compiler flags along with preprocessor definitions. If there is a compiler flag and its passed to `target_compile_definitions` then it will be treated as if it is a preprocessor definition. Found a case where a statically compiled LibRaw with a statically compiled Little-CMS caused `LibRaw_DEFINITIONS` to have `-pthread` in its listing which was passed to the compiler as a definition, `-D-pthread`. This caused a build failure with `auto-moc`. Add an additional parameter for the `add_oiio_plugin` macro to take `COMPILE_OPTIONS` and pass those to `target_compile_options` which can differentiate between compiler flags and preprocessor definitions. Pass `LibRaw_DEFINITIONS` to the CMake macro to prevent the above error. Signed-off-by: Don Olmstead <don.j.olmstead@gmail.com>
4369b8c
to
4e6a2ac
Compare
Done. Thanks for the speedy review! |
Ok looks like everything is happy @lgritz |
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.
LGTM, thanks for the fix!
I'll backport this to the next 3.0 and 2.5 patches. |
Thanks @lgritz ! I will update the vcpkg port once you get it on the 3.0 branch. You might want to look at https://github.com/microsoft/vcpkg/tree/master/ports/openimageio to see if there are any other patches that might be of interest to the project there. |
Quick glance:
It's hard to evaluate without understanding exactly why each of these change were made. But in general, any of them that are still relevant and necessary, I think we'd be happy to have them "upstreamed". It seems more maintainable for our build scripts to work for vcpkg out of the box, even if they have an occasional "if vcpkg" logic somewhere, than to have a lot of patches added on your end that we could break at any time without really being aware that they exist. I'd prefer that everything be attempted to be upstreamed, and only have vcpkg-side patches for the few things that for whatever reason we aren't able to accept. |
@lgritz In general we try to avoid patching anything that would result in 'putting words in one's mouth'; build system changes that adapt how dependencies are found to the way they are deployed in vcpkg we will often just take, but if there's something that would be very visible to users or touches sources meaningfully we're going to want upstream to at least look first. https://learn.microsoft.com/vcpkg/contributing/maintainer-guide#patching
Hmmm this should have probably been submitted upstream. I don't know exactly why it was added either in https://github.com/microsoft/vcpkg/pull/27766/files .
I'm not sure I understand; as far as I can tell that OIIO no longer supports Imath 2.x is exactly why this patch is here, to warn people that that combination will explode. |
…mySoftwareFoundation#4556) When using pkgconfig the value of `<NAME>_CFLAGS_OTHER` can contain compiler flags along with preprocessor definitions. If there is a compiler flag and its passed to `target_compile_definitions` then it will be treated as if it is a preprocessor definition. Found a case where a statically compiled LibRaw with a statically compiled Little-CMS caused `LibRaw_DEFINITIONS` to have `-pthread` in its listing which was passed to the compiler as a definition, `-D-pthread`. This caused a build failure with `auto-moc`. Add an additional parameter for the `add_oiio_plugin` macro to take `COMPILE_OPTIONS` and pass those to `target_compile_options` which can differentiate between compiler flags and preprocessor definitions. Pass `LibRaw_DEFINITIONS` to the CMake macro to prevent the above error. Issue found while updating Little-CMS in microsoft/vcpkg#42187 and the change fixes the build issue found there. This is an attempt to upstream it so the issue is fixed. Signed-off-by: Don Olmstead <don.j.olmstead@gmail.com>
…mySoftwareFoundation#4556) When using pkgconfig the value of `<NAME>_CFLAGS_OTHER` can contain compiler flags along with preprocessor definitions. If there is a compiler flag and its passed to `target_compile_definitions` then it will be treated as if it is a preprocessor definition. Found a case where a statically compiled LibRaw with a statically compiled Little-CMS caused `LibRaw_DEFINITIONS` to have `-pthread` in its listing which was passed to the compiler as a definition, `-D-pthread`. This caused a build failure with `auto-moc`. Add an additional parameter for the `add_oiio_plugin` macro to take `COMPILE_OPTIONS` and pass those to `target_compile_options` which can differentiate between compiler flags and preprocessor definitions. Pass `LibRaw_DEFINITIONS` to the CMake macro to prevent the above error. Issue found while updating Little-CMS in microsoft/vcpkg#42187 and the change fixes the build issue found there. This is an attempt to upstream it so the issue is fixed. Signed-off-by: Don Olmstead <don.j.olmstead@gmail.com>
…mySoftwareFoundation#4556) When using pkgconfig the value of `<NAME>_CFLAGS_OTHER` can contain compiler flags along with preprocessor definitions. If there is a compiler flag and its passed to `target_compile_definitions` then it will be treated as if it is a preprocessor definition. Found a case where a statically compiled LibRaw with a statically compiled Little-CMS caused `LibRaw_DEFINITIONS` to have `-pthread` in its listing which was passed to the compiler as a definition, `-D-pthread`. This caused a build failure with `auto-moc`. Add an additional parameter for the `add_oiio_plugin` macro to take `COMPILE_OPTIONS` and pass those to `target_compile_options` which can differentiate between compiler flags and preprocessor definitions. Pass `LibRaw_DEFINITIONS` to the CMake macro to prevent the above error. Issue found while updating Little-CMS in microsoft/vcpkg#42187 and the change fixes the build issue found there. This is an attempt to upstream it so the issue is fixed. Signed-off-by: Don Olmstead <don.j.olmstead@gmail.com>
Description
When using pkgconfig the value of
<NAME>_CFLAGS_OTHER
can contain compiler flags along with preprocessor definitions. If there is a compiler flag and its passed totarget_compile_definitions
then it will be treated as if it is a preprocessor definition.Found a case where a statically compiled LibRaw with a statically compiled Little-CMS caused
LibRaw_DEFINITIONS
to have-pthread
in its listing which was passed to the compiler as a definition,-D-pthread
. This caused a build failure withauto-moc
.Add an additional parameter for the
add_oiio_plugin
macro to takeCOMPILE_OPTIONS
and pass those totarget_compile_options
which can differentiate between compiler flags and preprocessor definitions. PassLibRaw_DEFINITIONS
to the CMake macro to prevent the above error.Tests
Issue found while updating Little-CMS in microsoft/vcpkg#42187 and the change fixes the build issue found there. This is an attempt to upstream it so the issue is fixed.
Checklist:
need to update the documentation, for example if this is a bug fix that
doesn't change the API.)
(adding new test cases if necessary).
corresponding Python bindings (and if altering ImageBufAlgo functions, also
exposed the new functionality as oiiotool options).
already run clang-format before submitting, I definitely will look at the CI
test that runs clang-format and fix anything that it highlights as being
nonconforming.