Support building with VS 2019 and Travis-CI Windows environment (#217)

1. Build rDSN with VS 2019.
    a. Upgrade cmake to 3.14.1
    b. Still use boost 1.64.0 lib64-msvc-14.1 since there is no pre-built boost libraries for VS 2019 yet.
2. Build rDSN in Travis-CI Windows build environment.
    a. Use "RelWithDebInfo" build type since abort() can "hang" on Windows for "Debug" build. This is because when the program is compiled in debug mode, abort() will pop up a message box displaying options to Abort, Retry, or Ignore. Please refer to https://docs.microsoft.com/en-us/previous-versions/k089yyh0(v=vs.140).
This commit is contained in:
HX Lin 2019-04-08 16:20:07 +08:00 коммит произвёл GitHub
Родитель ba15fea69d
Коммит d1e5fd3cac
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 151 добавлений и 75 удалений

18
.gitignore поставляемый
Просмотреть файл

@ -2,14 +2,32 @@
.arcconfig
.kdev4/
.zk_install/
.vscode/
bin/config.onecluster.ini
bin/Linux/thrift
bin/7z.dll
bin/7z.exe
bin/Windows/7z.dll
bin/Windows/7z.exe
bin/Windows/php.exe
bin/Windows/php.ini
bin/Windows/php5.dll
bin/Windows/ssed.exe
bin/Windows/thrift.exe
zk/
builddbg/
builder/
install/
data/
test_reports/
include/thrift/
ext/boost_1_64_0.7z
ext/boost_1_64_0/
ext/cmake-3.14.1.7z
ext/cmake-3.14.1/
rdsn.github.config
rdsn.github.creator
rdsn.github.creator.user*

Просмотреть файл

@ -1,30 +1,39 @@
sudo: required
dist: xenial
language: cpp
os: linux
compiler:
- gcc
before_install:
- sudo apt-get install -y wget build-essential cmake mono-xbuild php-cli libaio-dev
matrix:
include:
- os: windows
install:
- choco install jdk8 -params "source=false"
script:
- export PATH="/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin":"c/ProgramData/chocolatey/bin":$PATH
- export DSN_AUTO_TEST=1
- export DSN_TRAVIS=1
- git config --global user.name "travis"
- git config --global user.email ""
- ./run.cmd setup-env
- ./run.cmd build RelWithDebInfo builder build_plugins
- ./run.cmd install RelWithDebInfo builder
- ./run.cmd start_zk
- ./run.cmd test RelWithDebInfo builder
- ./run.cmd stop_zk
- os: linux
sudo: required
dist: xenial
before_install:
- sudo apt-get install -y wget mono-xbuild libaio-dev
- sudo apt-get install -y --no-install-recommends libboost-all-dev
install:
script:
- ./run.sh format
before_script:
- ./run.sh start_zk
- ulimit -c unlimited -S
script:
- this_path=`readlink -f $0`
- export DSN_ROOT=`dirname $this_path`
- ./run.sh build --build_plugins
- ./run.sh install
- ./run.sh start_zk
- ./run.sh test
- ./run.sh stop_zk
notifications:
email: false

Просмотреть файл

@ -125,7 +125,7 @@ then
then
wget http://git.n.xiaomi.com/pegasus/packages/raw/master/rdsn/thrift
else
wget --no-check-certificate https://github.com/imzhenyu/thrift/raw/master/pre-built/ubuntu14.04/thrift
wget --no-check-certificate -nv https://github.com/imzhenyu/thrift/raw/master/pre-built/ubuntu14.04/thrift
fi
chmod u+x thrift
mv thrift $TOP_DIR/bin/Linux

Просмотреть файл

@ -40,7 +40,7 @@ then
then
wget http://git.n.xiaomi.com/pegasus/packages/raw/master/rdsn/thrift
else
wget --no-check-certificate https://github.com/imzhenyu/thrift/raw/master/pre-built/ubuntu14.04/thrift
wget --no-check-certificate -nv https://github.com/imzhenyu/thrift/raw/master/pre-built/ubuntu14.04/thrift
fi
chmod u+x thrift
mv thrift $TOP_DIR/bin/Linux

Просмотреть файл

@ -18,21 +18,21 @@ IF "%3" EQU "build_plugins" (
popd
)
CALL "%bin_dir%\pre-require.cmd"
IF ERRORLEVEL 1 (
GOTO exit
)
IF "%build_type%" EQU "" SET build_type=Debug
IF "%build_dir%" EQU "" (
CALL "%bin_dir%\echoc.exe" 4 please specify build_dir
GOTO error_usage
)
CALL "%bin_dir%\pre-require.cmd"
IF ERRORLEVEL 1 (
GOTO error
)
:: detect VS
SET DSN_TMP_CMAKE_VERSION=3.9.0
SET DSN_TMP_BOOST_VERSION=1_64_0
IF DEFINED DSN_TRAVIS GOTO find_vs2017
IF "%VisualStudioVersion%"=="16.0" GOTO find_vs2019
IF "%VisualStudioVersion%"=="15.0" GOTO find_vs2017
IF "%VisualStudioVersion%"=="14.0" GOTO find_vs2015
SET DSN_TMP_VS_INSTALL_DIR=
@ -54,47 +54,66 @@ IF NOT "%VS140COMNTOOLS%"=="" (
)
)
CALL "%bin_dir%\echoc.exe" 4 "Visusal Studio 2015 or 2017 is not found, please run 'x64 Native Tools Command Prompt' and try later"
GOTO exit
CALL "%bin_dir%\echoc.exe" 4 "Visusal Studio 2015, 2017 or 2019 is not found, please run 'x64 Native Tools Command Prompt' and try later"
GOTO error
:find_vs2019
CALL "%bin_dir%\echoc.exe" 2 "Find Visusal Studio 2019."
SET DSN_TMP_BOOST_LIB=lib64-msvc-14.1
SET DSN_TMP_CMAKE_TARGET=Visual Studio 16 2019
GOTO start_build
:find_vs2017
CALL "%bin_dir%\echoc.exe" 2 "Find Visusal Studio 2017."
SET DSN_TMP_BOOST_LIB=lib64-msvc-14.1
SET DSN_TMP_CMAKE_TARGET=Visual Studio 15 2017 Win64
SET DSN_TMP_CMAKE_TARGET=Visual Studio 15 2017
GOTO start_build
:find_vs2015
CALL "%bin_dir%\echoc.exe" 2 "Find Visusal Studio 2015."
SET DSN_TMP_BOOST_LIB=lib64-msvc-14.0
SET DSN_TMP_CMAKE_TARGET=Visual Studio 14 2015 Win64
SET DSN_TMP_CMAKE_TARGET=Visual Studio 14 2015
GOTO start_build
:start_build
IF NOT EXIST "%build_dir%" mkdir "%build_dir%"
pushd "%build_dir%"
PUSHD "%build_dir%"
:: call cmake
echo CALL "%TOP_DIR%\ext\cmake-%DSN_TMP_CMAKE_VERSION%\bin\cmake.exe" "%cdir%" %buildall% -DCMAKE_INSTALL_PREFIX="%build_dir%\output" -DCMAKE_BUILD_TYPE="%build_type%" -DBOOST_INCLUDEDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%" -DBOOST_LIBRARYDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%\%DSN_TMP_BOOST_LIB%" -DDSN_GIT_SOURCE="github" -G "%DSN_TMP_CMAKE_TARGET%"
CALL "%TOP_DIR%\ext\cmake-%DSN_TMP_CMAKE_VERSION%\bin\cmake.exe" "%cdir%" %buildall% -DCMAKE_INSTALL_PREFIX="%build_dir%\output" -DCMAKE_BUILD_TYPE="%build_type%" -DBOOST_INCLUDEDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%" -DBOOST_LIBRARYDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%\%DSN_TMP_BOOST_LIB%" -DDSN_GIT_SOURCE="github" -G "%DSN_TMP_CMAKE_TARGET%"
echo CALL "%TOP_DIR%\ext\cmake-%DSN_TMP_CMAKE_VERSION%\bin\cmake.exe" "%cdir%" %buildall% -DCMAKE_INSTALL_PREFIX="%build_dir%\output" -DCMAKE_BUILD_TYPE="%build_type%" -DBOOST_INCLUDEDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%" -DBOOST_LIBRARYDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%\%DSN_TMP_BOOST_LIB%" -DDSN_GIT_SOURCE="github" -A x64 -G "%DSN_TMP_CMAKE_TARGET%"
CALL "%TOP_DIR%\ext\cmake-%DSN_TMP_CMAKE_VERSION%\bin\cmake.exe" "%cdir%" %buildall% -DCMAKE_INSTALL_PREFIX="%build_dir%\output" -DCMAKE_BUILD_TYPE="%build_type%" -DBOOST_INCLUDEDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%" -DBOOST_LIBRARYDIR="%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%\%DSN_TMP_BOOST_LIB%" -DDSN_GIT_SOURCE="github" -A x64 -G "%DSN_TMP_CMAKE_TARGET%"
IF ERRORLEVEL 1 (
SET DSN_TMP_CMAKE_TARGET=
SET DSN_TMP_BOOST_LIB=
CALL "%bin_dir%\echoc.exe" 4 "cmake error!"
POPD
GOTO error
)
:: clean temp environment variables
SET DSN_TMP_CMAKE_VERSION=
SET DSN_TMP_BOOST_VERSION=
SET DSN_TMP_BOOST_LIB=
SET DSN_TMP_CMAKE_TARGET=
SET DSN_TMP_BOOST_LIB=
FOR /F "delims=" %%i IN ('dir /b *.sln') DO set solution_name=%%i
msbuild %solution_name% /p:Configuration=%build_type% /m
IF ERRORLEVEL 1 (
CALL "%bin_dir%\echoc.exe" 4 "msbuild building error!"
POPD
GOTO error
)
msbuild INSTALL.vcxproj /p:Configuration=%build_type% /m
IF ERRORLEVEL 1 (
CALL "%bin_dir%\echoc.exe" 4 "msbuild installing error!"
POPD
GOTO error
)
popd
goto exit
POPD
EXIT /B 0
:error
:error_usage
CALL "%bin_dir%\echoc.exe" 4 "Usage: run.cmd build build_type(Debug|Release|RelWithDebInfo|MinSizeRel) build_dir [build_plugins]"
exit /B 1
:exit
exit /B 0
:error
EXIT /B 1

