[cmake] Add autotools like feature testing (#683)

This commit is contained in:
Ebrahim Byagowi 2018-01-09 01:39:42 +03:30 committed by GitHub
parent 0473d95e27
commit 3c7aeb5c64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 6 deletions

View File

@ -39,6 +39,7 @@ option(HB_HAVE_GLIB "Enable glib unicode functions" OFF)
option(HB_HAVE_ICU "Enable icu unicode functions" OFF)
if (APPLE)
option(HB_HAVE_CORETEXT "Enable CoreText shaper backend on macOS" ON)
set (CMAKE_MACOSX_RPATH ON)
endif ()
if (WIN32)
option(HB_HAVE_UNISCRIBE "Enable Uniscribe shaper backend on Windows" OFF)
@ -88,12 +89,15 @@ include_directories(AFTER
add_definitions(-DHAVE_OT)
add_definitions(-DHAVE_FALLBACK)
if (BUILD_SHARED_LIBS)
add_definitions(-DHAVE_ATEXIT)
if (APPLE)
set (CMAKE_MACOSX_RPATH ON)
endif ()
endif ()
include(CheckFunctionExists)
check_function_exists(atexit HAVE_ATEXIT)
check_function_exists(mprotect HAVE_MPROTECT)
check_function_exists(sysconf HAVE_SYSCONF)
check_function_exists(getpagesize HAVE_GETPAGESIZE)
check_function_exists(mmap HAVE_MMAP)
check_function_exists(isatty HAVE_ISATTY)
check_function_exists(newlocale HAVE_NEWLOCALE)
check_function_exists(strtod_l HAVE_STRTOD_L)
if (MSVC)
add_definitions(-wd4244 -wd4267 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
@ -244,6 +248,12 @@ if (HB_HAVE_FREETYPE)
list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-ft.cc)
list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-ft.h)
set (CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIRS})
set (CMAKE_REQUIRED_LIBRARIES ${FREETYPE_LIBRARIES})
check_function_exists(FT_Get_Var_Blend_Coordinates HAVE_FT_GET_VAR_BLEND_COORDINATES)
check_function_exists(FT_Set_Var_Blend_Coordinates HAVE_FT_SET_VAR_BLEND_COORDINATES)
check_function_exists(FT_Done_MM_Var HAVE_FT_DONE_MM_VAR)
endif ()
if (HB_HAVE_GRAPHITE2)