From 2bc2a5b550608f90332d937ab55dec95e18b8fc3 Mon Sep 17 00:00:00 2001 From: Peter Petrik Date: Fri, 15 Nov 2019 17:17:25 +0100 Subject: [PATCH 1/3] fix build on win --- README.md | 17 +++++-- appveyor.yml | 1 + win/config.conf | 0 win/distribute.cmd | 83 ++++++++++++++++++++-------------- win/recipes/geodiff/recipe.bat | 25 +++++----- win/recipes/osgeo/recipe.bat | 8 +--- win/recipes/qgis/recipe.bat | 44 +++++++----------- 7 files changed, 92 insertions(+), 86 deletions(-) delete mode 100644 win/config.conf diff --git a/README.md b/README.md index 5611a639..a3ea93e9 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,20 @@ Contains: # Windows +it is building automatically on appveyor.com +for local developement do: + - install Visual Studio (Community) 2015 (14) -- install OSGeo4W 64 bit to C:\OSGeo4W64b -- install bison and flex (either cygwin or through `choco`) -- modify `win/config.conf` with paths -- `cd win` +- install Microsoft SDK 8.1 +- install Microsoft Universal CRT SDK (not required on win 10) +- install dependency walker if you need to debug linkage +- install python 36 to path C:\Python36-x64 +- open visual studio IDE and compile any example project (you need to additionally download some packages) +- make sure you have file Microsoft Visual Studio 14.0\VC\vcvarsall.bat present on the installation! +- install OSGeo4W 64 bit to C:\projects\input-sdk\x86_64\repo\OSGeo4W64 +- install bison and flex and cmake and 7zip (through `choco`) +- get geodiff, qgis, input-sdk repos to C:\input-sdk\x86_64\repo\ +- `cd input-sdk\win` - run `distibute.cmd` ## Hints diff --git a/appveyor.yml b/appveyor.yml index 6fabba88..a2c8e0be 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,7 @@ image: Visual Studio 2017 install: + - call choco install winflexbison3 - call .\\win\\distribute.cmd build: off diff --git a/win/config.conf b/win/config.conf deleted file mode 100644 index e69de29b..00000000 diff --git a/win/distribute.cmd b/win/distribute.cmd index bec1f968..6ae13bb4 100755 --- a/win/distribute.cmd +++ b/win/distribute.cmd @@ -1,41 +1,56 @@ @echo on -set ROOT_DIR=C:\input-sdk\x86_64 -set RESULT_FILE=C:\projects\input-sdk\input-sdk-win-x86_64.zip -mkdir %ROOT_DIR% +set OLD_PATH=%PATH% +set ROOT_DIR=C:\projects\input-sdk\x86_64 +set PY36=C:\Python36-x64 set STAGE_PATH=%ROOT_DIR%\stage set BUILD_PATH=%ROOT_DIR%\build -mkdir %STAGE_PATH% -mkdir %BUILD_PATH% - -echo "install flex-bison" -choco install winflexbison3 - -echo "download osgeo" -call %~dp0\recipes\osgeo\recipe.bat - -echo "build geodiff" -call %~dp0\recipes\geodiff\recipe.bat - -IF EXIST "C:\input-sdk\x86_64\stage\lib\geodiff.dll" ( - echo "geodiff is OK" -) ELSE ( - echo "missing geodiff.dll, exiting" - exit /B 1 -) - -echo "build qgis" -call %~dp0\recipes\qgis\recipe.bat +set REPO_PATH=%ROOT_DIR%\repo +set DOWNLOAD_PATH=%ROOT_DIR%\download +set RESULT_FILE=%ROOT_DIR%\..\input-sdk-win-x86_64.zip +set OSGEO4W_ROOT=%REPO_PATH%\OSGeo4W64 + +if not exist %ROOT_DIR% mkdir %ROOT_DIR% +if not exist %BUILD_PATH% mkdir %BUILD_PATH% +if not exist %REPO_PATH% mkdir %REPO_PATH% +if not exist %DOWNLOAD_PATH% mkdir %DOWNLOAD_PATH% +if not exist %OSGEO4W_ROOT% call %~dp0\recipes\osgeo\recipe.bat +if not exist %STAGE_PATH% robocopy %OSGEO4W_ROOT% %STAGE_PATH% /E /NFL /NDL + +if not "%PROGRAMFILES(X86)%"=="" set PF86=%PROGRAMFILES(X86)% +if "%PF86%"=="" set PF86=%PROGRAMFILES% +if "%PF86%"=="" (echo PROGRAMFILES not set & goto error) +set VS140COMNTOOLS=%PF86%\Microsoft Visual Studio 14.0\Common7\Tools\ +call "%PF86%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 +path %path%;%PF86%\Microsoft Visual Studio 14.0\VC\bin +path %path%;%CMAKE% +path %path%;%STAGE_PATH%\apps\Qt5\bin;%PATH% +path %path%;%PY36%;%PATH% +set PYTHONPATH="%PY36%\DLLs;%PY36%\Lib;%PY36%\Lib\site-packages" +set Qt5_DIR=%STAGE_PATH%\apps\qt5\lib\cmake\Qt5 +set LIB=%STAGE_PATH%\apps\Qt5\lib;%STAGE_PATH%\lib +set LIB=%LIB%;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\ +set INCLUDE=%STAGE_PATH%\apps\Qt5\include;%STAGE_PATH%\include + +IF NOT EXIST "%STAGE_PATH%\lib\geodiff.dll" call %~dp0\recipes\geodiff\recipe.bat +IF NOT EXIST "%STAGE_PATH%\lib\geodiff.dll" goto error + +IF NOT EXIST "%STAGE_PATH%\qml\QgsQuick\qgis_quick_plugin.dll" call %~dp0\recipes\qgis\recipe.bat +IF NOT EXIST "%STAGE_PATH%\qml\QgsQuick\qgis_quick_plugin.dll" goto error + +IF NOT EXIST %RESULT_FILE% 7z a %RESULT_FILE% %STAGE_PATH%\* +dir %RESULT_FILE% -IF EXIST "C:\input-sdk\x86_64\stage\lib\qgis_core.dll" ( - echo "qgis is OK" -) ELSE ( - echo "missing qgis dlls, exiting" - exit /B 1 -) +set PATH=%OLD_PATH% +cd %~dp0 +echo "all done!" +goto end -dir %STAGE_PATH% -7z a %RESULT_FILE% %STAGE_PATH%\* -dir %RESULT_FILE% +:error +echo ENV ERROR %ERRORLEVEL%: %DATE% %TIME% +path %OLD_PATH% +cd %~dp0 +echo "error!" +exit /b 1 -ECHO "done" \ No newline at end of file +:end \ No newline at end of file diff --git a/win/recipes/geodiff/recipe.bat b/win/recipes/geodiff/recipe.bat index 4e8321c8..4ec8c6e2 100644 --- a/win/recipes/geodiff/recipe.bat +++ b/win/recipes/geodiff/recipe.bat @@ -1,26 +1,25 @@ @echo on -set VERSION_geodiff=0.7.5 +set VERSION_geodiff=0.7.6 set URL_geodiff=https://github.com/lutraconsulting/geodiff/archive/%VERSION_geodiff%.tar.gz set BUILD_geodiff=%BUILD_PATH%\geodiff -mkdir %BUILD_geodiff% -cd %BUILD_geodiff% - -curl -fsSL --connect-timeout 60 -o geodiff.tar.gz %URL_geodiff% -dir +set REPO_geodiff=%REPO_PATH%\geodiff +if not exist %BUILD_geodiff% mkdir %BUILD_geodiff% -7z x "geodiff.tar.gz" -so | 7z x -aoa -si -ttar -o"src" -cd src\geodiff-%VERSION_geodiff% -dir +IF NOT EXIST %REPO_geodiff% ( + cd %DOWNLOAD_PATH% + curl -fsSL --connect-timeout 60 -o geodiff.tar.gz %URL_geodiff% -mkdir %BUILD_geodiff%\build -cd %BUILD_geodiff%\build + 7z x "geodiff.tar.gz" -so | 7z x -aoa -si -ttar -o"src" + move src\geodiff-%VERSION_geodiff% %REPO_geodiff% +) -cmake -G "Visual Studio 15 2017 Win64" ^ +cd %BUILD_geodiff% +cmake -G %CMAKE_GENERATOR% ^ -DCMAKE_INSTALL_PREFIX:PATH=%STAGE_PATH% ^ -DENABLE_TESTS=OFF ^ -DBUILD_TOOLS=OFF ^ -DBUILD_STATIC_LIBS=OFF ^ -%BUILD_geodiff%\src\geodiff-%VERSION_geodiff%\geodiff +%REPO_geodiff%\geodiff cmake --build . --config Release --target install --parallel %NUMBER_OF_PROCESSORS% diff --git a/win/recipes/osgeo/recipe.bat b/win/recipes/osgeo/recipe.bat index 391661f4..333acc32 100644 --- a/win/recipes/osgeo/recipe.bat +++ b/win/recipes/osgeo/recipe.bat @@ -1,14 +1,9 @@ -@echo on - -echo "install osgeo4w deps" set SERVER="http://norbit.de/osgeo4w" REM set SERVER="http://download.osgeo.org/osgeo4w" +cd %DOWNLOAD_PATH% curl -fsS --connect-timeout 180 -o osgeo4w-setup.exe http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe -REM todo remove local osgeo4w installer... the server timeouted -REM C:\projects\input-sdk\win\recipes\osgeo\osgeo4w-setup-x86_64.exe ^ - @echo off set OLD_PATH=%PATH% set PATH="C:\Windows\system32;C:\Windows;C:\Windows\wbem" @@ -32,4 +27,3 @@ qt5-devel,qt5-qml,qt5-libs,qt5-libs-debug,qtkeychain-qt5-devel,^ qtkeychain-qt5-libs,spatialite,sqlite3,zlib set PATH=%OLD_PATH% -@echo on diff --git a/win/recipes/qgis/recipe.bat b/win/recipes/qgis/recipe.bat index ec3da77f..07172a16 100755 --- a/win/recipes/qgis/recipe.bat +++ b/win/recipes/qgis/recipe.bat @@ -3,23 +3,18 @@ set VERSION_qgis=31192093340f800d06d9ee67e1c3d46988520dd8 set URL_qgis=https://github.com/qgis/QGIS/archive/%VERSION_qgis%.tar.gz set BUILD_qgis=%BUILD_PATH%\qgis -mkdir %BUILD_qgis% -cd %BUILD_qgis% - -curl -fsSL --connect-timeout 60 -o qgis.tar.gz %URL_qgis% - -7z x "qgis.tar.gz" -so | 7z x -aoa -si -ttar -o"src" - -mkdir %BUILD_qgis%\build -cd %BUILD_qgis%\build - -set OLD_PATH=%PATH% +set REPO_qgis=%REPO_PATH%\qgis +if not exist %BUILD_qgis% mkdir %BUILD_qgis% -set PATH=%STAGE_PATH%\apps\Qt5\bin;%PATH% -set PATH=C:\Python36-x64;%PATH% -set Qt5_DIR=%STAGE_PATH%\apps\qt5\lib\cmake\Qt5 +IF NOT EXIST %REPO_qgis% ( + cd %DOWNLOAD_PATH% + curl -fsSL --connect-timeout 60 -o qgis.tar.gz %URL_qgis% + 7z x "qgis.tar.gz" -so | 7z x -aoa -si -ttar -o"src" + move src\QGIS-%VERSION_qgis% %REPO_qgis% +) -cmake -G "Visual Studio 15 2017 Win64" ^ +cd %BUILD_qgis% +cmake -G %CMAKE_GENERATOR% ^ -DCMAKE_INSTALL_PREFIX:PATH=%STAGE_PATH% ^ -DWITH_DESKTOP=OFF ^ -DDISABLE_DEPRECATED=ON ^ @@ -40,22 +35,15 @@ cmake -G "Visual Studio 15 2017 Win64" ^ -DWITH_APIDOC=OFF ^ -DWITH_ASTYLE=OFF ^ -DWITH_GRASS7:BOOL=OFF ^ +-DPYTHON_EXECUTABLE:PATH=%PY36%/python.exe ^ -DFORCE_STATIC_PROVIDERS=TRUE ^ --DSETUPAPI_LIBRARY:PATH="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/x64/SetupAPI.Lib" ^ --DVERSION_LIBRARY:PATH="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/x64/Version.Lib" ^ -DFLEX_EXECUTABLE:PATH="C:/ProgramData/chocolatey/lib/winflexbison3/tools/win_flex.exe" ^ -DBISON_EXECUTABLE:PATH="C:/ProgramData/chocolatey/lib/winflexbison3/tools/win_bison.exe" ^ --DCMAKE_PREFIX_PATH=%STAGE_PATH%;%STAGE_PATH%/apps/Qt5/lib/cmake ^ -%BUILD_qgis%\src\QGIS-%VERSION_qgis% - -cmake --build . --config Release --target install --parallel %NUMBER_OF_PROCESSORS% -- /verbosity:detailed - - -REM cp $BUILD_PATH/qgis/build-$ARCH/src/core/qgis_core.h ${STAGE_PATH}/QGIS.app/Contents/Frameworks/qgis_core.framework/Headers/ -REM cp $BUILD_PATH/qgis/build-$ARCH/src/quickgui/qgis_quick.h ${STAGE_PATH}/QGIS.app/Contents/MacOS/lib/qgis_quick.framework/Headers/ -REM cp $BUILD_qgis/src/quickgui/plugin/qgsquickplugin.h ${STAGE_PATH}/QGIS.app/Contents/MacOS/lib/qgis_quick.framework/Headers/ +%REPO_qgis% -REM cp -R $BUILD_qgis/src/quickgui/images ${STAGE_PATH}/QGIS.app/Contents/Resources/images/QgsQuick +cmake --build . --config Release --target install --parallel %NUMBER_OF_PROCESSORS% -set PATH=%OLD_PATH% +copy %REPO_qgis%\src\quickgui\plugin\qgsquickplugin.h %STAGE_PATH%\include +mkdir %STAGE_PATH%\images\QgsQuick +copy %REPO_qgis%\src\quickgui\images\* %STAGE_PATH%\images\QgsQuick\ From db743f5668f814c9b2973dab9cd1bb505484db75 Mon Sep 17 00:00:00 2001 From: Peter Petrik Date: Fri, 15 Nov 2019 21:56:45 +0100 Subject: [PATCH 2/3] fix docs --- README.md | 1 + win/recipes/qgis/recipe.bat | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a3ea93e9..45953022 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ for local developement do: - get geodiff, qgis, input-sdk repos to C:\input-sdk\x86_64\repo\ - `cd input-sdk\win` - run `distibute.cmd` +- optionally upload resulting sdk to common public place ## Hints diff --git a/win/recipes/qgis/recipe.bat b/win/recipes/qgis/recipe.bat index 07172a16..ba9d8e94 100755 --- a/win/recipes/qgis/recipe.bat +++ b/win/recipes/qgis/recipe.bat @@ -1,6 +1,6 @@ @echo on -set VERSION_qgis=31192093340f800d06d9ee67e1c3d46988520dd8 +set VERSION_qgis=d4f291fdb40f18a23b228aa7a4c7f07c3b8a27e2 set URL_qgis=https://github.com/qgis/QGIS/archive/%VERSION_qgis%.tar.gz set BUILD_qgis=%BUILD_PATH%\qgis set REPO_qgis=%REPO_PATH%\qgis From 1f210f510aefd9357b8a9e8259d89a1817b67f8c Mon Sep 17 00:00:00 2001 From: Peter Petrik Date: Fri, 15 Nov 2019 21:58:56 +0100 Subject: [PATCH 3/3] disable appveyor --- appveyor.yml | 30 +++++++++++++++--------------- win/distribute.cmd | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a2c8e0be..645f4adc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,25 +2,25 @@ image: Visual Studio 2017 install: - call choco install winflexbison3 - - call .\\win\\distribute.cmd + # - call .\\win\\distribute.cmd build: off # Do not build feature branch with open Pull Requests skip_branch_with_pr: false -artifacts: - - path: input-sdk-win-x86_64.zip - name: input-sdk-win-x86_64 +#artifacts: +# - path: input-sdk-win-x86_64.zip +# name: input-sdk-win-x86_64 -deploy: - - provider: GitHub - description: 'input-sdk windows release' - auth_token: - secure: gqLWRiVUFKd+MsoevoouKEHG0tpvM9zhhSnCpzj9lRg4vcGq+ssWIG2m7kCbgLAC - artifact: input-sdk-win-x86_64 - draft: false - prerelease: false - on: - branch: master - APPVEYOR_REPO_TAG: true +#deploy: +# - provider: GitHub +# description: 'input-sdk windows release' +# auth_token: +# secure: gqLWRiVUFKd+MsoevoouKEHG0tpvM9zhhSnCpzj9lRg4vcGq+ssWIG2m7kCbgLAC +# artifact: input-sdk-win-x86_64 +# draft: false +# prerelease: false +# on: +# branch: master +# APPVEYOR_REPO_TAG: true diff --git a/win/distribute.cmd b/win/distribute.cmd index 6ae13bb4..7f31bc2e 100755 --- a/win/distribute.cmd +++ b/win/distribute.cmd @@ -7,7 +7,7 @@ set STAGE_PATH=%ROOT_DIR%\stage set BUILD_PATH=%ROOT_DIR%\build set REPO_PATH=%ROOT_DIR%\repo set DOWNLOAD_PATH=%ROOT_DIR%\download -set RESULT_FILE=%ROOT_DIR%\..\input-sdk-win-x86_64.zip +set RESULT_FILE=%ROOT_DIR%\input-sdk-win-x86_64.zip set OSGEO4W_ROOT=%REPO_PATH%\OSGeo4W64 if not exist %ROOT_DIR% mkdir %ROOT_DIR%