Skip to content

Commit

Permalink
Merge pull request #1182 from madebr/arrow_recipe
Browse files Browse the repository at this point in the history
Add arrow/1.0.0 recipe
  • Loading branch information
danimtb committed Aug 18, 2020
2 parents f235046 + b7e7330 commit d6c56be
Show file tree
Hide file tree
Showing 11 changed files with 938 additions and 0 deletions.
7 changes: 7 additions & 0 deletions recipes/arrow/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()

add_subdirectory(source_subfolder/cpp)
14 changes: 14 additions & 0 deletions recipes/arrow/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sources:
"1.0.0":
url: "https://github.com/apache/arrow/archive/apache-arrow-1.0.0.tar.gz"
sha256: "08fbd4c633c08939850d619ca0224c75d7a0526467c721c0838b8aa7efccb270"
patches:
"1.0.0":
- base_path: "source_subfolder"
patch_file: "patches/1.0.0-0001-cmake.patch"
- base_path: "source_subfolder"
patch_file: "patches/1.0.0-0002-jemalloc.patch"
- base_path: "source_subfolder"
patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch"
- base_path: "source_subfolder"
patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch"
479 changes: 479 additions & 0 deletions recipes/arrow/all/conanfile.py

Large diffs are not rendered by default.

151 changes: 151 additions & 0 deletions recipes/arrow/all/patches/1.0.0-0001-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
--- cpp/CMakeLists.txt
+++ cpp/CMakeLists.txt
@@ -654,7 +654,7 @@ endif()

if(ARROW_WITH_BROTLI)
# Order is important for static linking
- set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon)
+ set(ARROW_BROTLI_LIBS Brotli::Brotli)
list(APPEND ARROW_LINK_LIBS ${ARROW_BROTLI_LIBS})
list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS})
endif()
@@ -668,8 +668,8 @@ if(ARROW_WITH_LZ4)
endif()

if(ARROW_WITH_SNAPPY)
- list(APPEND ARROW_STATIC_LINK_LIBS Snappy::snappy)
+ list(APPEND ARROW_STATIC_LINK_LIBS Snappy::Snappy)
endif()

if(ARROW_WITH_ZLIB)
list(APPEND ARROW_STATIC_LINK_LIBS ZLIB::ZLIB)
@@ -685,9 +685,9 @@ if(ARROW_ORC)
endif()

if(ARROW_USE_GLOG)
- list(APPEND ARROW_LINK_LIBS glog::glog)
- list(APPEND ARROW_STATIC_LINK_LIBS glog::glog)
+ list(APPEND ARROW_LINK_LIBS GLOG::GLOG)
+ list(APPEND ARROW_STATIC_LINK_LIBS GLOG::GLOG)
add_definitions("-DARROW_USE_GLOG")
endif()

if(ARROW_S3)
--- cpp/cmake_modules/DefineOptions.cmake
+++ cpp/cmake_modules/DefineOptions.cmake
@@ -76,7 +76,7 @@ macro(define_option_string name description default)
endmacro()

# Top level cmake dir
-if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+if(1)
#----------------------------------------------------------------------
set_option_category("Compile and link")

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -854,7 +854,7 @@ if(ARROW_WITH_SNAPPY)
# location.
# https://bugzilla.redhat.com/show_bug.cgi?id=1679727
# https://src.fedoraproject.org/rpms/snappy/pull-request/1
- find_package(Snappy QUIET HINTS "${CMAKE_ROOT}/Modules/")
+ find_package(Snappy REQUIRED)
if(NOT Snappy_FOUND)
find_package(SnappyAlt)
endif()
@@ -866,14 +866,14 @@ if(ARROW_WITH_SNAPPY)
elseif(Snappy_SOURCE STREQUAL "SYSTEM")
# SnappyConfig.cmake is not installed on Ubuntu/Debian
# TODO: Make a bug report upstream
- find_package(Snappy HINTS "${CMAKE_ROOT}/Modules/")
+ find_package(Snappy REQUIRED)
if(NOT Snappy_FOUND)
find_package(SnappyAlt REQUIRED)
endif()
endif()

# TODO: Don't use global includes but rather target_include_directories
- get_target_property(SNAPPY_INCLUDE_DIRS Snappy::snappy INTERFACE_INCLUDE_DIRECTORIES)
+ get_target_property(SNAPPY_INCLUDE_DIRS Snappy::Snappy INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${SNAPPY_INCLUDE_DIRS})
endif()

@@ -938,7 +938,7 @@ endmacro()
if(ARROW_WITH_BROTLI)
resolve_dependency(Brotli)
# TODO: Don't use global includes but rather target_include_directories
- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon
+ get_target_property(BROTLI_INCLUDE_DIR Brotli::Brotli
INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${BROTLI_INCLUDE_DIR})
endif()
@@ -1057,7 +1057,7 @@ endmacro()
if(ARROW_USE_GLOG)
resolve_dependency(GLOG)
# TODO: Don't use global includes but rather target_include_directories
- get_target_property(GLOG_INCLUDE_DIR glog::glog INTERFACE_INCLUDE_DIRECTORIES)
+ get_target_property(GLOG_INCLUDE_DIR GLOG::GLOG INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${GLOG_INCLUDE_DIR})
endif()

@@ -1139,8 +1139,8 @@
build_gflags()
elseif(gflags_SOURCE STREQUAL "SYSTEM")
- # gflagsConfig.cmake is not installed on Ubuntu/Debian
- # TODO: Make a bug report upstream
- find_package(gflags ${ARROW_GFLAGS_REQUIRED_VERSION})
+ find_package(gflags REQUIRED)
+ add_library(gflags-shared INTERFACE)
+ target_link_libraries(gflags-shared INTERFACE gflags::gflags)
if(NOT gflags_FOUND)
find_package(gflagsAlt ${ARROW_GFLAGS_REQUIRED_VERSION} REQUIRED)
endif()
@@ -1329,6 +1329,6 @@ macro(build_protobuf)
endmacro()
-
if(ARROW_WITH_PROTOBUF)
+ find_package(Protobuf REQUIRED)
if(ARROW_WITH_GRPC)
# gRPC 1.21.0 or later require Protobuf 3.7.0 or later.
set(ARROW_PROTOBUF_REQUIRED_VERSION "3.7.0")
@@ -1365,9 +1365,9 @@ if(ARROW_WITH_PROTOBUF)
set(ARROW_PROTOBUF_LIBPROTOC arrow::protobuf::libprotoc)
else()
if(NOT TARGET protobuf::libprotoc)
+ set(Protobuf_PROTOC_LIBRARY protoc)
if(PROTOBUF_PROTOC_LIBRARY AND NOT Protobuf_PROTOC_LIBRARY)
- # Old CMake versions have a different casing.
- set(Protobuf_PROTOC_LIBRARY ${PROTOBUF_PROTOC_LIBRARY})
+ set(Protobuf_PROTOC_LIBRARY protoc)
endif()
if(NOT Protobuf_PROTOC_LIBRARY)
message(FATAL_ERROR "libprotoc was set to ${Protobuf_PROTOC_LIBRARY}")
@@ -1802,7 +1802,7 @@ if(ARROW_WITH_RAPIDJSON)
elseif(RapidJSON_SOURCE STREQUAL "SYSTEM")
# Fedora packages place the package information at the wrong location.
# https://bugzilla.redhat.com/show_bug.cgi?id=1680400
- find_package(RapidJSON ${ARROW_RAPIDJSON_REQUIRED_VERSION} HINTS "${CMAKE_ROOT}")
+ find_package(RapidJSON REQUIRED)
if(RapidJSON_FOUND)
set(RAPIDJSON_INCLUDE_DIR ${RAPIDJSON_INCLUDE_DIRS})
else()
@@ -2088,7 +2088,7 @@ if(ARROW_WITH_BZ2)
PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}")
endif()
- include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}")
+ include_directories(SYSTEM "${BZip2_INCLUDE_DIR}")
endif()

