vcpkg/ports/libass/CMakeLists.txt
Codiferous c0bf747e45
Add a more correct port for libass (#5223)
This port currently only works on Windows because the dependencies of
the port (fribidi in particular) don't build on non-Windows platforms.

I made patch modifications to the source code because the Visual C++ C
compiler does not allow for non-constant-expression array indicesto be
used to declare a static array.

I've verified that this (1) builds on Windows and (2) works with a
sample test that's included in the libass github repo.
2019-01-24 11:47:28 -08:00

37 lines
1.0 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)
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_library(FRIBIDI_LIBRARY NAMES fribidi)
add_library(ass STATIC ${SOURCES})
target_include_directories(ass PRIVATE ${FRIBIDI_INCLUDE_DIR})
target_link_libraries(ass PRIVATE Freetype::Freetype)
install(TARGETS ass
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)