Mercurial > hg > orthanc
annotate Resources/ThirdParty/icu/CMakeLists.txt @ 3731:e7ff4f9b34bd storage-commitment
integration mainline->storage-commitment
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Mar 2020 17:19:45 +0100 |
parents | 905ee53c8274 |
children |
rev | line source |
---|---|
3237 | 1 cmake_minimum_required(VERSION 2.8) |
2 project(IcuCodeGeneration) | |
3 | |
3241
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
4 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)") |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
5 |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
6 if (NOT USE_LEGACY_LIBICU) |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
7 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
8 endif() |
3237 | 9 |
10 include(${CMAKE_SOURCE_DIR}/../../CMake/Compiler.cmake) | |
11 include(${CMAKE_SOURCE_DIR}/../../CMake/DownloadPackage.cmake) | |
12 include(Version.cmake) | |
13 | |
3242
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
14 set(SOURCE_DATA |
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
15 "${LIBICU_SOURCES_DIR}/source/data/in/${LIBICU_DATA_VERSION}${LIBICU_SUFFIX}.dat") |
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
16 |
3237 | 17 set(ALLOW_DOWNLOADS ON) |
18 DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}") | |
19 | |
20 include_directories( | |
21 ${LIBICU_SOURCES_DIR}/source/common | |
22 ${LIBICU_SOURCES_DIR}/source/i18n | |
23 ${LIBICU_SOURCES_DIR}/source/tools/toolutil/ | |
24 ) | |
25 | |
26 aux_source_directory(${LIBICU_SOURCES_DIR}/source/common LIBICU_SOURCES) | |
27 aux_source_directory(${LIBICU_SOURCES_DIR}/source/i18n LIBICU_SOURCES) | |
28 aux_source_directory(${LIBICU_SOURCES_DIR}/source/tools/toolutil LIBICU_SOURCES) | |
29 | |
3241
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
30 if (USE_LEGACY_LIBICU) |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
31 list(APPEND LIBICU_SOURCES |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
32 ${LIBICU_SOURCES_DIR}/source/stubdata/stubdata.c |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
33 ) |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
34 else() |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
35 list(APPEND LIBICU_SOURCES |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
36 ${LIBICU_SOURCES_DIR}/source/stubdata/stubdata.cpp |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
37 ) |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
38 set_source_files_properties( |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
39 ${LIBICU_SOURCES_DIR}/source/tools/genccode/genccode.c |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
40 PROPERTIES COMPILE_DEFINITIONS "char16_t=uint16_t" |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
41 ) |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
42 endif() |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
43 |
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3237
diff
changeset
|
44 |
3237 | 45 |
46 add_executable(IcuCodeGeneration | |
47 ${LIBICU_SOURCES_DIR}/source/tools/genccode/genccode.c | |
48 ${LIBICU_SOURCES} | |
49 ) | |
50 | |
3242
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
51 configure_file(${SOURCE_DATA} |
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
52 ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}.dat |
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
53 COPYONLY) |
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
54 |
3237 | 55 add_custom_command( |
3242
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
56 OUTPUT ${CMAKE_BINARY_DIR}/${LIBICU_DATA} |
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
57 COMMAND IcuCodeGeneration ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}.dat |
3237 | 58 DEPENDS IcuCodeGeneration |
59 ) | |
60 | |
3243
cf0ad1fb2bb7
trying a fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
61 # "--no-name" is necessary for 7-zip on Windows to behave similarly to gunzip |
3237 | 62 add_custom_command( |
3242
5d78df37c62f
automating compilation if icu is used
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3241
diff
changeset
|
63 OUTPUT ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz |
3243
cf0ad1fb2bb7
trying a fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3242
diff
changeset
|
64 COMMAND gzip ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}_dat.c --no-name -c > ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz |
3237 | 65 DEPENDS ${LIBICU_DATA} |
66 ) | |
67 | |
3266
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
68 |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
69 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
70 # Generate a precompiled version for Visual Studio 64bit |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
71 set(TMP_ASSEMBLER ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}_dat.S) |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
72 set(TMP_OBJECT ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}_dat-x86_64-mingw32.o) |
3269 | 73 set(TMP_LIBRARY ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}_dat-x86_64-mingw32.lib) |
74 set(PRECOMPILED_WIN64 ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}_dat-x86_64-mingw32.lib.gz) | |
3266
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
75 |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
76 add_custom_command( |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
77 OUTPUT ${TMP_ASSEMBLER} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
78 COMMAND IcuCodeGeneration ${CMAKE_BINARY_DIR}/${LIBICU_DATA_VERSION}.dat --assembly gcc-mingw64 |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
79 DEPENDS IcuCodeGeneration |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
80 ) |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
81 |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
82 add_custom_command( |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
83 OUTPUT ${TMP_OBJECT} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
84 COMMAND x86_64-w64-mingw32-gcc -c ${TMP_ASSEMBLER} -o ${TMP_OBJECT} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
85 DEPENDS ${TMP_ASSEMBLER} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
86 ) |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
87 |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
88 add_custom_command( |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
89 OUTPUT ${TMP_LIBRARY} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
90 COMMAND x86_64-w64-mingw32-ar qc ${TMP_LIBRARY} ${TMP_OBJECT} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
91 COMMAND x86_64-w64-mingw32-ranlib ${TMP_LIBRARY} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
92 DEPENDS ${TMP_OBJECT} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
93 ) |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
94 |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
95 # "--no-name" is necessary for 7-zip on Windows to behave similarly to gunzip |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
96 add_custom_command( |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
97 OUTPUT ${PRECOMPILED_WIN64} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
98 COMMAND gzip ${TMP_LIBRARY} --no-name -c > ${PRECOMPILED_WIN64} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
99 DEPENDS ${TMP_LIBRARY} |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
100 ) |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
101 endif() |
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
102 |
3251
fcfd4f73228c
using masm if compiling icu with Visual Studio
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3243
diff
changeset
|
103 |
fcfd4f73228c
using masm if compiling icu with Visual Studio
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3243
diff
changeset
|
104 add_custom_target(Final ALL DEPENDS |
fcfd4f73228c
using masm if compiling icu with Visual Studio
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3243
diff
changeset
|
105 ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz |
3266
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
106 ${PRECOMPILED_WIN64} |
3251
fcfd4f73228c
using masm if compiling icu with Visual Studio
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3243
diff
changeset
|
107 ) |
3237 | 108 |
109 install( | |
3251
fcfd4f73228c
using masm if compiling icu with Visual Studio
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3243
diff
changeset
|
110 FILES |
fcfd4f73228c
using masm if compiling icu with Visual Studio
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3243
diff
changeset
|
111 ${CMAKE_BINARY_DIR}/${LIBICU_DATA}.gz |
3266
25df9eae8891
fixing Visual Studio 2015 64bit with ICU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3252
diff
changeset
|
112 ${PRECOMPILED_WIN64} |
3237 | 113 DESTINATION ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads |
114 ) | |
115 | |
116 add_definitions( | |
117 #-DU_COMBINED_IMPLEMENTATION | |
118 -DUCONFIG_NO_SERVICE=1 | |
119 -DU_COMMON_IMPLEMENTATION | |
120 -DU_ENABLE_DYLOAD=0 | |
121 -DU_HAVE_STD_STRING=1 | |
122 -DU_I18N_IMPLEMENTATION | |
123 -DU_IO_IMPLEMENTATION | |
124 -DU_STATIC_IMPLEMENTATION=1 | |
125 -DU_TOOLUTIL_IMPLEMENTATION | |
126 ) |