Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created first working mockup for the multiverse plugin #5

Open
wants to merge 5 commits into
base: KnowRobIntegration
Choose a base branch
from
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
66 changes: 9 additions & 57 deletions knowrob_connector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,26 @@ project(KnowRobConnector)
set(KNOWROB_CONNECTOR knowrob_connector)
set(CMAKE_CXX_STANDARD 17)

# Construct Boost Python component name based on Python version
set(Boost_Python_VERSION "python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}")
set(Boost_Python_COMPONENT "Boost::${Boost_Python_VERSION}")
message(STATUS "Using Boost Python component: ${Boost_Python_COMPONENT}")

# Set Boost configurations
set(Boost_USE_STATIC_LIBS OFF) # Use shared libraries by default
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

# Find Boost and Boost.Python
find_package(Boost 1.50 REQUIRED COMPONENTS program_options serialization ${Boost_Python_VERSION})

if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost not found!")
endif()

# Explicitly set Boost.Python library path if necessary
set(Boost_PYTHON_LIBRARY /usr/lib/x86_64-linux-gnu/libboost_python38.so)
message(STATUS "Boost Python Library: ${Boost_PYTHON_LIBRARY}")

INCLUDE(FindPkgConfig)

pkg_check_modules(SWIPL REQUIRED swipl)
pkg_check_modules(MONGOC REQUIRED libmongoc-1.0)
pkg_check_modules(RAPTOR REQUIRED raptor2)
pkg_check_modules(REDLAND REQUIRED redland)
find_package(Python COMPONENTS Interpreter)
find_package(spdlog REQUIRED)

set(KNOWROB_LIBRARIES
${SWIPL_LIBRARIES}
${MONGOC_LIBRARIES}
${RAPTOR_LIBRARIES}
${REDLAND_LIBRARIES}
${Python_LIBRARIES}
spdlog::spdlog
)

function(build_knowrob_connector)
add_library(${KNOWROB_CONNECTOR} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/src/knowrob_connector.cpp)

target_include_directories(${KNOWROB_CONNECTOR} PRIVATE
/usr/include/python3.8
target_include_directories(${KNOWROB_CONNECTOR} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/multiverse_client/include
${CMAKE_CURRENT_SOURCE_DIR}/knowrob/include
)
target_link_directories(${KNOWROB_CONNECTOR} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/multiverse_client/include
${CMAKE_CURRENT_SOURCE_DIR}/knowrob/include
${CMAKE_CURRENT_SOURCE_DIR}/knowrob/src/integration/python
${SWIPL_INCLUDE_DIRS}
${MONGOC_INCLUDE_DIRS}
${RAPTOR_INCLUDE_DIRS}
${REDLAND_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)

if(UNIX)
target_link_libraries(${KNOWROB_CONNECTOR} PRIVATE
target_link_libraries(${KNOWROB_CONNECTOR} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/lib/libmultiverse_client_json.so
${CMAKE_CURRENT_SOURCE_DIR}/lib/libknowrob.so
${Boost_LIBRARIES} # Ensure all Boost libraries are linked
${Boost_PYTHON_LIBRARY} # Explicitly link Boost.Python
)

install(TARGETS ${KNOWROB_CONNECTOR} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libknowrob_connector.so DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib RENAME knowrob.so)
install(TARGETS ${KNOWROB_CONNECTOR} DESTINATION
${CMAKE_CURRENT_SOURCE_DIR}/lib
)
elseif(WIN32)
# Windows-specific linking (if needed)
# target_link_libraries(${MULTIVERSE_CLIENT_JSON} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/libmultiverse_client_json.dll)
# install(TARGETS ${MULTIVERSE_CLIENT_JSON} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib)
endif()
Expand Down
7 changes: 1 addition & 6 deletions knowrob_connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@
To run this package in Python run

```bash
> python3
Python 3.8.10 (default, Mar 11 2025, 17:45:31)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from knowrob import *
>>>
> python3 scripts/multiverse_reasoner_test.py
```
Binary file added knowrob_connector/dist-packages/knowrob.so
Binary file not shown.
Binary file modified knowrob_connector/lib/libknowrob.so
Binary file not shown.
Binary file modified knowrob_connector/lib/libmultiverse_client_json.so
Binary file not shown.
196 changes: 98 additions & 98 deletions knowrob_connector/owl/SOMA-Montessori.owl

Large diffs are not rendered by default.

Loading