• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..23-Feb-2021-

.gitignoreH A D23-Feb-2021797 1917

README.mdH A D23-Feb-20212.8 KiB8949

build_arrow.shH A D23-Feb-20211 KiB3611

build_example.shH A D23-Feb-2021882 286

docker-compose.ymlH A D23-Feb-20211.4 KiB5247

example.ccH A D23-Feb-20212.6 KiB7446

minimal.dockerfileH A D23-Feb-20211,012 2723

run.shH A D23-Feb-20211.2 KiB4922

run_static.batH A D23-Feb-20212 KiB8973

run_static.shH A D23-Feb-20212 KiB9157

system_dependency.dockerfileH A D23-Feb-20211.4 KiB4440

test.csvH A D23-Feb-202166 43

README.md

1<!---
2  Licensed to the Apache Software Foundation (ASF) under one
3  or more contributor license agreements.  See the NOTICE file
4  distributed with this work for additional information
5  regarding copyright ownership.  The ASF licenses this file
6  to you under the Apache License, Version 2.0 (the
7  "License"); you may not use this file except in compliance
8  with the License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing,
13  software distributed under the License is distributed on an
14  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  KIND, either express or implied.  See the License for the
16  specific language governing permissions and limitations
17  under the License.
18-->
19
20# Minimal C++ build example
21
22This directory showcases a minimal build of Arrow C++ (in `build_arrow.sh`).
23This minimal build is then used by an example third-party C++ project
24using CMake logic to compile and link against the Arrow C++ library
25(in `build_example.sh` and `CMakeLists.txt`).
26
27When run, the example executable reads a file named `test.csv`,
28displays its parsed contents, and then saves them in Arrow IPC format in
29a file named `test.arrow`.
30
31## Running the example
32
33You can run this simple example using [Docker Compose][docker-compose]
34and the given `docker-compose.yml` and dockerfiles, which installs a
35minimal Ubuntu image with a basic C++ toolchain.
36
37Just open a terminal in this directory and run the following commands:
38
39```bash
40docker-compose run --rm minimal
41```
42
43Note that this example mounts two volumes inside the Docker image:
44* `/arrow` points to the Arrow source tree
45* `/io` points to this example directory
46
47## Statically-linked builds
48
49We've provided an example build configuration here with CMake to show how to
50create a statically-linked executable with bundled dependencies.
51
52To run it on Linux, you can use the above Docker image:
53
54```bash
55docker-compose run --rm static
56```
57
58On macOS, you can use the `run_static.sh` but you must set some environment
59variables to point the script to your Arrow checkout, for example:
60
61```bash
62export ARROW_DIR=path/to/arrow-clone
63export EXAMPLE_DIR=$ARROW_DIR/cpp/examples/minimal_build
64export ARROW_BUILD_DIR=$(pwd)/arrow-build
65export EXAMPLE_BUILD_DIR=$(pwd)/example
66
67./run_static.sh
68```
69
70On Windows, you can run `run_static.bat` from the command prompt with Visual
71Studio's command line tools enabled and CMake and ninja build in the path:
72
73```
74call run_static.bat
75```
76
77### Static linking against system libraries
78
79You can also use static libraries of Arrow's dependencies from the
80system. To run this configuration, set
81`ARROW_DEPENDENCY_SOURCE=SYSTEM` for `run_static.sh`. You can use
82`docker-compose` for this too:
83
84```bash
85docker-compose run --rm static-system-dependency
86```
87
88[docker-compose]: https://docs.docker.com/compose/
89