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

Fix build with -DCLR_CMAKE_USE_SYSTEM_BROTLI=true #110816

Merged
Merged
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
4 changes: 4 additions & 0 deletions src/native/libs/System.IO.Compression.Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ if (NOT CLR_CMAKE_USE_SYSTEM_ZLIB)
endif()

if (CLR_CMAKE_USE_SYSTEM_BROTLI)
find_library(BROTLIDEC brotlidec REQUIRED)
find_library(BROTLIENC brotlienc REQUIRED)
list(APPEND ${BROTLI_LIBRARIES} ${BROTLIDEC} ${BROTLIENC})

if (CLR_CMAKE_HOST_FREEBSD)
set(CMAKE_REQUIRED_INCLUDES ${CROSS_ROOTFS}/usr/local/include)
endif()
Expand Down
7 changes: 7 additions & 0 deletions src/native/libs/System.IO.Compression.Native/extra_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ macro(append_extra_compression_libs NativeLibsExtra)
list(APPEND ZLIB_LIBRARIES $<IF:$<BOOL:${CLR_CMAKE_USE_SYSTEM_ZLIB}>,z,zlib>)
endif ()
list(APPEND ${NativeLibsExtra} ${ZLIB_LIBRARIES})

if (CLR_CMAKE_USE_SYSTEM_BROTLI)
find_library(BROTLIDEC brotlidec REQUIRED)
find_library(BROTLIENC brotlienc REQUIRED)
Comment on lines +24 to +25
Copy link
Member

Choose a reason for hiding this comment

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

Can we move these into Compression.Native/CMakeLists.txt and add the two libraries to the BROTLI_LIBRARIES variable? That would keep all of the brotli handling together.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does the updated change look okay?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wait, this doesn't work at all :(

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, because src/native/corehost/apphost/static/CMakeLists.txt only includes NATIVE_LIBS

# additional requirements for System.IO.Compression.Native
include(${CLR_SRC_NATIVE_DIR}/libs/System.IO.Compression.Native/extra_libs.cmake)
append_extra_compression_libs(NATIVE_LIBS)

Should it include BROTLI_LIBRARIES under a CLR_CMAKE_USE_SYSTEM_BROTL conditional?

Copy link
Member

Choose a reason for hiding this comment

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

The BROTLI_LIBRARIES values should be propagated up to the static apphost due to

target_link_libraries(System.IO.Compression.Native-Static PUBLIC ${BROTLI_LIBRARIES})

and

target_link_libraries(System.IO.Compression.Native-Static PUBLIC ${BROTLI_LIBRARIES})

You can change it back to how it was before to unblock and I can investigate later.


list(APPEND ${NativeLibsExtra} ${BROTLIDEC} ${BROTLIENC})
endif ()
endmacro()
Loading