Skip to content

Commit 1b8899c

Browse files
committed
Update per comment. Switch to bat for Windows.
1 parent d43591b commit 1b8899c

File tree

9 files changed

+116
-194
lines changed

9 files changed

+116
-194
lines changed

extension/data_loader/file_data_loader.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ FileDataLoader::~FileDataLoader() {
5959
// file_name_ can be nullptr if this instance was moved from, but freeing a
6060
// null pointer is safe.
6161
std::free(const_cast<char*>(file_name_));
62-
// fd_ can be -1 if this instance was moved from, but closing a negative fd is
63-
// safe (though it will return an error).
64-
#ifdef _WIN32
65-
if (fd_ == -1)
62+
// fd_ can be -1 if this instance was moved from.
63+
if (fd_ == -1) {
6664
return;
67-
#endif
65+
}
6866
::close(fd_);
6967
}
7068

extension/llm/custom_ops/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT)
102102

103103
target_link_libraries(custom_ops_aot_lib PUBLIC cpublas torch)
104104
if(WIN32)
105+
# There is no direct replacement for libpthread.so on Windows.
106+
# For the Windows build, link directly against pthreadpool and cpuinfo.
105107
target_link_libraries(custom_ops_aot_lib PUBLIC pthreadpool cpuinfo)
106108
endif()
107109
target_compile_options(

install_requirements.bat

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@ECHO OFF
2+
3+
rem Copyright (c) Meta Platforms, Inc. and affiliates.
4+
rem All rights reserved.
5+
6+
rem This batch file provides a basic functionality similar to the bash script.
7+
8+
cd /d "%~dp0"
9+
10+
rem Find the names of the python tools to use (replace with your actual python installation)
11+
if "%PYTHON_EXECUTABLE%"=="" (
12+
if "%CONDA_DEFAULT_ENV%"=="" OR "%CONDA_DEFAULT_ENV%"=="base" OR NOT EXIST "python" (
13+
set PYTHON_EXECUTABLE=python3
14+
) else (
15+
set PYTHON_EXECUTABLE=python
16+
)
17+
)
18+
19+
"%PYTHON_EXECUTABLE%" install_requirements.py %*
20+
21+
exit /b %ERRORLEVEL%

install_requirements.ps1

Lines changed: 0 additions & 125 deletions
This file was deleted.

install_requirements.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def python_is_compatible():
8383
print(f"Error: Unknown option {arg}")
8484
sys.exit(1)
8585

86+
# Use ClangCL on Windows.
87+
if os.name == "nt":
88+
CMAKE_ARGS += " -T ClangCL"
89+
8690
# Since ExecuTorch often uses main-branch features of pytorch, only the nightly
8791
# pip versions will have the required features.
8892
#

runtime/core/exec_aten/util/tensor_util.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
#include <cstddef> // size_t
1616
#include <limits>
1717

18-
#ifdef _WIN32
19-
#include <stddef.h>
20-
using ssize_t = ptrdiff_t;
21-
#endif
22-
2318
#include <executorch/runtime/core/array_ref.h>
2419
#include <executorch/runtime/core/error.h>
2520
#include <executorch/runtime/core/exec_aten/exec_aten.h>

runtime/core/portable_type/tensor_impl.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88

99
#pragma once
1010

11-
#ifndef _WIN32
12-
#include <sys/types.h> // TODO(T126923429): Include size_t, ssize_t
13-
#else
14-
#include <stddef.h>
15-
using ssize_t = ptrdiff_t;
16-
#endif
17-
1811
#include <executorch/runtime/core/array_ref.h>
1912
#include <executorch/runtime/core/error.h>
2013
#include <executorch/runtime/core/portable_type/scalar_type.h>

runtime/platform/compiler.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@
133133
#endif
134134
#endif // ifndef
135135

136-
#ifdef _WIN32
136+
#ifndef _WIN32
137+
#include <sys/types.h> // TODO(T126923429): Include size_t, ssize_t
138+
#else
137139
#include <stddef.h>
138140
using ssize_t = ptrdiff_t;
139141
#endif

0 commit comments

Comments
 (0)