@@ -148,6 +148,31 @@ def launcher_exe(name, platform, windowed=False):
148148 )
149149
150150
151+ def pyshellext (ext = '.exe' , ** props ):
152+ link_opts = ItemDefinition (
153+ 'Link' ,
154+ AdditionalDependencies = Prepend ('RuntimeObject.lib;' ),
155+ )
156+ if ext != '.exe' :
157+ link_opts .options ['ModuleDefinitionFile' ] = '$(SourceRootDir)src\\ pyshellext\\ pyshellext.def'
158+
159+
160+ return CProject (f"pyshellext{ ext .rpartition ('.' )[0 ]} " ,
161+ VersionInfo (
162+ FileDescription = 'Python shell extension' ,
163+ OriginalFilename = f'pyshellext{ ext } ' ,
164+ ),
165+ ItemDefinition ('ClCompile' , LanguageStandard = 'stdcpp20' ),
166+ link_opts ,
167+ Manifest ('default.manifest' ),
168+ CSourceFile ('shellext.cpp' ),
169+ ResourceFile ('pyshellext.rc' ),
170+ source = 'src/pyshellext' ,
171+ StaticLibcppLinkage = True ,
172+ ** props ,
173+ )
174+
175+
151176PACKAGE = Package ('python-manager' ,
152177 PyprojectTomlFile ('pyproject.toml' ),
153178 # MSIX manifest
@@ -206,23 +231,9 @@ def launcher_exe(name, platform, windowed=False):
206231 main_exe ("python3" ),
207232 mainw_exe ("pythonw3" ),
208233
209- CProject ("pyshellext" ,
210- VersionInfo (
211- FileDescription = "Python shell extension" ,
212- OriginalFilename = "pyshellext.exe" ,
213- ),
214- Property ('StaticLibcppLinkage' , 'true' ),
215- ItemDefinition ('ClCompile' , LanguageStandard = 'stdcpp20' ),
216- ItemDefinition ('Link' ,
217- AdditionalDependencies = Prepend ("RuntimeObject.lib;" ),
218- SubSystem = 'WINDOWS' ,
219- ),
220- Manifest ('default.manifest' ),
221- CSourceFile ('shellext.cpp' ),
222- ResourceFile ('pyshellext.rc' ),
223- source = 'src/pyshellext' ,
224- ConfigurationType = 'Application' ,
225- ),
234+ pyshellext (".exe" , ConfigurationType = "Application" ),
235+ pyshellext ("-64.dll" , Platform = "x64" ),
236+ pyshellext ("-arm64.dll" , Platform = "ARM64" ),
226237)
227238
228239
0 commit comments