forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
635 lines (515 loc) · 19.1 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
cmake_minimum_required(VERSION 3.2)
project(arrow)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../java/pom.xml" POM_XML)
string(REGEX MATCHALL
"\n <version>[^<]+</version>" ARROW_VERSION_TAG "${POM_XML}")
string(REGEX REPLACE
"(\n <version>|</version>)" "" ARROW_VERSION "${ARROW_VERSION_TAG}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
include(CMakeParseArguments)
include(ExternalProject)
# This ensures that things like gnu++11 get passed correctly
set(CMAKE_CXX_STANDARD 11)
# We require a C++11 compliant compiler
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(GNUInstallDirs)
# 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")
set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
set(CLANG_FORMAT_VERSION "4.0")
find_package(ClangTools)
if ("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND)
# Generate a Clang compile_commands.json "compilation database" file for use
# with various development tools, such as Vim's YouCompleteMe plugin.
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
endif()
find_package(InferTools)
if ("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR INFER_FOUND)
# Generate a Clang compile_commands.json "compilation database" file for use
# with various development tools, such as Vim's YouCompleteMe plugin.
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
endif()
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_FOUND})
endif(CCACHE_FOUND)
# ----------------------------------------------------------------------
# cmake options
# Top level cmake dir
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(ARROW_CXXFLAGS "" CACHE STRING
"Compiler flags to append when compiling Arrow")
option(ARROW_BUILD_STATIC
"Build the libarrow static libraries"
ON)
option(ARROW_BUILD_SHARED
"Build the libarrow shared libraries"
ON)
option(ARROW_TEST_MEMCHECK
"Run the test suite using valgrind --tool=memcheck"
OFF)
option(ARROW_BUILD_TESTS
"Build the Arrow googletest unit tests"
ON)
option(ARROW_BUILD_BENCHMARKS
"Build the Arrow micro benchmarks"
OFF)
option(ARROW_NO_DEPRECATED_API
"Exclude deprecated APIs from build"
OFF)
option(ARROW_COMPUTE
"Build the Arrow Compute Modules"
ON)
option(ARROW_EXTRA_ERROR_CONTEXT
"Compile with extra error context (line numbers, code)"
OFF)
option(ARROW_IPC
"Build the Arrow IPC extensions"
ON)
option(ARROW_GPU
"Build the Arrow GPU extensions (requires CUDA installation)"
OFF)
option(ARROW_JEMALLOC
"Build the Arrow jemalloc-based allocator"
OFF)
option(ARROW_JEMALLOC_USE_SHARED
"Rely on jemalloc shared libraries where relevant"
ON)
option(ARROW_HDFS
"Build the Arrow HDFS bridge"
ON)
option(ARROW_BOOST_USE_SHARED
"Rely on boost shared libraries where relevant"
ON)
option(ARROW_BOOST_VENDORED
"Use vendored Boost instead of existing Boost"
OFF)
option(ARROW_PYTHON
"Build the Arrow CPython extensions"
OFF)
option(ARROW_SSE3
"Build Arrow with SSE3"
ON)
option(ARROW_ALTIVEC
"Build Arrow with Altivec"
ON)
option(ARROW_BUILD_UTILITIES
"Build Arrow commandline utilities"
ON)
option(ARROW_RPATH_ORIGIN
"Build Arrow libraries with RATH set to \$ORIGIN"
OFF)
option(ARROW_INSTALL_NAME_RPATH
"Build Arrow libraries with install_name set to @rpath"
ON)
option(ARROW_PLASMA
"Build the plasma object store along with Arrow"
OFF)
option(ARROW_USE_SSE
"Build with SSE4 optimizations"
OFF)
option(ARROW_WITH_BROTLI
"Build with Brotli compression"
ON)
option(ARROW_WITH_LZ4
"Build with lz4 compression"
ON)
option(ARROW_WITH_SNAPPY
"Build with Snappy compression"
ON)
option(ARROW_WITH_ZLIB
"Build with zlib compression"
ON)
option(ARROW_WITH_ZSTD
"Build with zstd compression"
ON)
option(ARROW_WITH_GRPC
"Build with GRPC"
OFF)
option(ARROW_VERBOSE_THIRDPARTY_BUILD
"If off, output from ExternalProjects will be logged to files rather than shown"
ON)
if (MSVC)
set(BROTLI_MSVC_STATIC_LIB_SUFFIX "_static" CACHE STRING
"Brotli static lib suffix used on Windows with MSVC (default _static)")
set(SNAPPY_MSVC_STATIC_LIB_SUFFIX "_static" CACHE STRING
"Snappy static lib suffix used on Windows with MSVC (default is empty string)")
set(ZLIB_MSVC_STATIC_LIB_SUFFIX "libstatic" CACHE STRING
"Zlib static lib suffix used on Windows with MSVC (default libstatic)")
set(LZ4_MSVC_STATIC_LIB_SUFFIX "_static" CACHE STRING
"Lz4 static lib suffix used on Windows with MSVC (default _static)")
set(ZSTD_MSVC_STATIC_LIB_SUFFIX "_static" CACHE STRING
"ZStd static lib suffix used on Windows with MSVC (default _static)")
endif()
endif()
if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
set(ARROW_BUILD_STATIC ON)
set(ARROW_WITH_BROTLI ON)
set(ARROW_WITH_LZ4 ON)
set(ARROW_WITH_SNAPPY ON)
set(ARROW_WITH_ZLIB ON)
set(ARROW_WITH_ZSTD ON)
endif()
if(NOT ARROW_BUILD_TESTS)
set(NO_TESTS 1)
endif()
if(NOT ARROW_BUILD_BENCHMARKS)
set(NO_BENCHMARKS 1)
endif()
if(ARROW_HDFS)
set(ARROW_BOOST_HEADER_ONLY 0)
else()
set(ARROW_BOOST_HEADER_ONLY 1)
endif()
############################################################
# Compiler flags
############################################################
# Determine compiler version
include(CompilerInfo)
if (ARROW_NO_DEPRECATED_API)
add_definitions(-DARROW_NO_DEPRECATED_API)
endif()
if (ARROW_EXTRA_ERROR_CONTEXT)
add_definitions(-DARROW_EXTRA_ERROR_CONTEXT)
endif()
include(SetupCxxFlags)
############################################################
# Dependencies
############################################################
add_custom_target(arrow_dependencies)
include(BuildUtils)
enable_testing()
include(ThirdpartyToolchain)
# Add common flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARROW_CXXFLAGS}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
if ("${COMPILER_FAMILY}" STREQUAL "clang")
# Using Clang with ccache causes a bunch of spurious warnings that are
# purportedly fixed in the next version of ccache. See the following for details:
#
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
# http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CLANG_OPTIONS}")
endif()
# ASAN / TSAN / UBSAN
include(san-config)
# For any C code, use the same flags.
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
# Remove --std=c++11 to avoid errors from C compilers
string(REPLACE "-std=c++11" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
# Code coverage
if ("${ARROW_GENERATE_COVERAGE}")
if("${CMAKE_CXX_COMPILER}" MATCHES ".*clang.*")
# There appears to be some bugs in clang 3.3 which cause code coverage
# to have link errors, not locating the llvm_gcda_* symbols.
# This should be fixed in llvm 3.4 with http://llvm.org/viewvc/llvm-project?view=revision&revision=184666
message(SEND_ERROR "Cannot currently generate coverage with clang")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -DCOVERAGE_BUILD")
# For coverage to work properly, we need to use static linkage. Otherwise,
# __gcov_flush() doesn't properly flush coverage from every module.
# See http://stackoverflow.com/questions/28164543/using-gcov-flush-within-a-library-doesnt-force-the-other-modules-to-yield-gc
if(NOT ARROW_BUILD_STATIC)
message(SEND_ERROR "Coverage requires the static lib to be built")
endif()
endif()
# set compile output directory
string (TOLOWER ${CMAKE_BUILD_TYPE} BUILD_SUBDIR_NAME)
# If build in-source, create the latest symlink. If build out-of-source, which is
# preferred, simply output the binaries in the build folder
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/${BUILD_SUBDIR_NAME}/")
# Link build/latest to the current build directory, to avoid developers
# accidentally running the latest debug build when in fact they're building
# release builds.
FILE(MAKE_DIRECTORY ${BUILD_OUTPUT_ROOT_DIRECTORY})
if (NOT APPLE)
set(MORE_ARGS "-T")
endif()
EXECUTE_PROCESS(COMMAND ln ${MORE_ARGS} -sf ${BUILD_OUTPUT_ROOT_DIRECTORY}
${CMAKE_CURRENT_BINARY_DIR}/build/latest)
else()
set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_SUBDIR_NAME}/")
endif()
# where to put generated archives (.a files)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
set(ARCHIVE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
# where to put generated libraries (.so files)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
set(LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
# where to put generated binaries
set(EXECUTABLE_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
include_directories(src)
############################################################
# Visibility
############################################################
# For generate_export_header() and add_compiler_export_flags().
include(GenerateExportHeader)
# Adapted from Apache Kudu: https://github.com/apache/kudu/commit/bd549e13743a51013585
# Honor visibility properties for all target types. See
# "cmake --help-policy CMP0063" for details.
#
# This policy was only added to cmake in version 3.3, so until the cmake in
# thirdparty is updated, we must check if the policy exists before setting it.
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
if (PARQUET_BUILD_SHARED)
if (POLICY CMP0063)
set_target_properties(arrow_shared
PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN 1)
else()
# Sets -fvisibility=hidden for gcc
add_compiler_export_flags()
endif()
endif()
############################################################
# "make ctags" target
############################################################
if (UNIX)
add_custom_target(ctags ctags -R --languages=c++,c)
endif (UNIX)
############################################################
# "make etags" target
############################################################
if (UNIX)
add_custom_target(tags etags --members --declarations
`find ${CMAKE_CURRENT_SOURCE_DIR}/src
-name \\*.cc -or -name \\*.hh -or -name \\*.cpp -or -name \\*.h -or -name \\*.c -or
-name \\*.f`)
add_custom_target(etags DEPENDS tags)
endif (UNIX)
############################################################
# "make cscope" target
############################################################
if (UNIX)
add_custom_target(cscope find ${CMAKE_CURRENT_SOURCE_DIR}
( -name \\*.cc -or -name \\*.hh -or -name \\*.cpp -or
-name \\*.h -or -name \\*.c -or -name \\*.f )
-exec echo \"{}\" \; > cscope.files && cscope -q -b VERBATIM)
endif (UNIX)
############################################################
# "make lint" target
############################################################
if (UNIX)
file(GLOB_RECURSE LINT_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc"
)
FOREACH(item ${LINT_FILES})
IF(NOT ((item MATCHES "_generated.h") OR
(item MATCHES "pyarrow_api.h") OR
(item MATCHES "xxhash.h") OR
(item MATCHES "xxhash.cc") OR
(item MATCHES "config.h") OR
(item MATCHES "zmalloc.h") OR
(item MATCHES "ae.h")))
LIST(APPEND FILTERED_LINT_FILES ${item})
ENDIF()
ENDFOREACH(item ${LINT_FILES})
find_program(CPPLINT_BIN NAMES cpplint cpplint.py HINTS ${BUILD_SUPPORT_DIR})
message(STATUS "Found cpplint executable at ${CPPLINT_BIN}")
# Full lint
add_custom_target(lint ${CPPLINT_BIN}
--verbose=2
--linelength=90
--filter=-whitespace/comments,-readability/todo,-build/header_guard,-build/c++11,-runtime/references,-build/include_order
${FILTERED_LINT_FILES})
endif (UNIX)
############################################################
# "make format" and "make check-format" targets
############################################################
# runs clang format and updates files in place.
add_custom_target(format ${BUILD_SUPPORT_DIR}/run_clang_format.py
${CLANG_FORMAT_BIN}
${BUILD_SUPPORT_DIR}/clang_format_exclusions.txt
${CMAKE_CURRENT_SOURCE_DIR}/src)
# runs clang format and exits with a non-zero exit code if any files need to be reformatted
# TODO(wesm): Make this work in run_clang_format.py
add_custom_target(check-format ${BUILD_SUPPORT_DIR}/run_clang_format.py
${CLANG_FORMAT_BIN}
${BUILD_SUPPORT_DIR}/clang_format_exclusions.txt
${CMAKE_CURRENT_SOURCE_DIR}/src 1)
############################################################
# "make clang-tidy" and "make check-clang-tidy" targets
############################################################
if (${CLANG_TIDY_FOUND})
# runs clang-tidy and attempts to fix any warning automatically
add_custom_target(clang-tidy ${BUILD_SUPPORT_DIR}/run-clang-tidy.sh ${CLANG_TIDY_BIN} ${CMAKE_BINARY_DIR}/compile_commands.json 1
`find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc | sed -e '/_generated/g'`)
# runs clang-tidy and exits with a non-zero exit code if any errors are found.
add_custom_target(check-clang-tidy ${BUILD_SUPPORT_DIR}/run-clang-tidy.sh ${CLANG_TIDY_BIN} ${CMAKE_BINARY_DIR}/compile_commands.json
0 `find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc |grep -v -F -f ${CMAKE_CURRENT_SOURCE_DIR}/src/.clang-tidy-ignore | sed -e '/_generated/g'`)
endif()
############################################################
# "make infer" target
############################################################
if (${INFER_FOUND})
# runs infer capture
add_custom_target(infer ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN} ${CMAKE_BINARY_DIR}/compile_commands.json 1)
# runs infer analyze
add_custom_target(infer-analyze ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN} ${CMAKE_BINARY_DIR}/compile_commands.json 2)
# runs infer report
add_custom_target(infer-report ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN} ${CMAKE_BINARY_DIR}/compile_commands.json 3)
endif()
############################################################
# "make iwyu" target
############################################################
if(UNIX)
add_custom_target(iwyu ${BUILD_SUPPORT_DIR}/iwyu/iwyu.sh)
endif(UNIX)
############################################################
# Linker and Dependencies
############################################################
set(ARROW_STATIC_LINK_LIBS)
if (ARROW_WITH_BROTLI)
SET(ARROW_STATIC_LINK_LIBS
brotli_dec
brotli_enc
brotli_common
${ARROW_STATIC_LINK_LIBS})
endif()
if (ARROW_WITH_LZ4)
SET(ARROW_STATIC_LINK_LIBS lz4_static ${ARROW_STATIC_LINK_LIBS})
endif()
if (ARROW_WITH_SNAPPY)
SET(ARROW_STATIC_LINK_LIBS snappy ${ARROW_STATIC_LINK_LIBS})
endif()
if (ARROW_WITH_ZLIB)
SET(ARROW_STATIC_LINK_LIBS zlib ${ARROW_STATIC_LINK_LIBS})
endif()
if (ARROW_WITH_ZSTD)
SET(ARROW_STATIC_LINK_LIBS zstd_static ${ARROW_STATIC_LINK_LIBS})
endif()
if (ARROW_WITH_GRPC)
SET(ARROW_STATIC_LINK_LIBS
grpc_grp
grpc_grpc
grpc_grpcpp
${ARROW_STATIC_LINK_LIBS})
endif()
if (ARROW_STATIC_LINK_LIBS)
add_dependencies(arrow_dependencies ${ARROW_STATIC_LINK_LIBS})
endif()
set(ARROW_BENCHMARK_LINK_LIBS
arrow_static
arrow_benchmark_main
gtest
${ARROW_STATIC_LINK_LIBS})
set(ARROW_LINK_LIBS
${ARROW_STATIC_LINK_LIBS})
set(ARROW_SHARED_PRIVATE_LINK_LIBS
${BOOST_SYSTEM_LIBRARY}
${BOOST_FILESYSTEM_LIBRARY})
set(ARROW_STATIC_PRIVATE_LINK_LIBS
${BOOST_SYSTEM_LIBRARY}
${BOOST_FILESYSTEM_LIBRARY})
if (NOT MSVC)
set(ARROW_LINK_LIBS
${ARROW_LINK_LIBS}
${CMAKE_DL_LIBS})
endif()
set(ARROW_MIN_TEST_LIBS
arrow_static
${ARROW_STATIC_LINK_LIBS}
gtest
gtest_main)
if(NOT MSVC)
set(ARROW_MIN_TEST_LIBS
${ARROW_MIN_TEST_LIBS}
${CMAKE_DL_LIBS})
endif()
set(ARROW_TEST_LINK_LIBS ${ARROW_MIN_TEST_LIBS})
if (ARROW_JEMALLOC)
add_definitions(-DARROW_JEMALLOC)
# In the case that jemalloc is only available as a shared library also use it to
# link it in the static requirements. In contrast to other libraries we try in
# most cases to use the system provided version of jemalloc to better align with
# other potential users of jemalloc.
if (JEMALLOC_STATIC_LIB AND NOT ARROW_JEMALLOC_USE_SHARED)
set(ARROW_JEMALLOC_STATIC_LINK_LIBS jemalloc_static)
else()
set(ARROW_JEMALLOC_STATIC_LINK_LIBS jemalloc_shared)
endif()
if (NOT APPLE)
set(ARROW_JEMALLOC_STATIC_LINK_LIBS ${ARROW_JEMALLOC_STATIC_LINK_LIBS} ${PTHREAD_LIBRARY} rt)
endif()
if (ARROW_JEMALLOC_USE_SHARED)
set(ARROW_JEMALLOC_SHARED_LINK_LIBS jemalloc_shared)
else()
if (CMAKE_COMPILER_IS_GNUCXX)
set(ARROW_JEMALLOC_SHARED_LINK_LIBS
jemalloc_static
# For glibc <2.17 we need to link to librt.
# As we compile with --as-needed by default, the linker will omit this
# dependency if not required.
${PTHREAD_LIBRARY}
rt
)
else()
set(ARROW_JEMALLOC_SHARED_LINK_LIBS
jemalloc_static
)
endif()
endif()
set(ARROW_SHARED_PRIVATE_LINK_LIBS
${ARROW_SHARED_PRIVATE_LINK_LIBS}
${ARROW_JEMALLOC_SHARED_LINK_LIBS})
set(ARROW_STATIC_LINK_LIBS
${ARROW_STATIC_LINK_LIBS}
${ARROW_JEMALLOC_STATIC_LINK_LIBS})
elseif (NOT MSVC)
# We need to separate this as otherwise CMake would mess with the library
# linking order.
set(ARROW_LINK_LIBS
${ARROW_LINK_LIBS}
${PTHREAD_LIBRARY})
set(ARROW_STATIC_LINK_LIBS
${ARROW_STATIC_LINK_LIBS}
${PTHREAD_LIBRARY})
endif()
############################################################
# Subdirectories
############################################################
if(NOT WIN32 AND ARROW_PLASMA)
add_subdirectory(src/plasma)
endif()
add_subdirectory(src/arrow)
if(ARROW_PYTHON)
find_package(PythonLibsNew REQUIRED)
find_package(NumPy REQUIRED)
include_directories(SYSTEM
${NUMPY_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS})
add_subdirectory(src/arrow/python)
endif()