From 73bd63bfa94ebd7d38cdfdf422833c96415a3501 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Wed, 12 Aug 2020 10:37:49 +0200 Subject: [PATCH] Enable Windows CI --- .appveyor.yml | 45 +++++++++++++++++++++++++++++++++ CMakeLists.txt | 6 +++-- src/xeus_sqlite_interpreter.cpp | 15 ++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..7d0de09 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,45 @@ +build: false + +platform: + - x64 + +image: + - Visual Studio 2017 + # TODO: enable VS2015 when tabulate can use its std::optional polyfill + # - Visual Studio 2015 + +environment: + matrix: + - MINICONDA: C:\\xeus-conda + +init: + - "ECHO %MINICONDA%" + - if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" set VCVARPATH="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" + - if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" set VCARGUMENT=%PLATFORM% + - if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2017" set VCVARPATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" + - echo "%VCVARPATH% %VCARGUMENT%" + - "%VCVARPATH% %VCARGUMENT%" + - ps: Start-FileDownload 'http://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe' C:\Miniconda.exe + - cmd: C:\Miniconda.exe /S /D=C:\xeus-conda + - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%MINICONDA%\\Library\\bin;%PATH%" + +install: + - conda config --set always_yes yes --set changeps1 no + - conda update -q conda + - conda info -a + # Host dependencies + - conda install xeus xtl nlohmann_json cppzmq sqlite sqlitecpp cpp-tabulate=1.3 xvega xproperty -c conda-forge + # Build dependencies + - conda install cmake -c conda-forge + # Build and install xeus-python + - mkdir build + - cd build + - cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=%MINICONDA%\\Library -D XSQL_DOWNLOAD_GTEST=ON .. + - nmake + - nmake install + # Install test dependencies + - conda install pytest jupyter_kernel_test -c conda-forge + +build_script: + - cd test + - test_xeus_sqlite diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c1d12a..767d7db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,6 @@ project(xeus-sqlite) set(XEUS_SQLITE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) set(XEUS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) - set(CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH}) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) @@ -83,6 +82,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" else() message(FATAL_ERROR "Unsupported compiler -- xeus-sqlite requires C++17 support!") endif() +elseif (MSVC) + # std::optional used by cpp-tabulate + # TODO: drop c++17 when tabulate can fall back to the std::optional polyfill + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") endif() # Target and link @@ -104,7 +107,6 @@ set(XEUS_SQLITE_HEADERS # xeus-sqlite is the target for the library add_library(xeus-sqlite SHARED ${XEUS_SQLITE_SRC} ${XEUS_SQLITE_HEADERS}) - # xsqlite is the target for the kernel executable add_executable(xsqlite src/main.cpp) set_target_properties(xsqlite PROPERTIES ENABLE_EXPORTS 1) diff --git a/src/xeus_sqlite_interpreter.cpp b/src/xeus_sqlite_interpreter.cpp index 14207ec..8813c82 100644 --- a/src/xeus_sqlite_interpreter.cpp +++ b/src/xeus_sqlite_interpreter.cpp @@ -7,12 +7,17 @@ * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ +// Define WIN32_LEAN_AND_MEAN to prevent duplicate sockets symbols. +// (Prevents Winsock.h from being included by the Windows.h header) +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#endif + #include #include #include #include #include -#include #include #include "xeus/xinterpreter.hpp" @@ -23,6 +28,14 @@ #include #include +#if __cplusplus >= 201703L +#include +using std::variant; +#else +#include +using nonstd::variant; +#endif + namespace xeus_sqlite {