Mercurial > hg > orthanc
changeset 3251:fcfd4f73228c
using masm if compiling icu with Visual Studio
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 16 Feb 2019 14:28:53 +0100 |
parents | 212abfffc44d |
children | 768c219e7b11 |
files | Resources/CMake/Compiler.cmake Resources/CMake/LibIcuConfiguration.cmake Resources/ThirdParty/icu/CMakeLists.txt Resources/ThirdParty/icu/README.txt Resources/ThirdParty/icu/Version.cmake |
diffstat | 5 files changed, 51 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake Sat Feb 16 11:38:54 2019 +0100 +++ b/Resources/CMake/Compiler.cmake Sat Feb 16 14:28:53 2019 +0100 @@ -36,14 +36,8 @@ string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") endforeach(flag_var) - if (BOOST_LOCALE_BACKEND STREQUAL "icu") - # If compiling icu, the heap space must be further increased: - # "icudt58l_dat.c(1638339): fatal error C1060: compiler is out of heap space" - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm1024") - else() - # Add /Zm256 compiler option to Visual Studio to fix PCH errors - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm256") - endif() + # Add /Zm256 compiler option to Visual Studio to fix PCH errors + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm256") add_definitions( -D_CRT_SECURE_NO_WARNINGS=1
--- a/Resources/CMake/LibIcuConfiguration.cmake Sat Feb 16 11:38:54 2019 +0100 +++ b/Resources/CMake/LibIcuConfiguration.cmake Sat Feb 16 14:28:53 2019 +0100 @@ -9,17 +9,35 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICU) include(${CMAKE_CURRENT_LIST_DIR}/../ThirdParty/icu/Version.cmake) DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}") - DownloadCompressedFile(${LIBICU_DATA_MD5} ${LIBICU_DATA_URL} ${LIBICU_DATA}) + + if (MSVC) + # In Visual Studio 2015, we get the following error if using plain + # C: "icudt58l_dat.c(1638339): fatal error C1060: compiler is out + # of heap space" => use Microsoft Assembler to circumvent this issue + DownloadCompressedFile(${LIBICU_MASM_MD5} ${LIBICU_MASM_URL} ${LIBICU_MASM}) + + set(LIBICU_SOURCES + ${CMAKE_BINARY_DIR}/${LIBICU_MASM} + ) + else() + # Use plain C data library + DownloadCompressedFile(${LIBICU_DATA_MD5} ${LIBICU_DATA_URL} ${LIBICU_DATA}) + + set_source_files_properties( + ${CMAKE_BINARY_DIR}/${LIBICU_DATA} + PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t" + ) + + set(LIBICU_SOURCES + ${CMAKE_BINARY_DIR}/${LIBICU_DATA} + ) + endif() include_directories(BEFORE ${LIBICU_SOURCES_DIR}/source/common ${LIBICU_SOURCES_DIR}/source/i18n ) - set(LIBICU_SOURCES - ${CMAKE_BINARY_DIR}/${LIBICU_DATA} - ) - aux_source_directory(${LIBICU_SOURCES_DIR}/source/common LIBICU_SOURCES) aux_source_directory(${LIBICU_SOURCES_DIR}/source/i18n LIBICU_SOURCES) @@ -39,12 +57,7 @@ -DUNISTR_FROM_STRING_EXPLICIT= ) - set_source_files_properties( - ${CMAKE_BINARY_DIR}/${LIBICU_DATA} - PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t" - ) - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if (CMAKE_SYSTEM_NAME STREQUAL "Windows") set_source_files_properties( ${LIBICU_SOURCES_DIR}/source/common/locmap.c PROPERTIES COMPILE_DEFINITIONS "LOCALE_SNAME=0x0000005c"
--- a/Resources/ThirdParty/icu/CMakeLists.txt Sat Feb 16 11:38:54 2019 +0100 +++ b/Resources/ThirdParty/icu/CMakeLists.txt Sat Feb 16 14:28:53 2019 +0100 @@ -58,8 +58,11 @@ DEPENDS IcuCodeGeneration ) -message(${LIBICU_DATA}.gz) - +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/${LIBICU_MASM} + COMMAND IcuCodeGeneration ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}.dat --assembly masm + DEPENDS IcuCodeGeneration + ) # "--no-name" is necessary for 7-zip on Windows to behave similarly to gunzip add_custom_command( @@ -68,10 +71,21 @@ DEPENDS ${LIBICU_DATA} ) -add_custom_target(Final ALL DEPENDS ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz) +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/${LIBICU_MASM}.gz + COMMAND gzip ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}_dat.S --no-name -c > ${CMAKE_BINARY_DIR}/${LIBICU_MASM}.gz + DEPENDS ${LIBICU_MASM} + ) + +add_custom_target(Final ALL DEPENDS + ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz + ${CMAKE_BINARY_DIR}/${LIBICU_MASM}.gz + ) install( - FILES ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz + FILES + ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz + ${CMAKE_BINARY_DIR}/${LIBICU_MASM}.gz DESTINATION ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads )
--- a/Resources/ThirdParty/icu/README.txt Sat Feb 16 11:38:54 2019 +0100 +++ b/Resources/ThirdParty/icu/README.txt Sat Feb 16 14:28:53 2019 +0100 @@ -21,7 +21,7 @@ $ cmake .. -G Ninja -DUSE_LEGACY_LIBICU=ON && ninja install -Legacy version using LSB: +Legacy version, compiled using LSB: $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake .. -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=../../../LinuxStandardBaseToolchain.cmake \
--- a/Resources/ThirdParty/icu/Version.cmake Sat Feb 16 11:38:54 2019 +0100 +++ b/Resources/ThirdParty/icu/Version.cmake Sat Feb 16 14:28:53 2019 +0100 @@ -20,13 +20,19 @@ set(LIBICU_MD5 "fac212b32b7ec7ab007a12dff1f3aea1") set(LIBICU_DATA_VERSION "icudt58") set(LIBICU_DATA_MD5 "ce2c7791ab637898553c121633155fb6") + set(LIBICU_MASM_MD5 "8593ff014574adce0e5119762b428dc5") else() set(LIBICU_URL "${LIBICU_BASE_URL}/icu4c-63_1-src.tgz") set(LIBICU_MD5 "9e40f6055294284df958200e308bce50") set(LIBICU_DATA_VERSION "icudt63") set(LIBICU_DATA_MD5 "92b5c73a1accd8ecf8c20c89bc6925a9") + set(LIBICU_MASM_MD5 "016c28245796502194e4d81d5d1255e4") endif() set(LIBICU_SOURCES_DIR ${CMAKE_BINARY_DIR}/icu) set(LIBICU_DATA "${LIBICU_DATA_VERSION}${LIBICU_SUFFIX}_dat.c") set(LIBICU_DATA_URL "${LIBICU_BASE_URL}/${LIBICU_DATA}.gz") + +# For Microsoft assembler (masm). This is necessarily little-endian. +set(LIBICU_MASM "${LIBICU_DATA_VERSION}_dat.S") +set(LIBICU_MASM_URL "${LIBICU_BASE_URL}/${LIBICU_MASM}.gz")