[cairo,cairomm] add fontconfig and quartz feature, raise cairo version (#16825)

This commit is contained in:
Alexandre Bique 2021-04-20 00:30:03 +02:00 committed by GitHub
parent 3ec41f57e6
commit 4c830b1516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 211 additions and 36 deletions

View File

@ -4,7 +4,7 @@ project(cairo C)
# Add include directories
include_directories(".")
if(WIN32)
include_directories("./win32")
include_directories("./win32")
endif()
set(CAIRO_HEADERS
@ -15,7 +15,7 @@ set(CAIRO_HEADERS
cairo-ps.h
cairo-script.h
cairo-svg.h
../cairo-version.h
cairo-version.h
cairo-win32.h
../util/cairo-gobject/cairo-gobject.h
cairo-ft.h
@ -25,6 +25,11 @@ set(CAIRO_X11_HEADERS
cairo-xlib.h
)
set(CAIRO_QUARTZ_HEADERS
cairo-quartz.h
cairo-quartz-image.h
)
file(GLOB SOURCES
"cairo-analysis-surface.c"
"cairo-arc.c"
@ -163,6 +168,15 @@ if(WITH_FREETYPE)
list(APPEND SOURCES ${_FREETYPE_SOURCES})
endif()
if(WITH_QUARTZ)
file(GLOB _QUARTZ_SOURCES
"cairo-quartz-font.c"
"cairo-quartz-image-surface.c"
"cairo-quartz-surface.c"
)
list(APPEND SOURCES ${_QUARTZ_SOURCES})
endif()
# win32
file(GLOB PLATFORM_SOURCES_WIN32
"win32/cairo-win32-debug.c"
@ -176,7 +190,7 @@ file(GLOB PLATFORM_SOURCES_WIN32
)
if(WIN32)
list(APPEND SOURCES ${PLATFORM_SOURCES_WIN32})
list(APPEND SOURCES ${PLATFORM_SOURCES_WIN32})
endif()
set(CMAKE_DEBUG_POSTFIX "d")
@ -186,8 +200,14 @@ find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
if(WITH_FREETYPE)
find_package(Freetype REQUIRED)
endif()
if(WITH_FONTCONFIG)
find_package(Fontconfig REQUIRED)
endif()
if(WITH_QUARTZ)
find_library(CF CoreFoundation)
find_library(CG CoreGraphics)
endif()
find_package(unofficial-pixman CONFIG REQUIRED)
# Cairo needs to be told which features of FreeType are availible
@ -219,14 +239,23 @@ if (WITH_X11)
endif()
if(WITH_FREETYPE)
target_include_directories(cairo PUBLIC ${FREETYPE_INCLUDE_DIRS})
target_link_libraries(cairo PRIVATE Freetype::Freetype Fontconfig::Fontconfig)
target_link_libraries(cairo PRIVATE Freetype::Freetype)
endif()
if(WITH_FONTCONFIG)
target_link_libraries(cairo PRIVATE Fontconfig::Fontconfig)
endif()
target_link_libraries(cairo PRIVATE ZLIB::ZLIB PNG::PNG unofficial::pixman::pixman-1)
if(WIN32)
target_link_libraries(cairo PRIVATE gdi32 msimg32 user32)
endif()
if(WITH_QUARTZ)
target_link_libraries(cairo PRIVATE ${CF} ${CG})
endif()
# GObject support module
set(CAIRO_GOBJECT_SOURCES
@ -248,9 +277,9 @@ if(WITH_GOBJECT)
PROPERTIES COMPILE_DEFINITIONS "cairo_public=__attribute__((visibility(\"default\")))")
endif()
endif()
find_package(unofficial-glib CONFIG REQUIRED)
add_library(cairo-gobject ${CAIRO_GOBJECT_SOURCES})
find_package(unofficial-glib CONFIG REQUIRED)
add_library(cairo-gobject ${CAIRO_GOBJECT_SOURCES})
target_link_libraries(cairo-gobject PRIVATE cairo unofficial::glib::gobject unofficial::glib::glib)
endif()
@ -274,6 +303,11 @@ endif()
install(FILES ${CAIRO_HEADERS} DESTINATION include)
install(FILES ${CAIRO_HEADERS} DESTINATION include/cairo)
if(WITH_QUARTZ)
install(FILES ${CAIRO_QUARTZ_HEADERS} DESTINATION include)
install(FILES ${CAIRO_QUARTZ_HEADERS} DESTINATION include/cairo)
endif()
if (WITH_X11)
install(FILES ${CAIRO_X11_HEADERS} DESTINATION include)
install(FILES ${CAIRO_X11_HEADERS} DESTINATION include/cairo)
@ -292,7 +326,7 @@ if(WITH_GOBJECT)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
)
endif()
install(
@ -308,12 +342,18 @@ find_dependency(ZLIB)
find_dependency(PNG)
if(${WITH_FREETYPE})
find_dependency(Freetype)
endif()
if(${WITH_FONTCONFIG})
find_dependency(Fontconfig)
endif()
find_dependency(unofficial-pixman CONFIG)
if(${WITH_GOBJECT})
find_dependency(unofficial-glib CONFIG)
endif()
if(${WITH_QUARTZ})
find_library(CF CoreFoundation)
find_library(CG CoreGraphics)
endif()
include(\${CMAKE_CURRENT_LIST_DIR}/unofficial-cairo-targets.cmake)
")

View File

@ -35,4 +35,9 @@
/* Require FontConfig */
#cmakedefine01 CAIRO_HAS_FC_FONT
// apple quartz support
#cmakedefine01 CAIRO_HAS_QUARTZ_FONT
#cmakedefine01 CAIRO_HAS_QUARTZ_IMAGE_SURFACE
#cmakedefine01 CAIRO_HAS_QUARTZ_SURFACE
#endif

View File

@ -18,8 +18,19 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/sr
if("freetype" IN_LIST FEATURES)
set(CAIRO_HAS_FT_FONT TRUE)
endif()
if("fontconfig" IN_LIST FEATURES)
set(CAIRO_HAS_FC_FONT TRUE)
endif()
if("quartz" IN_LIST FEATURES)
set(CAIRO_HAS_QUARTZ TRUE)
set(CAIRO_HAS_QUARTZ_FONT TRUE)
set(CAIRO_HAS_QUARTZ_IMAGE_SURFACE TRUE)
set(CAIRO_HAS_QUARTZ_SURFACE TRUE)
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/cairo-features.h.in" "${SOURCE_PATH}/src/cairo-features.h")
if ("x11" IN_LIST FEATURES)
@ -36,9 +47,12 @@ if("gobject" IN_LIST FEATURES)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
x11 WITH_X11
gobject WITH_GOBJECT
freetype WITH_FREETYPE
FEATURES
x11 WITH_X11
gobject WITH_GOBJECT
freetype WITH_FREETYPE
fontconfig WITH_FONTCONFIG
quartz WITH_QUARTZ
)
vcpkg_configure_cmake(

View File

@ -1,7 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "cairo",
"version-string": "1.16.0",
"port-version": 9,
"port-version": 10,
"description": "Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System (via both Xlib and XCB), Quartz, Win32, image buffers, PostScript, PDF, and SVG file output. Experimental backends include OpenGL, BeOS, OS/2, and DirectFB.",
"homepage": "https://cairographics.org",
"dependencies": [
@ -10,13 +11,19 @@
"zlib"
],
"default-features": [
"fontconfig",
"freetype"
],
"features": {
"fontconfig": {
"description": "build with fontconfig",
"dependencies": [
"fontconfig"
]
},
"freetype": {
"description": "use the freetype font backend",
"dependencies": [
"fontconfig",
"freetype"
]
},
@ -26,6 +33,9 @@
"glib"
]
},
"quartz": {
"description": "build with quartz support"
},
"x11": {
"description": "build with x11 support"
}

View File

@ -34,9 +34,6 @@ configure_file("build/cmake/cairomm.rc.cmake" "cairomm.rc" @ONLY)
#build
set(cairomm_cc
cairomm/context.cc
cairomm/context_surface_quartz.cc
cairomm/context_surface_win32.cc
cairomm/context_surface_xlib.cc
cairomm/device.cc
cairomm/exception.cc
cairomm/fontface.cc
@ -45,16 +42,11 @@ set(cairomm_cc
cairomm/path.cc
cairomm/pattern.cc
cairomm/private.cc
cairomm/quartz_font.cc
cairomm/quartz_surface.cc
cairomm/region.cc
cairomm/scaledfont.cc
cairomm/script.cc
cairomm/script_surface.cc
cairomm/surface.cc
cairomm/win32_font.cc
cairomm/win32_surface.cc
cairomm/xlib_surface.cc)
cairomm/surface.cc)
set(cairomm_public_h
cairomm/cairomm.h
@ -67,18 +59,13 @@ set(cairomm_public_h
cairomm/matrix.h
cairomm/path.h
cairomm/pattern.h
cairomm/quartz_font.h
cairomm/quartz_surface.h
cairomm/refptr.h
cairomm/region.h
cairomm/scaledfont.h
cairomm/script.h
cairomm/script_surface.h
cairomm/surface.h
cairomm/types.h
cairomm/win32_font.h
cairomm/win32_surface.h
cairomm/xlib_surface.h)
cairomm/types.h)
set(cairomm_private_h
cairomm/context_private.h
@ -87,6 +74,34 @@ set(cairomm_private_h
set(cairomm_rc
${CMAKE_BINARY_DIR}/cairomm.rc)
if(WITH_QUARTZ)
list(APPEND cairomm_cc
cairomm/context_surface_quartz.cc
cairomm/quartz_font.cc
cairomm/quartz_surface.cc)
list(APPEND cairomm_public_h
cairomm/xlib_surface.h)
endif()
if(WITH_X11)
list(APPEND cairomm_cc
cairomm/xlib_surface.cc
cairomm/context_surface_xlib.cc)
list(APPEND cairomm_public_h
cairomm/quartz_font.h
cairomm/quartz_surface.h)
endif()
if(WIN32)
list(APPEND cairomm_cc
cairomm/context_surface_win32.cc
cairomm/win32_font.cc
cairomm/win32_surface.cc)
list(APPEND cairomm_public_h
cairomm/win32_font.h
cairomm/win32_surface.h)
endif()
add_library(cairomm-1.0 ${cairomm_cc} ${cairomm_rc})
target_link_libraries(cairomm-1.0 ${CAIRO_LIBRARY} ${SIGC++_LIBRARY} Freetype::Freetype)
target_include_directories(cairomm-1.0 PRIVATE

View File

@ -1,6 +0,0 @@
Source: cairomm
Version: 1.15.3
Port-Version: 5
Homepage: https://www.cairographics.org
Description: A C++ wrapper for the cairo graphics library
Build-Depends: cairo, libsigcpp

View File

@ -19,6 +19,15 @@ vcpkg_extract_source_archive_ex(
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake DESTINATION ${SOURCE_PATH}/build)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
x11 WITH_X11
gobject WITH_GOBJECT
freetype WITH_FREETYPE
fontconfig WITH_FONTCONFIG
quartz WITH_QUARTZ
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA

78
ports/cairomm/vcpkg.json Normal file
View File

@ -0,0 +1,78 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "cairomm",
"version-string": "1.15.3",
"port-version": 6,
"description": "A C++ wrapper for the cairo graphics library.",
"homepage": "https://cairographics.org",
"dependencies": [
"cairo",
"libsigcpp"
],
"default-features": [
"fontconfig",
"freetype"
],
"features": {
"fontconfig": {
"description": "build with fontconfig",
"dependencies": [
{
"name": "cairo",
"default-features": false,
"features": [
"fontconfig"
]
}
]
},
"freetype": {
"description": "use the freetype font backend",
"dependencies": [
{
"name": "cairo",
"default-features": false,
"features": [
"freetype"
]
}
]
},
"gobject": {
"description": "build gobject module",
"dependencies": [
{
"name": "cairo",
"default-features": false,
"features": [
"gobject"
]
}
]
},
"quartz": {
"description": "build with quartz support",
"dependencies": [
{
"name": "cairo",
"default-features": false,
"features": [
"quartz"
]
}
]
},
"x11": {
"description": "build with x11 support",
"dependencies": [
{
"name": "cairo",
"default-features": false,
"features": [
"x11"
]
}
]
}
}
}

View File

@ -1082,11 +1082,11 @@
},
"cairo": {
"baseline": "1.16.0",
"port-version": 9
"port-version": 10
},
"cairomm": {
"baseline": "1.15.3",
"port-version": 5
"port-version": 6
},
"camport3": {
"baseline": "1.5.3",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "aa8df97c4b06bf590dc04ad931a08f0bf1e47471",
"version-string": "1.16.0",
"port-version": 10
},
{
"git-tree": "eb09773c303a9608687dca6a0480ff551c0c2bf9",
"version-string": "1.16.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "208a6f99a6fbc0239696b79653d769568ca603cc",
"version-string": "1.15.3",
"port-version": 6
},
{
"git-tree": "0dce5120b52866ee6e0b485081389f9ea9679fb4",
"version-string": "1.15.3",