annotate Resources/CMake/LibIcuConfiguration.cmake @ 3230:4b042ec734c1

dynamic linking against libicu
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 14 Feb 2019 20:22:33 +0100
parents 4b9cfd92d1ae
children fc5bc0fe863c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3228
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 message("Using libicu")
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICU)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 # set(LIBICU_SOURCES_DIR ${CMAKE_BINARY_DIR}/libicu-1.15)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 # set(LIBICU_URL "http://orthanc.osimis.io/ThirdPartyDownloads/libicu-1.15.tar.gz")
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 # set(LIBICU_MD5 "ace8b5f2db42f7b3b3057585e80d9808")
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 # DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}")
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 # # Disable the support of libicu that is shipped by default with
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 # # the C standard library on Linux. Setting this macro redirects
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 # # calls from "icu*()" to "libicu*()" by defining macros in the
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 # # C headers of "libicu-1.15".
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 # add_definitions(-DLIBICU_PLUG=1)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 # # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 # add_definitions(
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 # -DBUILDING_LIBICU=1
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 # -DIN_LIBRARY=1
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 # -DLIBDIR=""
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 # -DICU_CONST=
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 # )
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 # configure_file(
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 # ${LIBICU_SOURCES_DIR}/srclib/localcharset.h
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 # ${LIBICU_SOURCES_DIR}/include
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 # COPYONLY)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 # set(HAVE_VISIBILITY 0)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 # set(ICU_CONST ${ICU_CONST})
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 # set(USE_MBSTATE_T 1)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 # set(BROKEN_WCHAR_H 0)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 # set(EILSEQ)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 # set(HAVE_WCHAR_T 1)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 # configure_file(
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 # ${LIBICU_SOURCES_DIR}/include/icu.h.build.in
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 # ${LIBICU_SOURCES_DIR}/include/icu.h
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 # )
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 # unset(HAVE_VISIBILITY)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 # unset(ICU_CONST)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 # unset(USE_MBSTATE_T)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 # unset(BROKEN_WCHAR_H)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 # unset(EILSEQ)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 # unset(HAVE_WCHAR_T)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 # if (NOT EXISTS ${LIBICU_SOURCES_DIR}/include/config.h)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 # # Create an empty "config.h" for libicu
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 # file(WRITE ${LIBICU_SOURCES_DIR}/include/config.h "")
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 # endif()
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 # include_directories(
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 # ${LIBICU_SOURCES_DIR}/include
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 # )
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 # set(LIBICU_SOURCES
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 # ${LIBICU_SOURCES_DIR}/lib/icu.c
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 # ${LIBICU_SOURCES_DIR}/lib/relocatable.c
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 # ${LIBICU_SOURCES_DIR}/libcharset/lib/localcharset.c
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 # ${LIBICU_SOURCES_DIR}/libcharset/lib/relocatable.c
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 # )
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 # source_group(ThirdParty\\libicu REGULAR_EXPRESSION ${LIBICU_SOURCES_DIR}/.*)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 # if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 # add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 # else()
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 # add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 # endif()
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 else()
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 CHECK_INCLUDE_FILE_CXX(unicode/uvernum.h HAVE_ICU_H)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 if (NOT HAVE_ICU_H)
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 message(FATAL_ERROR "Please install the libicu-dev package")
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 endif()
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
3230
4b042ec734c1 dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3228
diff changeset
76 find_library(LIBICU_PATH_1 NAMES icuuc)
4b042ec734c1 dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3228
diff changeset
77 find_library(LIBICU_PATH_2 NAMES icui18n)
4b042ec734c1 dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3228
diff changeset
78
4b042ec734c1 dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3228
diff changeset
79 if (NOT LIBICU_PATH_1 OR
4b042ec734c1 dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3228
diff changeset
80 NOT LIBICU_PATH_2)
4b042ec734c1 dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3228
diff changeset
81 message(FATAL_ERROR "Please install the libicu-dev package")
3228
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 else()
3230
4b042ec734c1 dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3228
diff changeset
83 link_libraries(icuuc icui18n)
3228
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 endif()
4b9cfd92d1ae preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 endif()