2019-01-25 03:47:28 +08:00
|
|
|
cmake_minimum_required(VERSION 3.9)
|
|
|
|
project(libass C CXX)
|
|
|
|
|
2019-02-02 03:11:01 +08:00
|
|
|
set(LIBASS_VERSION 0.14.0)
|
|
|
|
|
2019-01-25 03:47:28 +08:00
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in config.h)
|
|
|
|
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
2020-07-28 08:43:23 +08:00
|
|
|
if(WIN32)
|
|
|
|
add_compile_definitions(CONFIG_DIRECTWRITE)
|
|
|
|
elseif(APPLE)
|
|
|
|
add_compile_definitions(CONFIG_CORETEXT)
|
|
|
|
else()
|
|
|
|
add_compile_definitions(CONFIG_FONTCONFIG)
|
|
|
|
endif()
|
|
|
|
|
2019-01-31 05:41:51 +08:00
|
|
|
add_compile_definitions(CONFIG_FREETYPE)
|
|
|
|
add_compile_definitions(CONFIG_FRIBIDI)
|
|
|
|
add_compile_definitions(CONFIG_HARFBUZZ)
|
2019-01-25 03:47:28 +08:00
|
|
|
|
|
|
|
file (GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/libass/*.c)
|
|
|
|
|
2020-07-28 08:43:23 +08:00
|
|
|
if(WIN32)
|
|
|
|
list(FILTER SOURCES EXCLUDE REGEX ".*ass_coretext.c$")
|
|
|
|
list(FILTER SOURCES EXCLUDE REGEX ".*ass_fontconfig.c$")
|
|
|
|
elseif(APPLE)
|
|
|
|
list(FILTER SOURCES EXCLUDE REGEX ".*ass_directwrite.c$")
|
|
|
|
list(FILTER SOURCES EXCLUDE REGEX ".*ass_fontconfig.c$")
|
|
|
|
else()
|
|
|
|
list(FILTER SOURCES EXCLUDE REGEX ".*ass_coretext.c$")
|
|
|
|
list(FILTER SOURCES EXCLUDE REGEX ".*ass_directwrite.c$")
|
|
|
|
endif()
|
2019-01-25 03:47:28 +08:00
|
|
|
|
|
|
|
find_package(Freetype REQUIRED)
|
|
|
|
|
|
|
|
find_path(FRIBIDI_INCLUDE_DIR
|
|
|
|
NAMES fribidi.h
|
|
|
|
PATH_SUFFIXES fribidi)
|
|
|
|
|
2019-01-31 05:41:51 +08:00
|
|
|
find_path(HARFBUZZ_INCLUDE_DIR
|
|
|
|
NAMES hb.h
|
|
|
|
PATH_SUFFIXES harfbuzz)
|
|
|
|
|
2020-08-07 04:07:46 +08:00
|
|
|
find_path(DIRENT_INCLUDE_DIR
|
|
|
|
NAMES dirent.h)
|
|
|
|
|
2020-08-08 07:06:43 +08:00
|
|
|
find_library(FRIBIDI_LIBRARY NAMES libfribidi fribidi)
|
2019-01-31 05:41:51 +08:00
|
|
|
find_library(HARFBUZZ_LIBRARY NAMES harfbuzz)
|
2019-01-25 03:47:28 +08:00
|
|
|
|
2019-01-31 05:41:51 +08:00
|
|
|
add_library(ass ${SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/libass.def)
|
2019-01-25 03:47:28 +08:00
|
|
|
|
2020-07-28 08:43:23 +08:00
|
|
|
target_include_directories(ass PRIVATE
|
|
|
|
${FRIBIDI_INCLUDE_DIR}
|
2019-01-31 05:41:51 +08:00
|
|
|
${HARFBUZZ_INCLUDE_DIR})
|
2020-08-07 04:07:46 +08:00
|
|
|
if(DIRENT_INCLUDE_DIR)
|
|
|
|
target_include_directories(ass PRIVATE
|
|
|
|
${DIRENT_INCLUDE_DIR})
|
|
|
|
endif()
|
2020-07-28 08:43:23 +08:00
|
|
|
target_link_libraries(ass PRIVATE
|
|
|
|
Freetype::Freetype
|
|
|
|
${FRIBIDI_LIBRARY}
|
2019-01-31 05:41:51 +08:00
|
|
|
${HARFBUZZ_LIBRARY})
|
2019-01-25 03:47:28 +08:00
|
|
|
|
|
|
|
install(TARGETS ass
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
ARCHIVE DESTINATION lib)
|
|
|
|
|
2019-02-02 03:11:01 +08:00
|
|
|
# pkgconfig file
|
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
|
|
|
|
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
|
|
|
set(PACKAGE_VERSION ${LIBASS_VERSION})
|
|
|
|
set(PKG_REQUIRES_PRIVATE "harfbuzz >= 0.9.5, fribidi >= 0.19.0, freetype2 >= 9.10.3")
|
|
|
|
set(PKG_LIBS_PRIVATE -lm)
|
|
|
|
configure_file(libass.pc.in libass.pc @ONLY)
|
|
|
|
install(FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/libass.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|