Skip to content

Commit 86f56a6

Browse files
xhochywesm
authored andcommitted
ARROW-202: Integrate with appveyor ci for windows
This only adds yet a successful compilation for windows. Tests don't run. Author: Uwe L. Korn <uwelk@xhochy.com> Closes #213 from xhochy/ARROW-202 and squashes the following commits: d5088a6 [Uwe L. Korn] Correctly reference Kudu in LICENSE and NOTICE 72a583b [Uwe L. Korn] Differentiate Boost libraries based on build type 6c75699 [Uwe L. Korn] Add license header e33b08c [Uwe L. Korn] Pick up shared Boost libraries correctly 5da5f5d [Uwe L. Korn] ARROW-202: Integrate with appveyor ci for windows
1 parent 197120c commit 86f56a6

17 files changed

+217
-69
lines changed

LICENSE.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,15 @@
200200
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201
See the License for the specific language governing permissions and
202202
limitations under the License.
203+
204+
--------------------------------------------------------------------------------
205+
206+
This product includes code from Apache Kudu.
207+
208+
* cpp/cmake_modules/CompilerInfo.cmake is based on Kudu's cmake_modules/CompilerInfo.cmake
209+
210+
Copyright: 2016 The Apache Software Foundation.
211+
Home page: https://kudu.apache.org/
212+
License: http://www.apache.org/licenses/LICENSE-2.0
213+
214+
--------------------------------------------------------------------------------

NOTICE.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,17 @@ This product includes software from the CMake project
4141

4242
This product includes software from https://github.com/matthew-brett/multibuild (BSD 2-clause)
4343
* Copyright (c) 2013-2016, Matt Terry and Matthew Brett; all rights reserved.
44+
45+
--------------------------------------------------------------------------------
46+
47+
This product includes code from Apache Kudu, which includes the following in
48+
its NOTICE file:
49+
50+
Apache Kudu
51+
Copyright 2016 The Apache Software Foundation
52+
53+
This product includes software developed at
54+
The Apache Software Foundation (http://www.apache.org/).
55+
56+
Portions of this software were developed at
57+
Cloudera, Inc (http://www.cloudera.com/).

appveyor.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# Operating system (build VM template)
19+
os: Visual Studio 2015
20+
21+
environment:
22+
matrix:
23+
- GENERATOR: Visual Studio 14 2015 Win64
24+
# - GENERATOR: Visual Studio 14 2015
25+
MSVC_DEFAULT_OPTIONS: ON
26+
BOOST_ROOT: C:\Libraries\boost_1_59_0
27+
BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0
28+
29+
build_script:
30+
- cd cpp
31+
- mkdir build
32+
- cd build
33+
# A lot of features are still deactivated as they do not build on Windows
34+
# * gbenchmark doesn't build with MSVC
35+
- cmake -G "%GENERATOR%" -DARROW_BOOST_USE_SHARED=OFF -DARROW_IPC=OFF -DARROW_HDFS=OFF -DARROW_BUILD_BENCHMARKS=OFF ..
36+
- cmake --build . --config Debug
37+
38+
# test_script:
39+
# - ctest -VV

cpp/CMakeLists.txt

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ endif()
141141
# For CMAKE_BUILD_TYPE=Release
142142
# -O3: Enable all compiler optimizations
143143
# -g: Enable symbols for profiler tools (TODO: remove for shipping)
144-
set(CXX_FLAGS_DEBUG "-ggdb -O0")
145-
set(CXX_FLAGS_FASTDEBUG "-ggdb -O1")
146-
set(CXX_FLAGS_RELEASE "-O3 -g -DNDEBUG")
144+
if (NOT MSVC)
145+
set(CXX_FLAGS_DEBUG "-ggdb -O0")
146+
set(CXX_FLAGS_FASTDEBUG "-ggdb -O1")
147+
set(CXX_FLAGS_RELEASE "-O3 -g -DNDEBUG")
148+
endif()
147149

148150
set(CXX_FLAGS_PROFILE_GEN "${CXX_FLAGS_RELEASE} -fprofile-generate")
149151
set(CXX_FLAGS_PROFILE_BUILD "${CXX_FLAGS_RELEASE} -fprofile-use")
@@ -347,6 +349,8 @@ function(ADD_ARROW_TEST REL_TEST_NAME)
347349
COMPILE_FLAGS " -DARROW_VALGRIND")
348350
add_test(${TEST_NAME}
349351
valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ${TEST_PATH})
352+
elseif(MSVC)
353+
add_test(${TEST_NAME} ${TEST_PATH})
350354
else()
351355
add_test(${TEST_NAME}
352356
${BUILD_SUPPORT_DIR}/run-test.sh ${CMAKE_BINARY_DIR} test ${TEST_PATH})
@@ -431,40 +435,44 @@ endfunction()
431435
# ----------------------------------------------------------------------
432436
# Add Boost dependencies (code adapted from Apache Kudu (incubating))
433437

434-
# find boost headers and libs
438+
# Find static boost headers and libs
439+
# TODO Differentiate here between release and debug builds
435440
set(Boost_DEBUG TRUE)
436441
set(Boost_USE_MULTITHREADED ON)
437442
set(Boost_USE_STATIC_LIBS ON)
438443
find_package(Boost COMPONENTS system filesystem REQUIRED)
439-
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
440-
set(BOOST_STATIC_LIBS ${Boost_LIBRARIES})
441-
list(LENGTH BOOST_STATIC_LIBS BOOST_STATIC_LIBS_LEN)
444+
if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
445+
set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
446+
set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG})
447+
else()
448+
set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
449+
set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE})
450+
endif()
442451

