Fix VS2017 build issues and add Appveyor CI script (#118)

This commit is contained in:
Dso Tsin 2018-11-13 12:33:01 +08:00 committed by Fangrui Song
parent 63a510ac21
commit 77bec58a62
3 changed files with 30 additions and 6 deletions

22
.appveyor.yml Normal file
View File

@ -0,0 +1,22 @@
version: "{build}"
os: Visual Studio 2017
platform:
- x64
build:
parallel: true # enable MSBuild parallel builds
verbosity: minimal
install:
- if not exist llvm.tar.xz appveyor DownloadFile "https://ziglang.org/deps/llvm+clang-7.0.0-win64-msvc-release.tar.xz" -FileName llvm.tar.xz
- 7z e -txz llvm.tar.xz
- 7z x llvm.tar
- git submodule update --init --recursive
build_script:
- cmake -G"Visual Studio 15 2017 Win64" -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DSYSTEM_CLANG=ON -DCLANG_ROOT=C:\projects\ccls\llvm+clang-7.0.0-win64-msvc-release
- cmake --build build --target ccls --config Release
artifacts:
- path: build\Release

View File

@ -50,16 +50,17 @@ if(MSVC)
/EHsc /EHsc
/D_CRT_SECURE_NO_WARNINGS # don't try to use MSVC std replacements /D_CRT_SECURE_NO_WARNINGS # don't try to use MSVC std replacements
/W3 # roughly -Wall /W3 # roughly -Wall
/wd4996 # disable loguru unsafe warnings /wd4996 # ignore deprecated declaration
/wd4722 # ignores warning C4722
# (destructor never returns) in loguru
/wd4267 # ignores warning C4267 /wd4267 # ignores warning C4267
# (conversion from 'size_t' to 'type'), # (conversion from 'size_t' to 'type'),
# roughly -Wno-sign-compare # roughly -Wno-sign-compare
/wd4800 /wd4800
/wd4068 # Disable unknown pragma warning /wd4068 # Disable unknown pragma warning
/std:c++17
$<$<CONFIG:Debug>:/FS> $<$<CONFIG:Debug>:/FS>
) )
# relink system libs
target_link_libraries(ccls PRIVATE Mincore.lib)
else() else()
# Common GCC/Clang(Linux) options # Common GCC/Clang(Linux) options
target_compile_options(ccls PRIVATE target_compile_options(ccls PRIVATE

View File

@ -143,9 +143,10 @@ if(Clang_FOUND AND NOT TARGET Clang::Clang)
set_target_properties(Clang::Clang PROPERTIES set_target_properties(Clang::Clang PROPERTIES
IMPORTED_LOCATION ${Clang_LIBRARY} IMPORTED_LOCATION ${Clang_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES "${Clang_INCLUDE_DIR};${Clang_BUILD_INCLUDE_DIR};${LLVM_INCLUDE_DIR};${LLVM_BUILD_INCLUDE_DIR}") INTERFACE_INCLUDE_DIRECTORIES "${Clang_INCLUDE_DIR};${Clang_BUILD_INCLUDE_DIR};${LLVM_INCLUDE_DIR};${LLVM_BUILD_INCLUDE_DIR}")
if(NOT MSVC)
find_package(Curses REQUIRED) find_package(Curses REQUIRED)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
endif()
set_property(TARGET Clang::Clang PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES "${_Clang_LIBRARIES};${CURSES_LIBRARIES};${ZLIB_LIBRARIES}") set_property(TARGET Clang::Clang PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES "${_Clang_LIBRARIES};${CURSES_LIBRARIES};${ZLIB_LIBRARIES}")
if(MINGW) if(MINGW)
set_property(TARGET Clang::Clang APPEND_STRING PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ";version") set_property(TARGET Clang::Clang APPEND_STRING PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ";version")