ISCS1_4C_pruduct/product/windows10_debug/generate_manifest.bat
2024-10-30 11:54:46 +08:00

78 lines
2.5 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

::writen by yikenan, 20210401
::用于自动生成win下的动态库清单文件
::注意每个目录下的本文件内容manifest_file、manifest_name不同不要随意复制
@echo off
::延迟变量扩展否则for循环中的变量只有最后的值
@setlocal enabledelayedexpansion
set install_path=%~dp0
cd /d %install_path%
::文件路径
SET manifest_path=..\..\product\windows10_debug
::文件名
SET manifest_file=product.manifest
::文件中的name
SET manifest_name=..\..\product\windows10_debug\product
::删除已有文件
if exist %manifest_file% (
del %manifest_file%
)
if exist %manifest_file% (
echo Error: can not delete file %manifest_file%!
goto end
)
::写文件不变的部分,注意 > 与 >> 的区别
@echo ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> > %manifest_file%
@echo. >> %manifest_file%
@echo ^<^^!-- Generated by generate_manifest.bat, please do not modify^^! --^> >> %manifest_file%
@echo. >> %manifest_file%
@echo ^<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"^> >> %manifest_file%
@echo ^<assemblyIdentity name="%manifest_name%" processorArchitecture="amd64" version="1.0.0.0" type="win32" /^> >> %manifest_file%
::获取动态库文件并输出到manifest
:: manifest中写子目录的dll无效所以无需这样处理注释掉用下面的方法
::for /f %%s in ('dir /s /b ".\*.dll"') do (
:: ::绝对路径
:: set absolute_path=%%s
:: ::截取为相对路径
:: set relative_path=!absolute_path:%install_path%=!
:: @echo ^<file name = "!relative_path!"/^> >> %manifest_file%
::)
for /f %%s in ('dir /b ".\*.dll"') do (
@echo ^<file name = "%%s"/^> >> %manifest_file%
)
::额外依赖的清单文件,开始
@echo. >> %manifest_file%
@echo ^<dependency^> >> %manifest_file%
::QtAV用于视频解码
@echo ^<dependentAssembly^> >> %manifest_file%
@echo ^<assemblyIdentity name="%manifest_path%\QtAV\QtAV" processorArchitecture="amd64" version="1.0.0.0" type="win32" /^> >> %manifest_file%
@echo ^</dependentAssembly^> >> %manifest_file%
::额外依赖的清单文件,结束
@echo ^</dependency^> >> %manifest_file%
@echo. >> %manifest_file%
::写文件不变的部分
@echo ^</assembly^> >> %manifest_file%
@echo. >> %manifest_file%
@echo ^<^^!-- Generated by generate_manifest.bat, please do not modify^^! --^> >> %manifest_file%
@echo. >> %manifest_file%
:success
echo.
echo File "%manifest_file%" has been generated successfully.
echo.
pause
exit
:end
pause
exit