1 # Developing and using Seastar
3 ## Configuring the project
5 There are multiple ways to configure Seastar and its dependencies.
7 ### Use system-packages for most dependencies
9 See the instructions in [README.md](./README.md).
11 ### Download and install all external dependencies in a project-specific location
13 - Use `cmake-cooking` to prepare a development environment with all dependencies. This allows for reproducible development environments, but means that approximately 3 GiB of dependencies get installed to `build/_cooking_`:
19 - The same as above, and enable DPDK support:
22 ./cooking.sh -- -DSeastar_DPDK=ON
25 - Use system packages for all dependencies except `dpdk`, which is provided by `cmake-cooking` (and not yet widely available via system package-managers):
31 - Use `cmake-cooking` for all dependencies except for Boost:
37 - The same, but compile in "release" mode:
40 ./cooking.sh -e Boost -t Release
43 ## Using an IDE with CMake support
45 If you use `configure.py` or `cooking.sh` to to configure Seastar, then the easiest way to use an IDE (such as Qt Creator, or CLion) for development is to instruct the IDE, when it invokes CMake, to include the following option:
48 -DCMAKE_PREFIX_PATH=${source_dir}/build/_cooking/installed
51 where `${source_dir}` is the root of the Seastar source tree on your file-system.
53 This will allow the IDE to also index Seastar's dependencies.
55 ## Building the project
62 If you used `configure.py` to configure Seastar, then the build directory will be `build/$mode`. For example, `build/release`.
64 If you use `cooking.sh`, then the build directory will just be `build`.
68 Make sure you are in the "build" directory.
76 - Run distribution tests (these take a long time the first time, but then the dependencies are cached):
88 - Build and run a specific test:
91 ninja test_unit_thread_run
95 ## Building documentation
97 Make sure you are in the "build" directory.
99 - Build all documentation:
105 - Build the tutorial in HTML form:
108 ninja doc_tutorial_html
111 - Build the tutorial in HTML form (one file per chapter):
114 ninja doc_tutorial_html_split
117 - Build the Doxygen documentation:
123 ## Installing the project
125 Choose the install path:
130 ./configure.py --mode=release --prefix=/my/install/path
136 ./cooking.sh -- -DCMAKE_INSTALL_PREFIX=/my/install/path
140 ninja -C build install
143 ## Using Seastar in an application
147 Once Seastar has been installed, it is sufficient to add a dependency on Seastar with
150 find_package (Seastar ${VERSION} REQUIRED)
152 add_executable (my_program
155 target_link_libraries (my_program
156 PRIVATE Seastar::seastar)
159 where `VERSION` is the desired version.
161 If you'd like to use `cmake-cooking` to set up a development environment which includes Seastar and its dependencies (a "recipe"), you can include Seastar as follows:
164 cooking_ingredient (Seastar
165 COOKING_RECIPE <DEFAULT>
170 -DSeastar_TESTING=OFF
171 EXTERNAL_PROJECT_ARGS
172 SOURCE_DIR ${MY_SEASTAR_SOURCE_DIR})
177 Seastar includes a `seastar.pc` file. It can be used from both the
178 install and build directories.
180 Compiling a single file:
182 g++ foo.cc -o foo $(pkg-config --libs --cflags --static /path/to/seastar.pc)
185 Compiling multiple files:
187 // Compiling sources into object files
188 g++ -c $(pkg-config --cflags /path/to/seastar.pc)` foo.cc -o foo.o
189 g++ -c $(pkg-config --cflags /path/to/seastar.pc)` bar.cc -o bar.o
191 // Linking object files into an executable
192 g++ -o foo_bar foo.o bar.o $(pkg-config --libs --static /path/to/seastar.pc)
195 The `--static` flag is needed to include transitive (private) dependencies of `libseastar.a`.