On 18.07.2009 Mark de Wever wrote:
> Loonycyborg tested your patch with the scons build system and it works.
> 
> I tested your patch with the cmake build system and it failed as
> expected. Attached a patch for the cmake build system. Could you
> integrate this patch with yours and commit them in one commit?

The cmake patch didn't build on my system (Fedora-11) because
the CXXFLAGS and LDFLAGS wasn't passed to the compiler.

With my (non-existent) cmake knowledge I hacked the attached modified
patch which works with fribidi2. If it builds correctly on a legacy
fribidi system (e.g: Debian), I'll commit it together with the
autoconf/automake patches already tested by you.

Thanks,

-- 
Oron Peled                                 Voice: +972-4-8228492
[email protected]                  http://users.actcom.co.il/~oron
...there are two types of command interfaces in the world of
             computing: good interfaces and user interfaces.
                            - Dan Bernstein, Author of qmail

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 37103)
+++ CMakeLists.txt	(working copy)
@@ -26,7 +26,7 @@
 # yes, gettext is *required* even when NLS is deactivated (this is to compile
 # src/gettext.cpp since it includes libintl.h)
 find_package( Gettext REQUIRED )
-find_package( FriBiDi )
+
 find_package( X11 )
 
 if(NOT MSVC)
@@ -154,12 +154,6 @@
   add_definitions(-DUSE_TINY_GUI)
 endif(GUI STREQUAL "tiny")
 
-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_LOW_MEM)
   add_definitions(-DLOW_MEM)
 endif(ENABLE_LOW_MEM)
@@ -192,10 +186,19 @@
 if(ENABLE_GAME)
 	find_package( Lua51 REQUIRED)
 	find_package( PkgConfig REQUIRED )
+
 	pkg_check_modules( PANGOCAIRO REQUIRED pangocairo>=1.14.8 )
 	if(NOT MSVC)
 		pkg_check_modules( FONTCONFIG REQUIRED fontconfig>=2.4.1 )
 	endif(NOT MSVC)
+
+	find_package( FriBiDi )
+	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()
+
 endif(ENABLE_GAME)
 
 # get languages
Index: cmake/FindFriBiDi.cmake
===================================================================
--- cmake/FindFriBiDi.cmake	(revision 37103)
+++ cmake/FindFriBiDi.cmake	(working copy)
@@ -13,10 +13,13 @@
 
 SET(FRIBIDI_FOUND "NO")
 
-FIND_PATH(FRIBIDI_INCLUDE_DIR fribidi/fribidi.h
-  /usr/local/include
-  /usr/include
+# 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
@@ -27,12 +30,16 @@
 IF (FRIBIDI_LIBRARY AND FRIBIDI_INCLUDE_DIR)
   SET(CMAKE_REQUIRED_INCLUDES ${FRIBIDI_INCLUDE_DIR})
   SET(CMAKE_REQUIRED_LIBRARIES ${FRIBIDI_LIBRARY})
-  #we only support version 1 of fribidi and need the symbol fribidi_utf8_to_unicode
-  #here we check if it is really available
-  CHECK_SYMBOL_EXISTS(fribidi_utf8_to_unicode fribidi/fribidi.h FOUND_fribidi_utf8_to_unicode)
-  if(FOUND_fribidi_utf8_to_unicode)
+  CHECK_SYMBOL_EXISTS(fribidi_utf8_to_unicode fribidi.h FOUND_fribidi_utf8_to_unicode)
+  CHECK_SYMBOL_EXISTS(fribidi_charset_to_unicode fribidi.h FOUND_fribidi_charset_to_unicode)
+  if(FOUND_fribidi_charset_to_unicode)
     SET(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY})
     SET(FRIBIDI_FOUND "YES")
+  elseif(FOUND_fribidi_utf8_to_unicode)
+    SET(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY})
+    SET(FRIBIDI_FOUND "YES")
+    add_definitions(-DOLD_FRIBIDI)
+    MESSAGE(STATUS "Legacy FriBiDi: ${FRIBIDI_LIBRARY}")
   else()
     SET(FRIBIDI_LIBRARIES "NOTFOUND")
     SET(FRIBIDI_INCLUDE_DIR "NOTFOUND")
@@ -43,7 +50,7 @@
 IF (FRIBIDI_FOUND)
 
   IF (NOT FRIBIDI_FIND_QUIETLY)
-    MESSAGE(STATUS "Found FriBiDi: ${FRIBIDI_LIBRARY}")
+    MESSAGE(STATUS "Using FriBiDi: ${FRIBIDI_LIBRARY}")
   ENDIF (NOT FRIBIDI_FIND_QUIETLY)
 ELSE (FRIBIDI_FOUND)
   IF (FRIBIDI_FIND_REQUIRED)
_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev

Reply via email to