From dc6f561b5c0cc7c540df4cc2b1707a5709c5c345 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 25 Sep 2023 17:51:05 +0200 Subject: [PATCH 1/4] sync submodule --- sdk/master_board_sdk/cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/master_board_sdk/cmake b/sdk/master_board_sdk/cmake index 46af1c1..e1a7152 160000 --- a/sdk/master_board_sdk/cmake +++ b/sdk/master_board_sdk/cmake @@ -1 +1 @@ -Subproject commit 46af1c1c20206307471bf3983235532304b463fb +Subproject commit e1a71520cd2f0e6f2a611e1a70df4d8edf4d5a65 From f560a0b9d04568f9de493ba5b08475f2739e6b8e Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 25 Sep 2023 17:55:21 +0200 Subject: [PATCH 2/4] CMake: get the submodule if necessary --- sdk/master_board_sdk/CMakeLists.txt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/sdk/master_board_sdk/CMakeLists.txt b/sdk/master_board_sdk/CMakeLists.txt index 43a4d49..5fa8746 100644 --- a/sdk/master_board_sdk/CMakeLists.txt +++ b/sdk/master_board_sdk/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (c) 2019 CNRS # -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.14) # ---------------------------------------------------- # --- CXX FLAGS -------------------------------------- @@ -32,10 +32,22 @@ option(BUILD_PYTHON_INTERFACE "Build the python binding" ON) option(PYTHON_STANDARD_LAYOUT "Enable standard Python package layout" ON) option(PYTHON_DEB_LAYOUT "Enable Debian-style Python package layout" OFF) -include(cmake/base.cmake) -include(cmake/boost.cmake) -include(cmake/python.cmake) -include(cmake/ide.cmake) +# Check if the submodule cmake have been initialized +set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake") +if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake") + message(STATUS "JRL cmakemodules not found. Let's fetch it.") + include(FetchContent) + FetchContent_Declare( + "jrl-cmakemodules" + GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git") + FetchContent_MakeAvailable("jrl-cmakemodules") + FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES) +endif() + +include("${JRL_CMAKE_MODULES}/base.cmake") +include("${JRL_CMAKE_MODULES}/boost.cmake") +include("${JRL_CMAKE_MODULES}/python.cmake") +include("${JRL_CMAKE_MODULES}/ide.cmake") compute_project_args(PROJECT_ARGS LANGUAGES CXX) project(${PROJECT_NAME} ${PROJECT_ARGS}) From 26a1276d4b887c3f25c5e60bc526ed7904c850f1 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 25 Sep 2023 17:56:02 +0200 Subject: [PATCH 3/4] CMake: bump catch2 --- sdk/master_board_sdk/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/master_board_sdk/CMakeLists.txt b/sdk/master_board_sdk/CMakeLists.txt index 5fa8746..ca0ccb5 100644 --- a/sdk/master_board_sdk/CMakeLists.txt +++ b/sdk/master_board_sdk/CMakeLists.txt @@ -144,7 +144,7 @@ if(BUILD_TESTING) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.1.0) + GIT_TAG v3.4.0) FetchContent_MakeAvailable(Catch2) endif() add_unit_test(test_protocol tests/test_protocol.cpp) From 1d6dd67bdd364795e383f666da785f4c2a14c949 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 25 Sep 2023 18:00:13 +0200 Subject: [PATCH 4/4] CMake: update submodule use --- sdk/master_board_sdk/CMakeLists.txt | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sdk/master_board_sdk/CMakeLists.txt b/sdk/master_board_sdk/CMakeLists.txt index ca0ccb5..e4fb21a 100644 --- a/sdk/master_board_sdk/CMakeLists.txt +++ b/sdk/master_board_sdk/CMakeLists.txt @@ -69,14 +69,28 @@ endif(BUILD_PYTHON_INTERFACE) # ---------------------------------------------------- # --- MAIN LIBRARY ------------------------------------------------------------- -set(MASTER_BOARD_SRC +set(${PROJECT_NAME}_SOURCES src/ETHERNET_types.cpp src/Link_manager.cpp src/master_board_interface.cpp src/motor.cpp src/motor_driver.cpp) if(NOT APPLE) - list(APPEND MASTER_BOARD_SRC src/ESPNOW_manager.cpp src/ESPNOW_types.cpp) + list(APPEND ${PROJECT_NAME}_SOURCES src/ESPNOW_manager.cpp + src/ESPNOW_types.cpp) endif(NOT APPLE) - -add_library(${PROJECT_NAME} SHARED ${MASTER_BOARD_SRC}) +set(${PROJECT_NAME}_HEADERS + "include/${PROJECT_NAME}/defines.h" + "include/${PROJECT_NAME}/ESPNOW_manager.h" + "include/${PROJECT_NAME}/ESPNOW_types.h" + "include/${PROJECT_NAME}/ETHERNET_manager.h" + "include/${PROJECT_NAME}/ETHERNET_types.h" + "include/${PROJECT_NAME}/Link_manager.h" + "include/${PROJECT_NAME}/Link_types.h" + "include/${PROJECT_NAME}/master_board_interface.h" + "include/${PROJECT_NAME}/motor.h" + "include/${PROJECT_NAME}/motor_driver.h" + "include/${PROJECT_NAME}/protocol.h") + +add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} + ${${PROJECT_NAME}_HEADERS}) target_link_libraries(${PROJECT_NAME} pthread) target_include_directories( ${PROJECT_NAME} PUBLIC $ @@ -85,7 +99,6 @@ install( TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib) -install(DIRECTORY include/ DESTINATION include) install(FILES package.xml DESTINATION share/${PROJECT_NAME}) @@ -103,8 +116,9 @@ if(BUILD_PYTHON_INTERFACE) target_include_directories(${PYWRAP} SYSTEM PRIVATE ${PYTHON_INCLUDE_DIR}) target_link_libraries(${PYWRAP} ${PROJECT_NAME}) target_link_boost_python(${PYWRAP}) + get_relative_rpath(${${PYWRAP}_INSTALL_DIR} ${PYWRAP}_INSTALL_RPATH) set_target_properties(${PYWRAP} PROPERTIES INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/lib") + "${${PYWRAP}_INSTALL_RPATH}") install(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR}) # --- Allow to do: make python --- # @@ -112,7 +126,7 @@ if(BUILD_PYTHON_INTERFACE) set_target_properties(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True) add_dependencies(python ${PYWRAP}) - # --- Pre-build the python files for efficiency --- # + # --- build the python files to check them --- # python_build(example example.py) python_build(example listener.py) python_build(example com_analyser.py)