Skip to content

Commit

Permalink
Merge pull request #8 from lutraconsulting/win
Browse files Browse the repository at this point in the history
fix build on win
  • Loading branch information
PeterPetrik authored Nov 15, 2019
2 parents 6429da0 + 1f210f5 commit 02f0a07
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 102 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@ 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`
- optionally upload resulting sdk to common public place

## Hints

Expand Down
31 changes: 16 additions & 15 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
image: Visual Studio 2017

install:
- call .\\win\\distribute.cmd
- call choco install winflexbison3
# - 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
Empty file removed win/config.conf
Empty file.
83 changes: 49 additions & 34 deletions win/distribute.cmd
Original file line number Diff line number Diff line change
@@ -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"
:end
25 changes: 12 additions & 13 deletions win/recipes/geodiff/recipe.bat
Original file line number Diff line number Diff line change
@@ -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%
8 changes: 1 addition & 7 deletions win/recipes/osgeo/recipe.bat
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
46 changes: 17 additions & 29 deletions win/recipes/qgis/recipe.bat
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
@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
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 ^
Expand All @@ -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\

0 comments on commit 02f0a07

Please sign in to comment.