Просмотреть файл

@ -8,6 +8,7 @@ SET TOP_DIR=%CD%
POPD
:: detect VS
IF "%VisualStudioVersion%"=="16.0" GOTO find_vs
IF "%VisualStudioVersion%"=="15.0" GOTO find_vs
IF "%VisualStudioVersion%"=="14.0" GOTO find_vs
SET DSN_TMP_VS_INSTALL_DIR=
@ -20,49 +21,58 @@ IF DEFINED DSN_TMP_VS_INSTALL_DIR (
)
IF NOT "%VS140COMNTOOLS%"=="" GOTO find_vs
CALL "%bin_dir%\echoc.exe" 4 "Visusal Studio 2015 or 2017 is not found, please run 'x64 Native Tools Command Prompt' and try later"
CALL "%bin_dir%\echoc.exe" 4 "Visusal Studio 2015, 2017 or 2019 is not found, please run 'x64 Native Tools Command Prompt' and try later"
SET DSN_TMP_VS_INSTALL_DIR=
exit /B 1
:find_vs
IF NOT EXIST "%bin_dir%\ssed.exe" (
CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/ssed.exe -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/ssed.exe -P "%bin_dir%"
)
IF NOT EXIST "%bin_dir%\thrift.exe" (
CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/thrift/master/pre-built/windows8.1/thrift.exe -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/thrift/master/pre-built/windows8.1/thrift.exe -P "%bin_dir%"
)
IF NOT EXIST "%bin_dir%\7z.exe" (
CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/7z.dll -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/7z.exe -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/7z.dll -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/7z.exe -P "%bin_dir%"
@copy /y "%bin_dir%\7z.dll" "%bin_dir%\..\"
@copy /y "%bin_dir%\7z.exe" "%bin_dir%\..\"
)
IF NOT EXIST "%bin_dir%\php.exe" (
CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/php5.dll -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/php.exe -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/php.ini -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/php5.dll -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/php.exe -P "%bin_dir%"
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/php.ini -P "%bin_dir%"
)
SET DSN_TMP_BOOST_VERSION=1_64_0
SET DSN_TMP_BOOST_PACKAGE_NAME=boost_%DSN_TMP_BOOST_VERSION%.7z
IF NOT EXIST "%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%" (
IF NOT EXIST "%TOP_DIR%\ext\%DSN_TMP_BOOST_PACKAGE_NAME%" CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/%DSN_TMP_BOOST_PACKAGE_NAME% -P "%TOP_DIR%\ext"
IF NOT EXIST "%TOP_DIR%\ext\%DSN_TMP_BOOST_PACKAGE_NAME%" CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/%DSN_TMP_BOOST_PACKAGE_NAME% -P "%TOP_DIR%\ext"
CALL "%bin_dir%\echoc.exe" 2 "Decompressing Boost %DSN_TMP_BOOST_VERSION% to \"%TOP_DIR%\ext\""
CALL "%bin_dir%\7z.exe" x "%TOP_DIR%\ext\%DSN_TMP_BOOST_PACKAGE_NAME%" -y -o"%TOP_DIR%\ext" > nul
)
SET DSN_TMP_BOOST_VERSION=
SET DSN_TMP_BOOST_PACKAGE_NAME=
IF NOT EXIST "%TOP_DIR%\ext\boost_%DSN_TMP_BOOST_VERSION%" (
CALL "%bin_dir%\echoc.exe" 4 "Boost does not exist!"
GOTO error
)
SET DSN_TMP_CMAKE_VERSION=3.9.0
SET DSN_TMP_CMAKE_PACKAGE_NAME=cmake-%DSN_TMP_CMAKE_VERSION%.7z
IF NOT EXIST "%TOP_DIR%\ext\cmake-%DSN_TMP_CMAKE_VERSION%" (
IF NOT EXIST "%TOP_DIR%\ext\%DSN_TMP_CMAKE_PACKAGE_NAME%" CALL "%bin_dir%\wget.exe" --no-check-certificate https://raw.githubusercontent.com/imzhenyu/packages/master/windows/%DSN_TMP_CMAKE_PACKAGE_NAME% -P "%TOP_DIR%\ext"
IF NOT EXIST "%TOP_DIR%\ext\%DSN_TMP_CMAKE_PACKAGE_NAME%" CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% https://raw.githubusercontent.com/imzhenyu/packages/master/windows/%DSN_TMP_CMAKE_PACKAGE_NAME% -P "%TOP_DIR%\ext"
CALL "%bin_dir%\echoc.exe" 2 "Decompressing cmake %DSN_TMP_CMAKE_VERSION% to \"%TOP_DIR%\ext\""
CALL "%bin_dir%\7z.exe" x "%TOP_DIR%\ext\%DSN_TMP_CMAKE_PACKAGE_NAME%" -y -o"%TOP_DIR%\ext" > nul
)
SET DSN_TMP_CMAKE_VERSION=
SET DSN_TMP_CMAKE_PACKAGE_NAME=
IF NOT EXIST "%TOP_DIR%\ext\cmake-%DSN_TMP_CMAKE_VERSION%" (
CALL "%bin_dir%\echoc.exe" 4 "cmake does not exist!"
GOTO error
)
exit /B 0
:error
exit /B 1

