File tree Expand file tree Collapse file tree 3 files changed +7
-20
lines changed Expand file tree Collapse file tree 3 files changed +7
-20
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ file(GLOB unicode_source_files
61
61
add_library (
62
62
tokenizers STATIC ${tokenizers_source_files} ${unicode_source_files}
63
63
)
64
+ add_library (tokenizers::tokenizers ALIAS tokenizers )
64
65
65
66
# Using abseil from sentencepiece/third_party
66
67
target_include_directories (
@@ -101,6 +102,7 @@ if(SUPPORT_REGEX_LOOKAHEAD)
101
102
${CMAKE_CURRENT_SOURCE_DIR} /src/regex_lookahead.cpp
102
103
${CMAKE_CURRENT_SOURCE_DIR} /src/std_regex.cpp
103
104
)
105
+ add_library (tokenizers::regex_lookahead ALIAS regex_lookahead )
104
106
target_link_libraries (regex_lookahead PUBLIC pcre2-8-static )
105
107
target_include_directories (
106
108
regex_lookahead
Original file line number Diff line number Diff line change @@ -20,21 +20,21 @@ function(kernel_link_options target_name)
20
20
# "$<LINK_LIBRARY:WHOLE_ARCHIVE,target_name>")
21
21
target_link_options (
22
22
${target_name} INTERFACE "SHELL:LINKER:--whole-archive \
23
- $<TARGET_FILE:${target_name} > \
23
+ $<TARGET_FILE:tokenizers:: ${target_name} > \
24
24
LINKER:--no-whole-archive" )
25
25
endfunction ()
26
26
27
27
# Same as kernel_link_options but it's for MacOS linker
28
28
function (macos_kernel_link_options target_name )
29
29
target_link_options (${target_name} INTERFACE
30
- "SHELL:LINKER:-force_load,$<TARGET_FILE:${target_name} >" )
30
+ "SHELL:LINKER:-force_load,$<TARGET_FILE:tokenizers:: ${target_name} >" )
31
31
endfunction ()
32
32
33
33
# Same as kernel_link_options but it's for MSVC linker
34
34
function (msvc_kernel_link_options target_name )
35
35
target_link_options (
36
36
${target_name} INTERFACE
37
- "SHELL:LINKER:/WHOLEARCHIVE:$<TARGET_FILE:${target_name} >" )
37
+ "SHELL:LINKER:/WHOLEARCHIVE:$<TARGET_FILE:tokenizers:: ${target_name} >" )
38
38
endfunction ()
39
39
40
40
# Ensure that the load-time constructor functions run. By default, the linker
Original file line number Diff line number Diff line change 7
7
@PACKAGE_INIT@
8
8
9
9
include (CMakeFindDependencyMacro )
10
-
10
+ include ( GNUInstallDirs )
11
11
# Find dependencies
12
12
find_dependency (re2 REQUIRED )
13
13
find_dependency (absl REQUIRED )
14
14
# Directly include sentencepiece library
15
- set (SENTENCEPIECE_LIBRARY "${CMAKE_INSTALL_PREFIX} /lib64 /libsentencepiece.a" )
15
+ set (SENTENCEPIECE_LIBRARY "${CMAKE_INSTALL_PREFIX} /${CMAKE_INSTALL_LIBDIR} /libsentencepiece.a" )
16
16
if (NOT EXISTS "${SENTENCEPIECE_LIBRARY} " )
17
17
message (
18
18
FATAL_ERROR
@@ -26,21 +26,6 @@ include("${CMAKE_CURRENT_LIST_DIR}/tokenizers-targets.cmake")
26
26
# Set the include directories
27
27
set_and_check (TOKENIZERS_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@" )
28
28
29
- # Add --whole-archive linker flag for tokenizers library
30
- if (APPLE )
31
- set (TOKENIZERS_LINK_OPTIONS
32
- "SHELL:-force_load,$<TARGET_FILE:tokenizers::regex_lookahead>"
33
- )
34
- elseif (MSVC )
35
- set (TOKENIZERS_LINK_OPTIONS
36
- "SHELL:/WHOLEARCHIVE:$<TARGET_FILE:tokenizers::regex_lookahead>"
37
- )
38
- else ()
39
- set (TOKENIZERS_LINK_OPTIONS
40
- "SHELL:LINKER:--whole-archive $<TARGET_FILE:tokenizers::regex_lookahead> LINKER:--no-whole-archive"
41
- )
42
- endif ()
43
-
44
29
# Set the libraries and link options
45
30
set (TOKENIZERS_LIBRARIES tokenizers::tokenizers )
46
31
set_property (
You can’t perform that action at this time.
0 commit comments