@@ -243,11 +243,7 @@ def src_path(self, installer: "InstallerBuildExt") -> Path:
243
243
src_path = src_path .replace ("%BUILD_TYPE%" , cfg )
244
244
else :
245
245
# Remove %BUILD_TYPE% from the path.
246
- < << << << HEAD
247
246
src_path = src_path .replace ("/%BUILD_TYPE%" , "" )
248
- == == == =
249
- self .src = self .src .replace ("%BUILD_TYPE%/" , "" )
250
- >> >> >> > 038 fa5307 (fix windows build issue )
251
247
252
248
# Construct the full source path, resolving globs. If there are no glob
253
249
# pattern characters, this will just ensure that the source file exists.
@@ -295,7 +291,7 @@ def __init__(
295
291
output is in a subdirectory named after the build type. For single-
296
292
config generators (like Makefile Generators or Ninja), this placeholder
297
293
will be removed.
298
- src_name: The name of the file to install.
294
+ src_name: The name of the file to install
299
295
dst: The path to install to, relative to the root of the pip
300
296
package. If dst ends in "/", it is treated as a directory.
301
297
Otherwise it is treated as a filename.
@@ -349,25 +345,20 @@ def inplace_dir(self, installer: "InstallerBuildExt") -> Path:
349
345
class BuiltExtension (_BaseExtension ):
350
346
"""An extension that installs a python extension that was built by cmake."""
351
347
352
- def __init__ (self , src_dir : str , src_name : str , modpath : str ):
348
+ def __init__ (self , src : str , modpath : str ):
353
349
"""Initializes a BuiltExtension.
354
350
355
351
Args:
356
- src_dir: The directory of the file to install, relative to the cmake-out
357
- directory. A placeholder %BUILD_TYPE% will be replaced with the build
358
- type for multi-config generators (like Visual Studio) where the build
359
- output is in a subdirectory named after the build type. For single-
360
- config generators (like Makefile Generators or Ninja), this placeholder
361
- will be removed.
362
- src_name: The name of the file to install. If the path ends in `.so`,
352
+ src: The path to the file to install (typically a shared library),
353
+ relative to the cmake-out directory. May be an fnmatch-style
354
+ glob that matches exactly one file. If the path ends in `.so`,
363
355
this class will also look for similarly-named `.dylib` files.
364
356
modpath: The dotted path of the python module that maps to the
365
357
extension.
366
358
"""
367
359
assert (
368
360
"/" not in modpath
369
361
), f"modpath must be a dotted python module path: saw '{ modpath } '"
370
- src = os .path .join (src_dir , src_name )
371
362
# This is a real extension, so use the modpath as the name.
372
363
super ().__init__ (src = f"%CMAKE_CACHE_DIR%/{ src } " , dst = modpath , name = modpath )
373
364
@@ -792,9 +783,7 @@ def get_ext_modules() -> List[Extension]:
792
783
# portable kernels, and a selection of backends. This lets users
793
784
# load and execute .pte files from python.
794
785
BuiltExtension (
795
- src_dir = "%BUILD_TYPE%/" ,# Set the src directory based on build configuration for windows.
796
- src_name = "_portable_lib.cp*" ,# Rename _portable_lib.* to _portable_lib.cp* to avoid _portable_lib.lib is selected on windows.
797
- modpath = "executorch.extension.pybindings._portable_lib" ,
786
+ "_portable_lib.*" , "executorch.extension.pybindings._portable_lib"
798
787
)
799
788
)
800
789
if ShouldBuild .training ():
0 commit comments