[cmake] Add header existence tests (#685)

This commit is contained in:
Ebrahim Byagowi 2018-01-10 15:45:12 +03:30 committed by GitHub
parent a073621b5d
commit 71e0ed9cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 21 deletions

View File

@ -138,8 +138,8 @@ workflows:
version: 2 version: 2
build: build:
jobs: jobs:
- oracledeveloperstudio #- oracledeveloperstudio
- fedora-out-of-tree #- fedora-out-of-tree
- archlinux - archlinux
- freebsd9 - freebsd9
- base - base

View File

@ -89,15 +89,34 @@ include_directories(AFTER
add_definitions(-DHAVE_OT) add_definitions(-DHAVE_OT)
add_definitions(-DHAVE_FALLBACK) add_definitions(-DHAVE_FALLBACK)
include (CheckFunctionExists) include (CheckFunctionExists)
check_function_exists(atexit HAVE_ATEXIT) include (CheckIncludeFile)
check_function_exists(mprotect HAVE_MPROTECT) macro (check_funcs) # Similar to AC_CHECK_FUNCS of autotools
check_function_exists(sysconf HAVE_SYSCONF) foreach (func_name ${ARGN})
check_function_exists(getpagesize HAVE_GETPAGESIZE) set (RESULT OFF)
check_function_exists(mmap HAVE_MMAP) check_function_exists(${func_name} RESULT)
check_function_exists(isatty HAVE_ISATTY) if (${RESULT})
check_function_exists(newlocale HAVE_NEWLOCALE) string(TOUPPER ${func_name} definiton_to_add)
check_function_exists(strtod_l HAVE_STRTOD_L) add_definitions(-DHAVE_${definiton_to_add})
endif ()
endforeach ()
endmacro ()
check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l)
check_include_file(unistd.h HAVE_UNIST_H)
if (${HAVE_UNIST_H})
add_definitions(-DHAVE_UNIST_H)
endif ()
#check_include_file(sys/mman.h HAVE_SYS_MMAN_H) enable this sometime
#if (${HAVE_SYS_MMAN_H})
# add_definitions(-DHAVE_SYS_MMAN_H)
#endif ()
check_include_file(xlocale.h HAVE_XLOCALE_H)
if (${HAVE_XLOCALE_H})
add_definitions(-DHAVE_XLOCALE_H)
endif ()
if (MSVC) if (MSVC)
add_definitions(-wd4244 -wd4267 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) add_definitions(-wd4244 -wd4267 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
@ -249,11 +268,9 @@ if (HB_HAVE_FREETYPE)
list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-ft.cc) list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-ft.cc)
list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-ft.h) list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-ft.h)
set (CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIRS}) set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${FREETYPE_INCLUDE_DIRS})
set (CMAKE_REQUIRED_LIBRARIES ${FREETYPE_LIBRARIES}) set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${FREETYPE_LIBRARIES})
check_function_exists(FT_Get_Var_Blend_Coordinates HAVE_FT_GET_VAR_BLEND_COORDINATES) check_funcs(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
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 () endif ()
if (HB_HAVE_GRAPHITE2) if (HB_HAVE_GRAPHITE2)

View File

@ -2,7 +2,6 @@ if (HB_BUILD_UTILS)
file (READ "${CMAKE_CURRENT_SOURCE_DIR}/data/in-house/Makefile.am" INHOUSE) file (READ "${CMAKE_CURRENT_SOURCE_DIR}/data/in-house/Makefile.am" INHOUSE)
extract_make_variable (TESTS ${INHOUSE}) extract_make_variable (TESTS ${INHOUSE})
foreach (test IN ITEMS ${TESTS}) foreach (test IN ITEMS ${TESTS})
message(${CMAKE_CURRENT_SOURCE_DIR}/data/in-house)
add_test (NAME ${test} add_test (NAME ${test}
COMMAND python run-tests.py $<TARGET_FILE:hb-shape> "data/in-house/${test}" COMMAND python run-tests.py $<TARGET_FILE:hb-shape> "data/in-house/${test}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})