changeset 3241:32596919d729

first compilation combining ICU and LSB
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 16 Feb 2019 00:31:35 +0100
parents e44e0127e553
children 5d78df37c62f
files Resources/CMake/BoostConfiguration.cmake Resources/CMake/LibIconvConfiguration.cmake Resources/CMake/LibIcuConfiguration.cmake Resources/CMake/OrthancFrameworkConfiguration.cmake Resources/CMake/OrthancFrameworkParameters.cmake Resources/LinuxStandardBaseToolchain.cmake Resources/ThirdParty/icu/CMakeLists.txt Resources/ThirdParty/icu/Version.cmake UnitTestsSources/VersionsTests.cpp
diffstat 9 files changed, 65 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/BoostConfiguration.cmake	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/CMake/BoostConfiguration.cmake	Sat Feb 16 00:31:35 2019 +0100
@@ -271,7 +271,8 @@
         ${BOOST_SOURCES_DIR}/libs/locale/src/std/std_backend.cpp
         )
 
-      if (BOOST_LOCALE_BACKEND STREQUAL "iconv")
+      if (BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
+          BOOST_LOCALE_BACKEND STREQUAL "libiconv")
         add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
       elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
         add_definitions(-DBOOST_LOCALE_WITH_ICU=1)
@@ -302,7 +303,8 @@
         )
 
       if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR
-          BOOST_LOCALE_BACKEND STREQUAL "iconv")
+          BOOST_LOCALE_BACKEND STREQUAL "gcc" OR
+          BOOST_LOCALE_BACKEND STREQUAL "libiconv")
         # In WebAssembly or asm.js, we rely on the version of iconv
         # that is shipped with the stdlib
         add_definitions(-DBOOST_LOCALE_WITH_ICONV=1)
@@ -328,20 +330,21 @@
         )
 
       # 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"). Set
-      # "BOOST_LOCALE_BACKEND" to "wconv" to use WCONV anyway.
+      # libiconv on Windows. Indeed, the "WCONV" library of Windows XP
+      # seems not to support properly several codepages (notably
+      # "Latin3", "Hebrew", and "Arabic"). Set "BOOST_LOCALE_BACKEND"
+      # to "wconv" to use WCONV anyway.
 
-      if (BOOST_LOCALE_BACKEND STREQUAL "iconv")
+      if (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
         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")
+        add_definitions(-DBOOST_LOCALE_WITH_WCONV=1)
       else()
-        add_definitions(-DBOOST_LOCALE_WITH_WCONV=1)
+        message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND on Windows: ${BOOST_LOCALE_BACKEND}")
       endif()
 
     else()
--- a/Resources/CMake/LibIconvConfiguration.cmake	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/CMake/LibIconvConfiguration.cmake	Sat Feb 16 00:31:35 2019 +0100
@@ -19,6 +19,7 @@
     -DIN_LIBRARY=1
     -DLIBDIR=""
     -DICONV_CONST=
+    #-DENABLE_EXTRA=1
     )
 
   configure_file(
--- a/Resources/CMake/LibIcuConfiguration.cmake	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/CMake/LibIcuConfiguration.cmake	Sat Feb 16 00:31:35 2019 +0100
@@ -15,7 +15,6 @@
     )
 
   set(LIBICU_SOURCES
-    ${LIBICU_SOURCES}
     /home/jodogne/Subversion/orthanc/ThirdPartyDownloads/${LIBICU_DATA}
     )
 
@@ -26,13 +25,16 @@
     #-DU_COMBINED_IMPLEMENTATION
     #-DU_DEF_ICUDATA_ENTRY_POINT=icudt63l_dat
     #-DU_LIB_SUFFIX_C_NAME=l
-    -DUCONFIG_NO_SERVICE=1
+
+    #-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_CHARSET_IS_UTF8
+    -DUNISTR_FROM_STRING_EXPLICIT=
     )
 
   set_source_files_properties(
@@ -40,7 +42,6 @@
     PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t"
     )
 
-
 else() 
   CHECK_INCLUDE_FILE_CXX(unicode/uvernum.h HAVE_ICU_H)
   if (NOT HAVE_ICU_H)
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake	Sat Feb 16 00:31:35 2019 +0100
@@ -387,7 +387,8 @@
     # is shipped with the stdlib
     unset(BOOST_LOCALE_BACKEND CACHE)
   else()
-    if (BOOST_LOCALE_BACKEND STREQUAL "iconv")
+    if (BOOST_LOCALE_BACKEND STREQUAL "gcc")
+    elseif (BOOST_LOCALE_BACKEND STREQUAL "libiconv")
       include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake)
     elseif (BOOST_LOCALE_BACKEND STREQUAL "icu")
       include(${CMAKE_CURRENT_LIST_DIR}/LibIcuConfiguration.cmake)
