kou commented on code in PR #37311:
URL: https://github.com/apache/arrow/pull/37311#discussion_r1302186757
##########
cpp/examples/tutorial_examples/CMakeLists.txt:
##########
@@ -23,6 +23,7 @@ find_package(Arrow REQUIRED)
get_filename_component(ARROW_CONFIG_PATH ${Arrow_CONFIG} DIRECTORY)
find_package(Parquet REQUIRED HINTS ${ARROW_CONFIG_PATH})
+find_package(ArrowAcero REQUIRED HINTS ${ARROW_CONFIG_PATH})
find_package(ArrowDataset REQUIRED HINTS ${ARROW_CONFIG_PATH})
Review Comment:
One more FYI: We need only `find_package(ArrowDataset)` in this case. Other
`find_package(Arrow*)` and `find_package(Parquet)` are found implicitly by
`find_package(ArrowDataset)`.
##########
cpp/examples/tutorial_examples/CMakeLists.txt:
##########
@@ -23,6 +23,7 @@ find_package(Arrow REQUIRED)
get_filename_component(ARROW_CONFIG_PATH ${Arrow_CONFIG} DIRECTORY)
find_package(Parquet REQUIRED HINTS ${ARROW_CONFIG_PATH})
+find_package(ArrowAcero REQUIRED HINTS ${ARROW_CONFIG_PATH})
find_package(ArrowDataset REQUIRED HINTS ${ARROW_CONFIG_PATH})
Review Comment:
FYI: It's out-of-scope of this PR but `REQUIRED HINTS ...` should not be
needed in the recent Arrow C++:
```suggestion
find_package(Parquet)
find_package(ArrowAcero)
find_package(ArrowDataset)
```
##########
cpp/examples/tutorial_examples/run.sh:
##########
@@ -45,6 +45,8 @@ echo "== Running example project"
echo "=="
echo
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
Review Comment:
Because Arrow C++ is installed to `/usr/local/`. `build_arrow.sh` doesn't
specify `CMAKE_INSTALL_PREFIX` explicitly. `/usr/local/` is used in this case.
We may want to specify `CMAKE_INSTALL_PREFIX` explicitly and use rpath
instead of setting `LD_LIBRARY_PATH`:
```diff
diff --git a/cpp/examples/tutorial_examples/build_example.sh
b/cpp/examples/tutorial_examples/build_example.sh
index a315755a5..0b279890a 100755
--- a/cpp/examples/tutorial_examples/build_example.sh
+++ b/cpp/examples/tutorial_examples/build_example.sh
@@ -21,7 +21,7 @@ set -ex
mkdir -p $EXAMPLE_BUILD_DIR
pushd $EXAMPLE_BUILD_DIR
-cmake /io
+cmake /io $EXAMPLE_CMAKE_OPTIONS
make
popd
diff --git a/cpp/examples/tutorial_examples/run.sh
b/cpp/examples/tutorial_examples/run.sh
index ed319a9d3..b7dad5957 100755
--- a/cpp/examples/tutorial_examples/run.sh
+++ b/cpp/examples/tutorial_examples/run.sh
@@ -22,6 +22,7 @@ cd /io
export ARROW_BUILD_DIR=/build/arrow
export EXAMPLE_BUILD_DIR=/build/example
+export ARROW_INSTALL_DIR=/build/arrow-install
echo
echo "=="
@@ -29,7 +30,8 @@ echo "== Building Arrow C++ library"
echo "=="
echo
-./build_arrow.sh
+ARROW_CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=${ARROW_INSTALL_DIR}" \
+ ./build_arrow.sh
echo
echo "=="
@@ -37,7 +39,8 @@ echo "== Building example project using Arrow C++ library"
echo "=="
echo
-./build_example.sh
+EXAMPLE_CMAKE_OPTIONS="-DCMAKE_INSTALL_RPATH=${ARROW_INSTALL_DIR}/lib" \
+ ./build_example.sh
echo
echo "=="
```
##########
cpp/examples/tutorial_examples/CMakeLists.txt:
##########
@@ -44,5 +45,7 @@ add_executable(compute_example compute_example.cc)
target_link_libraries(compute_example PRIVATE Arrow::arrow_shared)
add_executable(dataset_example dataset_example.cc)
-target_link_libraries(dataset_example PRIVATE Arrow::arrow_shared
Parquet::parquet_shared
-
ArrowDataset::arrow_dataset_shared)
+target_link_libraries(dataset_example
+ PRIVATE Arrow::arrow_shared Parquet::parquet_shared
+ ArrowAcero::arrow_acero_shared
+ ArrowDataset::arrow_dataset_shared)
Review Comment:
I hope that the following works because `ArrowDataset::arrow_dataset_shared`
depends on `*::{parquet,arrow_acero,arrow}_shared`:
```suggestion
target_link_libraries(dataset_example PRIVATE
ArrowDataset::arrow_dataset_shared)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]