Skip to content

Commit

Permalink
Remove debian package python and pybind11 dependency (#28)
Browse files Browse the repository at this point in the history
* Add manual trigger for build and scan

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates
  • Loading branch information
paulbourelly999 authored Sep 11, 2024
1 parent e0a9434 commit c4fac21
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: Build Workflow

on:
workflow_dispatch:
push:
branches:
- 'master'
- 'develop'
- 'release/*'
pull_request:
types: [opened, synchronize, reopened]
# make GHA actions use node16 which still works with bionic
# See https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
# Unclear how long this will work though. Remove bionic from matrix as soon as we no longer need to support it.
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
build-package:
strategy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonar-scanner.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
on:
workflow_dispatch:
# Trigger analysis when pushing in master or pull requests, and when creating
# a pull request.
push:
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(CMAKE_MODULE_PATH "$ENV{CARMA_OPT_DIR}/cmake")
set(CMAKE_CXX_STANDARD 17)


project(carma_clock
project(carma-clock
DESCRIPTION "CARMA time library"
HOMEPAGE_URL https://github.com/usdot-fhwa-stol/carma-time-lib
VERSION 0.0.1
Expand All @@ -15,7 +15,7 @@ project(carma_clock

option(BUILD_PYTHON_BINDINGS
"BUILD PYTHON BINDINGS is used to configure whether or not to including building python module bindings into the cmake build process.
**NOTE** Build python bindings is currently only support for native builds (not supported for cross-compile builds) " ON)
**NOTE** Build python bindings is currently only support for native builds (not supported for cross-compile builds) " OFF)

include(cmake/dependencies.cmake)
add_library(${PROJECT_NAME} SHARED )
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ apt install carma-clock-1
```

This steps above add the relavent STOL apt repository for pulling correct debian package.
> [!IMPORTANT]\
>The python bindings for **CARMA Time Lib** are not included by default in the debian package. To install this library for use
with python we suggest you install it locally with the following steps

```shell
./install_dependencies.sh
cmake -Bbuild -DBUILD_PYTHON_BINDINGS=ON .
cmake --build build
```

### Including with CMake (C++)
To find and link this library via CMake the following commands are necessary
Expand All @@ -58,14 +67,16 @@ target_link_libraries( ${PROJECT_NAME} PUBLIC
### Importing as Python Module
> [!IMPORTANT]\
>Python module support is currently only available for x86/amd devices
To import this library as a python module the following is necessary
To import this library as a python module the following is necessary.

```python
# This path can be added via the sys module or by directly appending the PYTHON_PATH environment variable.
import sys
sys.path.append('/opt/carma/lib/')
# Import module
import libcarma_clock
sys.path.append('/path/to/library')
# Import C++ library as python module
import importlib
libcarma_clock = importlib.import_module("libcarma-clock")

...
# Initialize CARMA Clock object
clock = libcarma_clock.CarmaClock(False)
Expand Down
4 changes: 3 additions & 1 deletion carma_clock_py/python_wrapper_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/python3
import unittest
import libcarma_clock
import importlib
libcarma_clock = importlib.import_module("libcarma-clock")
# import libcarma_clock
import time

"""Test Case for testing basic CarmaClock functionality in python
Expand Down

0 comments on commit c4fac21

Please sign in to comment.