Skip to content

Added capability to specify the path to the mavlink xml files#2670

Merged
JonasVautherin merged 2 commits intomavlink:mainfrom
reedev:MavlinkPath
Oct 5, 2025
Merged

Added capability to specify the path to the mavlink xml files#2670
JonasVautherin merged 2 commits intomavlink:mainfrom
reedev:MavlinkPath

Conversation

@reedev
Copy link
Copy Markdown
Contributor

@reedev reedev commented Sep 30, 2025

No description provided.

@reedev
Copy link
Copy Markdown
Contributor Author

reedev commented Sep 30, 2025

This one replaces the previous change for specifying the xml filepaths to the mavlink xml files. This change shows up as cmake optional path.

I am sorry for mixing up with the other change, lack of experience with PRs here...

"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"-DBUILD_SHARED_LIBS=OFF"
"-DBUILD_TESTS=OFF"
"-DBUILD_TESTING=OFF"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should stay in your other PR about tinyxml2 😇

set(MAVSDK_SOVERSION_STRING ${MAVSDK_VERSION_MAJOR})
set(MAVSDK_VERSION_STRING ${MAVSDK_VERSION_MAJOR}.${MAVSDK_VERSION_MINOR}.${MAVSDK_VERSION_PATCH})

set(MAVLINK_XML_PATH "" CACHE PATH "Where the mavlink xml files are located.")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that good to me, I don't think that people would want to set all 4 mavlink paths 👍

Comment on lines +16 to +26
if (MAVLINK_XML_PATH)
set(MAVLINK_MINIMAL_XML "${MAVLINK_XML_PATH}/minimal.xml")
set(MAVLINK_STANDARD_XML "${MAVLINK_XML_PATH}/standard.xml")
set(MAVLINK_COMMON_XML "${MAVLINK_XML_PATH}/common.xml")
set(MAVLINK_ARDUPILOTMEGA_XML "${MAVLINK_XML_PATH}/ardupilotmega.xml")
else()
set(MAVLINK_MINIMAL_XML "${DEPS_INSTALL_PATH}/include/mavlink/message_definitions/v1.0/minimal.xml")
set(MAVLINK_STANDARD_XML "${DEPS_INSTALL_PATH}/include/mavlink/message_definitions/v1.0/standard.xml")
set(MAVLINK_COMMON_XML "${DEPS_INSTALL_PATH}/include/mavlink/message_definitions/v1.0/common.xml")
set(MAVLINK_ARDUPILOTMEGA_XML "${DEPS_INSTALL_PATH}/include/mavlink/message_definitions/v1.0/ardupilotmega.xml")
endif()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm nitpicking a bit, but wouldn't it be a bit easier if we did something like:

if(NOT MAVLINK_XML_PATH)
    set(MAVLINK_XML_PATH "${DEPS_INSTALL_PATH}/include/mavlink/message_definitions/v1.0")
endif()

set(MAVLINK_MINIMAL_XML "${MAVLINK_XML_PATH}/minimal.xml")
set(MAVLINK_STANDARD_XML "${MAVLINK_XML_PATH}/standard.xml")
set(MAVLINK_COMMON_XML "${MAVLINK_XML_PATH}/common.xml")
set(MAVLINK_ARDUPILOTMEGA_XML "${MAVLINK_XML_PATH}/ardupilotmega.xml")

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, good point indeed. I've gone ahead and made the PR. Hope that this is the right way to do it (still unfamiliar with github PRs)

Copy link
Copy Markdown
Collaborator

@julianoes julianoes Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hang on, we should not have different xmls, actually! That's because if you choose common.xml it will include minimal.xml and standard.xml.

And if you select ardupilotmega.xml, it includes common.xml. I guess we don't follow these includes and that's why we need to set it manually. But probably something to improve in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, xml files include 'each other'. I am confused now, does that have to do with my changes? I guess not, just double checking...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julianoes: is that blocking for this PR, or should we merge it?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the PR doesn't change the behaviour, not a blocker.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's the case, the PR does not change the behaviour.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think it's fine 👍

@reedev
Copy link
Copy Markdown
Contributor Author

reedev commented Oct 1, 2025

Ok, thanks for your comments. I have cleaned up the PR and I think it's now ready to go. Please review.

Copy link
Copy Markdown
Collaborator

@JonasVautherin JonasVautherin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! 🚀

@reedev
Copy link
Copy Markdown
Contributor Author

reedev commented Oct 1, 2025

Perfect, glad to be able to contribute something. Great work you are doing.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Oct 1, 2025

@JonasVautherin JonasVautherin merged commit c88a296 into mavlink:main Oct 5, 2025
61 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants