1# Orthanc - A Lightweight, RESTful DICOM Store 2# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 3# Department, University Hospital of Liege, Belgium 4# Copyright (C) 2017-2020 Osimis S.A., Belgium 5# 6# This program is free software: you can redistribute it and/or 7# modify it under the terms of the GNU Lesser General Public License 8# as published by the Free Software Foundation, either version 3 of 9# the License, or (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, but 12# WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Lesser General Public License for more details. 15# 16# You should have received a copy of the GNU Lesser General Public 17# License along with this program. If not, see 18# <http://www.gnu.org/licenses/>. 19 20 21 22# Check out: ../ThirdParty/icu/README.txt 23 24# http://userguide.icu-project.org/packaging 25# http://userguide.icu-project.org/howtouseicu 26 27message("Using libicu") 28 29if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICU) 30 include(${CMAKE_CURRENT_LIST_DIR}/../ThirdParty/icu/Version.cmake) 31 DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}") 32 33 # Use the gzip-compressed data 34 DownloadFile(${LIBICU_DATA_COMPRESSED_MD5} ${LIBICU_DATA_URL}) 35 set(LIBICU_RESOURCES 36 LIBICU_DATA ${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${LIBICU_DATA} 37 ) 38 39 set_source_files_properties( 40 ${CMAKE_BINARY_DIR}/${LIBICU_DATA} 41 PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t" 42 ) 43 44 include_directories(BEFORE 45 ${LIBICU_SOURCES_DIR}/source/common 46 ${LIBICU_SOURCES_DIR}/source/i18n 47 ) 48 49 aux_source_directory(${LIBICU_SOURCES_DIR}/source/common LIBICU_SOURCES) 50 aux_source_directory(${LIBICU_SOURCES_DIR}/source/i18n LIBICU_SOURCES) 51 52 add_definitions( 53 #-DU_COMBINED_IMPLEMENTATION 54 #-DU_DEF_ICUDATA_ENTRY_POINT=icudt63l_dat 55 #-DU_LIB_SUFFIX_C_NAME=l 56 57 #-DUCONFIG_NO_SERVICE=1 58 -DU_COMMON_IMPLEMENTATION 59 -DU_STATIC_IMPLEMENTATION 60 -DU_ENABLE_DYLOAD=0 61 -DU_HAVE_STD_STRING=1 62 -DU_I18N_IMPLEMENTATION 63 -DU_IO_IMPLEMENTATION 64 -DU_STATIC_IMPLEMENTATION=1 65 #-DU_CHARSET_IS_UTF8 66 -DUNISTR_FROM_STRING_EXPLICIT= 67 68 -DORTHANC_STATIC_ICU=1 69 -DORTHANC_ICU_DATA_MD5="${LIBICU_DATA_UNCOMPRESSED_MD5}" 70 ) 71 72 if (CMAKE_SYSTEM_NAME STREQUAL "Windows") 73 set_source_files_properties( 74 ${LIBICU_SOURCES_DIR}/source/common/locmap.c 75 PROPERTIES COMPILE_DEFINITIONS "LOCALE_SNAME=0x0000005c" 76 ) 77 endif() 78 79 source_group(ThirdParty\\libicu REGULAR_EXPRESSION ${LIBICU_SOURCES_DIR}/.*) 80 81else() 82 CHECK_INCLUDE_FILE_CXX(unicode/uvernum.h HAVE_ICU_H) 83 if (NOT HAVE_ICU_H) 84 message(FATAL_ERROR "Please install the libicu-dev package") 85 endif() 86 87 find_library(LIBICU_PATH_1 NAMES icuuc) 88 find_library(LIBICU_PATH_2 NAMES icui18n) 89 90 if (NOT LIBICU_PATH_1 OR 91 NOT LIBICU_PATH_2) 92 message(FATAL_ERROR "Please install the libicu-dev package") 93 else() 94 link_libraries(${LIBICU_PATH_1} ${LIBICU_PATH_2}) 95 endif() 96 97 add_definitions( 98 -DORTHANC_STATIC_ICU=0 99 ) 100endif() 101