build/msvc: Add Appveyor CI for MSVC

This commit is contained in:
b-r-o-c-k 2018-03-04 17:44:23 -06:00
parent 353ca83f73
commit cfb713b5c6
3 changed files with 40 additions and 25 deletions

View File

@ -1,7 +1,10 @@
version: '{build}' version: '{build}'
environment: environment:
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9" APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9"
image: Visual Studio 2017
configuration: configuration:
- MSVC_64
- MSVC_32
- MINGW_64 - MINGW_64
- MINGW_32 - MINGW_32
- MINGW_64-gcov - MINGW_64-gcov

View File

@ -1,27 +1,33 @@
:: These are native MinGW builds, but they use the toolchain inside
:: MSYS2, this allows using all the dependencies and tools available
:: in MSYS2, but we cannot build inside the MSYS2 shell.
echo on echo on
if "%CONFIGURATION%" == "MINGW_32" ( if "%CONFIGURATION%" == "MINGW_32" (
set ARCH=i686 set ARCH=i686
set BITS=32 set BITS=32
) else ( ) else if "%CONFIGURATION%" == "MINGW_64" (
set ARCH=x86_64 set ARCH=x86_64
set BITS=64 set BITS=64
) ) else if "%CONFIGURATION%" == "MINGW_64-gcov" (
if "%CONFIGURATION%" == "MINGW_64-gcov" (
set USE_GCOV="-DUSE_GCOV=ON" set USE_GCOV="-DUSE_GCOV=ON"
) else if "%CONFIGURATION%" == "MSVC_32" (
set CMAKE_GENERATOR="Visual Studio 15 2017"
) else if "%CONFIGURATION%" == "MSVC_64" (
set CMAKE_GENERATOR="Visual Studio 15 2017 Win64"
) )
:: We cannot have sh.exe in the PATH (MinGW) if "%CONFIGURATION:~0,5%" == "MINGW" (
set PATH=%PATH:C:\Program Files\Git\usr\bin;=% :: These are native MinGW builds, but they use the toolchain inside
set PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH% :: MSYS2, this allows using all the dependencies and tools available
:: The default cpack in the PATH is not CMake :: in MSYS2, but we cannot build inside the MSYS2 shell.
set PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH% set CMAKE_GENERATOR="MinGW Makefiles"
set CMAKE_GENERATOR_ARGS=VERBOSE=1
:: Build third-party dependencies :: Add MinGW to the PATH and remove the Git directory because it
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" || goto :error :: has a conflicting sh.exe
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-diffutils mingw-w64-%ARCH%-unibilium gperf" || goto :error set "PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH:C:\Program Files\Git\usr\bin;=%"
:: Build third-party dependencies
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" || goto :error
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-diffutils mingw-w64-%ARCH%-unibilium gperf" || goto :error
) else if "%CONFIGURATION:~0,4%" == "MSVC" (
set CMAKE_GENERATOR_ARGS=/verbosity:detailed
)
:: Setup python (use AppVeyor system python) :: Setup python (use AppVeyor system python)
C:\Python27\python.exe -m pip install neovim || goto :error C:\Python27\python.exe -m pip install neovim || goto :error
@ -42,19 +48,19 @@ where.exe neovim-node-host.cmd || goto :error
mkdir .deps mkdir .deps
cd .deps cd .deps
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\third-party\ || goto :error cmake -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\third-party\ || goto :error
mingw32-make VERBOSE=1 || goto :error cmake --build . -- %CMAKE_GENERATOR_ARGS% || goto :error
cd .. cd ..
:: Build Neovim :: Build Neovim
mkdir build mkdir build
cd build cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUSTED_OUTPUT_TYPE=nvim %USE_GCOV% -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error cmake -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUSTED_OUTPUT_TYPE=nvim %USE_GCOV% -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error
mingw32-make VERBOSE=1 || goto :error cmake --build . --config RelWithDebInfo -- %CMAKE_GENERATOR_ARGS% || goto :error
bin\nvim --version || goto :error bin\nvim --version || goto :error
:: Functional tests :: Functional tests
mingw32-make functionaltest VERBOSE=1 || goto :error cmake --build . --config RelWithDebInfo --target functionaltest -- %CMAKE_GENERATOR_ARGS% || goto :error
if defined USE_GCOV ( if defined USE_GCOV (
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F functionaltest || echo 'codecov upload failed.'" C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F functionaltest || echo 'codecov upload failed.'"
@ -63,13 +69,15 @@ if defined USE_GCOV (
:: Old tests :: Old tests
setlocal setlocal
set PATH=%PATH%;C:\msys64\usr\bin set PATH=%PATH%;C:\msys64\usr\bin
mingw32-make -C "%~dp0\..\src\nvim\testdir" VERBOSE=1 cmake --build "%~dp0\..\src\nvim\testdir" -- %CMAKE_GENERATOR_ARGS%
endlocal endlocal
if defined USE_GCOV ( if defined USE_GCOV (
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F oldtest || echo 'codecov upload failed.'" C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F oldtest || echo 'codecov upload failed.'"
) )
:: The default cpack in the PATH is not CMake
set PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH%
:: Build artifacts :: Build artifacts
cpack -G ZIP -C RelWithDebInfo cpack -G ZIP -C RelWithDebInfo
if defined APPVEYOR_REPO_TAG_NAME cpack -G NSIS -C RelWithDebInfo if defined APPVEYOR_REPO_TAG_NAME cpack -G NSIS -C RelWithDebInfo

View File

@ -76,15 +76,19 @@ elseif(WIN32 AND MSVC)
endif() endif()
include(TargetArch) include(TargetArch)
if("${TARGET_ARCH}" STREQUAL "X86_64") if(TARGET_ARCH STREQUAL "X86_64")
set(TARGET_ARCH x64) set(TARGET_ARCH x64)
elseif(TARGET_ARCH STREQUAL "X86") elseif(TARGET_ARCH STREQUAL "X86")
set(TARGET_ARCH x86) set(TARGET_ARCH x86)
endif() endif()
string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_BUILD_TYPE) if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(UV_OUTPUT_DIR ${DEPS_BUILD_DIR}/src/libuv/${CMAKE_BUILD_TYPE}) set(TARGET_CONFIG debug)
else()
set(TARGET_CONFIG release)
endif()
set(UV_OUTPUT_DIR ${DEPS_BUILD_DIR}/src/libuv/${TARGET_CONFIG})
BuildLibUv( BuildLibUv(
BUILD_COMMAND set PYTHON=${PYTHON_EXECUTABLE} COMMAND ${DEPS_BUILD_DIR}/src/libuv/vcbuild.bat shared ${LOWERCASE_BUILD_TYPE} ${TARGET_ARCH} BUILD_COMMAND set PYTHON=${PYTHON_EXECUTABLE} COMMAND ${DEPS_BUILD_DIR}/src/libuv/vcbuild.bat shared ${TARGET_CONFIG} ${TARGET_ARCH}
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/lib INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/lib
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/bin COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy ${UV_OUTPUT_DIR}/libuv.lib ${DEPS_INSTALL_DIR}/lib COMMAND ${CMAKE_COMMAND} -E copy ${UV_OUTPUT_DIR}/libuv.lib ${DEPS_INSTALL_DIR}/lib