VC项目一键编译脚本

发布VC软件时,需要在编译机器上配置好Directory参数(包括lib和include);

执行项目编译脚本,即可生成目标文件;

build.bat脚本如下:(这是为Android手机和IOS手机做推送信息的后台服务程序的编译脚本)

@rem  编译环境
@rem  安装mysql驱动,openssl。
@rem  VC配置“路径” 》include路径包含 mysql头文件目录,openssl头文件目录;
@rem                 》lib路径包含    mysql的lib目录, openssl lib目录;
@rem  ######################输出目录
@if   not   exist   Release   md   Release
@set m_time=%time%

@set hh=%m_time:~0,2%
@if /i %hh% LSS 10 (set hh=0%time:~1,1%)

@set log=.\Release\%date:~0,4%%date:~5,2%%date:~8,2%%hh%%time:~3,2%%time:~6,2%_buildlog

@md  %log%
@set logpath=%log%\

@echo  on
@rem  #######################编译模块
@set name=Notification4Android_dll_debug.log
msdev .\Notification4Android\Pushinfodll\pushinfo.dsw /make "pushinfo - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4Android_dll_release.log
msdev .\Notification4Android\Pushinfodll\pushinfo.dsw /make "pushinfo - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%

@set name=Notification4Android_service_debug.log
msdev .\Notification4Android\pushservice\pushservice.dsw /make "pushservice - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4Android_service_release.log
msdev .\Notification4Android\pushservice\pushservice.dsw /make "pushservice - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%

@set name=Notification4Android_monitor_release.log
msdev .\ServerMonitor\ServerMonitor.dsw /make "ServerMonitor - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%



XCOPY .\Notification4Android\pushservice\sysconfig.ini            				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\install_pushservice.bat   				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\Uninstall_pushservice.bat 				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\start_pushservice.bat     				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\stop_pushservice.bat      				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\libmysql.dll              				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\ReleaseMinDependency\pushservice.exe   .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\ReleaseMinDependency\pushinfo.dll      .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\ReleaseMinDependency\pushinfo.pdb      .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\ReleaseMinDependency\pushinfo.map      .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\registerdll.bat      								.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Unregisterdll.bat      							.\release\4Android_release\  /h /d /q /y
@rem  XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe        		.\release\4Android_release\.  /h /d /q /y


XCOPY .\Notification4Android\pushservice\sysconfig.ini             .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\install_pushservice.bat   .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\Uninstall_pushservice.bat .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\start_pushservice.bat     .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\stop_pushservice.bat      .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\libmysql.dll              .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\Debug\pushservice.exe     .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\Debug\pushinfo.dll        .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\Debug\pushinfo.pdb        .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\Debug\pushinfo.map        .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\registerdll.bat      				   .\release\4Android_debug\.  /h /d /q /y
XCOPY .\Notification4Android\Unregisterdll.bat      			   .\release\4Android_debug\.  /h /d /q /y
@rem  XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe       .\release\4Android_debug\.  /h /d /q /y


@rem  XCOPY .\\stlport_vc646.dll .\release  /h /d /q /y


@set name=Notification4IOS_dll_debug.log
msdev .\Notification4IOS\NotificationDll\NotificationDll.dsw /make "NotificationDll - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4IOS_dll_release.log
msdev .\Notification4IOS\NotificationDll\NotificationDll.dsw /make "NotificationDll - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%
@set name=Notification4IOS_service_debug.log
msdev .\Notification4IOS\NotificationService\NotificationService.dsw /make "NotificationService - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4IOS_service_release.log
msdev .\Notification4IOS\NotificationService\NotificationService.dsw /make "NotificationService - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%

XCOPY .\Notification4IOS\NotificationService\sysconfig.ini                                     .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\install_Notificationservice.bat                   .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\Uninstall_Notificationservice.bat                 .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\start_Notificationservice.bat                     .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\stop_Notificationservice.bat                      .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libmysql.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libeay32.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libssl32.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ssleay32.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\ReleaseMinDependency\NotificationService.exe      .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ReleaseMinDependency\NotificationDll.dll              .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ReleaseMinDependency\NotificationDll.pdb              .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ReleaseMinDependency\NotificationDll.map              .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\registerdll.bat                                     				   .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\Unregisterdll.bat                   								   .\release\4IOS_release\  /h /d /q /y

@rem  XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe                              .\release\4IOS_release\  /h /d /q /y


XCOPY .\Notification4IOS\NotificationService\sysconfig.ini                     .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\install_Notificationservice.bat   .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\Uninstall_Notificationservice.bat .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\start_Notificationservice.bat     .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\stop_Notificationservice.bat      .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libmysql.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libeay32.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libssl32.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ssleay32.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\Debug\NotificationService.exe     .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\Debug\NotificationDll.dll             .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\Debug\NotificationDll.pdb             .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\Debug\NotificationDll.map             .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\registerdll.bat                                       .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\Unregisterdll.bat                   				   .\release\4IOS_debug\  /h /d /q /y


XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe    .\release\  /h /d /q /y
XCOPY .\ServerMonitor\install_monitor_service.bat				.\release\  /h /d /q /y
XCOPY .\ServerMonitor\start_monitor_server.bat					.\release\  /h /d /q /y
XCOPY .\ServerMonitor\stop_monitor_server.bat					.\release\  /h /d /q /y
XCOPY .\ServerMonitor\Uninstall_monitor_service.bat				.\release\  /h /d /q /y


@echo  build is completed
pause

还有一个问题就是项目版本升级,要更新版本号:
版本号在rc文件中,一个简单的方法是:直接替换版本号。
#升级版本ruby脚本
#
#作者:jordan .sg 2012-8-31
#require "stringio"


File.open("./Notification4Android/Pushinfodll/pushinfo.rc", "r") do |rcfile|  # Open file out.txt for writing
 str=rcfile.read
 str.gsub!('1,0,0,4','1,0,0,5')
 str.gsub!('1, 0, 0, 4','1, 0, 0, 5')
 rcfile.close
 File.open("./pushinfo.rc", "w") do |rcfile|
  rcfile.write(str) 
  rcfile.flush
  rcfile.close
 end
end


File.open("./Notification4IOS/NotificationDll/NotificationDll.rc", "r") do |rcfile|  # Open file out.txt for writing
 str=rcfile.read
 str.gsub!('1,0,0,0','1,0,0,1')
 str.gsub!('1, 0, 0, 0','1, 0, 0, 1')
 rcfile.close
 File.open("./pushinfo.rc", "w") do |rcfile|
  rcfile.write(str) 
  rcfile.flush
  rcfile.close
 end
end


转载于:https://my.oschina.net/u/136923/blog/75948

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值