@@ -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,22 @@ 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.),
113- # add its implementation from the SDK:
114- # list(APPEND PLUGIN_SOURCES "${BSK_SDK_RUNTIME_MIN_DIR}/atmosphereBase.cpp")
115-
120+ # bsk_add_swig_module automatically links the required SDK runtime sources —
121+ # no manual list(APPEND) is needed. See the `custom-atm-plugin` example.
116122 bsk_add_swig_module(
117- TARGET myModule
118- INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/myModule/myModule .i"
123+ TARGET exampleCppModule
124+ INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/exampleCppModule/exampleCppModule .i"
119125 SOURCES ${PLUGIN_SOURCES}
120126 INCLUDE_DIRS
121- "${CMAKE_CURRENT_SOURCE_DIR}/myModule "
127+ "${CMAKE_CURRENT_SOURCE_DIR}/exampleCppModule "
122128 "${CMAKE_CURRENT_SOURCE_DIR}/messages"
123- LINK_LIBS bsk::plugin
124129 OUTPUT_DIR "${PKG_DIR}"
125130 )
126131
127- # Optional: generate Python bindings for custom messages
132+ # Optionally generate Python bindings for custom messages
128133 bsk_generate_messages(
129134 OUTPUT_DIR "${PKG_DIR}/messaging"
130135 MSG_HEADERS
@@ -137,17 +142,24 @@ pyproject.toml
137142.. code-block :: toml
138143
139144 [build-system]
140- requires = ["scikit-build-core>=0.9"]
145+ requires = ["scikit-build-core>=0.9.3", "bsk-sdk==2.X.Y", "bsk==2.X.Y", "swig==4.4.1 "]
141146 build-backend = "scikit_build_core.build"
142147
143148 [project]
144149 name = "my-plugin"
145150 version = "1.0.0"
146151 requires-python = ">=3.9"
147- dependencies = ["bsk"]
152+ dependencies = ["bsk==2.X.Y "]
148153
149154 [tool.scikit-build]
150- wheel.packages = []
155+ wheel.packages = ["my_plugin"]
156+
157+ .. note ::
158+
159+ ``bsk-sdk ``, ``bsk ``, and the runtime ``dependencies `` entry must all be
160+ **pinned to the same version **. The SDK compiles BSK sources into your
161+ plugin at build time, so mismatched versions will produce a CMake error.
162+ Replace ``2.X.Y `` with the Basilisk version you are targeting.
151163
152164Building and Installing
153165-----------------------
@@ -162,7 +174,7 @@ Building and Installing
162174 pip install dist/* .whl
163175
164176 # Run unit tests
165- pytest myModule /_UnitTest/ -v
177+ pytest exampleCppModule /_UnitTest/ -v
166178
167179 Publishing to PyPI
168180------------------
0 commit comments