Skip to content
Open
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ set(PAIMON_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(PAIMON_BINARY_DIR ${PROJECT_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build_support")
set(PAIMON_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")

include(GNUInstallDirs)
set(PAIMON_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Paimon")
include(DefineOptions)

if(PAIMON_OPTIONAL_INSTALL)
Expand Down Expand Up @@ -473,11 +473,11 @@ write_basic_package_version_file(

configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/PaimonConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/PaimonConfig.cmake"
INSTALL_DESTINATION lib/cmake/Paimon)
INSTALL_DESTINATION ${PAIMON_CMAKE_INSTALL_DIR})

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PaimonConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/PaimonConfigVersion.cmake"
DESTINATION lib/cmake/Paimon)
DESTINATION ${PAIMON_CMAKE_INSTALL_DIR})

config_summary_message()

Expand All @@ -497,3 +497,7 @@ add_subdirectory(test/inte)
if(PAIMON_BUILD_BENCHMARKS)
add_subdirectory(benchmark)
endif()

install(EXPORT PaimonTargets
NAMESPACE Paimon::
DESTINATION ${PAIMON_CMAKE_INSTALL_DIR})
Comment thread
zjw1111 marked this conversation as resolved.
132 changes: 3 additions & 129 deletions PaimonConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,134 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Main library
add_library(paimon_shared SHARED IMPORTED)
set_target_properties(paimon_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_static STATIC IMPORTED)
set_target_properties(paimon_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
@PACKAGE_INIT@

# paimon_parquet_file_format
add_library(paimon_parquet_file_format_shared SHARED IMPORTED)
set_target_properties(paimon_parquet_file_format_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_parquet_file_format.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_parquet_file_format_static STATIC IMPORTED)
set_target_properties(paimon_parquet_file_format_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_parquet_file_format.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
include("${CMAKE_CURRENT_LIST_DIR}/PaimonTargets.cmake")

# paimon_orc_file_format
add_library(paimon_orc_file_format_shared SHARED IMPORTED)
set_target_properties(paimon_orc_file_format_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_orc_file_format.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_orc_file_format_static STATIC IMPORTED)
set_target_properties(paimon_orc_file_format_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_orc_file_format.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_local_file_system
add_library(paimon_local_file_system_shared SHARED IMPORTED)
set_target_properties(paimon_local_file_system_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_local_file_system.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_local_file_system_static STATIC IMPORTED)
set_target_properties(paimon_local_file_system_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_local_file_system.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_avro_file_format
add_library(paimon_avro_file_format_shared SHARED IMPORTED)
set_target_properties(paimon_avro_file_format_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_avro_file_format.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_avro_file_format_static STATIC IMPORTED)
set_target_properties(paimon_avro_file_format_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_avro_file_format.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_blob_file_format
add_library(paimon_blob_file_format_shared SHARED IMPORTED)
set_target_properties(paimon_blob_file_format_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_blob_file_format.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_blob_file_format_static STATIC IMPORTED)
set_target_properties(paimon_blob_file_format_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_blob_file_format.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_file_index
add_library(paimon_file_index_shared SHARED IMPORTED)
set_target_properties(paimon_file_index_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_file_index.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_file_index_static STATIC IMPORTED)
set_target_properties(paimon_file_index_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_file_index.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_global_index
add_library(paimon_global_index_shared SHARED IMPORTED)
set_target_properties(paimon_global_index_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_global_index.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_global_index_static STATIC IMPORTED)
set_target_properties(paimon_global_index_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_global_index.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_jindo_file_system
add_library(paimon_jindo_file_system_shared SHARED IMPORTED)
set_target_properties(paimon_jindo_file_system_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_jindo_file_system.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_jindo_file_system_static STATIC IMPORTED)
set_target_properties(paimon_jindo_file_system_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_jindo_file_system.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_lance_file_format
add_library(paimon_lance_file_format_shared SHARED IMPORTED)
set_target_properties(paimon_lance_file_format_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_lance_file_format.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_lance_file_format_static STATIC IMPORTED)
set_target_properties(paimon_lance_file_format_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_lance_file_format.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)

# paimon_lumina_index
add_library(paimon_lumina_index_shared SHARED IMPORTED)
set_target_properties(paimon_lumina_index_shared PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_lumina_index.so"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
add_library(paimon_lumina_index_static STATIC IMPORTED)
set_target_properties(paimon_lumina_index_static PROPERTIES
IMPORTED_LOCATION "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpaimon_lumina_index.a"
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/include"
)
check_required_components(Paimon)
Comment thread
zjw1111 marked this conversation as resolved.
14 changes: 7 additions & 7 deletions ci/scripts/build_paimon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ source_dir=${1}
enable_sanitizer=${2:-false}
check_clang_tidy=${3:-false}
build_type=${4:-Debug}
build_dir=${1}/build
build_dir="${source_dir}/build"

# Display ccache status if available
if command -v ccache &> /dev/null; then
Expand All @@ -31,8 +31,8 @@ else
echo "=== ccache not found, compiling without cache acceleration ==="
fi

mkdir ${build_dir}
pushd ${build_dir}
mkdir -p "${build_dir}"
pushd "${build_dir}"

ENABLE_LUMINA="ON"
ENABLE_LANCE="ON"
Expand Down Expand Up @@ -62,9 +62,9 @@ if [[ "${enable_sanitizer}" == "true" ]]; then
)
fi

cmake "${CMAKE_ARGS[@]}" ${source_dir}
cmake --build . -- -j$(nproc)
ctest --output-on-failure -j $(nproc)
cmake "${CMAKE_ARGS[@]}" "${source_dir}"
cmake --build . -- -j "$(nproc)"
ctest --output-on-failure -j "$(nproc)"

if [[ "${check_clang_tidy}" == "true" ]]; then
cmake --build . --target check-clang-tidy
Expand All @@ -78,4 +78,4 @@ fi

popd

rm -rf ${build_dir}
rm -rf "${build_dir}"
4 changes: 2 additions & 2 deletions cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function(add_paimon_lib LIB_NAME)
endif()

install(TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL}
EXPORT ${LIB_NAME}_targets
EXPORT PaimonTargets
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down Expand Up @@ -233,7 +233,7 @@ function(add_paimon_lib LIB_NAME)
PUBLIC "$<BUILD_INTERFACE:paimon_sanitizer_flags>")

install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL}
EXPORT ${LIB_NAME}_targets
EXPORT PaimonTargets
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
32 changes: 16 additions & 16 deletions docs/source/build_system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ for data format and file system.
find_package(Paimon REQUIRED)

add_executable(my_example my_example.cc)
target_link_libraries(my_example PRIVATE arrow_shared
paimon_shared
paimon_parquet_file_format_shared
paimon_local_file_system_shared)
target_link_libraries(my_example PRIVATE Arrow::arrow_shared
Paimon::paimon_shared
Paimon::paimon_parquet_file_format_shared
Paimon::paimon_local_file_system_shared)

Available variables and targets
-------------------------------
Expand All @@ -61,10 +61,10 @@ The directive ``find_package(Paimon REQUIRED)`` instructs CMake to locate a
Paimon C++ installation on your system. If successful, it sets ``Paimon_FOUND``
to true if the Paimon C++ libraries were found.

It also defines the following linkable targets (plain strings, not variables):
It also defines the following linkable imported targets:

* ``paimon_shared`` links to the Paimon shared libraries
* ``paimon_static`` links to the Paimon static libraries
* ``Paimon::paimon_shared`` links to the Paimon shared libraries
* ``Paimon::paimon_static`` links to the Paimon static libraries

In most cases, it is recommended to use the Paimon shared libraries.

Expand All @@ -75,21 +75,21 @@ Paimon provides a set of built-in optional plugins that you can link to as neede

- File format plugins:

- ``paimon_parquet_file_format_shared`` / ``paimon_parquet_file_format_static``
- ``paimon_orc_file_format_shared`` / ``paimon_orc_file_format_static``
- ``paimon_avro_file_format_shared`` / ``paimon_avro_file_format_static``
- ``paimon_blob_file_format_shared`` / ``paimon_blob_file_format_static``
- ``paimon_lance_file_format_shared`` / ``paimon_lance_file_format_static``
- ``Paimon::paimon_parquet_file_format_shared`` / ``Paimon::paimon_parquet_file_format_static``
- ``Paimon::paimon_orc_file_format_shared`` / ``Paimon::paimon_orc_file_format_static``
- ``Paimon::paimon_avro_file_format_shared`` / ``Paimon::paimon_avro_file_format_static``
- ``Paimon::paimon_blob_file_format_shared`` / ``Paimon::paimon_blob_file_format_static``
- ``Paimon::paimon_lance_file_format_shared`` / ``Paimon::paimon_lance_file_format_static``

- File system plugins:

- ``paimon_local_file_system_shared`` / ``paimon_local_file_system_static``
- ``paimon_jindo_file_system_shared`` / ``paimon_jindo_file_system_static``
- ``Paimon::paimon_local_file_system_shared`` / ``Paimon::paimon_local_file_system_static``
- ``Paimon::paimon_jindo_file_system_shared`` / ``Paimon::paimon_jindo_file_system_static``

- Index plugins:

- ``paimon_file_index_shared`` / ``paimon_file_index_static``
- ``paimon_lumina_index_shared`` / ``paimon_lumina_index_static``
- ``Paimon::paimon_file_index_shared`` / ``Paimon::paimon_file_index_static``
- ``Paimon::paimon_lumina_index_shared`` / ``Paimon::paimon_lumina_index_static``

.. note::

Expand Down
22 changes: 10 additions & 12 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,18 @@ find_package(Paimon CONFIG REQUIRED)
add_executable(read_write_demo read_write_demo.cpp)
add_executable(clean_demo clean_demo.cpp)

include_directories(${PAIMON_INCLUDE_DIRS})

set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed ${CMAKE_EXE_LINKER_FLAGS}")

target_link_libraries(read_write_demo
PRIVATE arrow_shared
paimon_shared
paimon_parquet_file_format_shared
paimon_orc_file_format_shared
paimon_local_file_system_shared)
PRIVATE Arrow::arrow_shared
Paimon::paimon_shared
Paimon::paimon_parquet_file_format_shared
Paimon::paimon_orc_file_format_shared
Paimon::paimon_local_file_system_shared)

target_link_libraries(clean_demo
PRIVATE arrow_shared
paimon_shared
paimon_parquet_file_format_shared
paimon_orc_file_format_shared
paimon_local_file_system_shared)
PRIVATE Arrow::arrow_shared
Paimon::paimon_shared
Paimon::paimon_parquet_file_format_shared
Paimon::paimon_orc_file_format_shared
Paimon::paimon_local_file_system_shared)