diff --git a/appveyor.yml b/appveyor.yml index b8c26e6e5084..f2954a92e9e1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,17 +21,15 @@ os: Visual Studio 2015 environment: matrix: - GENERATOR: Visual Studio 14 2015 Win64 - # - GENERATOR: Visual Studio 14 2015 + PYTHON: "3.5" + ARCH: "64" MSVC_DEFAULT_OPTIONS: ON BOOST_ROOT: C:\Libraries\boost_1_63_0 BOOST_LIBRARYDIR: C:\Libraries\boost_1_63_0\lib64-msvc-14.0 -build_script: - - cd cpp - - mkdir build - - cd build - - cmake -G "%GENERATOR%" -DARROW_CXXFLAGS="/WX" -DARROW_BOOST_USE_SHARED=OFF -DCMAKE_BUILD_TYPE=Release .. - - cmake --build . --config Release +init: + - set MINICONDA=C:\Miniconda35-x64 + - set PATH=%MINICONDA%;%MINICONDA%/Scripts;%MINICONDA%/Library/bin;%PATH% -# test_script: - - ctest -VV +build_script: + - call ci\msvc-build.bat diff --git a/ci/msvc-build.bat b/ci/msvc-build.bat new file mode 100644 index 000000000000..de428b6e46e1 --- /dev/null +++ b/ci/msvc-build.bat @@ -0,0 +1,52 @@ +@rem Licensed to the Apache Software Foundation (ASF) under one +@rem or more contributor license agreements. See the NOTICE file +@rem distributed with this work for additional information +@rem regarding copyright ownership. The ASF licenses this file +@rem to you under the Apache License, Version 2.0 (the +@rem "License"); you may not use this file except in compliance +@rem with the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, +@rem software distributed under the License is distributed on an +@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@rem KIND, either express or implied. See the License for the +@rem specific language governing permissions and limitations +@rem under the License. + +@echo on + +set CONDA_ENV=C:\arrow-conda-env +set ARROW_HOME=C:\arrow-install + +conda create -p %CONDA_ENV% -q -y python=%PYTHON% ^ + six pytest setuptools numpy pandas cython +call activate %CONDA_ENV% + +@rem Build and test Arrow C++ libraries + +cd cpp +mkdir build +cd build +cmake -G "%GENERATOR%" ^ + -DCMAKE_INSTALL_PREFIX=%ARROW_HOME% ^ + -DARROW_BOOST_USE_SHARED=OFF ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DARROW_CXXFLAGS="/WX" ^ + -DARROW_PYTHON=on ^ + .. || exit /B +cmake --build . --target INSTALL --config Release || exit /B + +@rem Needed so python-test.exe works +set PYTHONPATH=%CONDA_ENV%\Lib;%CONDA_ENV%\Lib\site-packages;%CONDA_ENV%\python35.zip;%CONDA_ENV%\DLLs;%CONDA_ENV% + +ctest -VV || exit /B + +@rem Build and import pyarrow + +set PATH=%ARROW_HOME%\bin;%PATH% + +cd ..\..\python +python setup.py build_ext --inplace || exit /B +python -c "import pyarrow" || exit /B diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f702da16e7a4..c1cf7852a30b 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -36,6 +36,12 @@ else() include(GNUInstallDirs) endif() +# Compatibility with CMake 3.1 +if(POLICY CMP0054) + # http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html + cmake_policy(SET CMP0054 NEW) +endif() + set(ARROW_SO_VERSION "0") set(ARROW_ABI_VERSION "${ARROW_SO_VERSION}.0.0") diff --git a/cpp/cmake_modules/FindPythonLibsNew.cmake b/cpp/cmake_modules/FindPythonLibsNew.cmake index 961081609cb1..09124aa17bb9 100644 --- a/cpp/cmake_modules/FindPythonLibsNew.cmake +++ b/cpp/cmake_modules/FindPythonLibsNew.cmake @@ -141,12 +141,13 @@ string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES}) if(CMAKE_HOST_WIN32) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(PYTHON_LIBRARY - "${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") - else() - set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/libpython${PYTHON_LIBRARY_SUFFIX}.a") - endif() + # Appease CMP0054 + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(PYTHON_LIBRARY + "${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") + else() + set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/libpython${PYTHON_LIBRARY_SUFFIX}.a") + endif() elseif(APPLE) # In some cases libpythonX.X.dylib is not part of the PYTHON_PREFIX and we # need to call `python-config --prefix` to determine the correct location. diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 694e5a37df4b..7e229ff90a3e 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -30,7 +30,7 @@ if (MSVC) # insecure, like std::getenv add_definitions(-D_CRT_SECURE_NO_WARNINGS) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # clang-cl set(CXX_COMMON_FLAGS "-EHsc") elseif(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 19) diff --git a/cpp/src/arrow/python/CMakeLists.txt b/cpp/src/arrow/python/CMakeLists.txt index 607a1c436c45..5c2b58825294 100644 --- a/cpp/src/arrow/python/CMakeLists.txt +++ b/cpp/src/arrow/python/CMakeLists.txt @@ -57,6 +57,13 @@ set(ARROW_PYTHON_SHARED_LINK_LIBS arrow_shared ) +if (MSVC) + set(ARROW_PYTHON_SHARED_LINK_LIBS + ${ARROW_PYTHON_SHARED_LINK_LIBS} + ${PYTHON_LIBRARIES} + ) +endif() + ADD_ARROW_LIB(arrow_python SOURCES ${ARROW_PYTHON_SRCS} SHARED_LINK_FLAGS "" @@ -64,11 +71,6 @@ ADD_ARROW_LIB(arrow_python STATIC_LINK_LIBS "" ) -if (MSVC) - target_link_libraries(arrow_python_shared - ${PYTHON_LIBRARIES}) -endif() - if ("${COMPILER_FAMILY}" STREQUAL "clang") # Clang, be quiet. Python C API has lots of macros set_property(SOURCE ${ARROW_PYTHON_SRCS} diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index c1431af67ed5..3db7b7bf8382 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -28,6 +28,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cpp/cmake_mod include(CMakeParseArguments) +# Compatibility with CMake 3.1 +if(POLICY CMP0054) + # http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html + cmake_policy(SET CMP0054 NEW) +endif() + set(BUILD_SUPPORT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../cpp/build-support") # Allow "make install" to not depend on all targets.