gr-fosphor: Rely on the system-wide FindFreetype

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2016-05-22 22:27:22 +02:00
parent e1eb11b2d8
commit 0c4bd380ef
3 changed files with 5 additions and 110 deletions

View File

@ -104,8 +104,8 @@ if(NOT OpenCL_FOUND)
message(FATAL_ERROR "OpenCL required to compile gr-fosphor")
endif()
find_package(Freetype2)
if(NOT FREETYPE2_FOUND)
find_package(Freetype)
if(NOT FREETYPE_FOUND)
message(FATAL_ERROR "freetype2 required to compile gr-fosphor")
endif()

View File

@ -1,105 +0,0 @@
if(NOT FREETYPE2_FOUND)
INCLUDE(FindPkgConfig)
pkg_check_modules (FREETYPE2_PKG freetype2)
# find ft2build.h, which was added in 2.1.6; this could be in the
# top level include directory (for API release 16 or earlier) or in
# freetype2 (for API release 17 or later).
find_path(FREETYPE2_INCLUDE_DIR_ft2build
NAMES
ft2build.h
HINTS
${FREETYPE2_PKG_INCLUDE_DIRS}
ENV FREETYPE2_DIR
PATHS
/usr
/usr/local
/opt/local
PATH_SUFFIXES
include/freetype2
include
)
if(FREETYPE2_INCLUDE_DIR_ft2build)
# Freetype changed header locations between API release 16 and 17;
# look for config/ftheader.h depending on the API release number.
if(NOT FREETYPE2_PKG_VERSION)
# PKGCONFIG failed to find a package, but ft2build.h was
# located. Guess API release version based on trailing
# directory of ft2build.h location.
STRING(REGEX MATCH "[^/]*$" FREETYPE2_ft2build_DIR ${FREETYPE2_INCLUDE_DIR_ft2build})
message("FREETYPE2_ft2build_DIR is '${FREETYPE2_ft2build_DIR}'")
STRING(COMPARE NOTEQUAL ${FREETYPE2_ft2build_DIR} "freetype2" FREETYPE_IS_2_4_OR_EARLIER)
else(NOT FREETYPE2_PKG_VERSION)
# PKGCONFIG provides version information; use that
STRING(REGEX MATCH "[^.]*" FREETYPE2_RELEASE ${FREETYPE2_PKG_VERSION})
STRING(COMPARE LESS ${FREETYPE2_RELEASE} 17 FREETYPE_IS_2_4_OR_EARLIER)
endif(NOT FREETYPE2_PKG_VERSION)
if(FREETYPE_IS_2_4_OR_EARLIER)
# freetype 2.4 or earlier
set(FTHEADER_NAME freetype/config/ftheader.h)
else(FREETYPE_IS_2_4_OR_EARLIER)
# freetype 2.5 or later
set(FTHEADER_NAME config/ftheader.h)
endif(FREETYPE_IS_2_4_OR_EARLIER)
find_path(FREETYPE2_INCLUDE_DIR_ftheader
NAMES
${FTHEADER_NAME}
HINTS
${FREETYPE2_PKG_INCLUDE_DIRS}
${FREETYPE2_INCLUDE_DIR_ft2build}
ENV FREETYPE2_DIR
PATH_SUFFIXES
freetype2
include/freetype2
include
NO_DEFAULT_PATH
)
if(FREETYPE2_INCLUDE_DIR_ftheader)
string(COMPARE EQUAL ${FREETYPE2_INCLUDE_DIR_ft2build} ${FREETYPE2_INCLUDE_DIR_ftheader} FREETYPE2_DIRS_SAME)
if(FREETYPE2_DIRS_SAME)
set(FREETYPE2_INCLUDE_DIRS ${FREETYPE2_INCLUDE_DIR_ft2build} CACHE INTERNAL "freetype2 include directories")
else()
set(FREETYPE2_INCLUDE_DIRS ${FREETYPE2_INCLUDE_DIR_ft2build};${FREETYPE2_INCLUDE_DIR_ftheader} CACHE INTERNAL "freetype2 include directories")
endif()
find_library(FREETYPE2_LIBRARIES
NAMES
freetype
HINTS
${FREETYPE2_PKG_LIBRARY_DIRS}
ENV FREETYPE_DIR
PATHS
/usr
/usr/local
/opt/local
PATH_SUFFIXES
lib
lib64
)
if(FREETYPE2_LIBRARIES)
set(FREETYPE2_FOUND TRUE CACHE INTERNAL "freetype2 found")
message(STATUS "Found freetype2: ${FREETYPE2_INCLUDE_DIRS}, ${FREETYPE2_LIBRARIES}")
else(FREETYPE2_INCLUDE_DIRS AND FREETYPE2_LIBRARIES)
set(FREETYPE2_FOUND FALSE CACHE INTERNAL "freetype2 found")
message(STATUS "freetype2 not found.")
endif(FREETYPE2_LIBRARIES)
endif(FREETYPE2_INCLUDE_DIR_ftheader)
endif(FREETYPE2_INCLUDE_DIR_ft2build)
mark_as_advanced(FREETYPE2_INCLUDE_DIRS FREETYPE2_LIBRARIES)
endif(NOT FREETYPE2_FOUND)

View File

@ -38,13 +38,13 @@ add_custom_command(
include_directories(
${OPENGL_INCLUDE_DIRS}
${OpenCL_INCLUDE_DIRS}
${FREETYPE2_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
${Boost_INCLUDE_DIR}
)
link_directories(
${OPENGL_LIBRARY_DIRS}
${OpenCL_LIBRARY_DIRS}
${FREETYPE2_LIBRARY_DIRS}
${FREETYPE_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS}
)
@ -85,7 +85,7 @@ list_cond_append(ENABLE_WX fosphor_sources wx_core_sink_c_impl.cc)
list(APPEND fosphor_libraries
${OPENGL_LIBRARIES}
${OpenCL_LIBRARIES}
${FREETYPE2_LIBRARIES}
${FREETYPE_LIBRARIES}
${Boost_LIBRARIES}
${GNURADIO_ALL_LIBRARIES}
${CMAKE_DL_LIBS}