This is an automated email from the ASF dual-hosted git repository.
deshanxiao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new 16ffee44c ORC-1807: Native support for vcpkg
16ffee44c is described below
commit 16ffee44c02ebdd0f566e76e4594f5dbeb054b77
Author: Deshan Xiao <[email protected]>
AuthorDate: Fri Nov 29 16:05:14 2024 +0800
ORC-1807: Native support for vcpkg
### What changes were proposed in this pull request?
This PR is aimed to add native support for vcpkg.
And the PR in vcpkg is still on going. All tests are passed.
https://github.com/deshanxiao/vcpkg/tree/deshan/remove-patch
### Why are the changes needed?
Currently, we rely on vcpkg's patch mechanism to support vcpkg. Every time
a new version is released, the patch needs to be regenerated, which is very
inconvenient.
We do not need to regenerate the patch any more after the PR.
### How was this patch tested?
Test with vcpkg local branch:
```
vcpkg_from_git(
URL gitgithub.com:deshanxiao/orc.git
OUT_SOURCE_PATH SOURCE_PATH
HEAD_REF deshan/vcpkg
)
```
Then execute cmake with vcpkg
```
(base) deshanxiaodeshanxiao-Virtual-Machine:~/orc/conan/all/test_package$
cmake -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake .
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /home/deshanxiao/vcpkg/installed/x64-linux/lib/libz.a (found
version "1.3.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Protobuf:
/home/deshanxiao/vcpkg/installed/x64-linux/tools/protobuf/protoc (found version
"28.3.0")
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to:
/home/deshanxiao/orc/conan/all/test_package
```
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #2076 from deshanxiao/deshan/orc-1807.
Authored-by: Deshan Xiao <[email protected]>
Signed-off-by: Deshan Xiao <[email protected]>
---
CMakeLists.txt | 7 ++++++-
cmake_modules/ThirdpartyToolchain.cmake | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29cb1af79..b2d23d7ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,7 +156,12 @@ endif ()
enable_testing()
INCLUDE(GNUInstallDirs) # Put it before ThirdpartyToolchain to make
CMAKE_INSTALL_LIBDIR available.
-set(ORC_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/orc)
+
+if (ORC_PACKAGE_KIND STREQUAL "vcpkg")
+ set(ORC_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_DATAROOTDIR}/orc)
+else ()
+ set(ORC_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/orc)
+endif ()
INCLUDE(CheckSourceCompiles)
INCLUDE(ThirdpartyToolchain)
diff --git a/cmake_modules/ThirdpartyToolchain.cmake
b/cmake_modules/ThirdpartyToolchain.cmake
index 447d9a6a4..0a2593692 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -153,6 +153,12 @@ if (ORC_PACKAGE_KIND STREQUAL "conan")
add_resolved_library (orc_snappy ${Snappy_LIBRARIES} ${Snappy_INCLUDE_DIR})
list (APPEND ORC_SYSTEM_DEPENDENCIES Snappy)
list (APPEND ORC_INSTALL_INTERFACE_TARGETS
"$<INSTALL_INTERFACE:Snappy::snappy>")
+elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
+ find_package(Snappy CONFIG REQUIRED)
+ add_library (orc_snappy INTERFACE IMPORTED)
+ target_link_libraries(orc_snappy INTERFACE Snappy::snappy)
+ list (APPEND ORC_SYSTEM_DEPENDENCIES Snappy)
+ list (APPEND ORC_INSTALL_INTERFACE_TARGETS
"$<INSTALL_INTERFACE:Snappy::snappy>")
elseif (NOT "${SNAPPY_HOME}" STREQUAL "")
find_package (Snappy REQUIRED)
if (ORC_PREFER_STATIC_SNAPPY AND SNAPPY_STATIC_LIB)
@@ -197,6 +203,12 @@ if (ORC_PACKAGE_KIND STREQUAL "conan")
add_resolved_library (orc_zlib ${ZLIB_LIBRARIES} ${ZLIB_INCLUDE_DIR})
list (APPEND ORC_SYSTEM_DEPENDENCIES ZLIB)
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:ZLIB::ZLIB>")
+elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
+ find_package(ZLIB REQUIRED)
+ add_library (orc_zlib INTERFACE IMPORTED)
+ target_link_libraries(orc_zlib INTERFACE ZLIB::ZLIB)
+ list (APPEND ORC_SYSTEM_DEPENDENCIES ZLIB)
+ list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:ZLIB::ZLIB>")
elseif (NOT "${ZLIB_HOME}" STREQUAL "")
find_package (ZLIB REQUIRED)
if (ORC_PREFER_STATIC_ZLIB AND ZLIB_STATIC_LIB)
@@ -249,6 +261,12 @@ if (ORC_PACKAGE_KIND STREQUAL "conan")
add_resolved_library (orc_zstd ${zstd_LIBRARIES} ${zstd_INCLUDE_DIR})
list (APPEND ORC_SYSTEM_DEPENDENCIES ZSTD)
list (APPEND ORC_INSTALL_INTERFACE_TARGETS
"$<INSTALL_INTERFACE:$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>>")
+elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
+ find_package(zstd CONFIG REQUIRED)
+ add_library(orc_zstd INTERFACE)
+ target_link_libraries(orc_zstd INTERFACE
$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
+ list(APPEND ORC_SYSTEM_DEPENDENCIES zstd)
+ list(APPEND ORC_INSTALL_INTERFACE_TARGETS
"$<INSTALL_INTERFACE:$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>>")
elseif (NOT "${ZSTD_HOME}" STREQUAL "")
find_package (ZSTD REQUIRED)
if (ORC_PREFER_STATIC_ZSTD AND ZSTD_STATIC_LIB)
@@ -308,6 +326,12 @@ if (ORC_PACKAGE_KIND STREQUAL "conan")
add_resolved_library (orc_lz4 ${lz4_LIBRARIES} ${lz4_INCLUDE_DIR})
list (APPEND ORC_SYSTEM_DEPENDENCIES LZ4)
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:LZ4::lz4>")
+elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
+ find_package(lz4 CONFIG REQUIRED)
+ add_library (orc_lz4 INTERFACE IMPORTED)
+ target_link_libraries(orc_lz4 INTERFACE LZ4::lz4)
+ list (APPEND ORC_SYSTEM_DEPENDENCIES lz4)
+ list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:LZ4::lz4>")
elseif (NOT "${LZ4_HOME}" STREQUAL "")
find_package (LZ4 REQUIRED)
if (ORC_PREFER_STATIC_LZ4 AND LZ4_STATIC_LIB)
@@ -463,6 +487,13 @@ if (ORC_PACKAGE_KIND STREQUAL "conan")
add_resolved_library (orc_protobuf ${protobuf_LIBRARIES}
${protobuf_INCLUDE_DIR})
list (APPEND ORC_SYSTEM_DEPENDENCIES Protobuf)
list (APPEND ORC_INSTALL_INTERFACE_TARGETS
"$<INSTALL_INTERFACE:protobuf::libprotobuf>")
+elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
+ find_package(Protobuf CONFIG REQUIRED)
+ add_library (orc_protobuf INTERFACE IMPORTED)
+ target_link_libraries(orc_protobuf INTERFACE protobuf::libprotobuf)
+ list (APPEND ORC_SYSTEM_DEPENDENCIES Protobuf)
+ list (APPEND ORC_INSTALL_INTERFACE_TARGETS
"$<INSTALL_INTERFACE:protobuf::libprotobuf>")
+ set (PROTOBUF_EXECUTABLE protobuf::protoc)
elseif (NOT "${PROTOBUF_HOME}" STREQUAL "")
find_package (Protobuf REQUIRED)
@@ -526,7 +557,7 @@ else ()
endif ()
add_library (orc::protobuf ALIAS orc_protobuf)
-if (NOT ORC_PACKAGE_KIND STREQUAL "conan")
+if (NOT (ORC_PACKAGE_KIND STREQUAL "conan" OR ORC_PACKAGE_KIND STREQUAL
"vcpkg"))
add_library (orc::protoc ALIAS orc_protoc)
endif ()