diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d8fd1da37..598817a45 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -3,62 +3,59 @@ name: Build for Windows on: push: branches-ignore: - - '**' + - 'gh-pages' + +env: + postgis_version: 3 jobs: build: name: Build - runs-on: ${{ matrix.os }} + runs-on: windows-latest strategy: - matrix: - psql: [10] - os: [windows-latest] + matrix: + pg_major: [11.13, 12.8, 13.4] steps: - # - name: Add PostgreSQL APT repository - # run: | - # sudo apt-get install curl ca-certificates gnupg - # curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - - # sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ \ - # $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' - - # - name: Install dependencies - # run: | - # sudo apt-get update - # sudo apt-get install -y \ - # libboost-graph-dev \ - # libtap-parser-sourcehandler-pgtap-perl \ - # postgresql-${{ matrix.psql }} \ - # postgresql-${{ matrix.psql }}-pgtap \ - # postgresql-${{ matrix.psql }}-postgis-${{ matrix.postgis }} \ - # postgresql-${{ matrix.psql }}-postgis-${{ matrix.postgis }}-scripts \ - # postgresql-server-dev-${{ matrix.psql }} \ - # python-sphinx - - name: Checkout repository uses: actions/checkout@v2 - # - name: Prepare - # run: | - # sphinx-build --version - # sudo -u postgres psql -p 5432 -c "CREATE EXTENSION postgis" - # export PATH=/usr/lib/postgresql/${{ matrix.psql }}/bin:$PATH - # sudo -u postgres createdb ___vrp___test___ - # sudo -u postgres createdb pgr_test__db__test - - # - name: Configure - # run: | - # mkdir build - # cd build - # cmake -DPOSTGRESQL_VERSION=${{ matrix.psql }} -DCMAKE_BUILD_TYPE=Release -DWITH_DOC=OFF .. - - # - name: Build - # run: | - # cd build - # make - # sudo make install - - # - name: Test - # run: | - # sudo -u postgres bash ./tools/testers/pg_prove_tests.sh postgres 5432 Release + - name: Install boost + uses: MarkusJx/install-boost@v1.0.1 + id: install-boost + with: + # REQUIRED: Specify the required boost version + # A list of supported versions can be found here: + # https://github.com/actions/boost-versions/blob/main/versions-manifest.json + boost_version: 1.73.0 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.3 + + - name: Install PostgreSQL + run: | + curl https://get.enterprisedb.com/postgresql/postgresql-${{ matrix.pg_major }}-1-windows-x64-binaries.zip --output pgsql.zip + Expand-Archive 'pgsql.zip' -Force + $env:path += ";$(Get-Location)\pgsql\pgsql\bin\" + $env:path -split ";" + initdb -D pgsql\data -U postgres + pg_ctl -D pgsql\data start + echo "POSTGRESQL_DIR=$pwd\pgsql\pgsql" >> $env:GITHUB_ENV + + - name: Check Postgres running + run: | + ${{ env.POSTGRESQL_DIR }}\bin\psql -U postgres -d postgres -c "SELECT version()" + + - name: Configure + run: | + mkdir build + cd build + cmake -DPOSTGRESQL_BIN=${{ env.POSTGRESQL_DIR }}\bin -DPOSTGRESQL_INCLUDE_DIR="${{ env.POSTGRESQL_DIR }}\include;${{ env.POSTGRESQL_DIR }}\include\server" -G"Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DWITH_DOC=OFF .. + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + + - name: build + run: | + cd build + msbuild PGROUTING.sln /target:Build /property:Configuration=Release diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 396c8fdcb..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,55 +0,0 @@ -# ------------------------------------------------------------------------------ -# appVeyor script -# Copyright(c) pgRouting Contributors -# -# Main configuration -# ------------------------------------------------------------------------------ - -version: 0.0.{build} - -image: Visual Studio 2019 -configuration: Release -platform: x64 - -clone_depth: 1 -clone_folder: c:\build\vrprouting - -cache: - - downloads -> appveyor.yml - - c:\build\local\msvc160\x64 -> appveyor.yml - -services: - - postgresql101 - -environment: - CONFIGURATION: Release - MSVC_VER: 16.0 - BUILD_ROOT_DIR: c:\build - PGIS_VERSION: 3.1 - PG_VER: 10 - -init: - - git config --global core.autocrlf false - -install: - # Install pgRouting prerequisites: - # cmake - # postGIS - - call ci\appveyor\install.bat - - -build_script: - - cd c:\build\vrprouting\ci\appveyor - - msbuild_pgrouting.bat %PG_VER% - - cd %PGROUTING_BUILD_DIR% - - msbuild PGROUTING.sln /target:Build /property:Configuration=%CONFIGURATION% - - msbuild INSTALL.vcxproj /target:Build /property:Configuration=%CONFIGURATION% - -test_script: - - set PGUSER=postgres - - set PGPASSWORD=Password12! - - set PGHOME=C:\Progra~1\PostgreSQL\%PG_VER% - - set PGPORT=5432 - - set PATH=%PATH%;%PGHOME%\bin - # Execute algorithm test by Cygwin - #- C:\cygwin\bin\bash -lc "cd /cygdrive/c/build/pgrouting && tools/testers/doc_queries_generator.pl -psql \"/cygdrive/c/Progra~1/PostgreSQL/%PG_VER%/bin/psql\"" diff --git a/ci/appveyor/install-boost.bat b/ci/appveyor/install-boost.bat deleted file mode 100644 index 2f9c9782c..000000000 --- a/ci/appveyor/install-boost.bat +++ /dev/null @@ -1,150 +0,0 @@ -@echo off - - -set BOOST_LOCAL_DEBUG=1 -Setlocal EnableDelayedExpansion EnableExtensions - - -if not defined BOOST_VERSION goto _error -if not defined COMMON_INSTALL_DIR goto _error -if not defined MSVC_VER goto _error -if not defined ARCH goto _error -if not defined BUILD_ROOT_DIR goto _error -if not defined CONFIGURATION goto _error - -if defined BOOST_LOCAL_DEBUG ( - echo "install-boost.bat" - echo received environment - echo BOOST_VERSION %BOOST_VERSION% - echo COMMON_INSTALL_DIR %COMMON_INSTALL_DIR% - echo MSVC_VER %MSVC_VER% - echo ARCH %ARCH% - echo BUILD_ROOT_DIR %BUILD_ROOT_DIR% - echo CONFIGURATION %CONFIGURATION% -) -:: create a download & install directories: -mkdir %APPVEYOR_BUILD_FOLDER%\downloads 2>NUL -mkdir %COMMON_INSTALL_DIR% 2>NUL -if defined BOOST_LOCAL_DEBUG dir %DOWNLOADS_DIR% -if defined BOOST_LOCAL_DEBUG dir %COMMON_INSTALL_DIR% - -echo ==================================== BOOST - - -:: deducing variables -set BOOST_VER_USC=%BOOST_VERSION:.=_% -set BOOST_SHORT_VER=%BOOST_VER_USC:_0=% - -set BOOST_INSTALL_DIR=%COMMON_INSTALL_DIR% -set BOOST_INCLUDE_DIR=%BOOST_INSTALL_DIR%\include\boost-%BOOST_SHORT_VER% -set BOOST_LIBRARY_DIR=%BOOST_INSTALL_DIR%\lib -set BOOST_THREAD_LIB=%BOOST_INSTALL_DIR%\lib\libboost_thread-vc%MSVC_VER:.=%-mt-%BOOST_SHORT_VER%.lib -set BOOST_SYSTEM_LIB=%BOOST_INSTALL_DIR%\lib\libboost_system-vc%MSVC_VER:.=%-mt-%BOOST_SHORT_VER%.lib -set BOOST_ADDRESS_MODEL=%ARCH% -set BOOST_TOOLSET=msvc-%MSVC_VER% -set BOOST_SRC_DIR=%BUILD_ROOT_DIR%\boost_%BOOST_VER_USC% -set MSBUILD_CONFIGURATION=%CONFIGURATION% - -if defined BOOST_LOCAL_DEBUG ( - echo BOOST_VERSION %BOOST_VERSION% - echo BOOST_VER_USC %BOOST_VER_USC% - echo BOOST_SHORT_VER %BOOST_SHORT_VER% - echo BOOST_INSTALL_DIR %BOOST_INSTALL_DIR% - echo BOOST_INCLUDE_DIR %BOOST_INCLUDE_DIR% - echo BOOST_LIBRARY_DIR %BOOST_LIBRARY_DIR% - echo BOOST_THREAD_LIB %BOOST_THREAD_LIB% - echo BOOST_SYSTEM_LIB %BOOST_SYSTEM_LIB% - echo BOOST_ADDRESS_MODEL %BOOST_ADDRESS_MODEL% - echo BOOST_TOOLSET %BOOST_TOOLSET% -) - -:: check that everything needed from boost is there -set BOOST_INSTALL_FLAG=10 -if not exist %BOOST_INCLUDE_DIR%\ ( set BOOST_INSTALL_FLAG=1 ) -if not exist %BOOST_LIBRARY_DIR%\ ( set BOOST_INSTALL_FLAG=2 ) -if not exist %BOOST_THREAD_LIB% ( set BOOST_INSTALL_FLAG=3 ) -if not exist %BOOST_SYSTEM_LIB% ( set BOOST_INSTALL_FLAG=4 ) - - -if defined BOOST_LOCAL_DEBUG echo BOOST_INSTALL_FLAG %BOOST_INSTALL_FLAG% - - -if not "%BOOST_INSTALL_FLAG%"=="10" ( - - :: download if needed - if not exist %DOWNLOADS_DIR%\boost_%BOOST_VER_USC%.zip ( - echo ***** Downloading Boost %BOOST_VERSION% ... - pushd %DOWNLOADS_DIR% - curl -L -O -S -s http://downloads.sourceforge.net/project/boost/boost/%BOOST_VERSION%/boost_%BOOST_VER_USC%.zip - popd - if not exist %DOWNLOADS_DIR%\boost_%BOOST_VER_USC%.zip ( - echo something went wrong on boost %BOOST_VERSION% download !!!!!!!!! - if defined BOOST_LOCAL_DEBUG dir %DOWNLOADS_DIR% - Exit \B 1 - ) - ) else ( - echo **** Boost_%BOOST_VER_USC% already downloaded - ) - - echo **** Extracting Boost_%BOOST_VERSION%.zip ... - pushd %DOWNLOADS_DIR% - 7z x -o%BUILD_ROOT_DIR%\ boost_%BOOST_VER_USC%.zip - popd - if not exist %BOOST_SRC_DIR% ( - echo something went wrong on boost extraction!!!!!!!!! - if defined BOOST_LOCAL_DEBUG dir %BOOST_SRC_DIR% - Exit \B 1 - ) - - echo **** Executing bootstrap.bat... - if not exist "%BOOST_SRC_DIR%\b2.exe" ( - pushd %BOOST_SRC_DIR% - call "bootstrap.bat" - popd - if not exist "%BOOST_SRC_DIR%\b2.exe" ( - echo something went wrong on booststrap.bat execution!!!!!!!!! - if defined BOOST_LOCAL_DEBUG dir %BOOST_SRC_DIR% - Exit \B 1 - ) - ) - - echo **** Executing %BOOST_SRC_DIR%\b2.exe ... - pushd %BOOST_SRC_DIR% - if defined BOOST_LOCAL_DEBUG @echo on - b2 toolset=%BOOST_TOOLSET% variant=release link=static threading=multi address-model=%BOOST_ADDRESS_MODEL% ^ - --with-thread --with-system --prefix=%BOOST_INSTALL_DIR% -d0 install - if defined BOOST_LOCAL_DEBUG @echo off - popd -) else ( - echo Boost_%BOOST_VERSION% already installed -) - -echo ------------------------------ -echo Environment variables set: - -echo BOOST_INCLUDE_DIR %BOOST_INCLUDE_DIR% -echo BOOST_LIBRARY_DIR %BOOST_LIBRARY_DIR% -echo BOOST_THREAD_LIB %BOOST_THREAD_LIB% -echo BOOST_SYSTEM_LIB %BOOST_SYSTEM_LIB% -echo ====================================================== - - -endlocal & ( - set BOOST_INCLUDE_DIR=%BOOST_INCLUDE_DIR% - set BOOST_LIBRARY_DIR=%BOOST_LIBRARY_DIR% - set BOOST_THREAD_LIB=%BOOST_THREAD_LIB% - set BOOST_SYSTEM_LIB=%BOOST_SYSTEM_LIB% -) - -goto :eof - -:_error -echo an environment variable is missing: -echo -- BOOST_VERSION -echo -- COMMON_INSTALL_DIR -echo -- MSVC_VER -echo -- ARCH -echo -- BUILD_ROOT_DIR -echo -- CONFIGURATION -echo -- BOOST_LOCAL_DEBUG (if defined will print debug information) - diff --git a/ci/appveyor/install.bat b/ci/appveyor/install.bat deleted file mode 100644 index ec448b70b..000000000 --- a/ci/appveyor/install.bat +++ /dev/null @@ -1,184 +0,0 @@ -@echo off - -::set LOCAL_DEBUG=1 - -Setlocal EnableDelayedExpansion EnableExtensions - -if defined LOCAL_DEBUG echo APPVEYOR_BUILD_FOLDER %APPVEYOR_BUILD_FOLDER% -echo platform %platform% - -:: ========================================================= -:: Set some defaults. Infer some variables. -:: - -if not defined MSVC_VER set MSVC_VER=18.0 -if not defined RUNTIME set RUNTIME=msvc%MSVC_VER:.=% -if not defined MSVC_YEAR set MSVC_YEAR=2019 -if not defined BUILD_ROOT_DIR set BUILD_ROOT_DIR=c:\build -if not defined DOWNLOADS_DIR set DOWNLOADS_DIR=%APPVEYOR_BUILD_FOLDER%\downloads -if not defined COMMON_INSTALL_DIR set COMMON_INSTALL_DIR=%BUILD_ROOT_DIR%\local\%RUNTIME%\%PLATFORM% - -:: for cmake its the min version -if not defined CMAKE_VERSION set CMAKE_VERSION=3.12.2 -if not defined PGIS_VERSION set PGIS_VERSION=3.1 -if not defined BOOST_VERSION set BOOST_VERSION=1.65.1 -set PG_VER_NO_DOT=pg%PG_VER:.=% - - -set CMAKE_GENERATOR=Visual Studio %MSVC_VER:.0=% %MSVC_YEAR% - -:: Determine if arch is 32/64 bits -if /I "%platform%"=="x86" (set arch=32) else (set arch=64) - -:: Determine compiler used to build postgis -if "%arch%"=="64" (set GCC=81) else (set GCC=481) - - -:: -:: ========================================================= - -:: create a download directory: -pushd %APPVEYOR_BUILD_FOLDER% -mkdir downloads 2>NUL -popd -mkdir %COMMON_INSTALL_DIR% 2>NUL -if defined LOCAL_DEBUG dir %DOWNLOADS_DIR% -if defined LOCAL_DEBUG dir %COMMON_INSTALL_DIR% - - -:: ========================================================= -:: Download and install cmake -:: - -echo ==================================== CMAKE -for /f "tokens=* delims=" %%a in ('cmake --version') do ( - set CURR_CMAKE=%%a& goto _ExitForLoop1 -) -:_ExitForLoop1 -set CURR_CMAKE=%CURR_CMAKE:~14% -echo cmake %CURR_CMAKE% found - -CALL ci\appveyor\vercompare.bat "%CURR_CMAKE%" "%CMAKE_VERSION%" - -echo "errorlevel %ERRORLEVEL%" - -if %ERRORLEVEL% EQU 0 ( - echo cmake %CURR_CMAKE% already installed -) else ( - CALL SET - echo Downloading cmake %CMAKE_VERSION% - pushd %DOWNLOADS_DIR% - curl -L -O -S -s https://cmake.org/files/v3.5/cmake-%CMAKE_VERSION%-win32-%platform%.msi - popd - - echo Installing cmake %CMAKE_VERSION% - pushd %DOWNLOADS_DIR% - start /wait msiexec /i cmake-%CMAKE_VERSION%-win32-%platform%.msi /qn - popd - - for /f "tokens=* delims=" %%a in ('cmake --version') do ( - set CURR_CMAKE=%%a& goto _ExitForLoop2 - ) - :_ExitForLoop2 - set CURR_CMAKE=%CURR_CMAKE:~14% - if "%CURR_CMAKE%" == "%CMAKE_VERSION%" ( - echo cmake %CMAKE_VERSION% installed - ) else ( - echo something went wrong on cmake installation!!!!!!!!! - Exit \B 1 - ) -) -echo ==================================== - -:: -:: ========================================================= - - - -:: ========================================================= -:: Download and install Postgis -:: - -set PGIS_WILD_FILE=postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%* -set PGIS_FILE=postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%devw%arch%gcc%GCC%.zip - -echo %PGIS_WILD_FILE% -echo %PGIS_FILE% - -pushd %DOWNLOADS_DIR% -echo cleaning download -del * /F /Q -dir -popd - -echo ==================================== POSTGIS -if not exist "C:\Progra~1\PostgreSQL\%PG_VER%\%PGIS_WILD_FILE%" ( - cd %APPVEYOR_BUILD_FOLDER% - if not exist %DOWNLOADS_DIR%\postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%w%arch%gcc%GCC%.zip ( - echo Downloading PostGIS %PGIS_VERSION% - pushd %DOWNLOADS_DIR% - echo downloading postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%w%arch%gcc%GCC%.zip - curl -L -O -S http://winnie.postgis.net/download/windows/appveyor/postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%w%arch%gcc%GCC%.zip - popd - if not exist %DOWNLOADS_DIR%\postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%w%arch%gcc%GCC%.zip ( - echo something went wrong on PostGIS %PGIS_VERSION% download !!!!!!!!! - if defined LOCAL_DEBUG dir %DOWNLOADS_DIR% - Exit \B 1 - ) - ) - - echo Extracting PostGIS %PGIS_VERSION% - pushd %DOWNLOADS_DIR% - dir - 7z x -o%BUILD_ROOT_DIR%\ postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%w%arch%gcc%GCC%.zip - dir - popd - - echo **** Installing postGIS %PGIS_VERSION% - dir %BUILD_ROOT_DIR%\postgis* - dir C:\Progra~1\PostgreSQL\%PG_VER%\postgis* - xcopy /e /y /q %BUILD_ROOT_DIR%\postgis-%PG_VER_NO_DOT%-binaries-%PGIS_VERSION%*w%arch%gcc%GCC% C:\Progra~1\PostgreSQL\%PG_VER% - dir C:\Progra~1\PostgreSQL\%PG_VER%\postgis* - echo looking for %PGIS_WILD_FILE% in this list - dir %BUILD_ROOT_DIR%\postgis* - - if not exist "C:\Progra~1\PostgreSQL\%PG_VER%\%PGIS_WILD_FILE%" ( - echo something went wrong on PostGIS %PGIS_VERSION% installation - dir %DOWNLOADS_DIR% - dir C:\Progra~1\PostgreSQL\%PG_VER%\postgis* - ) else ( - echo **** PostGIS %PGIS_VERSION% %arch% installed - ) -) else ( - echo PostGIS %PGIS_VERSION% %arch% already installed -) -echo ==================================== - - -:: ========================================================= -:: Download and install Boost -:: - -:: set BOOST_LOCAL_DEBUG=1 -call ci/appveyor/install-boost.bat - -echo ====================================================== -echo Installation of Prerequisites done. -echo Environment variables set: - -echo BOOST_THREAD_LIB %BOOST_THREAD_LIB% -echo BOOST_SYSTEM_LIB %BOOST_SYSTEM_LIB% -echo BOOST_INCLUDE_DIR %BOOST_INCLUDE_DIR% -echo CMAKE_GENERATOR %CMAKE_GENERATOR% - -echo ====================================================== -echo. - -endlocal & ( - set BOOST_THREAD_LIB=%BOOST_THREAD_LIB% - set BOOST_SYSTEM_LIB=%BOOST_SYSTEM_LIB% - set BOOST_INCLUDE_DIR=%BOOST_INCLUDE_DIR% - set CMAKE_GENERATOR=%CMAKE_GENERATOR% -) - -goto :eof diff --git a/ci/appveyor/msbuild_pgrouting.bat b/ci/appveyor/msbuild_pgrouting.bat deleted file mode 100644 index 630854df7..000000000 --- a/ci/appveyor/msbuild_pgrouting.bat +++ /dev/null @@ -1,48 +0,0 @@ -@echo off - -set PG_VER=%1 - -echo MSVC_VER %MSVC_VER% -echo BUILD_ROOT_DIR %BUILD_ROOT_DIR% -echo CMAKE_GENERATOR %CMAKE_GENERATOR% -echo BOOST_THREAD_LIB %BOOST_THREAD_LIB% -echo BOOST_SYSTEM_LIB %BOOST_SYSTEM_LIB% -echo BOOST_INCLUDE_DIR %BOOST_INCLUDE_DIR% -echo PLATFORM %PLATFORM% -echo PG_VER %PG_VER% -echo PROGRAMFILES %PROGRAMFILES% - -set POSTGRESQL_DIR=%PROGRAMFILES%\PostgreSQL\%PG_VER% - -set PGROUTING_SRC_DIR=%~dp0..\..\ -echo PGROUTING_SRC_DIR %PGROUTING_SRC_DIR% - -path %PATH%;%PROGRAMFILES% (x86)\CMake\bin - -set PGROUTING_BUILD_DIR=%PGROUTING_SRC_DIR%build\pg%PG_VER:.=%\%PLATFORM% -set PGROUTING_INSTALL_DIR=%PGROUTING_SRC_DIR%lib\pg%PG_VER:.=%\%PLATFORM% - - -echo PGROUTING_BUILD_DIR %PGROUTING_BUILD_DIR% -echo PGROUTING_INSTALL_DIR %PGROUTING_INSTALL_DIR% -echo POSTGRESQL_DIR %POSTGRESQL_DIR% - -rem ### pgRouting ### - -if exist %PGROUTING_BUILD_DIR% ( - rmdir /S /Q %PGROUTING_BUILD_DIR% -) - -mkdir %PGROUTING_BUILD_DIR% -pushd %PGROUTING_BUILD_DIR% -@echo on -cmake -G "%CMAKE_GENERATOR%" -A %PLATFPROM% x64 -DPOSTGRESQL_INCLUDE_DIR:PATH="%POSTGRESQL_DIR%\include;%POSTGRESQL_DIR%\include\server;%POSTGRESQL_DIR%\include\server\port;%POSTGRESQL_DIR%\include\server\port\win32;%POSTGRESQL_DIR%\include\server\port\win32_msvc" ^ - -DPOSTGRESQL_LIBRARIES:FILEPATH="%POSTGRESQL_DIR%\lib\postgres.lib" ^ - -DPOSTGRESQL_EXECUTABLE:FILEPATH="%POSTGRESQL_DIR%\bin\postgres.exe" ^ - -DPOSTGRESQL_PG_CONFIG:FILEPATH="%POSTGRESQL_DIR%\bin\pg_config.exe" ^ - -DBoost_INCLUDE_DIR:PATH=%BOOST_INCLUDE_DIR% ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DBOOST_THREAD_LIBRARIES:FILEPATH="%BOOST_THREAD_LIB%;%BOOST_SYSTEM_LIB%" ..\..\..\ -@echo off -popd - diff --git a/ci/appveyor/vercompare.bat b/ci/appveyor/vercompare.bat deleted file mode 100644 index e21a2562e..000000000 --- a/ci/appveyor/vercompare.bat +++ /dev/null @@ -1,50 +0,0 @@ -@echo off - -:: left: the installed version -:: right: the required min version - -:: return 0 when installed version < required version -:: return 1 when installed version >= required version - -SETLOCAL - - -set left=%1 -set right=%2 - -for /f "tokens=1-3 delims=." %%a in (%left%) do ( - set VersionLeftMajor=%%a - set VersionLeftMinor=%%b - set VersionLeftBuild=%%c -) - - -for /f "delims=. tokens=1,2,3" %%a in ("%right%") do ( - set VersionRightMajor=%%a - set VersionRightMinor=%%b - set VersionRightBuild=%%c -) - - -:: examples -:: 3.2.12 > 2.3.1 ===> 1 installed does fulfill required -if "%VersionLeftMajor%" GTR "%VersionRight.Major%" ( - EXIT /B 0 -) - -:: 1.2.12 > 3.3.1 ===> 0 installed does not fulfill required -if %VersionLeftMajor% LSS %VersionRightMajor% ( - EXIT /B 1 -) - -:: the Major's are equal -:: 3.5.12 >= 3.3.1 ===> 1 installed does fulfill required -if %VersionLeftMinor% GEQ %VersionRightMinor% ( - EXIT /B 0 -) - -:: 3.2.12 > 3.3.1 ===> 0 installed does not fulfill required regardless of build -EXIT /B 1 - -:exit -exit /b