Add test support for windows MSVC 2015 on appveyor

- build the code with source and execution charset set to utf-8 (required
  for unicode chars in the source code)

- Example/culebra/linenoise.hpp requires being build with UNICODE on windows

  The WIN32 part of that code actually is written against wchar support
  only (e.g. wsprintf, wcstol, ...); but some pieces requires the UNICODE def
  being set explicitely (e.g. GetEnvironmentVariable).

- don't build lint and language subfolders on windows at all (for now)
This commit is contained in:
hvellyr 2016-06-07 10:50:47 +02:00
parent e562f51f63
commit f98f8697c6
6 changed files with 51 additions and 4 deletions

View File

@ -6,7 +6,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(FATAL_ERROR "Need at least gcc 4.9 to compile.") message(FATAL_ERROR "Need at least gcc 4.9 to compile.")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif(MSVC)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
message(FATAL_ERROR "Visual Studio 2015 or newer is required.") message(FATAL_ERROR "Visual Studio 2015 or newer is required.")
endif() endif()
@ -52,7 +52,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
) )
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(warning_options -Wall -Wpedantic -Wextra) set(warning_options -Wall -Wpedantic -Wextra)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif(MSVC)
set(warning_options /W4 /wd4503 /wd4512) set(warning_options /W4 /wd4503 /wd4512)
endif() endif()
@ -60,10 +60,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(add_link_deps pthread) set(add_link_deps pthread)
endif() endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
endif()
enable_testing() enable_testing()
add_subdirectory(lint)
add_subdirectory(test) add_subdirectory(test)
add_subdirectory(example) add_subdirectory(example)
if(NOT MSVC)
add_subdirectory(lint)
add_subdirectory(language/pl0) add_subdirectory(language/pl0)
add_subdirectory(language/culebra) add_subdirectory(language/culebra)
endif()

16
appveyor.yml Normal file
View File

@ -0,0 +1,16 @@
clone_depth: 5
environment:
matrix:
- CMAKE_GENERATOR: "Visual Studio 14 2015"
CONFIGURATION: Release
- CMAKE_GENERATOR: "Visual Studio 14 2015 Win64"
CONFIGURATION: Release
build_script:
- mkdir build && cd build
- cmake .. -Wno-dev -G"%CMAKE_GENERATOR%"
- cmake --build . --config %CONFIGURATION%
test_script:
- ctest -C %CONFIGURATION% -V

View File

@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
include_directories(..) include_directories(..)
add_compile_options(${cxx11_options} ${warning_options})
if(MSVC)
add_compile_options(${cxx11_options} /W3)
else()
add_compile_options(${cxx11_options})
endif()
add_executable(calc calc.cc) add_executable(calc calc.cc)
target_link_libraries(calc ${add_link_deps}) target_link_libraries(calc ${add_link_deps})

View File

@ -1,4 +1,11 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
include_directories(../..) include_directories(../..)
if(MSVC)
add_compile_options(${cxx11_options} /W3)
add_definitions(-DUNICODE)
else()
add_compile_options(${cxx11_options})
endif()
add_executable(culebra main.cc) add_executable(culebra main.cc)

View File

@ -1,4 +1,10 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
include_directories(../..) include_directories(../..)
if(MSVC)
add_compile_options(${cxx11_options} /W0)
else()
add_compile_options(${cxx11_options})
endif()
add_executable(pl0 pl0.cc) add_executable(pl0 pl0.cc)

View File

@ -1,4 +1,10 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
include_directories(..) include_directories(..)
if(MSVC)
add_compile_options(${cxx11_options} /W3)
else()
add_compile_options(${cxx11_options})
endif()
add_executable(peglint peglint.cc server.cc) add_executable(peglint peglint.cc server.cc)