Skip to content

Add support for pkg_config#894

Closed
gchatelet wants to merge 1 commit intoAcademySoftwareFoundation:masterfrom
gchatelet:master
Closed

Add support for pkg_config#894
gchatelet wants to merge 1 commit intoAcademySoftwareFoundation:masterfrom
gchatelet:master

Conversation

@gchatelet
Copy link
Contributor

Add support for pkg_config to be consistent with ilmbase and openexr. I'm open to changes here since there are multiple options :

  • move installation to CMakeLists.txt in root folder (aside CPack). Caveat is libraries are not accessible here so I would need to export them.
  • use a .in file and a configure_file command to mimic OpenEXR install, I went to inline config as you can see.

Also I'm adding all the libraries without paying attention to USE_xxx, this can be improved.

# Write the file.
file ( WRITE ${CMAKE_BINARY_DIR}/OpenImageIO.pc "prefix=${CMAKE_INSTALL_PREFIX}
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
Copy link

@krop krop Oct 16, 2018

Choose a reason for hiding this comment

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

Hardcoding 'lib' is a bad idea and would have to be patched by almost all distributions.
Use libdir=${CMAKE_INSTALL_FULL_LIBDIR} directly instead.

file ( WRITE ${CMAKE_BINARY_DIR}/OpenImageIO.pc "prefix=${CMAKE_INSTALL_PREFIX}
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Copy link

@krop krop Oct 16, 2018

Choose a reason for hiding this comment

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

same issue here, this shall be includedir=${CMAKE_INSTALL_FULL_INCLUDEDIR}

exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
OpenImageIO_includedir=\${prefix}/include/OpenImageIO
Copy link

Choose a reason for hiding this comment

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

OpenImageIO_includedir=\${includedir}/OpenImageIO

Requires: OpenEXR
")
install (FILES ${CMAKE_BINARY_DIR}/OpenImageIO.pc DESTINATION lib/pkgconfig)
endif (OIIO_INSTALL_PKGCONFIG)
Copy link

Choose a reason for hiding this comment

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

endif()

Cflags: -I\${OpenImageIO_includedir}
Requires: OpenEXR
")
install (FILES ${CMAKE_BINARY_DIR}/OpenImageIO.pc DESTINATION lib/pkgconfig)
Copy link

@krop krop Oct 16, 2018

Choose a reason for hiding this comment

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

DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig


Name: OpenImageIO
Description: OpenImageIO is an open source library for reading and writing image file formats, a nice format-agnostic image viewer, and other image-related classes and utilities.
Version: ${OIIO_VERSION_MAJOR}.${OIIO_VERSION_MINOR}.${OIIO_VERSION_PATCH}
Copy link

Choose a reason for hiding this comment

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

You can use Version: ${OpenImageIO_VERSION} or Version: ${PROJECT_VERSION}

@gchatelet
Copy link
Contributor Author

Thx for the review @krop but this PR is from 2014 and I moved on to other adventures in the meantime :)
Feel free to use copy/modify it if you find it useful, otherwise I'll close this PR.

Copy link

@krop krop left a comment

Choose a reason for hiding this comment

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

review edited. CMAKE_INSTALL_FULL_* shall be preferred (you cannot guess whether relative or absolute paths are used when running CMake)

@krop
Copy link

krop commented Oct 16, 2018

Oh, didn't look at the date, sorry. I was just looking at the opened ones :)

@gchatelet
Copy link
Contributor Author

No worries, and thx for taking the time to review. I'll close the PR then :)

@gchatelet gchatelet closed this Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants