Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/actions/setup-bsk/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Set up Basilisk
description: >
Clones the Basilisk source tree and installs the BSK Python package,
Clones the Basilisk source tree and installs the BSK Python package set,
beta/alpha => develop branch clone + nightly wheel index
rc => release tag clone + TestPyPI
release => release tag clone + PyPI
Expand All @@ -15,7 +15,7 @@ inputs:
description: Clone Basilisk source to external/basilisk (needed for sync_all.py)
default: "true"
install-package:
description: pip-install the BSK Python package into the current environment
description: pip-install the BSK Python package set into the current environment
default: "true"

runs:
Expand All @@ -34,7 +34,7 @@ runs:
git clone --depth 1 --branch "$REF" \
https://github.com/AVSLab/basilisk.git external/basilisk

- name: Install BSK Python package
- name: Install BSK Python package set
if: inputs.install-package == 'true'
shell: bash
run: |
Expand All @@ -43,12 +43,12 @@ runs:
pip install --pre \
--index-url https://avslab.github.io/basilisk/nightly/ \
--extra-index-url https://pypi.org/simple/ \
bsk
"bsk[all]"
elif [[ "$BSK" =~ rc ]]; then
pip install --pre \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
"bsk==${BSK}"
"bsk[all]==${BSK}"
else
pip install "bsk==${BSK}"
pip install "bsk[all]==${BSK}"
fi
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
pip install --pre \
--index-url https://avslab.github.io/basilisk/nightly/ \
--extra-index-url https://pypi.org/simple/ \
bsk
"bsk[all]"

- name: Sync and build SDK
run: |
Expand Down
1 change: 1 addition & 0 deletions build_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def _required_sync_files(repo_root: Path) -> list[Path]:
msg_auto = repo_root / "tools" / "msgAutoSource"
return [
repo_root / "src" / "bsk_sdk" / "_bsk_version.txt",
msg_auto / "generatePayloadEqualityHeader.py",
msg_auto / "generatePayloadMetaJson.py",
msg_auto / "generateSWIGModules.py",
msg_auto / "msgInterfacePy.i.in",
Expand Down
2 changes: 1 addition & 1 deletion cmake/bsk-sdkConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function(_bsk_sdk_check_basilisk_version)
" Installed Basilisk is ${_bsk_installed_version}\n\n"
"Plugins compiled against mismatched headers will have ABI incompatibilities.\n"
"Either install the matching Basilisk version or re-sync the SDK:\n"
" pip install bsk==${BSK_SDK_BSK_VERSION}\n"
" pip install \"bsk[all]==${BSK_SDK_BSK_VERSION}\"\n"
" # or: cd external/basilisk && git checkout v${_bsk_installed_version} && cd ../.. && python3 tools/sync_all.py"
)
endif()
Expand Down
16 changes: 15 additions & 1 deletion cmake/bsk_add_swig_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,21 @@ macro(_bsk_find_build_deps)
find_package(SWIG REQUIRED COMPONENTS python)
include(${SWIG_USE_FILE})
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module NumPy)
find_package(Eigen3 CONFIG REQUIRED)

if(NOT TARGET Eigen3::Eigen)
find_package(Eigen3 CONFIG QUIET)
endif()
if(NOT TARGET Eigen3::Eigen)
if(DEFINED BSK_SDK_INCLUDE_DIR
AND EXISTS "${BSK_SDK_INCLUDE_DIR}/eigen3/Eigen/Core")
add_library(Eigen3::Eigen IMPORTED INTERFACE GLOBAL)
set_target_properties(Eigen3::Eigen PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BSK_SDK_INCLUDE_DIR}/eigen3"
)
else()
find_package(Eigen3 CONFIG REQUIRED)
endif()
endif()
endmacro()

# Collect SDK implementation sources to compile directly into the plugin.
Expand Down
61 changes: 53 additions & 8 deletions cmake/bsk_generate_messages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/bsk_add_swig_module.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/bsk_add_swig_module.cmake")
endif()

