VC項目一鍵編譯腳本

發佈VC軟件時,須要在編譯機器上配置好Directory參數(包括lib和include);mysql

執行項目編譯腳本,便可生成目標文件;sql

build.bat腳本以下:(這是爲Android手機和IOS手機作推送信息的後臺服務程序的編譯腳本)shell

@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
相關文章
相關標籤/搜索