vcpkg/ports/libass/CMakeLists.txt
SunTY 397e1a5d6c libass dynamic library (#5244)
* libass dynamic library
it relies on fribidi, harfbuzz, fontconfig, libiconv

* Remove references to iconv and fontconfig

Because this port is currently Windows-only (Fribidi doesn't build on
Linux with vcpkg because of an issue with Meson), we don't want to worry
about FontConfig; DirectWrite should be enough.

* Freetype is important!

* Remove unnecessary fontconfig -- for real

* Remove unnecessary comment
2019-01-30 13:41:51 -08:00

50 lines
1.4 KiB
CMake

cmake_minimum_required(VERSION 3.9)
project(libass C CXX)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in config.h)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
# This is Windows-specific. Other acceptable values on different platforms should be
# macOS - CONFIG_CORETEXT
# linux - CONFIG_FONTCONFIG
add_compile_definitions(CONFIG_DIRECTWRITE)
add_compile_definitions(CONFIG_FREETYPE)
add_compile_definitions(CONFIG_FRIBIDI)
add_compile_definitions(CONFIG_HARFBUZZ)
file (GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/libass/*.c)
list(FILTER SOURCES EXCLUDE REGEX ".*ass_coretext.c$")
list(FILTER SOURCES EXCLUDE REGEX ".*ass_fontconfig.c$")
find_package(Freetype REQUIRED)
find_path(FRIBIDI_INCLUDE_DIR
NAMES fribidi.h
PATH_SUFFIXES fribidi)
find_path(HARFBUZZ_INCLUDE_DIR
NAMES hb.h
PATH_SUFFIXES harfbuzz)
find_library(FRIBIDI_LIBRARY NAMES fribidi)
find_library(HARFBUZZ_LIBRARY NAMES harfbuzz)
add_library(ass ${SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/libass.def)
target_include_directories(ass PRIVATE
${FRIBIDI_INCLUDE_DIR}
${HARFBUZZ_INCLUDE_DIR})
target_link_libraries(ass PRIVATE
Freetype::Freetype
${FRIBIDI_LIBRARY}
${HARFBUZZ_LIBRARY})
install(TARGETS ass
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)