Skip to content

Commit

Permalink
Fix a build issue when statically link to MSVC Runtime (#22393)
Browse files Browse the repository at this point in the history
Yesterday I updated ABSL to a newer version which added a new cmake
option: ABSL_MSVC_STATIC_RUNTIME . I wasn't aware of it. This PR fixes
it.
  • Loading branch information
snnn authored Oct 11, 2024
1 parent b4fb32d commit 6ada97c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,11 +1177,14 @@ def generate_build_tree(
)
add_default_definition(cmake_extra_defines, "ONNX_USE_MSVC_STATIC_RUNTIME", "ON")
add_default_definition(cmake_extra_defines, "protobuf_MSVC_STATIC_RUNTIME", "ON")
# The following build option was added in ABSL 20240722.0 and it must be explicitly set
add_default_definition(cmake_extra_defines, "ABSL_MSVC_STATIC_RUNTIME", "ON")
add_default_definition(cmake_extra_defines, "gtest_force_shared_crt", "OFF")
else:
# CMAKE_MSVC_RUNTIME_LIBRARY is default to MultiThreaded$<$<CONFIG:Debug>:Debug>DLL
add_default_definition(cmake_extra_defines, "ONNX_USE_MSVC_STATIC_RUNTIME", "OFF")
add_default_definition(cmake_extra_defines, "protobuf_MSVC_STATIC_RUNTIME", "OFF")
add_default_definition(cmake_extra_defines, "ABSL_MSVC_STATIC_RUNTIME", "OFF")
add_default_definition(cmake_extra_defines, "gtest_force_shared_crt", "ON")

if acl_home and os.path.exists(acl_home):
Expand Down

0 comments on commit 6ada97c

Please sign in to comment.