@@ -18,11 +18,11 @@ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL ON)
18
18
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" )
19
19
set (c_cxx_flags "-Wno-undef" )
20
20
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
21
+ # C4146: unary minus operator applied to unsigned type, result still unsigned
21
22
# C4244: 'argument' : conversion from 'type1' to 'type2', possible loss of data
22
23
# C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data
23
- set (c_cxx_flags "/wd4244 /wd4267" )
24
- # for fast tokenizers
25
- set (c_cxx_flags "${c_cxx_flags} /wd4146 /wd4700" )
24
+ # C4700: uninitialized local variable 'var' used
25
+ set (c_cxx_flags "/wd4146 /wd4244 /wd4267 /wd4700" )
26
26
endif ()
27
27
28
28
include (CheckCXXCompilerFlag)
@@ -34,6 +34,10 @@ endif()
34
34
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_flags} ${c_cxx_flags} " )
35
35
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${c_cxx_flags} " )
36
36
37
+ # Apply for 'Release' explicitly for WA '/sdl' issues
38
+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${cxx_flags} ${c_cxx_flags} " )
39
+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${c_cxx_flags} " )
40
+
37
41
#
38
42
# Dependencies
39
43
#
@@ -61,7 +65,10 @@ if(BUILD_FAST_TOKENIZERS)
61
65
fast_tokenizer
62
66
)
63
67
set (WITH_PYTHON OFF CACHE BOOL "Disable Python API for fast_tokenizer" )
64
- add_subdirectory (${fast_tokenizer_SOURCE_DIR} /fast_tokenizer ${CMAKE_CURRENT_BINARY_DIR} /fast_tokenizer)
68
+ add_subdirectory (${fast_tokenizer_SOURCE_DIR} /fast_tokenizer
69
+ ${CMAKE_CURRENT_BINARY_DIR} /fast_tokenizer
70
+ EXCLUDE_FROM_ALL
71
+ )
65
72
endif ()
66
73
67
74
# variables used later
@@ -147,9 +154,10 @@ endif()
147
154
target_link_libraries (${TARGET_NAME} PRIVATE ${FAST_TOKENIZER_LIBS} sentencepiece-static )
148
155
149
156
# string_view is used from cxx17
150
- string (REPLACE " " ";" cxx_flags "${cxx_flags} " )
151
- set_target_properties (${TARGET_NAME} PROPERTIES CXX_STANDARD 17
152
- COMPILE_OPTIONS "${cxx_flags} " )
157
+ set_target_properties (${TARGET_NAME} PROPERTIES CXX_STANDARD 17)
158
+
159
+ string (REPLACE " " ";" extra_flags "${c_cxx_flags} ${cxx_flags} " )
160
+ set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_OPTIONS "${extra_flags} " )
153
161
154
162
#
155
163
# Post build steps to copy core_tokenizers dependencies
0 commit comments