443-
# Find Boost shared libraries.
452+
# Find shared Boost libraries.
444453
set(Boost_USE_STATIC_LIBS OFF)
445454
find_package(Boost COMPONENTS system filesystem REQUIRED)
446-
set(BOOST_SHARED_LIBS ${Boost_LIBRARIES})
447-
list(LENGTH BOOST_SHARED_LIBS BOOST_SHARED_LIBS_LEN)
448-
list(SORT BOOST_SHARED_LIBS)
455+
if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
456+
set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
457+
set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG})
458+
else()
459+
set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
460+
set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE})
461+
endif()
449462

450463
message(STATUS "Boost include dir: " ${Boost_INCLUDE_DIRS})
451464
message(STATUS "Boost libraries: " ${Boost_LIBRARIES})
452465

453-
math(EXPR LAST_IDX "${BOOST_STATIC_LIBS_LEN} - 1")
454-
foreach(IDX RANGE ${LAST_IDX})
455-
list(GET BOOST_STATIC_LIBS ${IDX} BOOST_STATIC_LIB)
456-
list(GET BOOST_SHARED_LIBS ${IDX} BOOST_SHARED_LIB)
466+
ADD_THIRDPARTY_LIB(boost_system
467+
STATIC_LIB "${BOOST_STATIC_SYSTEM_LIBRARY}"
468+
SHARED_LIB "${BOOST_SHARED_SYSTEM_LIBRARY}")
469+
470+
ADD_THIRDPARTY_LIB(boost_filesystem
471+
STATIC_LIB "${BOOST_STATIC_FILESYSTEM_LIBRARY}"
472+
SHARED_LIB "${BOOST_SHARED_FILESYSTEM_LIBRARY}")
473+
474+
SET(ARROW_BOOST_LIBS boost_system boost_filesystem)
457475

458-
# Remove the prefix/suffix from the library name.
459-
#
460-
# e.g. libboost_system-mt --> boost_system
461-
get_filename_component(LIB_NAME ${BOOST_STATIC_LIB} NAME_WE)
462-
string(REGEX REPLACE "lib([^-]*)(-mt)?" "\\1" LIB_NAME_NO_PREFIX_SUFFIX ${LIB_NAME})
463-
ADD_THIRDPARTY_LIB(${LIB_NAME_NO_PREFIX_SUFFIX}
464-
STATIC_LIB "${BOOST_STATIC_LIB}"
465-
SHARED_LIB "${BOOST_SHARED_LIB}")
466-
list(APPEND ARROW_BOOST_LIBS ${LIB_NAME_NO_PREFIX_SUFFIX})
467-
endforeach()
468476
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
469477

470478
# ----------------------------------------------------------------------
@@ -482,7 +490,7 @@ if(ARROW_BUILD_TESTS)
482490

