@@ -30,22 +30,29 @@ Prerequisites
3030Plugin Layout
3131-------------
3232
33- Follow the same folder convention as BSK — one folder per module, named
34- identically to the module:
33+ Every plugin needs a Python package directory (``my_plugin/ `` below). This
34+ is the importable namespace your users will ``import `` from, and where both
35+ compiled SWIG extensions and pure-Python modules are installed. C++/SWIG
36+ source trees live alongside it at the repo root and get compiled into that
37+ package at build time. Pure-Python modules can be added directly inside the
38+ package directory with no extra build steps:
3539
3640.. code-block :: text
3741
3842 my-plugin/
3943 ├── pyproject.toml
4044 ├── CMakeLists.txt
41- ├── messages/ # (optional) custom message definitions
45+ ├── my_plugin/ # Python package (SWIG outputs install here too)
46+ │ ├── __init__.py
47+ │ └── examplePythonModule.py # (optional) pure-Python modules
48+ ├── messages/ # (optional) custom message definitions
4249 │ └── MyMsgPayload.h
43- └── myModule/
44- ├── myModule .h
45- ├── myModule .cpp
46- ├── myModule .i
50+ └── exampleCppModule/ # C++/SWIG module source
51+ ├── exampleCppModule .h
52+ ├── exampleCppModule .cpp
53+ ├── exampleCppModule .i
4754 └── _UnitTest/
48- └── test_myModule .py
55+ └── test_exampleCppModule .py
4956
5057 SWIG Interface
5158--------------
@@ -55,14 +62,14 @@ The ``.i`` file is the same as any BSK module. For C++ use
5562
5663.. code-block :: swig
5764
58- %module myModule
65+ %module exampleCppModule
5966 %{
60- #include "myModule .h"
67+ #include "exampleCppModule .h"
6168 %}
6269
6370 %include "swig_common_model.i" /* C++ modules */
6471 /* %include "swig_c_wrap.i" C modules — use %c_wrap_2 instead */
65- %include "myModule .h"
72+ %include "exampleCppModule .h"
6673
6774 If subclassing a BSK base class, ``%include `` its ``.i `` file before yours:
6875
@@ -107,24 +114,23 @@ plugin-specific section:
107114 # Plugin-specific configuration
108115 # ==========================================================================
109116
110- file(GLOB PLUGIN_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myModule /*.cpp")
117+ file(GLOB PLUGIN_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/exampleCppModule /*.cpp")
111118
112119 # If subclassing a BSK base class (AtmosphereBase, DynamicEffector, etc.),
113120 # add its implementation from the SDK:
114121 # list(APPEND PLUGIN_SOURCES "${BSK_SDK_RUNTIME_MIN_DIR}/atmosphereBase.cpp")
115-
122+ # An example of this is in the `custom-atm-plugin` example in the SDK repo.
116123 bsk_add_swig_module(
117- TARGET myModule
118- INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/myModule/myModule .i"
124+ TARGET exampleCppModule
125+ INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/exampleCppModule/exampleCppModule .i"
119126 SOURCES ${PLUGIN_SOURCES}
120127 INCLUDE_DIRS
121- "${CMAKE_CURRENT_SOURCE_DIR}/myModule "
128+ "${CMAKE_CURRENT_SOURCE_DIR}/exampleCppModule "
122129 "${CMAKE_CURRENT_SOURCE_DIR}/messages"
123- LINK_LIBS bsk::plugin
124130 OUTPUT_DIR "${PKG_DIR}"
125131 )
126132
127- # Optional: generate Python bindings for custom messages
133+ # Optionally generate Python bindings for custom messages
128134 bsk_generate_messages(
129135 OUTPUT_DIR "${PKG_DIR}/messaging"
130136 MSG_HEADERS
@@ -137,7 +143,7 @@ pyproject.toml
137143.. code-block :: toml
138144
139145 [build-system]
140- requires = ["scikit-build-core>=0.9"]
146+ requires = ["scikit-build-core>=0.9.3", "bsk-sdk==2.X.Y", "bsk==2.X.Y "]
141147 build-backend = "scikit_build_core.build"
142148
143149 [project]
@@ -147,7 +153,14 @@ pyproject.toml
147153 dependencies = ["bsk"]
148154
149155 [tool.scikit-build]
150- wheel.packages = []
156+ wheel.packages = ["my_plugin"]
157+
158+ .. note ::
159+
160+ Both ``bsk-sdk `` and ``bsk `` must be **pinned to the same version ** in
161+ ``build-system.requires ``. The SDK compiles BSK sources into your plugin
162+ at build time, so mismatched versions will produce a CMake error.
163+ Replace ``2.X.Y `` with the Basilisk version you are targeting.
151164
152165Building and Installing
153166-----------------------
@@ -162,7 +175,7 @@ Building and Installing
162175 pip install dist/* .whl
163176
164177 # Run unit tests
165- pytest myModule /_UnitTest/ -v
178+ pytest exampleCppModule /_UnitTest/ -v
166179
167180 Publishing to PyPI
168181------------------
0 commit comments