Skip to content

Commit 4fbe996

Browse files
authored
Add build option for mt/md (mlc-ai#1) (mlc-ai#70)
1 parent ae3d206 commit 4fbe996

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@ set(CMAKE_CXX_EXTENSIONS OFF)
77

88
include(FetchContent)
99

10+
set(TOKENIZERS_CPP_MSVC_RUNTIME_LIBRARY "" CACHE STRING "MSVC runtime library setting (One of MT or MD)")
11+
1012
# update to contain more rust flags
1113
set(TOKENIZERS_CPP_RUST_FLAGS "")
1214
set(TOKENIZERS_CPP_CARGO_TARGET "")
1315

16+
if(MSVC)
17+
if(TOKENIZERS_CPP_MSVC_RUNTIME_LIBRARY STREQUAL "MT")
18+
list(APPEND TOKENIZERS_CPP_RUST_FLAGS -Ctarget-feature=+crt-static)
19+
elseif(TOKENIZERS_CPP_MSVC_RUNTIME_LIBRARY STREQUAL "MD")
20+
list(APPEND TOKENIZERS_CPP_RUST_FLAGS -Ctarget-feature=-crt-static)
21+
elseif(TOKENIZERS_CPP_MSVC_RUNTIME_LIBRARY)
22+
message(WARNING "Invalid value for TOKENIZERS_CPP_MSVC_RUNTIME_LIBRARY. Ignoring.")
23+
endif()
24+
endif()
25+
1426
# extra link libraries
1527
set(TOKENIZERS_CPP_LINK_LIBS "")
1628
set(TOKENIZERS_C_LINK_LIBS "")

0 commit comments

Comments
 (0)