483491
ExternalProject_Add(googletest_ep
484492
URL "https://github.com/google/googletest/archive/release-${GTEST_VERSION}.tar.gz"
485-
CMAKE_ARGS -DCMAKE_CXX_FLAGS=${GTEST_CMAKE_CXX_FLAGS}
493+
CMAKE_ARGS -DCMAKE_CXX_FLAGS=${GTEST_CMAKE_CXX_FLAGS} -Dgtest_force_shared_crt=ON
486494
# googletest doesn't define install rules, so just build in the
487495
# source dir and don't try to install. See its README for
488496
# details.
@@ -491,7 +499,7 @@ if(ARROW_BUILD_TESTS)
491499

492500
set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix/src/googletest_ep")
493501
set(GTEST_INCLUDE_DIR "${GTEST_PREFIX}/include")
494-
set(GTEST_STATIC_LIB "${GTEST_PREFIX}/libgtest.a")
502+
set(GTEST_STATIC_LIB "${GTEST_PREFIX}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}")
495503
set(GTEST_VENDORED 1)
496504
else()
497505
find_package(GTest REQUIRED)
@@ -571,7 +579,7 @@ if(ARROW_BUILD_BENCHMARKS)
571579
"-DCMAKE_CXX_FLAGS=-fPIC ${GBENCHMARK_CMAKE_CXX_FLAGS}")
572580

573581
set(GBENCHMARK_INCLUDE_DIR "${GBENCHMARK_PREFIX}/include")
574-
set(GBENCHMARK_STATIC_LIB "${GBENCHMARK_PREFIX}/lib/libbenchmark.a")
582+
set(GBENCHMARK_STATIC_LIB "${GBENCHMARK_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}")
575583
set(GBENCHMARK_VENDORED 1)
576584
else()
577585
find_package(GBenchmark REQUIRED)

cpp/cmake_modules/CompilerInfo.cmake

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1-
# Copyright 2013 Cloudera, Inc.
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
28
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
9+
# http://www.apache.org/licenses/LICENSE-2.0
610
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
1417
#
1518
# Sets COMPILER_FAMILY to 'clang' or 'gcc'
1619
# Sets COMPILER_VERSION to the version
1720
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -v
1821
ERROR_VARIABLE COMPILER_VERSION_FULL)
1922
message(INFO " ${COMPILER_VERSION_FULL}")
23+
message(INFO " ${CMAKE_CXX_COMPILER_ID}")
24+
25+
if(MSVC)
26+
set(COMPILER_FAMILY "msvc")
2027

2128
# clang on Linux and Mac OS X before 10.9
22-
if("${COMPILER_VERSION_FULL}" MATCHES ".*clang version.*")
29+
elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang version.*")
2330
set(COMPILER_FAMILY "clang")
2431
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
2532
COMPILER_VERSION "${COMPILER_VERSION_FULL}")
@@ -29,10 +36,15 @@ elseif("${COMPILER_VERSION_FULL}" MATCHES ".*based on LLVM.*")
2936
string(REGEX REPLACE ".*based on LLVM ([0-9]+\\.[0.9]+).*" "\\1"
3037
COMPILER_VERSION "${COMPILER_VERSION_FULL}")
3138

32-
# clang on Mac OS X, XCode 7+. No version replacement is done
33-
# because Apple no longer advertises the upstream LLVM version.
34-
elseif("${COMPILER_VERSION_FULL}" MATCHES "clang-.*")
39+
# clang on Mac OS X, XCode 7.
40+
elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang-7")
41+
set(COMPILER_FAMILY "clang")
42+
set(COMPILER_VERSION "3.7.0svn")
43+
44+
# clang on Mac OS X, XCode 8.
45+
elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang-8")
3546
set(COMPILER_FAMILY "clang")
47+
set(COMPILER_VERSION "3.8.0svn")
3648

3749
# gcc
3850
elseif("${COMPILER_VERSION_FULL}" MATCHES ".*gcc version.*")

cpp/src/arrow/array-test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <cstdint>
1919
#include <cstdlib>
2020
#include <memory>
21+
#include <numeric>
2122
#include <vector>
2223

2324
#include "gtest/gtest.h"

