fix pixman and cairo for macOS (#3923)

* fix pixman error message about Unknown thread local support

* fixes for building cairo on macOS

* corrected appending files to sources

* [cairo][pixman] Bump package versions to include source code changes
This commit is contained in:
angelmixu 2018-08-01 02:10:12 +02:00 committed by Robert Schumacher
parent 0618d13b2e
commit 81d3b2cc6a
6 changed files with 61 additions and 15 deletions

View File

@ -0,0 +1,13 @@
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 3b308757..36700ff0 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -67,7 +67,7 @@
#include FT_LCD_FILTER_H
#endif
-#if HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#else
#define access(p, m) 0

View File

@ -2,7 +2,10 @@ cmake_minimum_required(VERSION 3.0)
project(cairo C)
# Add include directories
include_directories("." "./win32")
include_directories(".")
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
include_directories("./win32")
endif()
file(GLOB SOURCES
"cairo-analysis-surface.c"
@ -112,15 +115,6 @@ file(GLOB SOURCES
"cairo-user-font.c"
"cairo-version.c"
"cairo-wideint.c"
# win32
"win32/cairo-win32-debug.c"
"win32/cairo-win32-device.c"
"win32/cairo-win32-gdi-compositor.c"
"win32/cairo-win32-system.c"
"win32/cairo-win32-surface.c"
"win32/cairo-win32-display-surface.c"
"win32/cairo-win32-printing-surface.c"
"win32/cairo-win32-font.c"
# generic font support
"cairo-cff-subset.c"
"cairo-scaled-font-subsets.c"
@ -148,6 +142,22 @@ file(GLOB SOURCES
"cairo-ft-font.c"
)
# win32
file(GLOB PLATFORM_SOURCES_WIN32
"win32/cairo-win32-debug.c"
"win32/cairo-win32-device.c"
"win32/cairo-win32-gdi-compositor.c"
"win32/cairo-win32-system.c"
"win32/cairo-win32-surface.c"
"win32/cairo-win32-display-surface.c"
"win32/cairo-win32-printing-surface.c"
"win32/cairo-win32-font.c"
)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND SOURCES ${PLATFORM_SOURCES_WIN32})
endif()
set(CMAKE_DEBUG_POSTFIX "d")
find_package(ZLIB REQUIRED)
@ -172,10 +182,27 @@ add_definitions(
# Find FontConfig
find_library(FONTCONFIG_LIBRARY fontconfig)
# additional features for macOS
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(
-DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1
-DHAVE_SYS_TYPES_H=1
-DHAVE_UINT64_T=1
-DHAVE_UNISTD_H=1
-DCAIRO_HAS_PTHREAD=1
-DCAIRO_HAS_REAL_PTHREAD=1)
endif()
add_library(cairo ${SOURCES})
# cairo produces a lot of warnings which are disabled here because they otherwise fill up the log files
target_compile_options(cairo PUBLIC "/wd4244" PUBLIC "/wd4146" PUBLIC "/wd4312" PUBLIC "/wd4267"
PUBLIC "/wd4996" PUBLIC "/wd4311" PUBLIC "/wd4334" PUBLIC "/wd4101")
if(MSVC)
# cairo produces a lot of warnings which are disabled here because they otherwise fill up the log files
# NOTE: options only available to MSVC, clang in macOS doesn't understand these flags
target_compile_options(cairo PUBLIC "/wd4244" PUBLIC "/wd4146" PUBLIC "/wd4312" PUBLIC "/wd4267"
PUBLIC "/wd4996" PUBLIC "/wd4311" PUBLIC "/wd4334" PUBLIC "/wd4101")
endif()
target_link_libraries(cairo gdi32 msimg32 user32 ZLIB::ZLIB PNG::PNG freetype ${PIXMAN_LIBRARY} ${FONTCONFIG_LIBRARY})
install(TARGETS cairo

View File

@ -1,4 +1,4 @@
Source: cairo
Version: 1.15.8-1
Version: 1.15.8-2
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.
Build-Depends: zlib, libpng, pixman, glib, freetype, fontconfig

View File

@ -19,6 +19,7 @@ vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/export-only-in-shared-build.patch"
"${CMAKE_CURRENT_LIST_DIR}/0001_fix_osx_defined.patch"
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/src)

View File

@ -4,6 +4,11 @@ project(pixman VERSION 0.32.0 LANGUAGES C)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_DEBUG_POSTFIX "d")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(-DTLS=__thread)
add_definitions(-DHAVE_PTHREADS)
endif()
include_directories(".")
file(GLOB SOURCES

View File

@ -1,3 +1,3 @@
Source: pixman
Version: 0.34.0-2
Version: 0.34.0-3
Description: Pixman is a low-level software library for pixel manipulation, providing features such as image compositing and trapezoid rasterization.