diff --git a/cpp/.gitignore b/cpp/.gitignore index 0033ebe1a..9efb78914 100644 --- a/cpp/.gitignore +++ b/cpp/.gitignore @@ -4,3 +4,4 @@ apidoc/html apidoc/xml +*.log diff --git a/cpp/README.md b/cpp/README.md index 21709bf7e..024735077 100644 --- a/cpp/README.md +++ b/cpp/README.md @@ -88,6 +88,27 @@ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON .. make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores ``` +### Quick Build with Scripts + +For convenience, we provide build scripts for Ubuntu and macOS that configure the following CMake options: + +- `-DBUILD_BENCHMARKS=ON`: Build benchmark executables +- `-DCMAKE_BUILD_TYPE=Debug`: Build in debug mode +- `-DBUILD_TESTS=ON`: Build unit tests +- `-DBUILD_EXAMPLES=ON`: Build example executables + +**Ubuntu:** +```bash +./build_ubuntu.sh +``` + +**macOS:** +```bash +./build_macos.sh +``` + +These scripts will automatically create the build directory, configure with CMake, and compile the project. Build logs will be saved to `build_ubuntu.log` or `build_macos.log`. + After building, you can run the unit tests with: ```bash diff --git a/cpp/build_macos.sh b/cpp/build_macos.sh new file mode 100644 index 000000000..119e2491b --- /dev/null +++ b/cpp/build_macos.sh @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Change this line to your arrow and parquet include path if needed +export CPATH="/opt/homebrew/include:$CPATH" + +cmake -S . -B build_macos \ + -DBUILD_BENCHMARKS=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DBUILD_TESTS=ON \ + -DBUILD_EXAMPLES=ON + +cmake --build build_macos -j8 2>&1 | tee build_macos.log \ No newline at end of file diff --git a/cpp/build_ubuntu.sh b/cpp/build_ubuntu.sh new file mode 100644 index 000000000..82697a091 --- /dev/null +++ b/cpp/build_ubuntu.sh @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +cmake -S . -B build_ubuntu \ + -DBUILD_BENCHMARKS=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DBUILD_TESTS=ON \ + -DBUILD_EXAMPLES=ON + +cmake --build build_ubuntu -j8 2>&1 | tee build_ubuntu.log \ No newline at end of file