Skip to content

Commit

Permalink
compile
Browse files Browse the repository at this point in the history
Signed-off-by: sunby <[email protected]>
  • Loading branch information
sunby committed Apr 22, 2024
1 parent 5910d91 commit ae0e08c
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
46 changes: 46 additions & 0 deletions cpp/cmake/libarrow.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
function(build_arrow)
include(ExternalProject)
set(ARROW_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/arrow-ep)

file(MAKE_DIRECTORY
${ARROW_PREFIX}
"${ARROW_PREFIX}/include"
"${ARROW_PREFIX}/lib"
)
ExternalProject_Add(
arrow_ep
GIT_REPOSITORY [email protected]:apache/arrow.git
GIT_TAG 740889f
CMAKE_ARGS
-DARROW_PARQUET=ON
-DARROW_FILESYSTEM=ON
-DARROW_S3=ON
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
SOURCE_SUBDIR cpp
INSTALL_DIR ${ARROW_PREFIX}
)

ExternalProject_Get_Property(arrow_ep install_dir)

message(STATUS ${CMAKE_CURRENT_BINARY_DIR}/arrow_ep-prefix/src/arrow_ep-build/release/libparquet.so)
add_library(libarrow SHARED IMPORTED)
set_target_properties(libarrow
PROPERTIES
IMPORTED_GLOBAL TRUE
IMPORTED_LOCATION ${ARROW_PREFIX}/lib/libarrow.so
INTERFACE_INCLUDE_DIRECTORIES ${install_dir}/include/
)

add_library(libparquet SHARED IMPORTED)
set_target_properties(libparquet
PROPERTIES
IMPORTED_GLOBAL TRUE
IMPORTED_LOCATION ${ARROW_PREFIX}/lib/libparquet.so
INTERFACE_INCLUDE_DIRECTORIES ${install_dir}/include/
)

add_dependencies(libarrow arrow_ep)
add_dependencies(libparquet arrow_ep)
endfunction()

build_arrow()
32 changes: 32 additions & 0 deletions cpp/cmake/libglog.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function(build_glog)
include(ExternalProject)
set(GLOG_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/glog-ep)

file(MAKE_DIRECTORY
${GLOG_PREFIX}
"${GLOG_PREFIX}/include"
"${GLOG_PREFIX}/lib"
)
ExternalProject_Add(
glog_ep
GIT_REPOSITORY [email protected]:google/glog.git
GIT_TAG v0.6.0
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
INSTALL_DIR ${GLOG_PREFIX}
)

ExternalProject_Get_Property(glog_ep install_dir)

add_library(libglog SHARED IMPORTED)
set_target_properties(libglog
PROPERTIES
IMPORTED_GLOBAL TRUE
IMPORTED_LOCATION ${GLOG_PREFIX}/lib/libglog.so
INTERFACE_INCLUDE_DIRECTORIES ${install_dir}/include/
)

add_dependencies(libglog glog_ep)
endfunction()

build_glog()
3 changes: 3 additions & 0 deletions cpp/thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_subdirectory(gtest)
add_subdirectory(boost)
add_subdirectory(protobuf)
12 changes: 12 additions & 0 deletions cpp/thirdparty/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include(FetchContent)

message(STATUS "Fetching Boost 1.84.0")
FetchContent_Declare(
Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
URL_MD5 893b5203b862eb9bbd08553e24ff146a
DOWNLOAD_EXTRACT_TIMESTAMP ON
)

set(BOOST_INCLUDE_LIBRARIES uuid algorithm filesystem)
FetchContent_MakeAvailable(Boost)
10 changes: 10 additions & 0 deletions cpp/thirdparty/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include(FetchContent)

message(STATUS "Fetching googletest")
FetchContent_Declare(
googletest
GIT_REPOSITORY [email protected]:google/googletest.git
GIT_TAG v1.13.0
)

FetchContent_MakeAvailable(googletest)
11 changes: 11 additions & 0 deletions cpp/thirdparty/protobuf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include(FetchContent)

message(STATUS "Fetching protobuf")
FetchContent_Declare(protobuf
GIT_REPOSITORY [email protected]:protocolbuffers/protobuf.git
GIT_TAG v3.21.4
)

set(protobuf_BUILD_TESTS OFF)
set(protobuf_BUILD_PROTOC_BINARIES OFF)
FetchContent_MakeAvailable(protobuf)

0 comments on commit ae0e08c

Please sign in to comment.