--- a/Resources/CMake/OrthancFrameworkParameters.cmake	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/CMake/OrthancFrameworkParameters.cmake	Sat Feb 16 00:31:35 2019 +0100
@@ -67,9 +67,10 @@
 # Advanced and distribution-specific parameters
 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
 set(SYSTEM_MONGOOSE_USE_CALLBACKS ON CACHE BOOL "The system version of Mongoose uses callbacks (version >= 3.7)")
-set(BOOST_LOCALE_BACKEND "iconv" CACHE STRING "Back-end for locales that is used by Boost (can be \"iconv\", \"icu\", or \"wconv\" on Windows)")
+set(BOOST_LOCALE_BACKEND "libiconv" CACHE STRING "Back-end for locales that is used by Boost (can be \"gcc\", \"libiconv\", \"icu\", or \"wconv\" on Windows)")
 set(USE_PUGIXML ON CACHE BOOL "Use the Pugixml parser (turn off only for debug)")
-set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for old versions of Visual Studio)")
+set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for LSB and old versions of Visual Studio)")
+set(USE_LEGACY_LIBICU OFF CACHE BOOL "Use icu icu4c-58_2, latest version not requiring a C++11 compiler (for LSB and old versions of Visual Studio)")
 
 mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
 mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS)
--- a/Resources/LinuxStandardBaseToolchain.cmake	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/LinuxStandardBaseToolchain.cmake	Sat Feb 16 00:31:35 2019 +0100
@@ -1,4 +1,4 @@
-# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON
+# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DBOOST_LOCALE_BACKEND=gcc
 
 INCLUDE(CMakeForceCompiler)
 
--- a/Resources/ThirdParty/icu/CMakeLists.txt	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/ThirdParty/icu/CMakeLists.txt	Sat Feb 16 00:31:35 2019 +0100
@@ -1,7 +1,17 @@
+# Legacy version using LSB:
+# LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../../../LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_LIBICU=ON -G Ninja && ninja
+
+# Newest release of icu:
+# cmake .. -DCMAKE_BUILD_TYPE=Debug -G Ninja && ninja
+
 cmake_minimum_required(VERSION 2.8)
 project(IcuCodeGeneration)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+set(USE_LEGACY_LIBICU OFF CACHE BOOL "Use icu icu4c-58_2, latest version not requiring a C++11 compiler (for LSB and old versions of Visual Studio)")
+
+if (NOT USE_LEGACY_LIBICU)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+endif()
 
 include(${CMAKE_SOURCE_DIR}/../../CMake/Compiler.cmake)
 include(${CMAKE_SOURCE_DIR}/../../CMake/DownloadPackage.cmake)
@@ -20,14 +30,24 @@
 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"
-  )
+if (USE_LEGACY_LIBICU)
+  list(APPEND LIBICU_SOURCES
+    ${LIBICU_SOURCES_DIR}/source/stubdata/stubdata.c
+    )
+else()
+  list(APPEND LIBICU_SOURCES
+    ${LIBICU_SOURCES_DIR}/source/stubdata/stubdata.cpp
+    )
+  set_source_files_properties(
+    ${LIBICU_SOURCES_DIR}/source/tools/genccode/genccode.c
+    PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t"
+    )
+endif()
+
+
 
 add_executable(IcuCodeGeneration
   ${LIBICU_SOURCES_DIR}/source/tools/genccode/genccode.c
-  ${LIBICU_SOURCES_DIR}/source/stubdata/stubdata.cpp
   ${LIBICU_SOURCES}
   )
 
--- a/Resources/ThirdParty/icu/Version.cmake	Fri Feb 15 17:26:45 2019 +0100
+++ b/Resources/ThirdParty/icu/Version.cmake	Sat Feb 16 00:31:35 2019 +0100
@@ -12,7 +12,17 @@
 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")
+
+if (USE_LEGACY_LIBICU)
+  # This is the last version of icu that compiles with C++11
+  # support. It can be used for Linux Standard Base and Visual Studio 2008.
+  set(LIBICU_URL "http://orthanc.osimis.io/ThirdPartyDownloads/icu4c-58_2-src.tgz")
+  set(LIBICU_MD5 "fac212b32b7ec7ab007a12dff1f3aea1")
+  set(LIBICU_DATA "icudt58${LIBICU_SUFFIX}_dat.c")
+  set(LIBICU_SOURCE_DATA "${LIBICU_SOURCES_DIR}/source/data/in/icudt58l.dat")
+else()
+  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")
+endif()
--- a/UnitTestsSources/VersionsTests.cpp	Fri Feb 15 17:26:45 2019 +0100
+++ b/UnitTestsSources/VersionsTests.cpp	Sat Feb 16 00:31:35 2019 +0100
@@ -148,12 +148,15 @@
   ASSERT_STREQ("Lua 5.3.5", LUA_RELEASE);
 }
 
+
+#if BUILDING_LIBICONV == 1
 TEST(Version, LibIconvStatic)
 {
   static const int major = 1;
   static const int minor = 15;  
   ASSERT_EQ((major << 8) + minor, _LIBICONV_VERSION);
 }
+#endif
 
 
 #if ORTHANC_ENABLE_SSL == 1