Skip to content

cmake script to auto download and install the openjpeg dependency - #4911

Merged
lgritz merged 4 commits into
AcademySoftwareFoundation:mainfrom
grdanny:openjpeg_autobuild
Oct 15, 2025
Merged

cmake script to auto download and install the openjpeg dependency#4911
lgritz merged 4 commits into
AcademySoftwareFoundation:mainfrom
grdanny:openjpeg_autobuild

Conversation

@grdanny

@grdanny grdanny commented Sep 27, 2025

Copy link
Copy Markdown
Contributor

Description

sub task of : #4387
for sep 2025 dev days.

Adding a autobuild cmake file for openjpeg.

Matching the latest version like in the yet unmerged:
#4910

Tests

I built it locally - I can see it's downloading the files from github and building them.
I can run the tests.

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable. (Check if there is no
    need to update the documentation, for example if this is a bug fix that
    doesn't change the API.)
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • If I added or modified a C++ API call, I have also amended the
    corresponding Python bindings (and if altering ImageBufAlgo functions, also
    exposed the new functionality as oiiotool options).
  • My code follows the prevailing code style of this project. If I haven't
    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.

@grdanny grdanny added the devdays25 Dev Days 2025 label Sep 27, 2025
Comment thread src/cmake/build_OpenJPEG.cmake Outdated
@lgritz

lgritz commented Sep 27, 2025

Copy link
Copy Markdown
Collaborator

I think this is correct, but in ci.yml, in the "all local builds" job, you'll want to remove the setting of env variable OPENJPEG_VERSION=v2.5.4 because that will trigger the external script build_OpenJPEG.bash before the build. You don't want that, in this case you want to be sure you're forcing the autobuild one.

@grdanny
grdanny force-pushed the openjpeg_autobuild branch 5 times, most recently from 80dac5b to d41f053 Compare October 11, 2025 03:05
@grdanny
grdanny marked this pull request as ready for review October 11, 2025 03:37
Signed-off-by: grdanny <danny.gr@gmail.com>
@grdanny
grdanny force-pushed the openjpeg_autobuild branch from 76fd0cb to 71e5199 Compare October 13, 2025 00:56
Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz

lgritz commented Oct 14, 2025

Copy link
Copy Markdown
Collaborator

I pushed some fixes to the OpenJPEG build methodology. It was all about getting correct static libraries built and recognized.

@grdanny

grdanny commented Oct 14, 2025

Copy link
Copy Markdown
Contributor Author

I see, so if I'm running the bash script the does the OpenJpeg build and install I end up with these files:

oiio/ext/dist/lib64/pkgconfig/libopenjp2.pc
oiio/ext/dist/lib64/libopenjp2.a
oiio/ext/dist/lib64/libopenjp2.so
oiio/ext/dist/lib64/libopenjp2.so.7
oiio/ext/dist/lib64/libopenjp2.so.2.5.4

So basically we are telling the OpenImageIO build to prefer the "libopenjp2.a"?

Thanks for the help with this.

@grdanny grdanny left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this looks good to me now if it looks good to you btw. Thanks again.

@lgritz

lgritz commented Oct 14, 2025

Copy link
Copy Markdown
Collaborator

Aha, thanks for reminding me about the bash script. I need to adjust that, too.

… libs.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz

lgritz commented Oct 14, 2025

Copy link
Copy Markdown
Collaborator

I pushed one more amendment, to build_OpenJPEG.bash:

  • Build it with position independent code always (lets us use the static library from a dynamic library).
  • Allow a control to optionally disable building the dynamic libs.

That's for the bash script. The cmake auto-builder already does this (in my prior patch) and should default to the static library.

@lgritz lgritz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems to fully work now

@lgritz

lgritz commented Oct 14, 2025

Copy link
Copy Markdown
Collaborator

Wait, I think I need one more adjustment. Stay tuned.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

@lgritz lgritz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it all works now

@lgritz
lgritz merged commit 2ccad14 into AcademySoftwareFoundation:main Oct 15, 2025
64 checks passed
@grdanny

grdanny commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for helping me take this to the finish line.

lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Oct 17, 2025
…cy (AcademySoftwareFoundation#4911)

sub task of :
AcademySoftwareFoundation#4387
for sep 2025 dev days.

Adding a autobuild cmake file for OpenJPEG.

Includes some changes to recognize and use static OpenJPEG if available.

---------

Signed-off-by: grdanny <danny.gr@gmail.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…cy (AcademySoftwareFoundation#4911)

sub task of :
AcademySoftwareFoundation#4387
for sep 2025 dev days.

Adding a autobuild cmake file for OpenJPEG.

Includes some changes to recognize and use static OpenJPEG if available.

---------

Signed-off-by: grdanny <danny.gr@gmail.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…cy (AcademySoftwareFoundation#4911)

sub task of :
AcademySoftwareFoundation#4387
for sep 2025 dev days.

Adding a autobuild cmake file for OpenJPEG.

Includes some changes to recognize and use static OpenJPEG if available.

---------

Signed-off-by: grdanny <danny.gr@gmail.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
Signed-off-by: Vlad <shaamaan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devdays25 Dev Days 2025

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants