Index: lib/MsgUtils/CMakeLists.txt =================================================================== diff -u -rf9c6b488aa4135e8cd47ccd3fdc6c3ae1cd831aa -ra5781739bcbe58c754aff8861561495624bc5b67 --- lib/MsgUtils/CMakeLists.txt (.../CMakeLists.txt) (revision f9c6b488aa4135e8cd47ccd3fdc6c3ae1cd831aa) +++ lib/MsgUtils/CMakeLists.txt (.../CMakeLists.txt) (revision a5781739bcbe58c754aff8861561495624bc5b67) @@ -12,49 +12,33 @@ find_package(Protobuf REQUIRED) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network SerialBus) +find_package(Comms HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../Comms REQUIRED) set(MSGUTILS_SCRIPTS_DIR ${CMAKE_SOURCE_DIR}/scripts/MsgUtils) -# The project-wide venv ({CMAKE_BINARY_DIR}/.venv) is set up by -# cmake/PythonVenv.cmake at the top level; ${PROJECT_PYTHON} resolves to its -# interpreter. We install the msgutils package editable so the generator -# scripts below can `import msgutils` regardless of how they're invoked. +# The top-level CMakeLists includes cmake/PythonVenv.cmake, which creates the +# project-wide venv (${CMAKE_BINARY_DIR}/.venv) and sets ${PROJECT_PYTHON}. +# Installing msgutils editable lets the generators below `import msgutils`. include(cmake/MsgUtils.cmake) register_python_package(${MSGUTILS_SCRIPTS_DIR}) # set(DENALI_MSG_CSV ${CMAKE_CURRENT_SOURCE_DIR}/../../data/FW_Messages_List.csv) -set(LEAHI_MSG_CSV ${CMAKE_CURRENT_SOURCE_DIR}/../../data/Leahi_Staging_FW_Messages_List.csv) +# set(LEAHI_MSG_CSV ${CMAKE_CURRENT_SOURCE_DIR}/../../data/Leahi_Staging_FW_Messages_List.csv) set(LEAHI_MSG_CONF ${CMAKE_CURRENT_SOURCE_DIR}/../../data/LeahiUnhandled.conf) set(INCLUDES - include/AgentMessage.h - include/CanMessage.h - include/crc.h # include/DenaliLogUtils.h # include/encryption.h - include/format.h - include/FrameInterface.h - include/main.h - include/MessageBuilder.h - include/MessageDispatcher.h # include/MessageGlobals.h # include/MessageInterpreter.h # include/qrcodegen.h - include/types.h ) set(SRCS - src/AgentMessage.cpp - src/crc.cpp # src/DenaliLogUtils.cpp # src/encryption.cpp - src/format.cpp - src/FrameInterface.cpp - src/MessageBuilder.cpp - src/MessageDispatcher.cpp # src/MessageInterpreter.cpp # src/qrcodegen.cpp - src/types.cpp ) set(GENERATED_INCLUDES @@ -102,6 +86,7 @@ ) target_link_libraries(${PROJECT_NAME} PUBLIC + Comms ${Protobuf_LIBRARIES} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network @@ -124,7 +109,7 @@ LIBRARY DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/lib" COMPONENT dev ) -# Add all targets to the build-tree export set +# Export the targets so a sibling component can find this one without installing export( TARGETS ${PROJECT_NAME} FILE "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Targets.cmake" @@ -133,22 +118,22 @@ file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/include") set(CONF_INCLUDE_DIRS "\${MSGUTILS_CMAKE_DIR}/${REL_INCLUDE_DIR}") -# Create the ${PROJECT_NAME}Config.cmake and -# ${PROJECT_NAME}ConfigVersion.cmake files ... for the build tree +# Config files find_package() consumes, written straight to the source cmake/ dir configure_file(${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake" @ONLY) configure_file(${PROJECT_NAME}ConfigVersion.cmake.in "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake" @ONLY) -# ... for the install tree +# Same files staged in the binary dir, for the install() below to copy from configure_file(${PROJECT_NAME}Config.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" @ONLY) configure_file( ${PROJECT_NAME}ConfigVersion.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake" @ONLY) -# Install the ${PROJECT_NAME}Config.cmake and ${PROJECT_NAME}ConfigVersion.cmake +# Install the staged config files and the export set. Note the DESTINATIONs are +# absolute paths into the source tree, so `install` writes back to cmake/ here +# rather than to CMAKE_INSTALL_PREFIX. install( FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ) -# Install the export set for use with the install-tree install(EXPORT ${PROJECT_NAME}Targets DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/cmake")