Skip to content

Commit

Permalink
[Build] Add install_requirements.bat for windows build (#4862)
Browse files Browse the repository at this point in the history
Add install_requirements.bat on windows like install_requirements.sh.
Also force use ClangCL on windows in install_requirements.py.

For #4661
  • Loading branch information
python3kgae authored Aug 23, 2024
1 parent c7bc7e0 commit ee6e4e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions install_requirements.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@ECHO OFF

rem Copyright (c) Meta Platforms, Inc. and affiliates.
rem All rights reserved.

rem This batch file provides a basic functionality similar to the bash script.

cd /d "%~dp0"

rem Find the names of the python tools to use (replace with your actual python installation)
if "%PYTHON_EXECUTABLE%"=="" (
if "%CONDA_DEFAULT_ENV%"=="" OR "%CONDA_DEFAULT_ENV%"=="base" OR NOT EXIST "python" (
set PYTHON_EXECUTABLE=python3
) else (
set PYTHON_EXECUTABLE=python
)
)

"%PYTHON_EXECUTABLE%" install_requirements.py %*

exit /b %ERRORLEVEL%
6 changes: 6 additions & 0 deletions install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def python_is_compatible():
print(f"Error: Unknown option {arg}")
sys.exit(1)

# Use ClangCL on Windows.
# ClangCL is an alias to Clang that configures it to work in an MSVC-compatible
# mode. Using it on Windows to avoid compiler compatibility issues for MSVC.
if os.name == "nt":
CMAKE_ARGS += " -T ClangCL"

# Since ExecuTorch often uses main-branch features of pytorch, only the nightly
# pip versions will have the required features.
#
Expand Down

0 comments on commit ee6e4e9

Please sign in to comment.