Skip to content

Commit faacf8e

Browse files
authored
doc: shared library targets (#164)
1 parent 90d6ae2 commit faacf8e

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

pages/spec/manifest.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,52 @@ source-dir = "lib"
221221
include-dir = "inc"
222222
```
223223

224+
Since `fpm v0.12.0`, a library target can be built as a **monolithic**, **static**, or **shared** library using the `[library]` table in your `fpm.toml`. The build mode is selected via the `type` key:
225+
226+
```toml
227+
[library]
228+
type = "monolithic" # Default: single static archive bundling all code
229+
# type = "static" # Per-package static archives (.a or .lib)
230+
# type = "shared" # Per-package shared libraries (.so, .dll, .dylib)
231+
```
232+
233+
### 📦 Build types
234+
235+
* **`monolithic`** *(default)*:
236+
The root package and all its dependencies are compiled into a single static archive (`.a` or `.lib`). Only the objects required for building the apps, examples, and tests are actually included in the archive; everything else is pruned.
237+
238+
* **`static`**:
239+
Each package is compiled into its own static archive. This can be used to integrate `fpm`-built libraries into other build systems at the archive level.
240+
241+
* **`shared`**:
242+
Each package is compiled into its own shared/dynamic library (`.so`, `.dll`, or `.dylib`). These are linked dynamically, enabling reuse, faster incremental builds, and smaller binaries.
243+
244+
### 🛠️ Platform support
245+
246+
* On **Windows** (including MinGW, MSVC, and Intel compilers), `fpm` also generates:
247+
248+
* A `.lib` import library for each `.dll`
249+
* A `.def` export definition file if required by the compiler
250+
251+
### 📂 Installation layout
252+
253+
When the following setting is enabled:
254+
255+
```toml
256+
[install]
257+
library = true
258+
```
259+
260+
Then all generated library files are installed to the `lib/` subdirectory of the chosen install prefix.
261+
262+
Naming follows the pattern:
263+
264+
```text
265+
lib<package_name>.{a|so|dll|dylib}
266+
```
267+
268+
This convention is versioning-friendly and platform-compatible.
269+
224270
#### Include directory
225271

226272
:::{note}

0 commit comments

Comments
 (0)