Skip to content

Commit c218fc9

Browse files
committed
document new CMake inclusion and installation techniques
1 parent 21a2a43 commit c218fc9

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

sw/README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,53 @@ The Coyote software stack is a vital component of Coyote, providing a high-level
1313

1414
## Using the software
1515

16-
**Compilation**: To compile the software, CMake >= 3.5 and a compiler support C++17 is required. Coyote can be included as a CMake dependency either as a git sumbodule with `add_subdirectory` or from a system-wide installation using the CMake's standard `find_package`. Applications which include Coyote library can be found in any of the examples. Finally, the software can be built with debug prints, which can be enabled through the flags `VERBOSE_DEBUG_1` (for local operations), `VERBOSE_DEBUG_2` (for reconfigurations) and `VERBOSE_DEBUG_3` (for remote operations). Additionlly, when using the Coyote service and scheduler, debug prints and warning can be found in syslog.
16+
**Compilation**: To compile the software, CMake >= 3.5 and a compiler support C++17 is required. Coyote can be included as a CMake dependency either as a git sumbodule with `add_subdirectory` or from a system-wide installation using the CMake's standard `find_package`. Following is a brief explaination of the two approaches:
17+
18+
- `add_subdirectory`: You should use this CMake directive if you're including coyote as a Git submodule for your project. This is a common scenario if you're building an hardware design and a software library to go alongside it. In this case, the most convenient way to keep the Coyote dependency aligned with the hardware side is to include it in CMake directly from the Coyote source code that you already have in your project. To do this, you can use the [`add_subdirectory`]() driective, pointing it to the `sw` folder in the Coyote project. Here's an example for a typical project structure:
19+
```
20+
project/
21+
|- coyote/
22+
|- ...
23+
|- software/
24+
|- CMakeLists.txt
25+
|- src/
26+
```
27+
In that `CMakeLists.txt`, you would add the Coyote dependency as follows
28+
```cmake
29+
add_subdirectory(../coyote/sw coyote)
30+
```
31+
If you want to include the Coyote simulation version of the library, follow the instructions in the [simulation documentation](../sim/README.md).
32+
- `find_package`: You should use this CMake directive if you're including coyote as an external dependency, installed manually or via your system package manager. This is the preferred method when working on a third-party project that doesn't want to pull in Coyote as a git submodule. Please, refer to the installation section below for how to install Coyote system-wide or in a chroot. In this case, you can simply place this CMake directive in the project's `CMakeLists.txt`:
33+
```cmake
34+
find_package(Coyote)
35+
```
36+
You may also use the `CoyoteSimulation` package to run the software against xsim, as described in the [simulation documentation](../sim/README.md).
37+
38+
In both scenarios, after the CMake library has been included, you should link your target against Coyote with the following rules:
39+
```cmake
40+
target_link_libraries(<target> PUBLIC Coyote)
41+
target_include_directories(<target> PRIVATE ${COYOTE_INCLUDE_DIRS})
42+
```
43+
44+
Some applications which include Coyote library can be found in any of the examples. Finally, the software can be built with debug prints, which can be enabled through the flags `VERBOSE_DEBUG_1` (for local operations), `VERBOSE_DEBUG_2` (for reconfigurations) and `VERBOSE_DEBUG_3` (for remote operations). Additionlly, when using the Coyote service and scheduler, debug prints and warning can be found in syslog.
45+
46+
**Installation**: You can compile and install Coyote in your system or in a chroot using the following commands (assuming you're in the sw/ folder):
47+
```bash
48+
$ mkdir build && cd build
49+
$ cmake ..
50+
$ make install
51+
```
52+
53+
When running `make install` you can provide a custom chroot directory where the library should be installed. For example, when you're on the HACC cluster, you will not be able to install the library in `/usr`, so you may wish to install it in a chroot and then point your other projects to look for libraries under that path. Here's an example of how you would do that:
54+
```bash
55+
$ mkdir path/to/chroot
56+
...
57+
# when installing Coyote
58+
$ make DESTDIR=path/to/chroot install
59+
...
60+
# when compiling another project that should link against Coyote
61+
$ cmake -DCMAKE_PREFIX_PATH=path/to/chroot <path>
62+
```
63+
This way, the project will _also_ look for libraries in `path/to/chroot` and find the Coyote library to link against. Note that if you can install the library to a common prefix (i.e., `/`, `/usr`) you will not need to specify the `MAKE_PREFIX_PATH` option.
1764

1865
**Documentation**: All headers files (in `include`) contain extensive documentation about the functions and variables in standard Doxygen form. This documentation should be the first point of reference about the software. The source files (`src`) contain less comments. Harder-to-understand functions and complex code segments include comments, but Coyote's approach is to write smaller, self-contained functions that can be fully explained by the docstring in the accompanying headers.

0 commit comments

Comments
 (0)