Skip to content

Commit

Permalink
Move contrib block in root CMakeLists.txt into contrib subdirs (scale…
Browse files Browse the repository at this point in the history
…s better)
  • Loading branch information
Joe Drago committed Jun 22, 2020
1 parent e4bfb23 commit 98d9f4b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
31 changes: 1 addition & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,33 +449,4 @@ if(WIN32)
endif()
endif()

# ---------------------------------------------------------------------------------------
# Contrib modules, enhancing other software with AVIF support
#
# Note: Anything listed here is not officially supported by libavif.

option(AVIF_BUILD_GDK_PIXBUF "Build a gdk-pixbuf loader" OFF)
if(AVIF_BUILD_GDK_PIXBUF)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(GDK_PIXBUF gdk-pixbuf-2.0)
if(GDK_PIXBUF_FOUND)
set(GDK_PIXBUF_SRCS
contrib/gdk-pixbuf/loader.c
)
add_library(pixbufloader-avif ${GDK_PIXBUF_SRCS})

# This is required because glib stupidly uses invalid #define names, such as __G_LIB_H__…
add_definitions(-Wno-reserved-id-macro)
target_link_libraries(pixbufloader-avif PUBLIC ${GDK_PIXBUF_LIBRARIES} avif)
target_include_directories(pixbufloader-avif PUBLIC ${GDK_PIXBUF_INCLUDE_DIRS})

pkg_get_variable(GDK_PIXBUF_MODULEDIR gdk-pixbuf-2.0 gdk_pixbuf_moduledir)
install(TARGETS pixbufloader-avif DESTINATION ${GDK_PIXBUF_MODULEDIR})
else()
message(WARNING "gdk-pixbuf loader: disabled due to missing gdk-pixbuf-2.0")
endif()
else()
message(WARNING "gdk-pixbuf loader: disabled due to missing pkg-config")
endif()
endif()
add_subdirectory(contrib)
4 changes: 4 additions & 0 deletions contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2020 Joe Drago. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause

add_subdirectory(gdk-pixbuf)
28 changes: 28 additions & 0 deletions contrib/gdk-pixbuf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020 Emmanuel Gil Peyrot. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause

option(AVIF_BUILD_GDK_PIXBUF "Build a gdk-pixbuf loader" OFF)
if(AVIF_BUILD_GDK_PIXBUF)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(GDK_PIXBUF gdk-pixbuf-2.0)
if(GDK_PIXBUF_FOUND)
set(GDK_PIXBUF_SRCS
loader.c
)
add_library(pixbufloader-avif ${GDK_PIXBUF_SRCS})

# This is required because glib stupidly uses invalid #define names, such as __G_LIB_H__…
add_definitions(-Wno-reserved-id-macro)
target_link_libraries(pixbufloader-avif PUBLIC ${GDK_PIXBUF_LIBRARIES} avif)
target_include_directories(pixbufloader-avif PUBLIC ${GDK_PIXBUF_INCLUDE_DIRS})

pkg_get_variable(GDK_PIXBUF_MODULEDIR gdk-pixbuf-2.0 gdk_pixbuf_moduledir)
install(TARGETS pixbufloader-avif DESTINATION ${GDK_PIXBUF_MODULEDIR})
else()
message(WARNING "gdk-pixbuf loader: disabled due to missing gdk-pixbuf-2.0")
endif()
else()
message(WARNING "gdk-pixbuf loader: disabled due to missing pkg-config")
endif()
endif()

0 comments on commit 98d9f4b

Please sign in to comment.