# Locate the msgAutoSource directory that ships generateSWIGModules.py and
# generatePayloadMetaJson.py. Both scripts must be present — the JSON
# generator was added in BSK 2.11 and is required by bsk_generate_messages().
# Locate the msgAutoSource directory that ships the message generators. These
# scripts must be present — the JSON and equality generators were added in BSK
# 2.11 and are required by bsk_generate_messages().
function(_bsk_resolve_msg_autosource_dir out_var)
if(DEFINED BSK_SDK_MSG_AUTOSOURCE_DIR
AND EXISTS "${BSK_SDK_MSG_AUTOSOURCE_DIR}/generateSWIGModules.py"
AND EXISTS "${BSK_SDK_MSG_AUTOSOURCE_DIR}/generatePayloadMetaJson.py")
AND EXISTS "${BSK_SDK_MSG_AUTOSOURCE_DIR}/generatePayloadMetaJson.py"
AND EXISTS "${BSK_SDK_MSG_AUTOSOURCE_DIR}/generatePayloadEqualityHeader.py")
set(${out_var} "${BSK_SDK_MSG_AUTOSOURCE_DIR}" PARENT_SCOPE)
return()
endif()
Expand All @@ -48,7 +49,8 @@ function(_bsk_resolve_msg_autosource_dir out_var)

foreach(_cand IN LISTS _candidates)
if(EXISTS "${_cand}/generateSWIGModules.py"
AND EXISTS "${_cand}/generatePayloadMetaJson.py")
AND EXISTS "${_cand}/generatePayloadMetaJson.py"
AND EXISTS "${_cand}/generatePayloadEqualityHeader.py")
set(${out_var} "${_cand}" PARENT_SCOPE)
return()
endif()
Expand All @@ -57,7 +59,8 @@ function(_bsk_resolve_msg_autosource_dir out_var)
string(JOIN "\n " _cand_list ${_candidates})
message(FATAL_ERROR
"bsk-sdk message generators not found.\n\n"
"Looked for generateSWIGModules.py and generatePayloadMetaJson.py under:\n"
"Looked for generateSWIGModules.py, generatePayloadMetaJson.py, and "
"generatePayloadEqualityHeader.py under:\n"
" ${_cand_list}\n\n"
"Re-sync the SDK tools (requires BSK >= 2.11):\n"
" python3 tools/sync_all.py --sync-submodules\n\n"
Expand Down Expand Up @@ -89,6 +92,7 @@ function(bsk_generate_messages)

set(_gen_swig "${_msg_autosrc}/generateSWIGModules.py")
set(_gen_meta "${_msg_autosrc}/generatePayloadMetaJson.py")
set(_gen_eq "${_msg_autosrc}/generatePayloadEqualityHeader.py")
set(_auto_root "${CMAKE_CURRENT_BINARY_DIR}/autoSource")
set(_json_dir "${_auto_root}/cMsgMeta")
file(MAKE_DIRECTORY "${_json_dir}")
Expand Down Expand Up @@ -131,6 +135,32 @@ function(bsk_generate_messages)
VERBATIM
)

# Generate the per-payload equality traits header included by the SWIG
# template. Basilisk's generator includes payload headers below
# "architecture/${_eq_payload_search_dir}", so create a forwarding include
# tree in autoSource that points back to the plugin's real payload header.
set(_eq_payload_search_dir "bskSdkPluginPayloads")
Comment thread
schaubh marked this conversation as resolved.
file(TO_CMAKE_PATH "${_hdr_abs}" _hdr_include)
set(_eq_forward_dir "${_auto_root}/architecture/${_eq_payload_search_dir}")
set(_eq_forward_hdr "${_eq_forward_dir}/${_payload_name}.h")
file(MAKE_DIRECTORY "${_eq_forward_dir}")
file(WRITE "${_eq_forward_hdr}"
"#pragma once\n"
"#include \"${_hdr_include}\"\n"
)

set(_eq_out "${_auto_root}/${_payload_name}_equality.h")
add_custom_command(
OUTPUT "${_eq_out}"
COMMAND ${Python3_EXECUTABLE}
"${_gen_eq}"
"${_eq_out}" "${_meta_out}" "${_payload_name}" "${_eq_payload_search_dir}"
DEPENDS "${_meta_out}" "${_gen_eq}" "${_eq_forward_hdr}"
WORKING_DIRECTORY "${_msg_autosrc}"
COMMENT "Generating payload equality header for ${_payload_name}"
VERBATIM
)

