-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
ThirdpartyToolchain.cmake
5498 lines (4993 loc) · 219 KB
/
ThirdpartyToolchain.cmake
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
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# 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.
include(ProcessorCount)
processorcount(NPROC)
# Accumulate all bundled targets and we will splice them together later as
# libarrow_bundled_dependencies.a so that third party libraries have something
# usable to create statically-linked builds with some BUNDLED dependencies,
# including allocators like jemalloc and mimalloc
set(ARROW_BUNDLED_STATIC_LIBS)
# Accumulate all system dependencies to provide suitable static link
# parameters to the third party libraries.
set(ARROW_SYSTEM_DEPENDENCIES)
set(ARROW_FLIGHT_SYSTEM_DEPENDENCIES)
set(ARROW_TESTING_SYSTEM_DEPENDENCIES)
set(PARQUET_SYSTEM_DEPENDENCIES)
# ----------------------------------------------------------------------
# Toolchain linkage options
set(ARROW_RE2_LINKAGE
"static"
CACHE STRING "How to link the re2 library. static|shared (default static)")
# ----------------------------------------------------------------------
# Resolve the dependencies
set(ARROW_THIRDPARTY_DEPENDENCIES
absl
AWSSDK
Azure
benchmark
Boost
Brotli
BZip2
c-ares
gflags
glog
google_cloud_cpp_storage
gRPC
GTest
jemalloc
LLVM
lz4
nlohmann_json
opentelemetry-cpp
orc
re2
Protobuf
RapidJSON
Snappy
Substrait
Thrift
ucx
utf8proc
xsimd
ZLIB
zstd)
# For backward compatibility. We use "BOOST_SOURCE" if "Boost_SOURCE"
# isn't specified and "BOOST_SOURCE" is specified.
# We renamed "BOOST" dependency name to "Boost" in 3.0.0 because
# upstreams (CMake and Boost) use "Boost" not "BOOST" as package name.
if("${Boost_SOURCE}" STREQUAL "" AND NOT "${BOOST_SOURCE}" STREQUAL "")
set(Boost_SOURCE ${BOOST_SOURCE})
endif()
# For backward compatibility. We use "RE2_SOURCE" if "re2_SOURCE"
# isn't specified and "RE2_SOURCE" is specified.
# We renamed "RE2" dependency name to "re2" in 3.0.0 because
# upstream uses "re2" not "RE2" as package name.
if("${re2_SOURCE}" STREQUAL "" AND NOT "${RE2_SOURCE}" STREQUAL "")
set(re2_SOURCE ${RE2_SOURCE})
endif()
# For backward compatibility. We use "ORC_SOURCE" if "orc_SOURCE"
# isn't specified and "ORC_SOURCE" is specified.
# We renamed "ORC" dependency name to "orc" in 15.0.0 because
# upstream uses "orc" not "ORC" as package name.
if("${orc_SOURCE}" STREQUAL "" AND NOT "${ORC_SOURCE}" STREQUAL "")
set(orc_SOURCE ${ORC_SOURCE})
endif()
# For backward compatibility. We use "RE2_ROOT" if "re2_ROOT"
# isn't specified and "RE2_ROOT" is specified.
if("${re2_ROOT}" STREQUAL "" AND NOT "${RE2_ROOT}" STREQUAL "")
set(re2_ROOT ${RE2_ROOT})
endif()
# For backward compatibility. We use "Lz4_SOURCE" if "lz4_SOURCE"
# isn't specified and "lz4_SOURCE" is specified.
# We renamed "Lz4" dependency name to "lz4" in 9.0.0 because
# upstream uses "lz4" not "Lz4" as package name.
if("${lz4_SOURCE}" STREQUAL "" AND NOT "${Lz4_SOURCE}" STREQUAL "")
set(lz4_SOURCE ${Lz4_SOURCE})
endif()
# For backward compatibility. We use "GLOG_SOURCE" if "glog_SOURCE"
# isn't specified and "GLOG_SOURCE" is specified.
# We renamed "GLOG" dependency name to "glog" in 16.0.0 because
# upstream uses "glog" not "GLOG" as package name.
if("${glog_SOURCE}" STREQUAL "" AND NOT "${GLOG_SOURCE}" STREQUAL "")
set(glog_SOURCE ${GLOG_SOURCE})
endif()
# For backward compatibility. We use bundled jemalloc by default.
if("${jemalloc_SOURCE}" STREQUAL "")
set(jemalloc_SOURCE "BUNDLED")
endif()
message(STATUS "Using ${ARROW_DEPENDENCY_SOURCE} approach to find dependencies")
if(ARROW_DEPENDENCY_SOURCE STREQUAL "CONDA")
if(MSVC)
set(ARROW_PACKAGE_PREFIX "$ENV{CONDA_PREFIX}/Library")
else()
set(ARROW_PACKAGE_PREFIX $ENV{CONDA_PREFIX})
endif()
set(ARROW_ACTUAL_DEPENDENCY_SOURCE "SYSTEM")
# GoogleTest provided by conda can't be used on macOS because it's
# built with C++14. So we accept auto fallback only for GoogleTest.
if("${GTest_SOURCE}" STREQUAL "")
set(GTest_SOURCE "AUTO")
endif()
message(STATUS "Using CONDA_PREFIX for ARROW_PACKAGE_PREFIX: ${ARROW_PACKAGE_PREFIX}")
else()
set(ARROW_ACTUAL_DEPENDENCY_SOURCE "${ARROW_DEPENDENCY_SOURCE}")
endif()
if(ARROW_PACKAGE_PREFIX)
message(STATUS "Setting (unset) dependency *_ROOT variables: ${ARROW_PACKAGE_PREFIX}")
set(ENV{PKG_CONFIG_PATH} "${ARROW_PACKAGE_PREFIX}/lib/pkgconfig/")
if(NOT ENV{BOOST_ROOT})
set(ENV{BOOST_ROOT} ${ARROW_PACKAGE_PREFIX})
endif()
if(NOT ENV{Boost_ROOT})
set(ENV{Boost_ROOT} ${ARROW_PACKAGE_PREFIX})
endif()
if(NOT DEFINED OPENSSL_ROOT_DIR)
set(OPENSSL_ROOT_DIR ${ARROW_PACKAGE_PREFIX})
endif()
endif()
# For each dependency, set dependency source to global default, if unset
foreach(DEPENDENCY ${ARROW_THIRDPARTY_DEPENDENCIES})
if("${${DEPENDENCY}_SOURCE}" STREQUAL "")
set(${DEPENDENCY}_SOURCE ${ARROW_ACTUAL_DEPENDENCY_SOURCE})
# If no ROOT was supplied and we have a global prefix, use it
if(NOT ${DEPENDENCY}_ROOT AND ARROW_PACKAGE_PREFIX)
set(${DEPENDENCY}_ROOT ${ARROW_PACKAGE_PREFIX})
endif()
endif()
endforeach()
macro(build_dependency DEPENDENCY_NAME)
if("${DEPENDENCY_NAME}" STREQUAL "absl")
build_absl()
elseif("${DEPENDENCY_NAME}" STREQUAL "AWSSDK")
build_awssdk()
elseif("${DEPENDENCY_NAME}" STREQUAL "Azure")
build_azure_sdk()
elseif("${DEPENDENCY_NAME}" STREQUAL "benchmark")
build_benchmark()
elseif("${DEPENDENCY_NAME}" STREQUAL "Boost")
build_boost()
elseif("${DEPENDENCY_NAME}" STREQUAL "Brotli")
build_brotli()
elseif("${DEPENDENCY_NAME}" STREQUAL "BZip2")
build_bzip2()
elseif("${DEPENDENCY_NAME}" STREQUAL "c-ares")
build_cares()
elseif("${DEPENDENCY_NAME}" STREQUAL "gflags")
build_gflags()
elseif("${DEPENDENCY_NAME}" STREQUAL "glog")
build_glog()
elseif("${DEPENDENCY_NAME}" STREQUAL "google_cloud_cpp_storage")
build_google_cloud_cpp_storage()
elseif("${DEPENDENCY_NAME}" STREQUAL "gRPC")
build_grpc()
elseif("${DEPENDENCY_NAME}" STREQUAL "GTest")
build_gtest()
elseif("${DEPENDENCY_NAME}" STREQUAL "jemalloc")
build_jemalloc()
elseif("${DEPENDENCY_NAME}" STREQUAL "lz4")
build_lz4()
elseif("${DEPENDENCY_NAME}" STREQUAL "nlohmann_json")
build_nlohmann_json()
elseif("${DEPENDENCY_NAME}" STREQUAL "opentelemetry-cpp")
build_opentelemetry()
elseif("${DEPENDENCY_NAME}" STREQUAL "orc")
build_orc()
elseif("${DEPENDENCY_NAME}" STREQUAL "Protobuf")
build_protobuf()
elseif("${DEPENDENCY_NAME}" STREQUAL "RapidJSON")
build_rapidjson()
elseif("${DEPENDENCY_NAME}" STREQUAL "re2")
build_re2()
elseif("${DEPENDENCY_NAME}" STREQUAL "Snappy")
build_snappy()
elseif("${DEPENDENCY_NAME}" STREQUAL "Substrait")
build_substrait()
elseif("${DEPENDENCY_NAME}" STREQUAL "Thrift")
build_thrift()
elseif("${DEPENDENCY_NAME}" STREQUAL "ucx")
build_ucx()
elseif("${DEPENDENCY_NAME}" STREQUAL "utf8proc")
build_utf8proc()
elseif("${DEPENDENCY_NAME}" STREQUAL "xsimd")
build_xsimd()
elseif("${DEPENDENCY_NAME}" STREQUAL "ZLIB")
build_zlib()
elseif("${DEPENDENCY_NAME}" STREQUAL "zstd")
build_zstd()
else()
message(FATAL_ERROR "Unknown thirdparty dependency to build: ${DEPENDENCY_NAME}")
endif()
endmacro()
function(provide_cmake_module MODULE_NAME ARROW_CMAKE_PACKAGE_NAME)
set(module "${CMAKE_SOURCE_DIR}/cmake_modules/${MODULE_NAME}.cmake")
if(EXISTS "${module}")
message(STATUS "Providing CMake module for ${MODULE_NAME} as part of ${ARROW_CMAKE_PACKAGE_NAME} CMake package"
)
install(FILES "${module}"
DESTINATION "${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}")
endif()
endfunction()
# Find modules are needed by the consumer in case of a static build, or if the
# linkage is PUBLIC or INTERFACE.
function(provide_find_module PACKAGE_NAME ARROW_CMAKE_PACKAGE_NAME)
provide_cmake_module("Find${PACKAGE_NAME}" ${ARROW_CMAKE_PACKAGE_NAME})
endfunction()
macro(resolve_dependency DEPENDENCY_NAME)
set(options)
set(one_value_args
ARROW_CMAKE_PACKAGE_NAME
ARROW_PC_PACKAGE_NAME
FORCE_ANY_NEWER_VERSION
HAVE_ALT
IS_RUNTIME_DEPENDENCY
REQUIRED_VERSION
USE_CONFIG)
set(multi_value_args COMPONENTS PC_PACKAGE_NAMES)
cmake_parse_arguments(ARG
"${options}"
"${one_value_args}"
"${multi_value_args}"
${ARGN})
if(ARG_UNPARSED_ARGUMENTS)
message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
endif()
if("${ARG_IS_RUNTIME_DEPENDENCY}" STREQUAL "")
set(ARG_IS_RUNTIME_DEPENDENCY TRUE)
endif()
if(ARG_HAVE_ALT)
set(PACKAGE_NAME "${DEPENDENCY_NAME}Alt")
else()
set(PACKAGE_NAME ${DEPENDENCY_NAME})
endif()
set(FIND_PACKAGE_ARGUMENTS ${PACKAGE_NAME})
if(ARG_REQUIRED_VERSION AND NOT ARG_FORCE_ANY_NEWER_VERSION)
list(APPEND FIND_PACKAGE_ARGUMENTS ${ARG_REQUIRED_VERSION})
endif()
if(ARG_USE_CONFIG)
list(APPEND FIND_PACKAGE_ARGUMENTS CONFIG)
endif()
if(ARG_COMPONENTS)
list(APPEND FIND_PACKAGE_ARGUMENTS COMPONENTS ${ARG_COMPONENTS})
endif()
if(${DEPENDENCY_NAME}_SOURCE STREQUAL "AUTO")
find_package(${FIND_PACKAGE_ARGUMENTS})
set(COMPATIBLE ${${PACKAGE_NAME}_FOUND})
if(COMPATIBLE
AND ARG_FORCE_ANY_NEWER_VERSION
AND ARG_REQUIRED_VERSION)
if(${${PACKAGE_NAME}_VERSION} VERSION_LESS ${ARG_REQUIRED_VERSION})
message(DEBUG "Couldn't find ${DEPENDENCY_NAME} >= ${ARG_REQUIRED_VERSION}")
set(COMPATIBLE FALSE)
endif()
endif()
if(COMPATIBLE)
set(${DEPENDENCY_NAME}_SOURCE "SYSTEM")
else()
build_dependency(${DEPENDENCY_NAME})
set(${DEPENDENCY_NAME}_SOURCE "BUNDLED")
endif()
elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "BUNDLED")
build_dependency(${DEPENDENCY_NAME})
elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM")
find_package(${FIND_PACKAGE_ARGUMENTS} REQUIRED)
if(ARG_FORCE_ANY_NEWER_VERSION AND ARG_REQUIRED_VERSION)
if(${${PACKAGE_NAME}_VERSION} VERSION_LESS ${ARG_REQUIRED_VERSION})
message(FATAL_ERROR "Couldn't find ${DEPENDENCY_NAME} >= ${ARG_REQUIRED_VERSION}")
endif()
endif()
endif()
if(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM" AND ARG_IS_RUNTIME_DEPENDENCY)
if(NOT ARG_ARROW_CMAKE_PACKAGE_NAME)
set(ARG_ARROW_CMAKE_PACKAGE_NAME "Arrow")
endif()
# ArrowFlight -> _Arrow_Flight
string(REGEX REPLACE "([A-Z])" "_\\1" ARG_ARROW_CMAKE_PACKAGE_NAME_SNAKE
${ARG_ARROW_CMAKE_PACKAGE_NAME})
# _Arrow_Flight -> Arrow_Flight
string(SUBSTRING ${ARG_ARROW_CMAKE_PACKAGE_NAME_SNAKE} 1 -1
ARG_ARROW_CMAKE_PACKAGE_NAME_SNAKE)
# Arrow_Flight -> ARROW_FLIGHT
string(TOUPPER ${ARG_ARROW_CMAKE_PACKAGE_NAME_SNAKE}
ARG_ARROW_CMAKE_PACKAGE_NAME_UPPER_SNAKE)
provide_find_module(${PACKAGE_NAME} ${ARG_ARROW_CMAKE_PACKAGE_NAME})
list(APPEND ${ARG_ARROW_CMAKE_PACKAGE_NAME_UPPER_SNAKE}_SYSTEM_DEPENDENCIES
${PACKAGE_NAME})
if(NOT ARG_ARROW_PC_PACKAGE_NAME)
set(ARG_ARROW_PC_PACKAGE_NAME "arrow")
endif()
# arrow-flight -> arrow_flight
string(REPLACE "-" "_" ARG_ARROW_PC_PACKAGE_NAME_SNAKE ${ARG_ARROW_PC_PACKAGE_NAME})
# arrow_flight -> ARROW_FLIGHT
string(TOUPPER ${ARG_ARROW_PC_PACKAGE_NAME_SNAKE}
ARG_ARROW_PC_PACKAGE_NAME_UPPER_SNAKE)
if(ARROW_BUILD_STATIC)
find_package(PkgConfig QUIET)
foreach(ARG_PC_PACKAGE_NAME ${ARG_PC_PACKAGE_NAMES})
pkg_check_modules(${ARG_PC_PACKAGE_NAME}_PC
${ARG_PC_PACKAGE_NAME}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
QUIET)
set(RESOLVE_DEPENDENCY_PC_PACKAGE
"pkg-config package for ${ARG_PC_PACKAGE_NAME} ")
string(APPEND RESOLVE_DEPENDENCY_PC_PACKAGE
"that is used by ${ARG_ARROW_PC_PACKAGE_NAME} for static link")
if(${${ARG_PC_PACKAGE_NAME}_PC_FOUND})
message(STATUS "Using ${RESOLVE_DEPENDENCY_PC_PACKAGE}")
string(APPEND ${ARG_ARROW_PC_PACKAGE_NAME_UPPER_SNAKE}_PC_REQUIRES_PRIVATE
" ${ARG_PC_PACKAGE_NAME}")
else()
message(STATUS "${RESOLVE_DEPENDENCY_PC_PACKAGE} isn't found")
endif()
endforeach()
endif()
endif()
endmacro()
# ----------------------------------------------------------------------
# Thirdparty versions, environment variables, source URLs
set(THIRDPARTY_DIR "${arrow_SOURCE_DIR}/thirdparty")
add_library(arrow::flatbuffers INTERFACE IMPORTED)
target_include_directories(arrow::flatbuffers
INTERFACE "${THIRDPARTY_DIR}/flatbuffers/include")
# ----------------------------------------------------------------------
# Some EP's require other EP's
if(PARQUET_REQUIRE_ENCRYPTION)
set(ARROW_JSON ON)
endif()
if(ARROW_WITH_OPENTELEMETRY)
set(ARROW_WITH_NLOHMANN_JSON ON)
set(ARROW_WITH_PROTOBUF ON)
endif()
if(ARROW_THRIFT)
set(ARROW_WITH_ZLIB ON)
endif()
if(ARROW_PARQUET)
set(ARROW_WITH_THRIFT ON)
endif()
if(ARROW_FLIGHT)
set(ARROW_WITH_GRPC ON)
endif()
if(ARROW_WITH_GRPC)
set(ARROW_WITH_RE2 ON)
set(ARROW_WITH_ZLIB ON)
endif()
if(ARROW_GCS)
set(ARROW_WITH_GOOGLE_CLOUD_CPP ON)
set(ARROW_WITH_NLOHMANN_JSON ON)
set(ARROW_WITH_ZLIB ON)
endif()
if(ARROW_AZURE)
set(ARROW_WITH_AZURE_SDK ON)
endif()
if(ARROW_JSON)
set(ARROW_WITH_RAPIDJSON ON)
endif()
if(ARROW_ORC OR ARROW_FLIGHT)
set(ARROW_WITH_PROTOBUF ON)
endif()
if(ARROW_SUBSTRAIT)
set(ARROW_WITH_PROTOBUF ON)
endif()
if(ARROW_S3)
set(ARROW_WITH_ZLIB ON)
endif()
if((NOT ARROW_COMPUTE) AND (NOT ARROW_GANDIVA))
set(ARROW_WITH_UTF8PROC OFF)
endif()
if((NOT ARROW_COMPUTE)
AND (NOT ARROW_GANDIVA)
AND (NOT ARROW_WITH_GRPC))
set(ARROW_WITH_RE2 OFF)
endif()
# ----------------------------------------------------------------------
# Versions and URLs for toolchain builds, which also can be used to configure
# offline builds
# Note: We should not use the Apache dist server for build dependencies
macro(set_urls URLS)
set(${URLS} ${ARGN})
endmacro()
# Read toolchain versions from cpp/thirdparty/versions.txt
file(STRINGS "${THIRDPARTY_DIR}/versions.txt" TOOLCHAIN_VERSIONS_TXT)
foreach(_VERSION_ENTRY ${TOOLCHAIN_VERSIONS_TXT})
# Exclude comments
if(NOT ((_VERSION_ENTRY MATCHES "^[^#][A-Za-z0-9-_]+_VERSION=")
OR (_VERSION_ENTRY MATCHES "^[^#][A-Za-z0-9-_]+_CHECKSUM=")))
continue()
endif()
string(REGEX MATCH "^[^=]*" _VARIABLE_NAME ${_VERSION_ENTRY})
string(REPLACE "${_VARIABLE_NAME}=" "" _VARIABLE_VALUE ${_VERSION_ENTRY})
# Skip blank or malformed lines
if(_VARIABLE_VALUE STREQUAL "")
continue()
endif()
# For debugging
message(STATUS "${_VARIABLE_NAME}: ${_VARIABLE_VALUE}")
set(${_VARIABLE_NAME} ${_VARIABLE_VALUE})
endforeach()
set(THIRDPARTY_MIRROR_URL "https://apache.jfrog.io/artifactory/arrow/thirdparty/7.0.0")
if(DEFINED ENV{ARROW_ABSL_URL})
set(ABSL_SOURCE_URL "$ENV{ARROW_ABSL_URL}")
else()
set_urls(ABSL_SOURCE_URL
"https://github.com/abseil/abseil-cpp/archive/${ARROW_ABSL_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_AUTH_URL})
set(AWS_C_AUTH_SOURCE_URL "$ENV{ARROW_AWS_C_AUTH_URL}")
else()
set_urls(AWS_C_AUTH_SOURCE_URL
"https://github.com/awslabs/aws-c-auth/archive/${ARROW_AWS_C_AUTH_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_CAL_URL})
set(AWS_C_CAL_SOURCE_URL "$ENV{ARROW_AWS_C_CAL_URL}")
else()
set_urls(AWS_C_CAL_SOURCE_URL
"https://github.com/awslabs/aws-c-cal/archive/${ARROW_AWS_C_CAL_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_COMMON_URL})
set(AWS_C_COMMON_SOURCE_URL "$ENV{ARROW_AWS_C_COMMON_URL}")
else()
set_urls(AWS_C_COMMON_SOURCE_URL
"https://github.com/awslabs/aws-c-common/archive/${ARROW_AWS_C_COMMON_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_COMPRESSION_URL})
set(AWS_C_COMPRESSION_SOURCE_URL "$ENV{ARROW_AWS_C_COMPRESSION_URL}")
else()
set_urls(AWS_C_COMPRESSION_SOURCE_URL
"https://github.com/awslabs/aws-c-compression/archive/${ARROW_AWS_C_COMPRESSION_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_EVENT_STREAM_URL})
set(AWS_C_EVENT_STREAM_SOURCE_URL "$ENV{ARROW_AWS_C_EVENT_STREAM_URL}")
else()
set_urls(AWS_C_EVENT_STREAM_SOURCE_URL
"https://github.com/awslabs/aws-c-event-stream/archive/${ARROW_AWS_C_EVENT_STREAM_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_HTTP_URL})
set(AWS_C_HTTP_SOURCE_URL "$ENV{ARROW_AWS_C_HTTP_URL}")
else()
set_urls(AWS_C_HTTP_SOURCE_URL
"https://github.com/awslabs/aws-c-http/archive/${ARROW_AWS_C_HTTP_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_IO_URL})
set(AWS_C_IO_SOURCE_URL "$ENV{ARROW_AWS_C_IO_URL}")
else()
set_urls(AWS_C_IO_SOURCE_URL
"https://github.com/awslabs/aws-c-io/archive/${ARROW_AWS_C_IO_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_MQTT_URL})
set(AWS_C_MQTT_SOURCE_URL "$ENV{ARROW_AWS_C_MQTT_URL}")
else()
set_urls(AWS_C_MQTT_SOURCE_URL
"https://github.com/awslabs/aws-c-mqtt/archive/${ARROW_AWS_C_MQTT_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_S3_URL})
set(AWS_C_S3_SOURCE_URL "$ENV{ARROW_AWS_C_S3_URL}")
else()
set_urls(AWS_C_S3_SOURCE_URL
"https://github.com/awslabs/aws-c-s3/archive/${ARROW_AWS_C_S3_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_C_SDKUTILS_URL})
set(AWS_C_SDKUTILS_SOURCE_URL "$ENV{ARROW_AWS_C_SDKUTILS_URL}")
else()
set_urls(AWS_C_SDKUTILS_SOURCE_URL
"https://github.com/awslabs/aws-c-sdkutils/archive/${ARROW_AWS_C_SDKUTILS_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_CHECKSUMS_URL})
set(AWS_CHECKSUMS_SOURCE_URL "$ENV{ARROW_AWS_CHECKSUMS_URL}")
else()
set_urls(AWS_CHECKSUMS_SOURCE_URL
"https://github.com/awslabs/aws-checksums/archive/${ARROW_AWS_CHECKSUMS_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_CRT_CPP_URL})
set(AWS_CRT_CPP_SOURCE_URL "$ENV{ARROW_AWS_CRT_CPP_URL}")
else()
set_urls(AWS_CRT_CPP_SOURCE_URL
"https://github.com/awslabs/aws-crt-cpp/archive/${ARROW_AWS_CRT_CPP_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWS_LC_URL})
set(AWS_LC_SOURCE_URL "$ENV{ARROW_AWS_LC_URL}")
else()
set_urls(AWS_LC_SOURCE_URL
"https://github.com/awslabs/aws-lc/archive/${ARROW_AWS_LC_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_AWSSDK_URL})
set(AWSSDK_SOURCE_URL "$ENV{ARROW_AWSSDK_URL}")
else()
set_urls(AWSSDK_SOURCE_URL
"https://github.com/aws/aws-sdk-cpp/archive/${ARROW_AWSSDK_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/aws-sdk-cpp-${ARROW_AWSSDK_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_AZURE_SDK_URL})
set(ARROW_AZURE_SDK_URL "$ENV{ARROW_AZURE_SDK_URL}")
else()
set_urls(ARROW_AZURE_SDK_URL
"https://github.com/Azure/azure-sdk-for-cpp/archive/${ARROW_AZURE_SDK_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_BOOST_URL})
set(BOOST_SOURCE_URL "$ENV{ARROW_BOOST_URL}")
else()
string(REPLACE "." "_" ARROW_BOOST_BUILD_VERSION_UNDERSCORES
${ARROW_BOOST_BUILD_VERSION})
set_urls(BOOST_SOURCE_URL
# These are trimmed boost bundles we maintain.
# See cpp/build-support/trim-boost.sh
# FIXME(ARROW-6407) automate uploading this archive to ensure it reflects
# our currently used packages and doesn't fall out of sync with
# ${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}
"${THIRDPARTY_MIRROR_URL}/boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}.tar.gz"
"https://boostorg.jfrog.io/artifactory/main/release/${ARROW_BOOST_BUILD_VERSION}/source/boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}.tar.gz"
"https://sourceforge.net/projects/boost/files/boost/${ARROW_BOOST_BUILD_VERSION}/boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_BROTLI_URL})
set(BROTLI_SOURCE_URL "$ENV{ARROW_BROTLI_URL}")
else()
set_urls(BROTLI_SOURCE_URL
"https://github.com/google/brotli/archive/${ARROW_BROTLI_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/brotli-${ARROW_BROTLI_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_BZIP2_URL})
set(ARROW_BZIP2_SOURCE_URL "$ENV{ARROW_BZIP2_URL}")
else()
set_urls(ARROW_BZIP2_SOURCE_URL
"https://sourceware.org/pub/bzip2/bzip2-${ARROW_BZIP2_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/bzip2-${ARROW_BZIP2_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_CARES_URL})
set(CARES_SOURCE_URL "$ENV{ARROW_CARES_URL}")
else()
string(REPLACE "." "_" ARROW_CARES_BUILD_VERSION_UNDERSCORES
${ARROW_CARES_BUILD_VERSION})
set_urls(CARES_SOURCE_URL
"https://github.com/c-ares/c-ares/releases/download/cares-${ARROW_CARES_BUILD_VERSION_UNDERSCORES}/c-ares-${ARROW_CARES_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/cares-${ARROW_CARES_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_CRC32C_URL})
set(CRC32C_SOURCE_URL "$ENV{ARROW_CRC32C_URL}")
else()
set_urls(CRC32C_SOURCE_URL
"https://github.com/google/crc32c/archive/${ARROW_CRC32C_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_GBENCHMARK_URL})
set(GBENCHMARK_SOURCE_URL "$ENV{ARROW_GBENCHMARK_URL}")
else()
set_urls(GBENCHMARK_SOURCE_URL
"https://github.com/google/benchmark/archive/${ARROW_GBENCHMARK_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/gbenchmark-${ARROW_GBENCHMARK_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_GFLAGS_URL})
set(GFLAGS_SOURCE_URL "$ENV{ARROW_GFLAGS_URL}")
else()
set_urls(GFLAGS_SOURCE_URL
"https://github.com/gflags/gflags/archive/${ARROW_GFLAGS_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/gflags-${ARROW_GFLAGS_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_GLOG_URL})
set(GLOG_SOURCE_URL "$ENV{ARROW_GLOG_URL}")
else()
set_urls(GLOG_SOURCE_URL
"https://github.com/google/glog/archive/${ARROW_GLOG_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/glog-${ARROW_GLOG_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_GOOGLE_CLOUD_CPP_URL})
set(google_cloud_cpp_storage_SOURCE_URL "$ENV{ARROW_GOOGLE_CLOUD_CPP_URL}")
else()
set_urls(google_cloud_cpp_storage_SOURCE_URL
"https://github.com/googleapis/google-cloud-cpp/archive/${ARROW_GOOGLE_CLOUD_CPP_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/google-cloud-cpp-${ARROW_GOOGLE_CLOUD_CPP_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_GRPC_URL})
set(GRPC_SOURCE_URL "$ENV{ARROW_GRPC_URL}")
else()
set_urls(GRPC_SOURCE_URL
"https://github.com/grpc/grpc/archive/${ARROW_GRPC_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/grpc-${ARROW_GRPC_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_GTEST_URL})
set(GTEST_SOURCE_URL "$ENV{ARROW_GTEST_URL}")
else()
set_urls(GTEST_SOURCE_URL
"https://github.com/google/googletest/archive/release-${ARROW_GTEST_BUILD_VERSION}.tar.gz"
"https://chromium.googlesource.com/external/github.com/google/googletest/+archive/release-${ARROW_GTEST_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/gtest-${ARROW_GTEST_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_JEMALLOC_URL})
set(JEMALLOC_SOURCE_URL "$ENV{ARROW_JEMALLOC_URL}")
else()
set_urls(JEMALLOC_SOURCE_URL
"https://github.com/jemalloc/jemalloc/releases/download/${ARROW_JEMALLOC_BUILD_VERSION}/jemalloc-${ARROW_JEMALLOC_BUILD_VERSION}.tar.bz2"
"${THIRDPARTY_MIRROR_URL}/jemalloc-${ARROW_JEMALLOC_BUILD_VERSION}.tar.bz2")
endif()
if(DEFINED ENV{ARROW_MIMALLOC_URL})
set(MIMALLOC_SOURCE_URL "$ENV{ARROW_MIMALLOC_URL}")
else()
set_urls(MIMALLOC_SOURCE_URL
"https://github.com/microsoft/mimalloc/archive/${ARROW_MIMALLOC_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/mimalloc-${ARROW_MIMALLOC_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_NLOHMANN_JSON_URL})
set(NLOHMANN_JSON_SOURCE_URL "$ENV{ARROW_NLOHMANN_JSON_URL}")
else()
set_urls(NLOHMANN_JSON_SOURCE_URL
"https://github.com/nlohmann/json/archive/${ARROW_NLOHMANN_JSON_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_LZ4_URL})
set(LZ4_SOURCE_URL "$ENV{ARROW_LZ4_URL}")
else()
set_urls(LZ4_SOURCE_URL
"https://github.com/lz4/lz4/archive/${ARROW_LZ4_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/lz4-${ARROW_LZ4_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_ORC_URL})
set(ORC_SOURCE_URL "$ENV{ARROW_ORC_URL}")
else()
set_urls(ORC_SOURCE_URL
"https://www.apache.org/dyn/closer.cgi?action=download&filename=/orc/orc-${ARROW_ORC_BUILD_VERSION}/orc-${ARROW_ORC_BUILD_VERSION}.tar.gz"
"https://downloads.apache.org/orc/orc-${ARROW_ORC_BUILD_VERSION}/orc-${ARROW_ORC_BUILD_VERSION}.tar.gz"
"https://github.com/apache/orc/archive/rel/release-${ARROW_ORC_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_OPENTELEMETRY_URL})
set(OPENTELEMETRY_SOURCE_URL "$ENV{ARROW_OPENTELEMETRY_URL}")
else()
# TODO: add mirror
set_urls(OPENTELEMETRY_SOURCE_URL
"https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/${ARROW_OPENTELEMETRY_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_OPENTELEMETRY_PROTO_URL})
set(OPENTELEMETRY_PROTO_SOURCE_URL "$ENV{ARROW_OPENTELEMETRY_PROTO_URL}")
else()
# TODO: add mirror
# N.B. upstream pins to particular commits, not tags
set_urls(OPENTELEMETRY_PROTO_SOURCE_URL
"https://github.com/open-telemetry/opentelemetry-proto/archive/${ARROW_OPENTELEMETRY_PROTO_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_PROTOBUF_URL})
set(PROTOBUF_SOURCE_URL "$ENV{ARROW_PROTOBUF_URL}")
else()
string(SUBSTRING ${ARROW_PROTOBUF_BUILD_VERSION} 1 -1
ARROW_PROTOBUF_STRIPPED_BUILD_VERSION)
# strip the leading `v`
set_urls(PROTOBUF_SOURCE_URL
"https://github.com/protocolbuffers/protobuf/releases/download/${ARROW_PROTOBUF_BUILD_VERSION}/protobuf-all-${ARROW_PROTOBUF_STRIPPED_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/protobuf-${ARROW_PROTOBUF_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_RE2_URL})
set(RE2_SOURCE_URL "$ENV{ARROW_RE2_URL}")
else()
set_urls(RE2_SOURCE_URL
"https://github.com/google/re2/archive/${ARROW_RE2_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/re2-${ARROW_RE2_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_RAPIDJSON_URL})
set(RAPIDJSON_SOURCE_URL "$ENV{ARROW_RAPIDJSON_URL}")
else()
set_urls(RAPIDJSON_SOURCE_URL
"https://github.com/miloyip/rapidjson/archive/${ARROW_RAPIDJSON_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/rapidjson-${ARROW_RAPIDJSON_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_S2N_TLS_URL})
set(S2N_TLS_SOURCE_URL "$ENV{ARROW_S2N_TLS_URL}")
else()
set_urls(S2N_TLS_SOURCE_URL
"https://github.com/aws/s2n-tls/archive/${ARROW_S2N_TLS_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_SNAPPY_URL})
set(SNAPPY_SOURCE_URL "$ENV{ARROW_SNAPPY_URL}")
else()
set_urls(SNAPPY_SOURCE_URL
"https://github.com/google/snappy/archive/${ARROW_SNAPPY_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/snappy-${ARROW_SNAPPY_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_SUBSTRAIT_URL})
set(SUBSTRAIT_SOURCE_URL "$ENV{ARROW_SUBSTRAIT_URL}")
else()
set_urls(SUBSTRAIT_SOURCE_URL
"https://github.com/substrait-io/substrait/archive/${ARROW_SUBSTRAIT_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_THRIFT_URL})
set(THRIFT_SOURCE_URL "$ENV{ARROW_THRIFT_URL}")
else()
set_urls(THRIFT_SOURCE_URL
"https://www.apache.org/dyn/closer.cgi?action=download&filename=/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://downloads.apache.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://apache.claz.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://apache.cs.utah.edu/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://apache.mirrors.lucidnetworks.net/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://apache.osuosl.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://ftp.wayne.edu/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://mirror.olnevhost.net/pub/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://mirrors.gigenet.com/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://mirrors.koehn.com/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://mirrors.ocf.berkeley.edu/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://mirrors.sonic.net/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"https://us.mirrors.quenda.co/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_UCX_URL})
set(ARROW_UCX_SOURCE_URL "$ENV{ARROW_UCX_URL}")
else()
set_urls(ARROW_UCX_SOURCE_URL
"https://github.com/openucx/ucx/archive/v${ARROW_UCX_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_UTF8PROC_URL})
set(ARROW_UTF8PROC_SOURCE_URL "$ENV{ARROW_UTF8PROC_URL}")
else()
set_urls(ARROW_UTF8PROC_SOURCE_URL
"https://github.com/JuliaStrings/utf8proc/archive/${ARROW_UTF8PROC_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_XSIMD_URL})
set(XSIMD_SOURCE_URL "$ENV{ARROW_XSIMD_URL}")
else()
set_urls(XSIMD_SOURCE_URL
"https://github.com/xtensor-stack/xsimd/archive/${ARROW_XSIMD_BUILD_VERSION}.tar.gz"
)
endif()
if(DEFINED ENV{ARROW_ZLIB_URL})
set(ZLIB_SOURCE_URL "$ENV{ARROW_ZLIB_URL}")
else()
set_urls(ZLIB_SOURCE_URL
"https://zlib.net/fossils/zlib-${ARROW_ZLIB_BUILD_VERSION}.tar.gz"
"${THIRDPARTY_MIRROR_URL}/zlib-${ARROW_ZLIB_BUILD_VERSION}.tar.gz")
endif()
if(DEFINED ENV{ARROW_ZSTD_URL})
set(ZSTD_SOURCE_URL "$ENV{ARROW_ZSTD_URL}")
else()
set_urls(ZSTD_SOURCE_URL
"https://github.com/facebook/zstd/releases/download/v${ARROW_ZSTD_BUILD_VERSION}/zstd-${ARROW_ZSTD_BUILD_VERSION}.tar.gz"
)
endif()
# ----------------------------------------------------------------------
# ExternalProject options
set(EP_LIST_SEPARATOR "|")
set(EP_COMMON_OPTIONS LIST_SEPARATOR ${EP_LIST_SEPARATOR})
set(EP_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(EP_C_FLAGS "${CMAKE_C_FLAGS}")
if(NOT MSVC_TOOLCHAIN)
# Set -fPIC on all external projects
string(APPEND EP_CXX_FLAGS " -fPIC")
string(APPEND EP_C_FLAGS " -fPIC")
endif()
# We pass MSVC runtime related options via
# CMAKE_${LANG}_FLAGS_${CONFIG} explicitly because external projects
# may not require CMake 3.15 or later. If an external project doesn't
# require CMake 3.15 or later, CMAKE_MSVC_RUNTIME_LIBRARY is ignored.
# If CMAKE_MSVC_RUNTIME_LIBRARY is ignored, an external project may
# use different MSVC runtime. For example, Apache Arrow C++ uses /MTd
# (multi threaded debug) but an external project uses /MT (multi
# threaded release). It causes an link error.
foreach(CONFIG DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
set(EP_CXX_FLAGS_${CONFIG} "${CMAKE_CXX_FLAGS_${CONFIG}}")
set(EP_C_FLAGS_${CONFIG} "${CMAKE_C_FLAGS_${CONFIG}}")
if(CONFIG STREQUAL DEBUG)
set(EP_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
else()
set(EP_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
endif()
string(APPEND EP_CXX_FLAGS_${CONFIG}
" ${CMAKE_CXX_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_${EP_MSVC_RUNTIME_LIBRARY}}")
string(APPEND EP_C_FLAGS_${CONFIG}
" ${CMAKE_C_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_${EP_MSVC_RUNTIME_LIBRARY}}")
endforeach()
if(MSVC_TOOLCHAIN)
string(REPLACE "/WX" "" EP_CXX_FLAGS_DEBUG "${EP_CXX_FLAGS_DEBUG}")
string(REPLACE "/WX" "" EP_C_FLAGS_DEBUG "${EP_C_FLAGS_DEBUG}")
else()
string(APPEND EP_CXX_FLAGS_DEBUG " -Wno-error")
string(APPEND EP_C_FLAGS_DEBUG " -Wno-error")
endif()
# CC/CXX environment variables are captured on the first invocation of the
# builder (e.g make or ninja) instead of when CMake is invoked into to build
# directory. This leads to issues if the variables are exported in a subshell
# and the invocation of make/ninja is in distinct subshell without the same
# environment (CC/CXX).
set(EP_C_COMPILER "${CMAKE_C_COMPILER}")
if(NOT CMAKE_VERSION VERSION_LESS 3.19)
if(CMAKE_C_COMPILER_ARG1)
separate_arguments(EP_C_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_C_COMPILER_ARG1}")
list(APPEND EP_C_COMPILER ${EP_C_COMPILER_ARGS})
endif()
string(REPLACE ";" ${EP_LIST_SEPARATOR} EP_C_COMPILER "${EP_C_COMPILER}")
endif()
set(EP_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
if(NOT CMAKE_VERSION VERSION_LESS 3.19)
if(CMAKE_CXX_COMPILER_ARG1)
separate_arguments(EP_CXX_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_CXX_COMPILER_ARG1}")
list(APPEND EP_CXX_COMPILER ${EP_CXX_COMPILER_ARGS})
endif()
string(REPLACE ";" ${EP_LIST_SEPARATOR} EP_CXX_COMPILER "${EP_CXX_COMPILER}")
endif()
set(EP_COMMON_TOOLCHAIN "-DCMAKE_C_COMPILER=${EP_C_COMPILER}"
"-DCMAKE_CXX_COMPILER=${EP_CXX_COMPILER}")
if(CMAKE_AR)
# Ensure using absolute path.
find_program(EP_CMAKE_AR ${CMAKE_AR} REQUIRED)
list(APPEND EP_COMMON_TOOLCHAIN -DCMAKE_AR=${EP_CMAKE_AR})
endif()
# RANLIB isn't used for MSVC
if(NOT MSVC)
if(CMAKE_RANLIB)
# Ensure using absolute path.
find_program(EP_CMAKE_RANLIB ${CMAKE_RANLIB} REQUIRED)
list(APPEND EP_COMMON_TOOLCHAIN -DCMAKE_RANLIB=${EP_CMAKE_RANLIB})
endif()
endif()
# External projects are still able to override the following declarations.
# cmake command line will favor the last defined variable when a duplicate is
# encountered. This requires that `EP_COMMON_CMAKE_ARGS` is always the first
# argument.
set(EP_COMMON_CMAKE_ARGS
${EP_COMMON_TOOLCHAIN}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_STATIC_LIBS=ON
-DBUILD_TESTING=OFF
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${EP_CXX_FLAGS_DEBUG}
-DCMAKE_CXX_FLAGS_MISIZEREL=${EP_CXX_FLAGS_MINSIZEREL}
-DCMAKE_CXX_FLAGS_RELEASE=${EP_CXX_FLAGS_RELEASE}
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${EP_CXX_FLAGS_RELWITHDEBINFO}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_C_FLAGS=${EP_C_FLAGS}
-DCMAKE_C_FLAGS_DEBUG=${EP_C_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_MISIZEREL=${EP_C_FLAGS_MINSIZEREL}
-DCMAKE_C_FLAGS_RELEASE=${EP_C_FLAGS_RELEASE}
-DCMAKE_C_FLAGS_RELWITHDEBINFO=${EP_C_FLAGS_RELWITHDEBINFO}
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=${CMAKE_EXPORT_NO_PACKAGE_REGISTRY}
-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE})
# if building with a toolchain file, pass that through
if(CMAKE_TOOLCHAIN_FILE)
list(APPEND EP_COMMON_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
# and crosscompiling emulator (for try_run() )
if(CMAKE_CROSSCOMPILING_EMULATOR)
string(REPLACE ";" ${EP_LIST_SEPARATOR} EP_CMAKE_CROSSCOMPILING_EMULATOR
"${CMAKE_CROSSCOMPILING_EMULATOR}")
list(APPEND EP_COMMON_CMAKE_ARGS
-DCMAKE_CROSSCOMPILING_EMULATOR=${EP_CMAKE_CROSSCOMPILING_EMULATOR})
endif()
if(CMAKE_PROJECT_INCLUDE)
list(APPEND EP_COMMON_CMAKE_ARGS -DCMAKE_PROJECT_INCLUDE=${CMAKE_PROJECT_INCLUDE})
endif()
# Enable s/ccache if set by parent.
if(CMAKE_C_COMPILER_LAUNCHER AND CMAKE_CXX_COMPILER_LAUNCHER)
list(APPEND EP_COMMON_CMAKE_ARGS