Skip to content
Open
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
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ install(TARGETS PiPCA9685_cpp
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

# Strip the install prefix if Python_SITEARCH is underneath it
cmake_path(
RELATIVE_PATH Python_SITEARCH
BASE_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
OUTPUT_VARIABLE PYTHON_INSTALL_DIR
)

install(TARGETS PiPCA9685_python
DESTINATION ${Python_SITEARCH}
LIBRARY DESTINATION "${PYTHON_INSTALL_DIR}"
)

install(EXPORT PiPCA9685_export
Expand All @@ -74,3 +81,5 @@ if(NOT TARGET uninstall)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

add_subdirectory(examples/cpp)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,14 @@ To run the Python example, run the following command in the `examples/python/` d
```bash
python3 example.py
```

## Development

If you want to work on a local copy without root access:
```bash
cmake -B build
cmake --build build
cmake --install build --prefix install
```

With this workflow, the example will be built in `./build/examples/cpp/example-cpp`.
4 changes: 3 additions & 1 deletion examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ project(example)

set(CMAKE_CXX_STANDARD 23)

find_package(PiPCA9685 REQUIRED)
if(NOT TARGET PiPCA9685::PiPCA9685)
find_package(PiPCA9685 REQUIRED)
endif()

add_executable(example-cpp main.cpp)
target_link_libraries(example-cpp PiPCA9685::PiPCA9685)