Skip to content

Commit

Permalink
pkg-config: add Requires.private to allow static builds
Browse files Browse the repository at this point in the history
Ensure cmake is aware of gdk-pixbuf pthread dependency
for static builds.
  • Loading branch information
lovell committed Oct 5, 2020
1 parent 90b7f4f commit 9e6ff00
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,20 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
if (LIBDE265_FOUND)
list(APPEND REQUIRES_PRIVATE "libde265")
set(have_libde265 yes)
else()
set(have_libde265 no)
endif()
if (X265_FOUND)
list(APPEND REQUIRES_PRIVATE "x265")
set(have_x265 yes)
else()
set(have_x265 no)
endif()
if (AOM_FOUND)
list(APPEND REQUIRES_PRIVATE "aom")
endif()
if (AOM_FOUND OR DAV1D_FOUND)
set(have_avif_decoder yes)
else()
Expand All @@ -121,6 +126,7 @@ if (AOM_FOUND OR USE_LOCAL_RAV1E)
else()
set(have_avif_encoder no)
endif()
list(JOIN REQUIRES_PRIVATE " " REQUIRES_PRIVATE)
set(VERSION ${PROJECT_VERSION})

configure_file(libheif.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libheif.pc @ONLY)
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,14 @@ AM_CONDITIONAL([HAVE_TESTS], [test "x$HAVE_TESTS" == "x1"])
AM_CONDITIONAL([HAVE_VISIBILITY], [test "x$HAVE_VISIBILITY" != "x0"])
if eval "test x$enable_visibility = x" ; then enable_visibility=yes ; fi

REQUIRES_PRIVATE=""
AC_SUBST([REQUIRES_PRIVATE])

PKG_CHECK_MODULES([aom], [aom], [
AC_DEFINE([HAVE_AOM], [1], [Whether aom was found.])
AC_SUBST(aom_CFLAGS)
AC_SUBST(aom_LIBS)
REQUIRES_PRIVATE="$REQUIRES_PRIVATE aom"
have_aom="yes"
have_avif_decoder="yes"
have_avif_encoder="yes"
Expand All @@ -113,6 +117,7 @@ if eval "test x$enable_libde265 != xno"; then
AC_DEFINE([HAVE_LIBDE265], [1], [Whether libde265 was found.])
AC_SUBST(libde265_CFLAGS)
AC_SUBST(libde265_LIBS)
REQUIRES_PRIVATE="$REQUIRES_PRIVATE libde265"
have_libde265="yes"
], [have_libde265="no"])
else
Expand All @@ -129,6 +134,7 @@ if eval "test x$enable_x265 != xno"; then
AC_DEFINE([HAVE_X265], [1], [Whether x265 was found.])
AC_SUBST(x265_CFLAGS)
AC_SUBST(x265_LIBS)
REQUIRES_PRIVATE="$REQUIRES_PRIVATE x265"
have_x265="yes"
], [have_x265="no"])
else
Expand Down
2 changes: 1 addition & 1 deletion examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ gopath:
ln -sf ${CURDIR}/../go ${CURDIR}/src/github.com/strukturag/libheif/

heif-test-go: gopath $(top_builddir)/libheif/libheif.la $(top_builddir)/libheif.pc heif-test.go
GOPATH=${CURDIR} PKG_CONFIG_PATH=$(abs_top_builddir) CGO_CFLAGS="-I$(abs_top_builddir)" CGO_LDFLAGS="-L$(abs_top_builddir)/libheif/.libs" LD_LIBRARY_PATH=$(abs_top_builddir)/libheif/.libs $(GO) build -o heif-test-go ${heif_test_go_SOURCES}
GOPATH=${CURDIR} PKG_CONFIG_PATH=$(abs_top_builddir):$(abs_top_builddir)/libde265/dist/lib/pkgconfig/ CGO_CFLAGS="-I$(abs_top_builddir)" CGO_LDFLAGS="-L$(abs_top_builddir)/libheif/.libs" LD_LIBRARY_PATH=$(abs_top_builddir)/libheif/.libs $(GO) build -o heif-test-go ${heif_test_go_SOURCES}

format-go: ${heif_test_go_SOURCES}
$(GO) fmt ${heif_test_go_SOURCES}
Expand Down
1 change: 1 addition & 0 deletions gdk-pixbuf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if(UNIX)
find_package(PkgConfig)
find_package(Threads)
pkg_check_modules(GDKPIXBUF2 gdk-pixbuf-2.0)

if(GDKPIXBUF2_FOUND)
Expand Down
1 change: 1 addition & 0 deletions libheif.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Description: HEIF image codec.
URL: https://github.com/strukturag/libheif
Version: @VERSION@
Requires:
Requires.private: @REQUIRES_PRIVATE@
Libs: -L@libdir@ -lheif
Libs.private: @LIBS@ -lstdc++
Cflags: -I@includedir@
2 changes: 1 addition & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ gopath:
ln -sf ${CURDIR}/../go ${CURDIR}/src/github.com/strukturag/libheif/

test-race: gopath $(top_builddir)/libheif/libheif.la $(top_builddir)/libheif.pc test-race.go
GOPATH=${CURDIR} PKG_CONFIG_PATH=$(abs_top_builddir) CGO_CFLAGS="-I$(abs_top_builddir)" CGO_LDFLAGS="-L$(abs_top_builddir)/libheif/.libs" LD_LIBRARY_PATH=$(abs_top_builddir)/libheif/.libs $(GO) build -o test-race ${test_race_SOURCES}
GOPATH=${CURDIR} PKG_CONFIG_PATH=$(abs_top_builddir):$(abs_top_builddir)/libde265/dist/lib/pkgconfig/ CGO_CFLAGS="-I$(abs_top_builddir)" CGO_LDFLAGS="-L$(abs_top_builddir)/libheif/.libs" LD_LIBRARY_PATH=$(abs_top_builddir)/libheif/.libs $(GO) build -o test-race ${test_race_SOURCES}

format-go: ${test_race_SOURCES}
$(GO) fmt ${test_race_SOURCES}
Expand Down

0 comments on commit 9e6ff00

Please sign in to comment.