Просмотреть файл

@ -8,6 +8,7 @@ POPD
SET INSTALL_DIR=%~f1
SET PORT=%2
SET zk=zookeeper-3.4.6
SET DSN_TMP_ZOOKEEPER_URL=https://archive.apache.org/dist/zookeeper/%zk%/%zk%.tar.gz
IF "%INSTALL_DIR%" EQU "" (
set INSTALL_DIR=%TOP_DIR%\zk
@ -18,17 +19,20 @@ IF "%PORT%" EQU "" (
)
CALL "%bin_dir%\pre-require.cmd"
IF ERRORLEVEL 1 (
GOTO error
)
IF NOT EXIST "%INSTALL_DIR%" mkdir "%INSTALL_DIR%"
PUSHD "%INSTALL_DIR%"
IF NOT EXIST "%INSTALL_DIR%\%zk%" (
CALL "%bin_dir%\wget.exe" --no-check-certificate https://github.com/shengofsun/packages/raw/master/%zk%.tar.gz?raw=true
CALL "%bin_dir%\wget.exe" %DSN_TMP_WGET_OPT% %DSN_TMP_ZOOKEEPER_URL%
IF NOT EXIST %zk%.tar.gz (
CALL "%bin_dir%\echoc.exe" 4 download zookeeper package failed from https://github.com/shengofsun/packages/raw/master/%zk%.tar.gz?raw=true
CALL "%bin_dir%\echoc.exe" 4 download zookeeper package failed from %DSN_TMP_ZOOKEEPER_URL%
POPD
EXIT /B 1
GOTO error
)
CALL "%bin_dir%\echoc.exe" 2 "Decompressing %zk% to \"%INSTALL_DIR%\""
@ -57,17 +61,20 @@ IF NOT EXIST "%ZOOKEEPER_HOME%\data" @mkdir "%ZOOKEEPER_HOME%\data"
REM powershell -command "Start-Process %ZOOKEEPER_HOME%\bin\zkServer.cmd"
powershell -command "Start-Process -FilePath cmd.exe -ArgumentList '/C title zk-%PORT%-%ZOOKEEPER_HOME%\bin\zkServer.cmd&&\"%ZOOKEEPER_HOME%\bin\zkServer.cmd\"'"
IF ERRORLEVEL 1 (
POPD
GOTO error
)
REM CALL start cmd.exe /k "title zk-%PORT%&& %ZOOKEEPER_HOME%\bin\zkServer.cmd"
POPD
GOTO exit
EXIT /B 0
:usage
ECHO run.cmd start_zk [INSTALL_DIR = .\zk [PORT = 12181]]
GOTO:EOF
:exit
EXIT /B 0
:error
exit /B 1

Двоичные данные
bin/Windows/vswhere.exe

Двоичный файл не отображается.

Просмотреть файл

@ -19,7 +19,7 @@ GOTO copy_latest
SET ltime=
IF EXIST "%PROJ_LIB_DIR%\%lconfig%" (
ECHO CHECK dir "%PROJ_LIB_DIR%\%lconfig%" ...
FOR /f "tokens=1,2,3" %%i IN ('dir /o:d /TW "%PROJ_LIB_DIR%\%lconfig%" ^| find "/"' ) DO (
FOR /f "tokens=1,2,3" %%i IN ('dir /o:d /TW "%PROJ_LIB_DIR%\%lconfig%" ^| %SystemRoot%\System32\find.exe "/"' ) DO (
SET valid_k=0
if "%%k" EQU "AM" SET valid_k=1
if "%%k" EQU "PM" SET valid_k=1

Просмотреть файл

@ -5,7 +5,7 @@ PUSHD "%TOP_DIR%"
SET TOP_DIR=%CD%
POPD
SET bin_dir=%TOP_DIR%\bin\windows
SET bin_dir=%TOP_DIR%\bin\Windows
SET old_dsn_root=%DSN_ROOT%
IF "%1" EQU "" GOTO usage
IF "%1" NEQ "setup-env" IF "%DSN_ROOT%" NEQ "" GOTO main
@ -48,14 +48,27 @@ CALL "%bin_dir%\echoc.exe" 2 DSN_ROOT ("%DSN_ROOT%") is setup, and rDSN SDK will
CALL "%bin_dir%\echoc.exe" 2 DSN_ROOT\lib and DSN_ROOT\bin are added to PATH env.
:main
SET DSN_TMP_CMAKE_VERSION=3.14.1
SET DSN_TMP_BOOST_VERSION=1_64_0
SET DSN_TMP_WGET_OPT=--no-check-certificate -nv
CALL :%1 %1 %2 %3 %4 %5 %6 %7 %8 %9
IF ERRORLEVEL 1 (
CALL "%bin_dir%\echoc.exe" 4 unknown command '%1'
SET DSN_TMP_CMAKE_VERSION=
SET DSN_TMP_BOOST_VERSION=
SET DSN_TMP_WGET_OPT=
CALL "%bin_dir%\echoc.exe" 4 command '%1' fails or is unknown.
CALL :usage
exit /B 1
)
SET DSN_TMP_CMAKE_VERSION=
SET DSN_TMP_BOOST_VERSION=
SET DSN_TMP_WGET_OPT=
exit /B 0
:pre-require