From c84594f620d95b104279a911c0146093f520654c Mon Sep 17 00:00:00 2001 From: qinwf Date: Wed, 27 Apr 2016 14:39:06 +0800 Subject: [PATCH] add Windows CI with MSVC --- appveyor.yml | 32 ++++++++++++++++++++++++++++++++ deps/gtest/CMakeLists.txt | 4 +++- test/unittest/CMakeLists.txt | 6 +++++- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..f6cdfc8 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,32 @@ +os: Visual Studio 2015 + +platform: x64 + +# clone directory +clone_folder: c:\projects\cppjieba + +# scripts to run before build +before_build: + - echo Running cmake... + - cd c:\projects\cppjieba + - cmake . + +build: + project: ALL_BUILD.vcxproj # path to Visual Studio solution or project + +# scripts to run after build +after_build: + - cd Debug + - demo.exe + - load_test.exe + - cd .. + - COPY .\test\Debug\test.run.exe .\test\test.run.exe + - cd test + - test.run.exe + - cd .. + - 7z a c:\projects\all.zip * -tzip + - cd c:\projects + +artifacts: + - path: all.zip + name: all.zip diff --git a/deps/gtest/CMakeLists.txt b/deps/gtest/CMakeLists.txt index ae1ebad..d445929 100644 --- a/deps/gtest/CMakeLists.txt +++ b/deps/gtest/CMakeLists.txt @@ -1,3 +1,5 @@ INCLUDE_DIRECTORIES(./ include) ADD_LIBRARY(gtest STATIC src/gtest-all.cc) -TARGET_LINK_LIBRARIES(gtest pthread) +if(NOT MSVC) + TARGET_LINK_LIBRARIES(gtest pthread) +endif() diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index de3cf04..80c86af 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -15,5 +15,9 @@ ADD_EXECUTABLE(test.run pre_filter_test.cpp unicode_test.cpp ) -TARGET_LINK_LIBRARIES(test.run gtest pthread) +if(MSVC) + TARGET_LINK_LIBRARIES(test.run gtest) +else() + TARGET_LINK_LIBRARIES(test.run gtest pthread) +endif()