switch to better way finding FriBiDi in cmake
* FriBiDi can be found using pkgconfig, switch to using it instead of using our homegrown FindFriBiDi.cmake file for finding it in cmake * had to set some extra "do not consider these warnings" for font.cpp, is this really no issue for scons for strict compilation with -Wall?
This commit is contained in:
parent
98c9bc4e5a
commit
76c6cc1de3
4 changed files with 18 additions and 86 deletions
|
@ -582,12 +582,14 @@ if(ENABLE_TESTS)
|
|||
find_package( Boost 1.36 REQUIRED COMPONENTS unit_test_framework )
|
||||
endif(ENABLE_TESTS)
|
||||
if(ENABLE_GAME)
|
||||
find_package( FriBiDi 0.10.9 )
|
||||
if(ENABLE_FRIBIDI AND FRIBIDI_LIBRARIES)
|
||||
add_definitions(-DHAVE_FRIBIDI)
|
||||
elseif(ENABLE_FRIBIDI AND NOT FRIBIDI_LIBRARIES)
|
||||
message("Could not find FriBiDi. Disabling FriBiDi support.")
|
||||
endif()
|
||||
if(ENABLE_FRIBIDI)
|
||||
PKG_CHECK_MODULES(FRIBIDI fribidi>=0.10.9)
|
||||
if(FRIBIDI_FOUND)
|
||||
add_definitions(-DHAVE_FRIBIDI)
|
||||
elseif(NOT FRIBIDI_FOUND)
|
||||
message("Could not find FriBiDi. Disabling FriBiDi support.")
|
||||
endif(FRIBIDI_FOUND)
|
||||
endif(ENABLE_FRIBIDI)
|
||||
|
||||
if(ENABLE_NOTIFICATIONS)
|
||||
pkg_check_modules(LIBDBUS dbus-1)
|
||||
|
|
|
@ -573,6 +573,7 @@ Version 1.13.0-dev:
|
|||
* Fixed bug #23445: set default build type in cmake to "Release" to ensure
|
||||
that the game is not unoptimized
|
||||
* Increased minimum version of FriBiDi to 0.10.9 in cmake to match scons
|
||||
* Changed how FriBiDi is found in cmake to using pkgconfig
|
||||
|
||||
Version 1.11.11:
|
||||
* Add-ons server:
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
# - Find the native FriBiDI includes and library
|
||||
#
|
||||
#
|
||||
# This module defines
|
||||
# FRIBIDI_INCLUDE_DIR, where to find fribidi.h, etc.
|
||||
# FRIBIDI_LIBRARIES, the libraries to link against to use FriBiDi.
|
||||
# PNG_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
|
||||
# FRIBIDI_FOUND, If false, do not try to use PNG.
|
||||
# also defined, but not for general use are
|
||||
# FRIBIDI_LIBRARY, where to find the FriBiDi library.
|
||||
#
|
||||
# FriBiDi provides both fribidi_utf8_to_unicode and fribidi_charset_to_unicode.
|
||||
# The difference is that
|
||||
# 1. fribidi >= 0.10.5 has FRIBIDI_CHAR_SET_UTF8.
|
||||
# 2. fribidi <= 0.10.4 has FRIBIDI_CHARSET_UTF8.
|
||||
# Wesnoth uses fribidi_charset_to_unicode and FRIBIDI_CHAR_SET_UTF8.
|
||||
|
||||
INCLUDE(CheckSymbolExists)
|
||||
|
||||
SET(FRIBIDI_FOUND "NO")
|
||||
|
||||
# Set variable in temp var, otherwise FIND_PATH might fail
|
||||
# unset isn't present in the required version of cmake.
|
||||
FIND_PATH(xFRIBIDI_INCLUDE_DIR fribidi.h
|
||||
/usr/local/include/fribidi
|
||||
/usr/include/fribidi
|
||||
)
|
||||
SET(FRIBIDI_INCLUDE_DIR ${xFRIBIDI_INCLUDE_DIR})
|
||||
|
||||
SET(FRIBIDI_NAMES ${FRIBIDI_NAMES} fribidi libfribidi)
|
||||
FIND_LIBRARY(FRIBIDI_LIBRARY
|
||||
NAMES ${FRIBIDI_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
|
||||
IF (FRIBIDI_LIBRARY AND FRIBIDI_INCLUDE_DIR)
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${FRIBIDI_INCLUDE_DIR})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${FRIBIDI_LIBRARY})
|
||||
CHECK_SYMBOL_EXISTS(fribidi_charset_to_unicode fribidi.h FOUND_fribidi_charset_to_unicode)
|
||||
CHECK_SYMBOL_EXISTS(FRIBIDI_CHAR_SET_UTF8 fribidi.h FOUND_FRIBIDI_CHAR_SET_UTF8)
|
||||
|
||||
# Newer versions of fribidi (not tested the initial version which has the
|
||||
# issue, but at least 0.19.2 has the issue) no longer have the symbol
|
||||
# FRIBIDI_CHAR_SET_UTF8. But the symbol is build with some macros confusing
|
||||
# cmake. To test for that case let the compiler give its verdict.
|
||||
IF(FOUND_fribidi_charset_to_unicode AND NOT FOUND_FRIBIDI_CHAR_SET_UTF8)
|
||||
FILE(WRITE "${CMAKE_BINARY_DIR}/fribidi_test.c"
|
||||
"#include <fribidi.h>\nint main(){FriBidiCharSet s = FRIBIDI_CHAR_SET_UTF8;}"
|
||||
)
|
||||
TRY_COMPILE(FOUND_FRIBIDI_CHAR_SET_UTF8
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/fribidi_test.c"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${FRIBIDI_INCLUDE_DIR}"
|
||||
)
|
||||
FILE(REMOVE "${CMAKE_BINARY_DIR}/fribidi_test.c")
|
||||
ENDIF(FOUND_fribidi_charset_to_unicode AND NOT FOUND_FRIBIDI_CHAR_SET_UTF8)
|
||||
|
||||
IF(FOUND_fribidi_charset_to_unicode AND FOUND_FRIBIDI_CHAR_SET_UTF8)
|
||||
# fribidi >= 0.10.5
|
||||
SET(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY})
|
||||
SET(FRIBIDI_FOUND "YES")
|
||||
ELSE()
|
||||
SET(FRIBIDI_LIBRARIES "NOTFOUND")
|
||||
SET(FRIBIDI_INCLUDE_DIR "NOTFOUND")
|
||||
SET(FRIBIDI_FOUND "NO")
|
||||
ENDIF()
|
||||
ENDIF (FRIBIDI_LIBRARY AND FRIBIDI_INCLUDE_DIR)
|
||||
|
||||
IF (FRIBIDI_FOUND)
|
||||
IF (NOT FRIBIDI_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Using FriBiDi: ${FRIBIDI_LIBRARY}")
|
||||
ENDIF (NOT FRIBIDI_FIND_QUIETLY)
|
||||
ELSE (FRIBIDI_FOUND)
|
||||
IF (FRIBIDI_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find FriBiDi library")
|
||||
ENDIF (FRIBIDI_FIND_REQUIRED)
|
||||
ENDIF (FRIBIDI_FOUND)
|
|
@ -158,10 +158,16 @@ set(tools-external-libs
|
|||
${Boost_RANDOM_LIBRARY}
|
||||
)
|
||||
|
||||
if(ENABLE_FRIBIDI AND FRIBIDI_LIBRARIES)
|
||||
include_directories(SYSTEM ${FRIBIDI_INCLUDE_DIR} )
|
||||
if(ENABLE_FRIBIDI AND FRIBIDI_FOUND)
|
||||
set(game-external-libs ${game-external-libs} ${FRIBIDI_LIBRARIES})
|
||||
endif(ENABLE_FRIBIDI AND FRIBIDI_LIBRARIES)
|
||||
include_directories(SYSTEM ${FRIBIDI_INCLUDE_DIRS} )
|
||||
# latest FriBiDi deprecated some functions we rely on...
|
||||
set_source_files_properties(
|
||||
font.cpp
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-deprecated-declarations -Wno-unused-result"
|
||||
)
|
||||
endif(ENABLE_FRIBIDI AND FRIBIDI_FOUND)
|
||||
|
||||
if(X11_FOUND)
|
||||
include_directories(SYSTEM ${X11_INCLUDE_DIR} )
|
||||
|
|
Loading…
Add table
Reference in a new issue