Skip to content

Commit 260dcd3

Browse files
committed
cross-platform: use ICU libs from target --icu path instead
Searches for the libs from custom ICU path
1 parent 814d084 commit 260dcd3

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

CMakeLists.txt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,26 @@ function(clr_unknown_arch)
1010
endif()
1111
endfunction()
1212

13+
if(ICU_INCLUDE_PATH)
14+
set(ICU_CC_PATH "${ICU_INCLUDE_PATH}/../lib/")
15+
find_library(ICUUC icuuc PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
16+
find_library(ICU18 icui18n PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
17+
find_library(ICUDATA icudata PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
18+
if(ICUUC)
19+
message("found libraries on ${ICU_CC_PATH}")
20+
set(ICULIB
21+
${ICUUC}
22+
${ICU18}
23+
${ICUDATA}
24+
)
25+
endif()
26+
endif()
27+
1328
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
29+
if(NOT ICULIB)
30+
set(ICULIB "icuuc")
31+
endif()
32+
1433
set(CLR_CMAKE_PLATFORM_UNIX 1)
1534
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
1635
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
@@ -21,9 +40,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
2140
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
2241
add_definitions(
2342
-DPLATFORM_UNIX
24-
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
2543
)
2644

45+
if(NOT ICULIB)
46+
set(ICULIB "icucore")
47+
add_definitions(
48+
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
49+
)
50+
message("using ICU from system default: ${ICULIB}")
51+
endif()
52+
2753
set(CLR_CMAKE_PLATFORM_UNIX 1)
2854
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
2955
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)

bin/ChakraCore/CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ add_library (ChakraCore SHARED
33
ConfigParserExternals.cpp
44
TestHooks.cpp
55
)
6-
6+
77
target_include_directories (
88
ChakraCore PUBLIC
99
${CMAKE_CURRENT_SOURCE_DIR}
@@ -45,18 +45,9 @@ set(lib_target "${lib_target}"
4545
pthread
4646
stdc++
4747
dl
48+
${ICULIB}
4849
)
4950

50-
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
51-
set(lib_target "${lib_target}"
52-
icuuc
53-
)
54-
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
55-
set(lib_target "${lib_target}"
56-
icucore
57-
)
58-
endif() # Linux ?
59-
6051
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
6152
set(lib_target "${lib_target}"
6253
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version
@@ -72,7 +63,7 @@ if(NOT CC_XCODE_PROJECT)
7263
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
7364
set(CC_LIB_EXT "dylib")
7465
endif()
75-
66+
7667
add_custom_command(TARGET ChakraCore POST_BUILD
7768
COMMAND ${CMAKE_COMMAND} -E copy_if_different
7869
"${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.${CC_LIB_EXT}"

bin/ch/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ if(STATIC_LIBRARY)
5959

6060
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
6161
set(lib_target "${lib_target}"
62-
icuuc
62+
${ICULIB}
6363
unwind-x86_64
6464
)
6565
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
6666
set(lib_target "${lib_target}"
67-
icucore
67+
${ICULIB}
6868
"-framework CoreFoundation"
6969
"-framework Security"
7070
# set stack size to 64Mb for stack tests

0 commit comments

Comments
 (0)