78 lines
2.5 KiB
Batchfile
78 lines
2.5 KiB
Batchfile
|
|
::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=..\..\platform\windows10_release
|
|||
|
|
::文件名
|
|||
|
|
SET manifest_file=platform.manifest
|
|||
|
|
::文件中的name
|
|||
|
|
SET manifest_name=..\..\platform\windows10_release\platform
|
|||
|
|
|
|||
|
|
::删除已有文件
|
|||
|
|
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%
|
|||
|
|
::海康威视网络SDK,用于集成门禁等设备,实现指纹、人脸识别等
|
|||
|
|
@echo ^<dependentAssembly^> >> %manifest_file%
|
|||
|
|
@echo ^<assemblyIdentity name="%manifest_path%\hikvision\hikvision" 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
|