cpp/src/arrow/io/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@
1818
# ----------------------------------------------------------------------
1919
# arrow_io : Arrow IO interfaces
2020

21-
set(ARROW_IO_LINK_LIBS
22-
arrow_shared
23-
dl
24-
)
21+
if (MSVC)
22+
set(ARROW_IO_LINK_LIBS
23+
arrow_shared
24+
)
25+
else()
26+
set(ARROW_IO_LINK_LIBS
27+
arrow_shared
28+
dl
29+
)
30+
endif()
2531

2632
if (ARROW_BOOST_USE_SHARED)
2733
set(ARROW_IO_PRIVATE_LINK_LIBS

cpp/src/arrow/io/io-file-test.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#include <cstdint>
1919
#include <cstdio>
2020
#include <cstring>
21-
#include <fcntl.h>
21+
#ifndef _MSC_VER
22+
# include <fcntl.h>
23+
#endif
2224
#include <fstream>
2325
#include <memory>
2426
#include <sstream>
@@ -38,7 +40,12 @@ static bool FileExists(const std::string& path) {
3840
}
3941

4042
static bool FileIsClosed(int fd) {
43+
#ifdef _MSC_VER
44+
// Close file a second time, this should set errno to EBADF
45+
close(fd);
46+
#else
4147
if (-1 != fcntl(fd, F_GETFD)) { return false; }
48+
#endif
4249
return errno == EBADF;
4350
}
4451

cpp/src/arrow/io/memory.cc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@
1717

1818
#include "arrow/io/memory.h"
1919

20-
#include <sys/mman.h> // For memory-mapping
20+
// sys/mman.h not present in Visual Studio or Cygwin
21+
#ifdef _WIN32
22+
#ifndef NOMINMAX
23+
#define NOMINMAX
24+
#endif
25+
#include "arrow/io/mman.h"
26+
#undef Realloc
27+
#undef Free
28+
#include <windows.h>
29+
#else
30+
#include <sys/mman.h>
31+
#endif
2132

2233
#include <algorithm>
2334
#include <cerrno>

cpp/src/arrow/io/mman.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static DWORD __map_mmap_prot_file(const int prot) {
7676
return desiredAccess;
7777
}
7878

79-
void* mmap(void* addr, size_t len, int prot, int flags, int fildes, off_t off) {
79+
static void* mmap(void* addr, size_t len, int prot, int flags, int fildes, off_t off) {
8080
HANDLE fm, h;
8181

8282
void* map = MAP_FAILED;
@@ -143,15 +143,15 @@ void* mmap(void* addr, size_t len, int prot, int flags, int fildes, off_t off) {
143143
return map;
144144
}
145145

146-
int munmap(void* addr, size_t len) {
146+
static int munmap(void* addr, size_t len) {
147147
if (UnmapViewOfFile(addr)) return 0;
148148

149149
errno = __map_mman_error(GetLastError(), EPERM);
150150

151151
return -1;
152152
}
153153

154-
int mprotect(void* addr, size_t len, int prot) {
154+
static int mprotect(void* addr, size_t len, int prot) {
155155
DWORD newProtect = __map_mmap_prot_page(prot);
156156
DWORD oldProtect = 0;
157157

@@ -162,23 +162,23 @@ int mprotect(void* addr, size_t len, int prot) {
162162
return -1;
163163
}
164164

165-
int msync(void* addr, size_t len, int flags) {
165+
static int msync(void* addr, size_t len, int flags) {
166166
if (FlushViewOfFile(addr, len)) return 0;
167167

168168
errno = __map_mman_error(GetLastError(), EPERM);
169169

170170
return -1;
171171
}
172172

173-
int mlock(const void* addr, size_t len) {
173+
static int mlock(const void* addr, size_t len) {
174174
if (VirtualLock((LPVOID)addr, len)) return 0;
175175

176176
errno = __map_mman_error(GetLastError(), EPERM);
177177

178178
return -1;
179179
}
180180

181-
int munlock(const void* addr, size_t len) {
181+
static int munlock(const void* addr, size_t len) {
182182
if (VirtualUnlock((LPVOID)addr, len)) return 0;
183183

184184
errno = __map_mman_error(GetLastError(), EPERM);

0 commit comments

Comments
 (0)