changeset 3230:4b042ec734c1

dynamic linking against libicu
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 14 Feb 2019 20:22:33 +0100
parents 77e8378f0323
children fc5bc0fe863c
files Core/Toolbox.cpp Resources/CMake/BoostConfiguration.cmake Resources/CMake/LibIcuConfiguration.cmake
diffstat 3 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Thu Feb 14 19:52:35 2019 +0100
+++ b/Core/Toolbox.cpp	Thu Feb 14 20:22:33 2019 +0100
@@ -499,7 +499,11 @@
         return "GB18030";
 
       case Encoding_Thai:
+#if BOOST_LOCALE_WITH_ICU == 1
+        return "tis620.2533";
+#else
         return "TIS620.2533-0";
+#endif
 
       case Encoding_Korean:
         return "ISO-IR-149";
--- a/Resources/CMake/BoostConfiguration.cmake	Thu Feb 14 19:52:35 2019 +0100
+++ b/Resources/CMake/BoostConfiguration.cmake	Thu Feb 14 20:22:33 2019 +0100
@@ -228,6 +228,18 @@
   if (NOT ENABLE_LOCALE)
     message("boost::locale is disabled")
   else()
+    set(BOOST_ICU_SOURCES
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/boundary.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/codecvt.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/collator.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/conversion.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/date_time.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/formatter.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/icu_backend.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/numeric.cpp
+      ${BOOST_SOURCES_DIR}/libs/locale/src/icu/time_zone.cpp
+      )
+
     list(APPEND BOOST_SOURCES
       ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
       ${BOOST_SOURCES_DIR}/libs/locale/src/shared/generator.cpp
@@ -263,6 +275,7 @@
         add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
       elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
         add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
+        list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
       else()
         message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
       endif()
@@ -295,17 +308,7 @@
         add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
       elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
         add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
-        list(APPEND BOOST_SOURCES
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/boundary.cpp
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/codecvt.cpp
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/collator.cpp
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/conversion.cpp
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/date_time.cpp
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/formatter.cpp   
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/icu_backend.cpp
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/numeric.cpp
-           ${BOOST_SOURCES_DIR}/libs/locale/src/icu/time_zone.cpp
-          )        
+        list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
       else()
         message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}")
       endif()
@@ -334,6 +337,7 @@
         add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
       elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
         add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
+        list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES})
       elseif (BOOST_LOCALE_BACKEND STREQUAL "wconv")
         message("Using Window's wconv")
       else()
--- a/Resources/CMake/LibIcuConfiguration.cmake	Thu Feb 14 19:52:35 2019 +0100
+++ b/Resources/CMake/LibIcuConfiguration.cmake	Thu Feb 14 20:22:33 2019 +0100
@@ -73,11 +73,13 @@
     message(FATAL_ERROR "Please install the libicu-dev package")
   endif()
 
-  CHECK_LIBRARY_EXISTS(icuuc udata_close "" HAVE_ICU_LIB)
-  if (NOT HAVE_ICU_LIB)
-    #message(FATAL_ERROR "Please install the libicu-dev package")
-    link_libraries(icuuc)
+  find_library(LIBICU_PATH_1 NAMES icuuc)
+  find_library(LIBICU_PATH_2 NAMES icui18n)
+
+  if (NOT LIBICU_PATH_1 OR 
+      NOT LIBICU_PATH_2)
+    message(FATAL_ERROR "Please install the libicu-dev package")
   else()
-    link_libraries(icuuc)
+    link_libraries(icuuc icui18n)
   endif()
 endif()