diff --git a/build.bat b/build.bat index 1b86a6e67..e92bb19ae 100644 --- a/build.bat +++ b/build.bat @@ -42,10 +42,17 @@ IF "%~1" == "" ( :START PUSHD "src" -CALL "%VS120COMNTOOLS%vsvars32.bat" x86 -TITLE %BUILDTYPE%ing SubtitleEdit - Release^|Any CPU... +CALL "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" x86 +TITLE %BUILDTYPE%ing SubtitleEdit - Release^|x86... -"MSBuild.exe" SubtitleEdit.sln /t:%BUILDTYPE% /p:Configuration=Release /p:Platform="Any CPU"^ +"MSBuild.exe" SubtitleEdit.sln /t:%BUILDTYPE% /p:Configuration=Release /p:Platform="x86"^ + /maxcpucount /consoleloggerparameters:DisableMPLogging;Summary;Verbosity=minimal +IF %ERRORLEVEL% NEQ 0 GOTO EndWithError + +CALL "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" x86_amd64 +TITLE %BUILDTYPE%ing SubtitleEdit - Release^|x64... + +"MSBuild.exe" SubtitleEdit.sln /t:%BUILDTYPE% /p:Configuration=Release /p:Platform="x64"^ /maxcpucount /consoleloggerparameters:DisableMPLogging;Summary;Verbosity=minimal IF %ERRORLEVEL% NEQ 0 GOTO EndWithError @@ -54,19 +61,20 @@ POPD IF /I "%BUILDTYPE%" == "Clean" GOTO END -IF DEFINED SEVENZIP_PATH IF EXIST "%SEVENZIP_PATH%" CALL :SubZipFile +CALL :SubDetectSevenzipPath +IF DEFINED SEVENZIP_PATH IF EXIST "%SEVENZIP_PATH%" ( + CALL :SubZipFile x86 + CALL :SubZipFile x64 +) CALL :SubDetectInnoSetup IF DEFINED InnoSetupPath ( - PUSHD "installer" - TITLE Compiling installer... - "%InnoSetupPath%\iscc.exe" /O.. /Q "Subtitle_Edit_installer.iss" + "%InnoSetupPath%" /O"." /Q "installer\Subtitle_Edit_installer.iss" IF %ERRORLEVEL% NEQ 0 GOTO EndWithError ECHO. & ECHO Installer compiled successfully! - POPD ) ELSE ( ECHO Inno Setup wasn't found; the installer wasn't built ) @@ -81,8 +89,8 @@ EXIT /B :SubZipFile -TITLE Creating the ZIP file... -PUSHD "src\bin\Release" +TITLE Creating the %~1 ZIP file... +PUSHD "src\bin\Release\%~1" IF EXIST "temp_zip" RD /S /Q "temp_zip" IF NOT EXIST "temp_zip" MD "temp_zip" IF NOT EXIST "temp_zip\Languages" MD "temp_zip\Languages" @@ -90,27 +98,28 @@ IF NOT EXIST "temp_zip\Tesseract" MD "temp_zip\Tesseract" IF NOT EXIST "temp_zip\Tesseract\tessdata" MD "temp_zip\Tesseract\tessdata" IF NOT EXIST "temp_zip\Tesseract\tessdata\configs" MD "temp_zip\Tesseract\tessdata\configs" -COPY /Y /V "..\..\..\gpl.txt" "temp_zip\" -COPY /Y /V "..\..\Changelog.txt" "temp_zip\" -COPY /Y /V "Interop.QuartzTypeLib.dll" "temp_zip\" -COPY /Y /V "Hunspellx86.dll" "temp_zip\" -COPY /Y /V "SubtitleEdit.exe" "temp_zip\" -COPY /Y /V "Languages\*.xml" "temp_zip\Languages\" -COPY /Y /V "..\..\..\Tesseract\msvcp90.dll" "temp_zip\Tesseract\" -COPY /Y /V "..\..\..\Tesseract\msvcr90.dll" "temp_zip\Tesseract\" -COPY /Y /V "..\..\..\Tesseract\tesseract.exe" "temp_zip\Tesseract\" -COPY /Y /V "..\..\..\Tesseract\tessdata\configs\hocr" "temp_zip\Tesseract\tessdata\configs\" -COPY /Y /V "..\..\..\Tesseract\tessdata\eng.traineddata" "temp_zip\Tesseract\tessdata\" +COPY /Y /V "..\..\..\..\gpl.txt" "temp_zip\" +COPY /Y /V "..\..\..\Changelog.txt" "temp_zip\" +COPY /Y /V "Interop.QuartzTypeLib.dll" "temp_zip\" +COPY /Y /V "Hunspell%~1.dll" "temp_zip\" +COPY /Y /V "SubtitleEdit.exe" "temp_zip\" +COPY /Y /V "Languages\*.xml" "temp_zip\Languages\" +COPY /Y /V "..\..\..\..\Tesseract\msvcp90.dll" "temp_zip\Tesseract\" +COPY /Y /V "..\..\..\..\Tesseract\msvcr90.dll" "temp_zip\Tesseract\" +COPY /Y /V "..\..\..\..\Tesseract\tesseract.exe" "temp_zip\Tesseract\" +COPY /Y /V "..\..\..\..\Tesseract\tessdata\configs\hocr" "temp_zip\Tesseract\tessdata\configs\" +COPY /Y /V "..\..\..\..\Tesseract\tessdata\eng.traineddata" "temp_zip\Tesseract\tessdata\" PUSHD "temp_zip" -START "" /B /WAIT "%SEVENZIP_PATH%" a -tzip -mx=9 "SE%VERSION%.zip" * >NUL +START "" /B /WAIT "%SEVENZIP_PATH%" a -tzip -mx=9 "SE%VERSION%.%~1.zip" * >NUL IF %ERRORLEVEL% NEQ 0 GOTO EndWithError -MOVE /Y "SE%VERSION%.zip" "..\..\..\.." >NUL +MOVE /Y "SE%VERSION%.%~1.zip" "..\..\..\..\.." >NUL POPD IF EXIST "temp_zip" RD /S /Q "temp_zip" POPD + EXIT /B @@ -137,21 +146,21 @@ ENDLOCAL EXIT /B +:SubDetectSevenzipPath +FOR %%G IN (7z.exe) DO (SET "SEVENZIP_PATH=%%~$PATH:G") +IF EXIST "%SEVENZIP_PATH%" (SET "SEVENZIP=%SEVENZIP_PATH%" & EXIT /B) + +FOR %%G IN (7za.exe) DO (SET "SEVENZIP_PATH=%%~$PATH:G") +IF EXIST "%SEVENZIP_PATH%" (SET "SEVENZIP=%SEVENZIP_PATH%" & EXIT /B) + +FOR /F "tokens=2*" %%A IN ( + 'REG QUERY "HKLM\SOFTWARE\7-Zip" /v "Path" 2^>NUL ^| FIND "REG_SZ" ^|^| + REG QUERY "HKLM\SOFTWARE\Wow6432Node\7-Zip" /v "Path" 2^>NUL ^| FIND "REG_SZ"') DO SET "SEVENZIP=%%B\7z.exe" +EXIT /B + + :SubDetectInnoSetup -rem Detect if we are running on 64bit Windows and use Wow6432Node since Inno Setup is -rem a 32-bit application, and set the registry key of Inno Setup accordingly -IF DEFINED PROGRAMFILES(x86) ( - SET "U_=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" -) ELSE ( - SET "U_=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" -) - -FOR /F "delims=" %%a IN ( - 'REG QUERY "%U_%\Inno Setup 5_is1" /v "Inno Setup: App Path"2^>Nul^|FIND "REG_"') DO ( - SET "InnoSetupPath=%%a" & CALL :SubInnoSetup %%InnoSetupPath:*Z=%%) -EXIT /B - - -:SubInnoSetup -SET "InnoSetupPath=%*" +FOR /F "tokens=5*" %%A IN ( + 'REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ" ^|^| + REG QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ"') DO SET "InnoSetupPath=%%B\ISCC.exe" EXIT /B diff --git a/installer/Subtitle_Edit_installer.iss b/installer/Subtitle_Edit_installer.iss index d1ade0f61..5202ccdd9 100644 --- a/installer/Subtitle_Edit_installer.iss +++ b/installer/Subtitle_Edit_installer.iss @@ -48,7 +48,8 @@ #define VerBuild #define VerRevision -#define bindir "..\src\bin\Release" +#define bindir "..\src\bin\Release\x86" +#define bindir_x64 "..\src\bin\Release\x64" #ifnexist bindir + "\SubtitleEdit.exe" #error Compile Subtitle Edit first @@ -112,6 +113,8 @@ PrivilegesRequired=admin ShowLanguageDialog=yes DisableDirPage=auto DisableProgramGroupPage=auto +ArchitecturesAllowed=x86 x64 +ArchitecturesInstallIn64BitMode=x64 [Languages] @@ -203,7 +206,8 @@ Source: ..\Dictionaries\ru_RU_names_etc.xml; DestDir: {userappdata}\Subtit Source: ..\Dictionaries\ru_RU_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main Source: ..\Dictionaries\rus_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main Source: ..\Dictionaries\swe_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main -Source: {#bindir}\Hunspellx86.dll; DestDir: {app}; Flags: ignoreversion; Components: main +Source: {#bindir_x64}\Hunspellx64.dll; DestDir: {app}; Flags: ignoreversion; Components: main; Check: Is64BitInstallMode() +Source: {#bindir}\Hunspellx86.dll; DestDir: {app}; Flags: ignoreversion; Components: main; Check: not Is64BitInstallMode() Source: {#bindir}\Icons\Find.png; DestDir: {app}\Icons; Flags: ignoreversion; Components: main Source: {#bindir}\Icons\Help.png; DestDir: {app}\Icons; Flags: ignoreversion; Components: main Source: {#bindir}\Icons\New.png; DestDir: {app}\Icons; Flags: ignoreversion; Components: main @@ -252,7 +256,8 @@ Source: {#bindir}\Languages\zh-CHS.xml; DestDir: {app}\Languages; Source: {#bindir}\Languages\zh-tw.xml; DestDir: {app}\Languages; Flags: ignoreversion; Components: translations #endif -Source: {#bindir}\SubtitleEdit.exe; DestDir: {app}; Flags: ignoreversion; Components: main +Source: {#bindir_x64}\SubtitleEdit.exe; DestDir: {app}; Flags: ignoreversion; Components: main; Check: Is64BitInstallMode() +Source: {#bindir}\SubtitleEdit.exe; DestDir: {app}; Flags: ignoreversion; Components: main; Check: not Is64BitInstallMode() Source: ..\src\Changelog.txt; DestDir: {app}; Flags: ignoreversion; Components: main Source: ..\gpl.txt; DestDir: {app}; Flags: ignoreversion; Components: main Source: ..\Tesseract\msvcp90.dll; DestDir: {app}\Tesseract; Flags: ignoreversion; Components: main @@ -350,13 +355,15 @@ Type: dirifempty; Name: {app}\Languages; Check: not IsComponentSe [Run] -Filename: {win}\Microsoft.NET\Framework\v4.0.30319\ngen.exe; Parameters: "install ""{app}\SubtitleEdit.exe"""; StatusMsg: {cm:msg_OptimizingPerformance}; Flags: runhidden runascurrentuser skipifdoesntexist +Filename: {win}\Microsoft.NET\Framework\v4.0.30319\ngen.exe; Parameters: "install ""{app}\SubtitleEdit.exe"""; StatusMsg: {cm:msg_OptimizingPerformance}; Flags: runhidden runascurrentuser skipifdoesntexist; Check: not Is64BitInstallMode() +Filename: {win}\Microsoft.NET\Framework64\v4.0.30319\ngen.exe; Parameters: "install ""{app}\SubtitleEdit.exe"""; StatusMsg: {cm:msg_OptimizingPerformance}; Flags: runhidden runascurrentuser skipifdoesntexist; Check: Is64BitInstallMode() Filename: {app}\SubtitleEdit.exe; Description: {cm:LaunchProgram,Subtitle Edit}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked Filename: http://www.nikse.dk/SubtitleEdit/; Description: {cm:run_VisitWebsite}; Flags: nowait postinstall skipifsilent unchecked shellexec [UninstallRun] -Filename: {win}\Microsoft.NET\Framework\v4.0.30319\ngen.exe; Parameters: "uninstall ""{app}\SubtitleEdit.exe"""; Flags: runhidden runascurrentuser skipifdoesntexist +Filename: {win}\Microsoft.NET\Framework\v4.0.30319\ngen.exe; Parameters: "uninstall ""{app}\SubtitleEdit.exe"""; Flags: runhidden runascurrentuser skipifdoesntexist; Check: not Is64BitInstallMode() +Filename: {win}\Microsoft.NET\Framework64\v4.0.30319\ngen.exe; Parameters: "uninstall ""{app}\SubtitleEdit.exe"""; Flags: runhidden runascurrentuser skipifdoesntexist; Check: Is64BitInstallMode() [Code] diff --git a/src/SubtitleEdit.csproj b/src/SubtitleEdit.csproj index 7b403cc57..777c025c6 100644 --- a/src/SubtitleEdit.csproj +++ b/src/SubtitleEdit.csproj @@ -2,7 +2,7 @@ Debug - AnyCPU + x86 9.0.21022 2.0 {511A5B59-1C35-4719-8536-23B19AF9B21A} @@ -41,11 +41,11 @@ true Client - + true full false - bin\Debug\ + bin\Debug\x86\ TRACE;DEBUG prompt 4 @@ -53,10 +53,10 @@ x86 Off - + pdbonly true - bin\Release\ + bin\Release\x86\ TRACE prompt 4 @@ -65,6 +65,32 @@ true Off + + true + bin\Debug\x64\ + TRACE;DEBUG + true + full + x64 + bin\Debug\SubtitleEdit.exe.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + Off + prompt + + + bin\Release\x64\ + TRACE + true + true + pdbonly + x64 + bin\Release\SubtitleEdit.exe.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + Off + prompt + False @@ -1879,10 +1905,8 @@ "$(ProjectDir)..\update_rev.bat" - COPY /Y /V "$(ProjectDir)Dlls\Hunspellx86.dll" "$(TargetDir)" -COPY /Y /V "$(ProjectDir)Dlls\Hunspellx64.dll" "$(TargetDir)" -COPY /Y /V "$(ProjectDir)Dlls\Interop.QuartzTypeLib.dll" "$(TargetDir)" - + COPY /Y /V "$(ProjectDir)Dlls\Hunspell$(PlatformName).dll" "$(TargetDir)" +COPY /Y /V "$(ProjectDir)Dlls\Interop.QuartzTypeLib.dll" "$(TargetDir)"