# Generate the .i interface file from the JSON
set(_i_out "${_auto_root}/${_payload_name}.i")
add_custom_command(
Expand All @@ -140,7 +170,7 @@ function(bsk_generate_messages)
"${_i_out}" "${_hdr_abs}" "${_payload_name}" "${_hdr_dir}"
"${_gen_c}"
"${_meta_out}" 0
DEPENDS "${_hdr_abs}" "${_meta_out}" "${_gen_swig}" "${_msg_autosrc}/msgInterfacePy.i.in"
DEPENDS "${_hdr_abs}" "${_meta_out}" "${_eq_out}" "${_gen_swig}" "${_msg_autosrc}/msgInterfacePy.i.in"
WORKING_DIRECTORY "${_msg_autosrc}"
COMMENT "Generating SWIG interface for ${_payload_name}"
VERBATIM
Expand Down Expand Up @@ -169,6 +199,21 @@ function(bsk_generate_messages)
endif()
endif()

if(NOT EXISTS "${_eq_out}")
execute_process(
COMMAND ${Python3_EXECUTABLE}
"${_gen_eq}"
"${_eq_out}" "${_meta_out}" "${_payload_name}" "${_eq_payload_search_dir}"
WORKING_DIRECTORY "${_msg_autosrc}"
RESULT_VARIABLE _gen_rc
ERROR_VARIABLE _gen_err
)
if(NOT _gen_rc EQUAL 0)
message(FATAL_ERROR
"generatePayloadEqualityHeader.py failed for ${_payload_name}:\n${_gen_err}")
endif()
endif()

if(NOT EXISTS "${_i_out}")
execute_process(
COMMAND ${Python3_EXECUTABLE}
Expand Down Expand Up @@ -203,7 +248,7 @@ function(bsk_generate_messages)

_bsk_configure_swig_target(
${_payload_name} "${BSK_OUTPUT_DIR}" "${BSK_TARGET_LINK_LIBS}"
"${BSK_INCLUDE_DIRS};${_hdr_dir}"
"${BSK_INCLUDE_DIRS};${_hdr_dir};${_auto_root}"
)

if(_bsk_msg_sdk_sources)
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-atm-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ custom-atm-plugin/
## Building

```bash
pip install bsk-sdk bsk
pip install bsk-sdk "bsk[all]"
pip install build scikit-build-core
python -m build --wheel --no-isolation
```
Expand Down
2 changes: 1 addition & 1 deletion external/basilisk
Submodule basilisk updated 649 files
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ backend-path = ["."]

[project]
name = "bsk-sdk"
version = "2.11.0beta"
version = "2.11.0"
description = "Vendored Basilisk SDK headers, runtime, and CMake integration for plugin authors"
readme = "README.md"
license = { text = "ISC" }
Expand Down Expand Up @@ -35,7 +35,11 @@ wheel.py-api = "py3"
wheel.platlib = false
wheel.install-dir = "bsk_sdk"

sdist.inclusion-mode = "explicit"
sdist.include = [
"pyproject.toml",
"build_backend.py",
"README.md",
"CMakeLists.txt",
"cmake/**",
"src/bsk_sdk/include/**",
Expand All @@ -57,6 +61,8 @@ sdist.exclude = [
"examples/**",
"external/**",
"tests/**",
".DS_Store",
"**/.DS_Store",
"**/__pycache__/**",
"**/*.pyc",
]
Expand Down
2 changes: 1 addition & 1 deletion src/bsk_sdk/_bsk_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.11.0beta
2.11.0
9 changes: 7 additions & 2 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def test_builtin_c_msg_interfaces_present() -> None:
def test_msg_autosource_generators_present() -> None:
autosrc = Path(bsk_sdk.msg_autosource_dir())
assert autosrc.is_dir(), f"msg_autosource_dir() does not exist: {autosrc}"
for name in ("generatePayloadMetaJson.py", "generateSWIGModules.py",
"msgInterfacePy.i.in", "cMsgCInterfacePy.i.in"):
for name in (
"generatePayloadEqualityHeader.py",
"generatePayloadMetaJson.py",
"generateSWIGModules.py",
"msgInterfacePy.i.in",
"cMsgCInterfacePy.i.in",
):
assert (autosrc / name).exists(), f"Missing msgAutoSource file: {name}"
Loading