macro(build_utf8proc)
--- cpp/cmake_modules/SetupCxxFlags.cmake
+++ cpp/cmake_modules/SetupCxxFlags.cmake
@@ -188,7 +188,7 @@
message(STATUS "Arrow build warning level: ${BUILD_WARNING_LEVEL}")

macro(arrow_add_werror_if_debug)
- if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
+ if(0)
# Treat all compiler warnings as errors
if(MSVC)
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /WX")
43 changes: 43 additions & 0 deletions recipes/arrow/all/patches/1.0.0-0002-jemalloc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1407,6 +1407,6 @@ endif()
# jemalloc - Unix-only high-performance allocator
-
if(ARROW_JEMALLOC)
+if(0)
message(STATUS "Building (vendored) jemalloc from source")
# We only use a vendored jemalloc as we want to control its version.
# Also our build of jemalloc is specially prefixed so that it will not
@@ -1465,6 +1465,8 @@ if(ARROW_JEMALLOC)
add_dependencies(jemalloc::jemalloc jemalloc_ep)

list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc)
+else()
+ find_package(jemalloc REQUIRED)
+endif()
endif()
-
# ----------------------------------------------------------------------
# mimalloc - Cross-platform high-performance allocator, from Microsoft
--- cpp/src/arrow/CMakeLists.txt
+++ cpp/src/arrow/CMakeLists.txt
@@ -292,7 +292,7 @@

set(_allocator_dependencies "") # Empty list
if(ARROW_JEMALLOC)
- list(APPEND _allocator_dependencies jemalloc_ep)
+ list(APPEND _allocator_dependencies jemalloc::jemalloc)
endif()
if(ARROW_MIMALLOC)
list(APPEND _allocator_dependencies mimalloc_ep)
--- cpp/src/arrow/memory_pool.cc
+++ cpp/src/arrow/memory_pool.cc
@@ -31,7 +31,7 @@
// Needed to support jemalloc 3 and 4
#define JEMALLOC_MANGLE
// Explicitly link to our version of jemalloc
-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h"
+#include "jemalloc/jemalloc.h"
#endif

#ifdef ARROW_MIMALLOC
13 changes: 13 additions & 0 deletions recipes/arrow/all/patches/1.0.0-0003-fix-shared-msvc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- cpp/src/arrow/CMakeLists.txt
+++ cpp/src/arrow/CMakeLists.txt
@@ -490,6 +490,10 @@
target_compile_definitions(arrow_static PUBLIC ARROW_STATIC)
endif()

+if(ARROW_BUILD_SHARED AND WIN32)
+target_compile_definitions(arrow_shared PRIVATE ARROW_EXPORTING)
+endif()
+
if(ARROW_WITH_BACKTRACE)
find_package(Backtrace)

11 changes: 11 additions & 0 deletions recipes/arrow/all/patches/1.0.0-0004-mallctl-takes-size_t.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- cpp/src/arrow/memory_pool.cc
+++ cpp/src/arrow/CMakeLists.txt
@@ -427,7 +427,7 @@

Status jemalloc_set_decay_ms(int ms) {
#ifdef ARROW_JEMALLOC
- ssize_t decay_time_ms = static_cast<ssize_t>(ms);
+ size_t decay_time_ms = static_cast<size_t>(ms);

int err = mallctl("arenas.dirty_decay_ms", nullptr, nullptr, &decay_time_ms,
sizeof(decay_time_ms));
10 changes: 10 additions & 0 deletions recipes/arrow/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_JEMALLOC)
17 changes: 17 additions & 0 deletions recipes/arrow/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
Loading

0 comments on commit d6c56be

Please sign in to comment.