diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..65012b8 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,32 @@ +image: Visual Studio 2015 + +environment: + ARCH: x86 + +clone_depth: 1 + +platform: + - x64 + +init: + - if /i %APPVEYOR_REPO_TAG% == true set WITH_TESSDATA=1 + +install: + - call "scripts\win\prepare.bat" + +build_script: + - call "scripts\win\build.bat" + +artifacts: + - path: 'screen-translator-*.exe' + name: installer + +deploy: + - provider: GitHub + description: "Version $(APPVEYOR_REPO_TAG_NAME)" + auth_token: + secure: NnyUV44yNAx8ea1L46dVhE4kQxUGd5M1O+yVk+9ncsNHWtw/9JoCnDqNybnxTccP + artifact: installer + force_update: true + on: + appveyor_repo_tag: true diff --git a/scripts/win/build.bat b/scripts/win/build.bat new file mode 100644 index 0000000..bdec605 --- /dev/null +++ b/scripts/win/build.bat @@ -0,0 +1,59 @@ +@echo off + +set SELF_PATH=%~dp0 +call %SELF_PATH%\env.bat + + +::build +rmdir /q /s build +set ROOT=%SELF_PATH%\..\.. +lrelease %ROOT%\ScreenTranslator.pro +mkdir build +cd build +qmake INCLUDEPATH+=%cd%\..\installed\include LIBS+=-L%cd%\..\installed\bin LIBS+=-L%cd%\..\installed\lib %ROOT% +nmake +cd .. +if %errorlevel% neq 0 exit /b %errorlevel% + + +::pack +rmdir /q /s iss +mkdir iss +copy /Y %ROOT%\distr\iss\* iss +copy /Y %ROOT%\distr\Changelog_en.txt iss\ +copy /Y %ROOT%\distr\Changelog_ru.txt iss\ +copy /Y %ROOT%\LICENSE.md iss\LICENSE_en.md +copy /Y %ROOT%\images\icon.ico iss\icon.ico + +mkdir iss\content +copy /Y build\release\ScreenTranslator.exe iss\content\ScreenTranslator.exe +copy /Y installed\bin\*.dll iss\content +mkdir iss\content\translations +copy /Y %ROOT%\translations\*.qm iss\content\translations +mkdir iss\content\translators +copy /Y %ROOT%\translators\* iss\content\translators + +windeployqt --release iss\content\ScreenTranslator.exe + +for /f "delims=" %%i in ('findstr versionString %ROOT%\version.json') do set VERSION_LINE=%%i +set UNQUOTED=%VERSION_LINE:"='% +for /f "tokens=4 delims='" %%i in ("%UNQUOTED%") do set VERSION=%%i +echo #define MyAppVersion "%VERSION%" > iss\defines.iss + + + +cd iss +iscc.exe InnoSetup.iss +cd .. + + +if "%WITH_TESSDATA%" == "" goto end + +mkdir iss\tessdata +copy /Y download\tessdata\* iss\tessdata + +cd iss +iscc.exe InnoSetupWithTessdata.iss +cd .. + +:end \ No newline at end of file diff --git a/scripts/win/env.bat b/scripts/win/env.bat new file mode 100644 index 0000000..61722ad --- /dev/null +++ b/scripts/win/env.bat @@ -0,0 +1,19 @@ +@echo off + +if "%ARCH%" == "" set ARCH=x86 + +if /i %ARCH% == x86 goto x86 +if /i %ARCH% == x64 goto x64 +goto end + +:x64 +call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 +set PATH=c:\Qt\5.5\msvc2013_64\bin\;c:\Program Files (x86)\NSIS\;C:\Program Files (x86)\Inno Setup 5;C:\Program Files\CMake\bin;%PATH% +goto end + +:x86 +call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 +set PATH=c:\Qt\5.5\msvc2013\bin\;c:\Program Files (x86)\NSIS\;C:\Program Files (x86)\Inno Setup 5;C:\Program Files\CMake\bin;%PATH% +goto end + +:end diff --git a/scripts/win/prepare.bat b/scripts/win/prepare.bat new file mode 100644 index 0000000..21e4f93 --- /dev/null +++ b/scripts/win/prepare.bat @@ -0,0 +1,101 @@ +@echo off + +set SELF_PATH=%~dp0 +call %SELF_PATH%\env.bat + +rem choco install curl cmake + +mkdir download +if not exist download\leptonica.zip ( + curl -fsSLk -o download\leptonica.zip https://github.com/DanBloomberg/leptonica/archive/1.74.4.zip +) +if not exist download\tesseract.zip ( + curl -fsSLk -o download\tesseract.zip https://github.com/tesseract-Ocr/tesseract/archive/3.05.01.zip +) + + +if "%WITH_TESSDATA%" == "" goto build + +mkdir download\tessdata +cd download\tessdata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/chi_sim.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/deu.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.tesseract_cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.tesseract_cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/frk.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/frm.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/jpn.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa_old.traineddata +cd ..\.. + + +:build + +rmdir /s /q installed + +rmdir /s /q leptonica +unzip -qq download\leptonica.zip +move leptonica* leptonica +mkdir leptonica-build +cd leptonica-build +cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_CPU=%ARCH% -DCMAKE_INSTALL_PREFIX=..\installed ..\leptonica +cmake --build . --config Release +cmake --build . --config Release --target install +cd .. +copy /y /b installed\lib\leptonica*.lib installed\lib\lept.lib +if %errorlevel% neq 0 exit /b %errorlevel% + + +rmdir /s /q tesseract +unzip -qq download\tesseract.zip +move tesseract* tesseract +mkdir tesseract-build +cd tesseract-build +cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_CPU=%ARCH% -DCMAKE_INSTALL_PREFIX=..\installed -DCMAKE_PREFIX_PATH=..\installed ..\tesseract +cmake --build . --config Release +cmake --build . --config Release --target install +cd .. +copy /y /b installed\lib\tesseract*.lib installed\lib\tesseract.lib +if %errorlevel% neq 0 exit /b %errorlevel% + + +