vcpkg/ports/cairo/CMakeLists.txt
Alexander Neumann 3a26eb3dc4
[intl/gettext/fontconfig] update to native build system (#11776)
* [fontconfig] update fontconfig

* [libiconv] update to make

* [gettext] update to make

* [vcpkg_configure_make] Changes considering pure configure ports without the requirement to run autoconfig

* [fontconfig] make it work on windows

* Remove install of unofficial cmake config

* add function get_cmake_vars

* fine tuning.

* apply to make based ports.

* add log suffix on not windows platforms

* fix c&p error

* add previous LINK env

* setup env on windows and extract cpp flags correctly.

* update glib and libxml2

* fix windows regressions

* Apply suggestions from code review

* add windres wrapper to invoke RC.

* remove wrong fi

* fix libintl.

* try fixing uwp

* other things to update

* exiv2 fix

* libtool does not like -RTC1

* pass the /RTC<x> flag directly to the compiler

* trust cmake instead of adding extra flags

* fix expat

* fix iconv wrapper install

* change fontconfig intl linkage.

* add appcontainer back in which is required for UWP. Why is this not in the cmake flags?

* fix pkg-config in vcpkg_configure_make

* fix json-c pkg-config installation

* remove remnoved config

* comment out debug messages + bit of tuning

* finally fontconfig

* comment debug messages

* expat apply extra patches.

* Switch back to -E instead of -EP in cpp

* commit changes from fontconfig PR

* [expat] fix expat details

* Apply suggestions from code review

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>

* cleanup docs

* update osx pipeline so that fontconfig actually builds

* fix expat the lazy way by using a higher commit than release

* fix a barage of regressions due to the use of unofficial targets

* [expat] use a higher commit hash with a better stabilized cmake build

* forgot freexl regression

* more unofficial fixes

* fix downstream expat usage

* fix wxwidgets

* fix gcdm regression

* [vtk] fix the regression due to expat

* add uwp cl flags back in. Somehow those are not set by cmake

* add a few other configure options for full gettext build

* fix cmake regression

* fix a few regressions

* fix static gettext build

* fix gettext static

* fix libxml2 wrapper for cmake

* some more regressions fixes

* add conversion from somelib.lib to -lsomelib

* add a few option to libiconv.

* get logs from CI

* add missing ar-lib wrapper

* add missing ar-lib wrapper

* add fatal error to gettext

* remove uuid from the list of LIBS since it seems to not exist in CI?

* small but important regex correction

* fix regex and add debug message for libs

* remove error and only build libintl.

* add uuid dependency to fontconfig in qt5-base

* osx install gettext for autopoint

* fix io2d regression by saying the port is broken .....
(which it is; upstream needs to learn proper cmake)

* restore the old libxml2 wrapper with minor modifications

* fix xmlsec regression

* install wrapper correctly

* try actual fixing io2d

* improve iconv wrapper

* add latest changes from update_fontconfig PR

* Apply suggestions from code review

first set which don't need special attention

Co-authored-by: ras0219 <533828+ras0219@users.noreply.github.com>

* Apply suggestions from code review

one more simple change

Co-authored-by: ras0219 <533828+ras0219@users.noreply.github.com>

* [x264] set env AS

* fix bugs due to refactor

* use subpath everywhere

* apply changes from CR

* fix fontconfig build.

* only change libs in static builds

* remove unnecessary lines 41 & 44

* remove flag transformation

* reintroduce the flag / to - transformation for MSVC

* trying to figure out autopoint issue.
using wrong (windows) find.exe instead of msys

* add correct working_dir to subpath

* escape stupid env paths.

* fix typo

* add findutils
remove debug messages

* add error if libtool chokes

* add file to msys

* pass lt_cv_deplibs_check_method=pass_all on windows
(couldn't get file.exe to work so that libtool correctly ids the passed libs)

* add bzip2 to msys

* reenable libtool check. Lets see if CI agrees

* unbreak linux
try to figure out where uuid should be on windows.

* add -L flag and help libtool ?

* try to get ci to find uuid.

* try to use cygpath

* update controls

* cleanup merge mistakes

* correct merge issues

* determine cmake vars if not done before.

* move adding of -l earlier

* more merge cleanup

* fix uwp builds by not transforming libs

* fix patches in io2d

* fix xz download error

* apply code review changes manually

* fix the typos left behind in CR

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: ras0219 <533828+ras0219@users.noreply.github.com>
2020-11-17 09:18:59 -08:00

309 lines
7.6 KiB
CMake

cmake_minimum_required(VERSION 3.11)
project(cairo C)
# Add include directories
include_directories(".")
if(WIN32)
include_directories("./win32")
endif()
set(CAIRO_HEADERS
cairo.h
cairo-deprecated.h
cairo-features.h
cairo-pdf.h
cairo-ps.h
cairo-script.h
cairo-svg.h
../cairo-version.h
cairo-win32.h
../util/cairo-gobject/cairo-gobject.h
cairo-ft.h
)
set(CAIRO_X11_HEADERS
cairo-xlib.h
)
file(GLOB SOURCES
"cairo-analysis-surface.c"
"cairo-arc.c"
"cairo-array.c"
"cairo-atomic.c"
"cairo-base64-stream.c"
"cairo-base85-stream.c"
"cairo-bentley-ottmann.c"
"cairo-bentley-ottmann-rectangular.c"
"cairo-bentley-ottmann-rectilinear.c"
"cairo-botor-scan-converter.c"
"cairo-boxes.c"
"cairo-boxes-intersect.c"
"cairo.c"
"cairo-cache.c"
"cairo-clip.c"
"cairo-clip-boxes.c"
"cairo-clip-polygon.c"
"cairo-clip-region.c"
"cairo-clip-surface.c"
"cairo-color.c"
"cairo-composite-rectangles.c"
"cairo-compositor.c"
"cairo-contour.c"
"cairo-damage.c"
"cairo-debug.c"
"cairo-default-context.c"
"cairo-device.c"
"cairo-error.c"
"cairo-fallback-compositor.c"
"cairo-fixed.c"
"cairo-font-face.c"
"cairo-font-face-twin.c"
"cairo-font-face-twin-data.c"
"cairo-font-options.c"
"cairo-freelist.c"
"cairo-freed-pool.c"
"cairo-gstate.c"
"cairo-hash.c"
"cairo-hull.c"
"cairo-image-compositor.c"
"cairo-image-info.c"
"cairo-image-source.c"
"cairo-image-surface.c"
"cairo-line.c"
"cairo-lzw.c"
"cairo-matrix.c"
"cairo-mask-compositor.c"
"cairo-mesh-pattern-rasterizer.c"
"cairo-mempool.c"
"cairo-misc.c"
"cairo-mono-scan-converter.c"
"cairo-mutex.c"
"cairo-no-compositor.c"
"cairo-observer.c"
"cairo-output-stream.c"
"cairo-paginated-surface.c"
"cairo-path-bounds.c"
"cairo-path.c"
"cairo-path-fill.c"
"cairo-path-fixed.c"
"cairo-path-in-fill.c"
"cairo-path-stroke.c"
"cairo-path-stroke-boxes.c"
"cairo-path-stroke-polygon.c"
"cairo-path-stroke-traps.c"
"cairo-path-stroke-tristrip.c"
"cairo-pattern.c"
"cairo-pen.c"
"cairo-polygon.c"
"cairo-polygon-intersect.c"
"cairo-polygon-reduce.c"
"cairo-raster-source-pattern.c"
"cairo-recording-surface.c"
"cairo-rectangle.c"
"cairo-rectangular-scan-converter.c"
"cairo-region.c"
"cairo-rtree.c"
"cairo-scaled-font.c"
"cairo-shape-mask-compositor.c"
"cairo-slope.c"
"cairo-spans.c"
"cairo-spans-compositor.c"
"cairo-spline.c"
"cairo-stroke-dash.c"
"cairo-stroke-style.c"
"cairo-surface.c"
"cairo-surface-clipper.c"
"cairo-surface-fallback.c"
"cairo-surface-observer.c"
"cairo-surface-offset.c"
"cairo-surface-snapshot.c"
"cairo-surface-subsurface.c"
"cairo-surface-wrapper.c"
"cairo-time.c"
"cairo-tor-scan-converter.c"
"cairo-tor22-scan-converter.c"
"cairo-clip-tor-scan-converter.c"
"cairo-tag-attributes.c"
"cairo-tag-stack.c"
"cairo-toy-font-face.c"
"cairo-traps.c"
"cairo-tristrip.c"
"cairo-traps-compositor.c"
"cairo-unicode.c"
"cairo-user-font.c"
"cairo-version.c"
"cairo-wideint.c"
# generic font support
"cairo-cff-subset.c"
"cairo-scaled-font-subsets.c"
"cairo-truetype-subset.c"
"cairo-type1-fallback.c"
"cairo-type1-glyph-names.c"
"cairo-type1-subset.c"
"cairo-type3-glyph-surface.c"
# pdf
"cairo-pdf-interchange.c"
"cairo-pdf-operators.c"
"cairo-pdf-shading.c"
"cairo-pdf-surface.c"
# png
"cairo-png.c"
# ps surface
"cairo-ps-surface.c"
# deflate source
"cairo-deflate-stream.c"
# svg surface
"cairo-svg-surface.c"
# script surface
"cairo-script-surface.c"
# fontconfig + freetype
"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(WIN32)
list(APPEND SOURCES ${PLATFORM_SOURCES_WIN32})
endif()
set(CMAKE_DEBUG_POSTFIX "d")
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
find_package(Freetype REQUIRED)
find_package(Fontconfig REQUIRED)
find_package(unofficial-pixman CONFIG REQUIRED)
# Cairo needs to be told which features of FreeType are availible
add_definitions(
-DHAVE_FT_GLYPHSLOT_EMBOLDEN=1
-DHAVE_FT_LIBRARY_SETLCDFILTER=1
-DHAVE_FT_GLYPHSLOT_OBLIQUE=1
-DHAVE_FT_LOAD_SFNT_TABLE=1
-DHAVE_FT_GET_X11_FONT_FORMAT=1)
# additional features for macOS
if(UNIX OR APPLE)
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})
if (WITH_X11)
target_compile_definitions(cairo PUBLIC -DCAIRO_HAS_XLIB_SURFACE=1)
endif()
target_include_directories(cairo PUBLIC ${FREETYPE_INCLUDE_DIRS})
target_link_libraries(cairo PRIVATE ZLIB::ZLIB PNG::PNG Freetype::Freetype unofficial::pixman::pixman-1 Fontconfig::Fontconfig)
if(WIN32)
target_link_libraries(cairo PRIVATE gdi32 msimg32 user32)
endif()
# GObject support module
set(CAIRO_GOBJECT_SOURCES
"../util/cairo-gobject/cairo-gobject-enums.c"
"../util/cairo-gobject/cairo-gobject-structs.c")
# GObject support sources do not include header with export macro
if(WITH_GOBJECT)
if(BUILD_SHARED_LIBS)
if(MSVC)
set_source_files_properties(
"../util/cairo-gobject/cairo-gobject-enums.c"
"../util/cairo-gobject/cairo-gobject-structs.c"
PROPERTIES COMPILE_DEFINITIONS "cairo_public=__declspec(dllexport)")
else()
set_source_files_properties(
"../util/cairo-gobject/cairo-gobject-enums.c"
"../util/cairo-gobject/cairo-gobject-structs.c"
PROPERTIES COMPILE_DEFINITIONS "cairo_public=__attribute__((visibility(\"default\")))")
endif()
endif()
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()
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 PRIVATE
"/wd4244" "/wd4146" "/wd4312" "/wd4267" "/wd4996" "/wd4311" "/wd4334" "/wd4101"
)
if(WITH_GOBJECT)
target_compile_options(cairo-gobject PRIVATE
"/wd4244" "/wd4146" "/wd4312" "/wd4267" "/wd4996" "/wd4311" "/wd4334" "/wd4101"
)
endif()
endif()
if (CAIRO_HAS_XLIB_SURFACE)
file(INSTALL cairo-xlib.h DESTINATION include)
endif()
install(FILES ${CAIRO_HEADERS} DESTINATION include)
install(FILES ${CAIRO_HEADERS} DESTINATION include/cairo)
if (WITH_X11)
install(FILES ${CAIRO_X11_HEADERS} DESTINATION include)
install(FILES ${CAIRO_X11_HEADERS} DESTINATION include/cairo)
endif()
install(TARGETS cairo
EXPORT cairo-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(WITH_GOBJECT)
install(TARGETS cairo-gobject
EXPORT cairo-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
endif()
install(
EXPORT cairo-targets
NAMESPACE unofficial::cairo::
FILE unofficial-cairo-targets.cmake
DESTINATION share/unofficial-cairo
)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/unofficial-cairo-config.cmake "
include(CMakeFindDependencyMacro)
find_dependency(ZLIB)
find_dependency(PNG)
find_dependency(Freetype)
find_dependency(Fontconfig)
find_dependency(unofficial-pixman CONFIG)
if(WITH_GOBJECT)
find_dependency(unofficial-glib CONFIG)
endif()
include(\${CMAKE_CURRENT_LIST_DIR}/unofficial-cairo-targets.cmake)
")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-cairo-config.cmake DESTINATION share/unofficial-cairo)