changeset 3237:ed6dc4ecabcb

continuing with icu
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 15 Feb 2019 16:32:12 +0100
parents 47fbb0467a62
children e1a4bfd14e66
files Resources/CMake/LibIcuConfiguration.cmake Resources/ThirdParty/icu/CMakeLists.txt Resources/ThirdParty/icu/Version.cmake
diffstat 3 files changed, 111 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/LibIcuConfiguration.cmake	Fri Feb 15 10:26:32 2019 +0100
+++ b/Resources/CMake/LibIcuConfiguration.cmake	Fri Feb 15 16:32:12 2019 +0100
@@ -5,17 +5,39 @@
 message("Using libicu")
 
 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICU)
-  set(LIBICU_SOURCES_DIR ${CMAKE_BINARY_DIR}/icu)
-  set(LIBICU_URL "http://orthanc.osimis.io/ThirdPartyDownloads/icu4c-63_1-src.tgz")
-  set(LIBICU_MD5 "9e40f6055294284df958200e308bce50")
+  include(${CMAKE_CURRENT_LIST_DIR}/../ThirdParty/icu/Version.cmake)
+  DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}")
+  #DownloadPackage("2e12e17ae89e04768cfdc531aae4a5fb" "http://localhost/icudt63l_dat.c.gz" "icudt63l_dat.c")
 
-  DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}")
+  include_directories(BEFORE
+    ${LIBICU_SOURCES_DIR}/source/common
+    ${LIBICU_SOURCES_DIR}/source/i18n
+    )
+
+  set(LIBICU_SOURCES
+    ${LIBICU_SOURCES}
+    /home/jodogne/Subversion/orthanc/ThirdPartyDownloads/${LIBICU_DATA}
+    )
+
+  aux_source_directory(${LIBICU_SOURCES_DIR}/source/common LIBICU_SOURCES)
+  aux_source_directory(${LIBICU_SOURCES_DIR}/source/i18n LIBICU_SOURCES)
 
+  add_definitions(
+    #-DU_COMBINED_IMPLEMENTATION
+    #-DU_DEF_ICUDATA_ENTRY_POINT=icudt63l_dat
+    #-DU_LIB_SUFFIX_C_NAME=l
+    -DUCONFIG_NO_SERVICE=1
+    -DU_COMMON_IMPLEMENTATION
+    -DU_ENABLE_DYLOAD=0
+    -DU_HAVE_STD_STRING=1
+    -DU_I18N_IMPLEMENTATION
+    -DU_IO_IMPLEMENTATION
+    -DU_STATIC_IMPLEMENTATION=1
+    )
 
-  # TODO
-  add_definitions(
-    -DU_STATIC_IMPLEMENTATION
-    #-DU_COMBINED_IMPLEMENTATION
+  set_source_files_properties(
+    /home/jodogne/Subversion/orthanc/ThirdPartyDownloads/${LIBICU_DATA}
+    PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t"
     )
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/ThirdParty/icu/CMakeLists.txt	Fri Feb 15 16:32:12 2019 +0100
@@ -0,0 +1,63 @@
+cmake_minimum_required(VERSION 2.8)
+project(IcuCodeGeneration)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+
+include(${CMAKE_SOURCE_DIR}/../../CMake/Compiler.cmake)
+include(${CMAKE_SOURCE_DIR}/../../CMake/DownloadPackage.cmake)
+include(Version.cmake)
+
+set(ALLOW_DOWNLOADS ON)
+DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}")
+
+include_directories(
+  ${LIBICU_SOURCES_DIR}/source/common
+  ${LIBICU_SOURCES_DIR}/source/i18n
+  ${LIBICU_SOURCES_DIR}/source/tools/toolutil/
+  )
+
+aux_source_directory(${LIBICU_SOURCES_DIR}/source/common         LIBICU_SOURCES)
+aux_source_directory(${LIBICU_SOURCES_DIR}/source/i18n           LIBICU_SOURCES)
+aux_source_directory(${LIBICU_SOURCES_DIR}/source/tools/toolutil LIBICU_SOURCES)
+
+set_source_files_properties(
+  ${LIBICU_SOURCES_DIR}/source/tools/genccode/genccode.c
+  PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t"
+  )
+
+add_executable(IcuCodeGeneration
+  ${LIBICU_SOURCES_DIR}/source/tools/genccode/genccode.c
+  ${LIBICU_SOURCES_DIR}/source/stubdata/stubdata.cpp
+  ${LIBICU_SOURCES}
+  )
+
+add_custom_command(
+  OUTPUT   ${LIBICU_DATA}
+  COMMAND  IcuCodeGeneration ${LIBICU_SOURCE_DATA}
+  DEPENDS  IcuCodeGeneration
+  )
+
+add_custom_command(
+  OUTPUT   ${LIBICU_DATA}.gz
+  COMMAND  gzip -f ${LIBICU_DATA}
+  DEPENDS  ${LIBICU_DATA}
+  )
+
+add_custom_target(Final ALL DEPENDS  ${LIBICU_DATA}.gz)
+
+install(
+  FILES ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz
+  DESTINATION ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads
+  )
+
+add_definitions(
+  #-DU_COMBINED_IMPLEMENTATION
+  -DUCONFIG_NO_SERVICE=1
+  -DU_COMMON_IMPLEMENTATION
+  -DU_ENABLE_DYLOAD=0
+  -DU_HAVE_STD_STRING=1
+  -DU_I18N_IMPLEMENTATION
+  -DU_IO_IMPLEMENTATION
+  -DU_STATIC_IMPLEMENTATION=1
+  -DU_TOOLUTIL_IMPLEMENTATION
+  )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/ThirdParty/icu/Version.cmake	Fri Feb 15 16:32:12 2019 +0100
@@ -0,0 +1,18 @@
+# NB: Orthanc assume that the platform is of ASCII-family, not of
+# EBCDIC-family. A "e" suffix would be needed on EBCDIC. Look for
+# macro "U_ICUDATA_TYPE_LETTER" in the source code of icu for more
+# information.
+
+include(TestBigEndian)
+TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
+if(IS_BIG_ENDIAN)
+  set(LIBICU_SUFFIX "b")
+else()
+  set(LIBICU_SUFFIX "l")
+endif()
+
+set(LIBICU_SOURCES_DIR ${CMAKE_BINARY_DIR}/icu)
+set(LIBICU_URL "http://orthanc.osimis.io/ThirdPartyDownloads/icu4c-63_1-src.tgz")
+set(LIBICU_MD5 "9e40f6055294284df958200e308bce50")
+set(LIBICU_DATA "icudt63${LIBICU_SUFFIX}_dat.c")
+set(LIBICU_SOURCE_DATA "${LIBICU_SOURCES_DIR}/source/data/in/icudt63l.dat")