Fix an issue in wasm nortti build and add minimal build support for vcpkg (#24012)
1. Patch ONNX to support minimal build
2. Improve ort-web's vcpkg build scripts.
The generate_vcpkg_triplets_for_emscripten function in
tools\python\util\vcpkg_helpers.py didn't process the enable_rtti
condition. So, when it is true, we should add -fno-rtti to cxxflags
Fix an issue related to DISABLE_EXCEPTION_CATCHING. Make it clear that
there are three modes:
1. No EH (-fno-exceptions, -sDISABLE_EXCEPTION_CATCHING=1):
Set enable_minimal_onnx_build=True, enable_wasm_exception_catching=False
2. Full EH (-fexceptions, -sDISABLE_EXCEPTION_CATCHING=0):
Set enable_minimal_onnx_build=False, enable_wasm_exception_catching=True
3. Throw Only EH (-fexceptions, -sDISABLE_EXCEPTION_CATCHING=1):
Set enable_minimal_onnx_build=False,
enable_wasm_exception_catching=False
Debug build should only use the second one.
In release build by default emscripten disables catching C++ exceptions
(specifically, emitting catch blocks). That's the second case. In a
normal release build(what we ship),
- Usually enable_wasm_api_exception_catching is set to true
- So disable_wasm_exception_catching is also True
- So onnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING is False
- So, the flag DISABLE_EXCEPTION_CATCHING should not be set. Because by
default it is true. We should not have "-sDISABLE_EXCEPTION_CATCHING=0"
But we do not want to rely on what default value is. So the
vcpkg_helper.py script still explicitly set DISABLE_EXCEPTION_CATCHING
to 1.
In onnxruntime_webassembly.cmake currently we have
```cmake
if (NOT onnxruntime_ENABLE_WEBASSEMBLY_MEMORY64)
target_link_options(onnxruntime_webassembly PRIVATE "SHELL:-s DISABLE_EXCEPTION_THROWING=0")
endif()
```
But I think we need to set DISABLE_EXCEPTION_THROWING to 1 when the
build is in the first mode(No EH). This PR also resolves #24279 ,
because vcpkg has native support for cross-compiling. Users do not need
to specific a custom protoc path.