changeset 1094:1b905ad6c913

Replace wconv by iconv under Windows
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Aug 2014 15:42:19 +0200
parents 552a038f7c96
children ed5069aa1f50
files Resources/CMake/BoostConfiguration.cmake Resources/CMake/LibIconvConfiguration.cmake
diffstat 2 files changed, 58 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/BoostConfiguration.cmake	Tue Aug 05 13:08:41 2014 +0200
+++ b/Resources/CMake/BoostConfiguration.cmake	Tue Aug 05 15:42:19 2014 +0200
@@ -76,9 +76,14 @@
       ${BOOST_SOURCES_DIR}/libs/thread/src/win32/tss_pe.cpp
       ${BOOST_FILESYSTEM_SOURCES_DIR}/windows_file_codecvt.cpp
       )
-    add_definitions(
-      -DBOOST_LOCALE_WITH_WCONV=1
-      )
+
+    # Starting with release 0.8.2, Orthanc statically links against
+    # libiconv, even on Windows. Indeed, the "WCONV" library of
+    # Windows XP seems not to support properly several codepages
+    # (notably "Latin3", "Hebrew", and "Arabic").
+
+    # add_definitions(-DBOOST_LOCALE_WITH_WCONV=1)
+    include(${ORTHANC_ROOT}/Resources/CMake/LibIconvConfiguration.cmake)
 
   else()
     message(FATAL_ERROR "Support your platform here")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CMake/LibIconvConfiguration.cmake	Tue Aug 05 15:42:19 2014 +0200
@@ -0,0 +1,50 @@
+set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.14)
+DownloadPackage(
+  "e34509b1623cec449dfeb73d7ce9c6c6"
+  "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/libiconv-1.14.tar.gz"
+  "${LIBICONV_SOURCES_DIR}")
+
+# https://groups.google.com/forum/#!topic/android-ndk/AS1nkxnk6m4
+add_definitions(
+  -DBOOST_LOCALE_WITH_ICONV=1
+  -DBUILDING_LIBICONV=1
+  -DIN_LIBRARY=1
+  -DLIBDIR=""
+  -DICONV_CONST=
+  )
+
+configure_file(
+  ${LIBICONV_SOURCES_DIR}/srclib/localcharset.h
+  ${LIBICONV_SOURCES_DIR}/include
+  COPYONLY)
+
+set(HAVE_VISIBILITY 0)
+set(ICONV_CONST ${ICONV_CONST})
+set(USE_MBSTATE_T 1)
+set(BROKEN_WCHAR_H 0)
+set(EILSEQ)
+set(HAVE_WCHAR_T 1)   
+configure_file(
+  ${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in
+  ${LIBICONV_SOURCES_DIR}/include/iconv.h
+  )
+unset(HAVE_VISIBILITY)
+unset(ICONV_CONST)
+unset(USE_MBSTATE_T)
+unset(BROKEN_WCHAR_H)
+unset(EILSEQ)
+unset(HAVE_WCHAR_T)   
+
+include_directories(
+  ${LIBICONV_SOURCES_DIR}/include
+  )
+
+list(APPEND BOOST_SOURCES
+  ${LIBICONV_SOURCES_DIR}/lib/genaliases2.c  
+  ${LIBICONV_SOURCES_DIR}/lib/genflags.c
+  ${LIBICONV_SOURCES_DIR}/lib/gentranslit.c
+  ${LIBICONV_SOURCES_DIR}/lib/iconv.c  
+  ${LIBICONV_SOURCES_DIR}/lib/relocatable.c
+  ${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c  
+  ${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c
+  )