Skip to content

Commit 2fa7da9

Browse files
authored
discriminat dev and portable variants (#37)
1 parent 40547d4 commit 2fa7da9

File tree

7 files changed

+426
-76
lines changed

7 files changed

+426
-76
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include(GNUInstallDirs)
66
set(CMAKE_AUTOMOC ON)
77

88
option(LOGOS_PACKAGE_MANAGER_USE_VENDOR "Force use of vendored Logos dependencies" OFF)
9+
option(LGPM_PORTABLE_BUILD "Build for portable variant selection (selects portable LGX variants instead of dev)" OFF)
910

1011
# Allow override from environment or command line
1112
if(NOT DEFINED LOGOS_LIBLOGOS_ROOT)
@@ -171,6 +172,11 @@ else()
171172
add_library(package_manager_plugin SHARED ${PLUGIN_SOURCES})
172173
endif()
173174

175+
# Propagate portable build flag to plugin library
176+
if(LGPM_PORTABLE_BUILD)
177+
target_compile_definitions(package_manager_plugin PRIVATE LGPM_PORTABLE_BUILD=1)
178+
endif()
179+
174180
# Set output name without lib prefix
175181
set_target_properties(package_manager_plugin PROPERTIES
176182
PREFIX "")

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
## Building with Nix (Recommended)
44

55
### Outputs
6-
- `.#lib`: builds the plugin library (`package_manager_plugin.{dylib|so}`)
6+
- `.#lib`: builds the plugin library (`package_manager_plugin.{dylib|so}`) — dev build (selects `-dev` LGX variants)
7+
- `.#lib-portable`: builds the plugin library — portable build (selects portable LGX variants)
78
- `.#logos-package-manager-include`: generates C/C++ headers from the built plugin
8-
- `.#cli`: builds the command-line tool (`lgpm`)
9+
- `.#cli`: builds the command-line tool (`lgpm`) — dev build
10+
- `.#cli-portable`: builds the CLI — portable build
11+
- `.#cli-bundle-dir`: bundled portable CLI (self-contained directory)
912
- `.#default`: combined output exposing both `lib/` and `include/`
1013

1114
### Build the module
@@ -151,6 +154,19 @@ lgpm --release v2.1.0 install waku-module
151154
lgpm --release v2.1.0 list --json
152155
```
153156

157+
## Dev vs Portable Builds
158+
159+
The package manager supports two build modes controlled by the `LGPM_PORTABLE_BUILD` CMake flag:
160+
161+
- **Dev build** (default): Selects LGX variants with `-dev` suffix (e.g., `linux-amd64-dev`). Used in Nix/development environments where libraries resolve from `/nix/store`.
162+
- **Portable build** (`-DLGPM_PORTABLE_BUILD=ON`): Selects portable LGX variants without suffix (e.g., `linux-amd64`). Used in self-contained distributed applications.
163+
164+
This is a compile-time choice with no fallback — a dev build will reject packages that only contain portable variants, and vice versa.
165+
166+
### Variant File
167+
168+
When a package is installed, a `variant` text file is written to the module's installation subdirectory containing the name of the installed variant (e.g., `linux-amd64-dev`).
169+
154170
## Dependencies
155171

156172
- [logos-cpp-sdk](https://github.com/logos-co/logos-cpp-sdk) - Logos C++ SDK and code generator

cmd/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ target_link_libraries(lgpm PRIVATE
2626
# Link lgx library
2727
target_link_libraries(lgpm PRIVATE ${LGX_LIB})
2828

29+
# Propagate portable build flag to CLI
30+
if(LGPM_PORTABLE_BUILD)
31+
target_compile_definitions(lgpm PRIVATE LGPM_PORTABLE_BUILD=1)
32+
endif()
33+
2934
# Set output directory
3035
set_target_properties(lgpm PROPERTIES
3136
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"

0 commit comments

Comments
 (0)