Skip to content

[build] add option to use externally build LZ4 library - #13803

Merged
Nir-Az merged 1 commit into
realsenseai:developmentfrom
RobbertProost:allow-to-link-against-prebuild-lz4
Mar 4, 2025
Merged

[build] add option to use externally build LZ4 library#13803
Nir-Az merged 1 commit into
realsenseai:developmentfrom
RobbertProost:allow-to-link-against-prebuild-lz4

Conversation

@RobbertProost

Copy link
Copy Markdown
Contributor

This PR adds a CMake option with which you can control if the SDK should be building its own version of LZ4 compression library or should use a prebuild library that can be found in the build environment.

This enables to use of a statically build RealSense SDK in combination with other statically build libraries that use LZ4.

Related issue #13796

@sysrsbuild

Copy link
Copy Markdown
Contributor

Can one of the admins verify this patch?

@Nir-Az

Nir-Az commented Mar 2, 2025

Copy link
Copy Markdown
Collaborator

HI @RobbertProost ,

Looks like a nice addition, and if it fix your issue it's great.
We will run some tests and update.

Thanks for your contribution

$<$<NOT:$<BOOL:${USE_EXTERNAL_LZ4}>>:${LZ4_INCLUDE_PATH}>
)

target_link_libraries(${PROJECT_NAME} PRIVATE

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.

Why not wrapping this line with

if (USE_EXTERNAL_LZ4)

?

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.

No particular reason, apart from style. I personally like to use this form such that you can have a single target_link_libraries and a single target_include_directories. Now for this particular case, where we only need to link against one library when building, there is no added benifit of using the generator expression, but it keeps it consistent with the target_include_directories.

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.

Fair Enough :)

@Nir-Az Nir-Az left a comment

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.

LGTM

@Nir-Az
Nir-Az merged commit 19886e7 into realsenseai:development Mar 4, 2025
@RobbertProost
RobbertProost deleted the allow-to-link-against-prebuild-lz4 branch March 4, 2025 12:57
@dg0yt

dg0yt commented Jul 15, 2025

Copy link
Copy Markdown

@dg0yt

dg0yt commented Jul 15, 2025

Copy link
Copy Markdown

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.

4 participants