[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52346] trunk/blender: Fix when statically linking with distro's boost: in this case, we most likely also need to statically link against icu, as most boost packages are built with it.

Bastien Montagne montagne29 at wanadoo.fr
Mon Nov 19 09:51:36 CET 2012


Revision: 52346
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52346
Author:   mont29
Date:     2012-11-19 08:51:35 +0000 (Mon, 19 Nov 2012)
Log Message:
-----------
Fix when statically linking with distro's boost: in this case, we most likely also need to statically link against icu, as most boost packages are built with it. Without that, you get a bunch of errors at link time (when using boost_locale, or, in freestyle branch, boost_regex).

So when you enable Boost_USE_STATIC_LIBS, you should also set Boost_USE_ICU to True. Will add a note about that in build doc too.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/cmake/macros.cmake

Added Paths:
-----------
    trunk/blender/build_files/cmake/Modules/FindIcuLinux.cmake

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2012-11-19 08:48:21 UTC (rev 52345)
+++ trunk/blender/CMakeLists.txt	2012-11-19 08:51:35 UTC (rev 52346)
@@ -644,6 +644,9 @@
 				list(APPEND __boost_packages locale)
 			endif()
 			find_package(Boost 1.34 COMPONENTS ${__boost_packages})
+			if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+				find_package(IcuLinux)
+			endif()
 			mark_as_advanced(Boost_DIR)  # why doesnt boost do this?
 		endif()
 

Added: trunk/blender/build_files/cmake/Modules/FindIcuLinux.cmake
===================================================================
--- trunk/blender/build_files/cmake/Modules/FindIcuLinux.cmake	                        (rev 0)
+++ trunk/blender/build_files/cmake/Modules/FindIcuLinux.cmake	2012-11-19 08:51:35 UTC (rev 52346)
@@ -0,0 +1,146 @@
+# - Find static icu libraries
+# Find the native static icu libraries (needed for static boost_locale :/ ).
+# This module defines
+#  ICU_LIBRARIES, libraries to link against to use icu.
+#  ICU_ROOT_DIR, The base directory to search for icu.
+#                    This can also be an environment variable.
+#  ICU_FOUND, If false, do not try to use icu.
+#
+# also defined, but not for general use are
+#  ICU_LIBRARY_xxx, where to find the icu libraries.
+
+#=============================================================================
+# Copyright 2012 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If ICU_ROOT_DIR was defined in the environment, use it.
+IF(NOT ICU_ROOT_DIR AND NOT $ENV{ICU_ROOT_DIR} STREQUAL "")
+  SET(ICU_ROOT_DIR $ENV{ICU_ROOT_DIR})
+ENDIF()
+
+if(Boost_USE_STATIC_LIBS)
+  set(_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+  set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
+endif()
+
+SET(_icu_SEARCH_DIRS
+  ${ICU_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+)
+
+# We don't need includes, only libs to link against...
+#FIND_PATH(ICU_INCLUDE_DIR
+#  NAMES
+#    utf.h
+#  HINTS
+#    ${_icu_SEARCH_DIRS}
+#  PATH_SUFFIXES
+#    include/unicode
+#)
+
+FIND_LIBRARY(ICU_LIBRARY_DATA
+  NAMES
+    icudata
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_I18N
+  NAMES
+    icui18n
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_IO
+  NAMES
+    icuio
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_LE
+  NAMES
+    icule
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_LX
+  NAMES
+    iculx
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_TU
+  NAMES
+    icutu
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+FIND_LIBRARY(ICU_LIBRARY_UC
+  NAMES
+    icuuc
+  HINTS
+    ${_icu_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+# Restore the original find library ordering
+if(Boost_USE_STATIC_LIBS)
+  set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
+    ICU_LIBRARY_DATA
+    ICU_LIBRARY_I18N
+    ICU_LIBRARY_IO
+    ICU_LIBRARY_LE
+    ICU_LIBRARY_LX
+    ICU_LIBRARY_TU
+    ICU_LIBRARY_UC
+)
+
+IF(ICU_FOUND)
+  SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
+  SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
+ENDIF(ICU_FOUND)
+
+MARK_AS_ADVANCED(
+  ICU_INCLUDE_DIR
+  ICU_LIBRARY_DATA
+  ICU_LIBRARY_I18N
+  ICU_LIBRARY_IO
+  ICU_LIBRARY_LE
+  ICU_LIBRARY_LX
+  ICU_LIBRARY_TU
+  ICU_LIBRARY_UC
+)

Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake	2012-11-19 08:48:21 UTC (rev 52345)
+++ trunk/blender/build_files/cmake/macros.cmake	2012-11-19 08:51:35 UTC (rev 52346)
@@ -312,6 +312,9 @@
 	endif()
 	if(WITH_BOOST)
 		target_link_libraries(${target} ${BOOST_LIBRARIES})
+		if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+			target_link_libraries(${target} ${ICU_LIBRARIES})
+		endif()
 	endif()
 	target_link_libraries(${target} ${JPEG_LIBRARIES})
 	if(WITH_IMAGE_OPENEXR)




More information about the Bf-blender-cvs mailing list