-
Notifications
You must be signed in to change notification settings - Fork 13
Move zlib and brotli compression services from capy to http #250
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,7 +58,6 @@ set(BOOST_HTTP_DEPENDENCIES | |
| Boost::capy | ||
| Boost::config | ||
| Boost::core | ||
| Boost::corosio | ||
| Boost::json | ||
| Boost::mp11 | ||
| Boost::static_assert | ||
|
|
@@ -68,23 +67,32 @@ set(BOOST_HTTP_DEPENDENCIES | |
| Boost::url | ||
| Boost::winapi) | ||
|
|
||
| # corosio is used header-only (only io_buffer_param.hpp) | ||
| # We include it separately to avoid linking against the full library | ||
| set(BOOST_HTTP_HEADER_ONLY_DEPENDENCIES corosio) | ||
|
|
||
| foreach (BOOST_HTTP_DEPENDENCY ${BOOST_HTTP_DEPENDENCIES}) | ||
| if (BOOST_HTTP_DEPENDENCY MATCHES "^[ ]*Boost::([A-Za-z0-9_]+)[ ]*$") | ||
| list(APPEND BOOST_HTTP_INCLUDE_LIBRARIES ${CMAKE_MATCH_1}) | ||
| endif () | ||
| endforeach () | ||
| # Add header-only dependencies to include list (but not link list) | ||
| list(APPEND BOOST_HTTP_INCLUDE_LIBRARIES ${BOOST_HTTP_HEADER_ONLY_DEPENDENCIES}) | ||
| # Conditional dependencies | ||
| if (NOT BOOST_URL_MRDOCS_BUILD) | ||
| if (NOT BOOST_HTTP_MRDOCS_BUILD) | ||
| if (BOOST_HTTP_BUILD_TESTS) | ||
| set(BOOST_HTTP_UNIT_TEST_LIBRARIES filesystem) | ||
| set(BOOST_HTTP_UNIT_TEST_LIBRARIES asio filesystem) | ||
| endif () | ||
| if (BOOST_HTTP_BUILD_EXAMPLES) | ||
| # set(BOOST_HTTP_EXAMPLE_LIBRARIES json) | ||
| endif () | ||
| endif () | ||
| # Complete dependency list | ||
| set(BOOST_INCLUDE_LIBRARIES ${BOOST_HTTP_INCLUDE_LIBRARIES} ${BOOST_HTTP_UNIT_TEST_LIBRARIES} ${BOOST_HTTP_EXAMPLE_LIBRARIES}) | ||
| set(BOOST_EXCLUDE_LIBRARIES http) | ||
| # Complete dependency list (only set when http is the root project) | ||
| # When built as part of the superproject, these are set by the superproject | ||
| if (BOOST_HTTP_IS_ROOT) | ||
| set(BOOST_INCLUDE_LIBRARIES ${BOOST_HTTP_INCLUDE_LIBRARIES} ${BOOST_HTTP_UNIT_TEST_LIBRARIES} ${BOOST_HTTP_EXAMPLE_LIBRARIES}) | ||
| set(BOOST_EXCLUDE_LIBRARIES http) | ||
| endif() | ||
|
|
||
| #------------------------------------------------- | ||
| # | ||
|
|
@@ -151,6 +159,10 @@ function(boost_http_setup_properties target) | |
| target_include_directories(${target} PUBLIC "${PROJECT_SOURCE_DIR}/include") | ||
| target_include_directories(${target} PRIVATE "${PROJECT_SOURCE_DIR}") | ||
| target_link_libraries(${target} PUBLIC ${BOOST_HTTP_DEPENDENCIES}) | ||
| # Add corosio headers without linking (header-only usage) | ||
| # BUILD_INTERFACE: only during build (installed headers are in standard Boost include path) | ||
| target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/../corosio/include>) | ||
| target_compile_definitions(${target} PUBLIC BOOST_COROSIO_NO_LIB) # Disable corosio auto-linking | ||
|
Comment on lines
+162
to
+165
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded sibling path may break standalone builds. The path Consider guarding this with a check for the directory's existence or using Suggested improvement- # Add corosio headers without linking (header-only usage)
- # BUILD_INTERFACE: only during build (installed headers are in standard Boost include path)
- target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/../corosio/include>)
+ # Add corosio headers without linking (header-only usage)
+ # BUILD_INTERFACE: only during build (installed headers are in standard Boost include path)
+ set(COROSIO_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../corosio/include")
+ if (EXISTS "${COROSIO_INCLUDE_DIR}")
+ target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${COROSIO_INCLUDE_DIR}>)
+ endif ()🤖 Prompt for AI Agents |
||
| target_compile_definitions(${target} PUBLIC BOOST_HTTP_NO_LIB) | ||
| target_compile_definitions(${target} PRIVATE BOOST_HTTP_SOURCE) | ||
| if (BUILD_SHARED_LIBS) | ||
|
|
@@ -180,6 +192,39 @@ elseif (APPLE) | |
| target_link_libraries(boost_http PRIVATE "-framework Security") | ||
| endif () | ||
|
|
||
| # Zlib | ||
| find_package(ZLIB) | ||
| if (ZLIB_FOUND) | ||
| file(GLOB_RECURSE BOOST_HTTP_ZLIB_HEADERS CONFIGURE_DEPENDS include/boost/http/zlib/*.hpp) | ||
| file(GLOB_RECURSE BOOST_HTTP_ZLIB_SOURCES CONFIGURE_DEPENDS src_zlib/*.cpp src_zlib/*.hpp) | ||
| source_group("" FILES "include/boost/http/zlib.hpp") | ||
| source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost/http/zlib PREFIX "include" FILES ${BOOST_HTTP_ZLIB_HEADERS}) | ||
| source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src_zlib PREFIX "src" FILES ${BOOST_HTTP_ZLIB_SOURCES}) | ||
| add_library(boost_http_zlib include/boost/http/zlib.hpp build/Jamfile ${BOOST_HTTP_ZLIB_HEADERS} ${BOOST_HTTP_ZLIB_SOURCES}) | ||
| add_library(Boost::http_zlib ALIAS boost_http_zlib) | ||
| target_link_libraries(boost_http_zlib PUBLIC boost_http) | ||
| target_link_libraries(boost_http_zlib PRIVATE ZLIB::ZLIB) | ||
| target_compile_definitions(boost_http_zlib PUBLIC BOOST_HTTP_HAS_ZLIB) | ||
| target_compile_definitions(boost_http_zlib PRIVATE BOOST_HTTP_SOURCE) | ||
| endif () | ||
|
Comment on lines
+195
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: fd -t f "\.hpp$" include/ | grep -i zlib | head -20Repository: cppalliance/http Length of output: 176 🏁 Script executed: cd /tmp && find . -name "CMakeLists.txt" -type f 2>/dev/null | head -1 | xargs cat > /dev/null 2>&1; echo "ready"Repository: cppalliance/http Length of output: 65 🏁 Script executed: # Get the full CMakeLists.txt to understand the project structure
wc -l CMakeLists.txtRepository: cppalliance/http Length of output: 78 🏁 Script executed: # Check the boost_http target setup
sed -n '1,189p' CMakeLists.txt | tail -50Repository: cppalliance/http Length of output: 2337 🏁 Script executed: # Check the complete ZLIB section and surrounding context
sed -n '180,210p' CMakeLists.txtRepository: cppalliance/http Length of output: 1546 🏁 Script executed: sed -n '204,240p' CMakeLists.txtRepository: cppalliance/http Length of output: 1575 Add target_include_directories and target_compile_features to boost_http_zlib target. The target_compile_features(boost_http_zlib PUBLIC cxx_constexpr)
target_include_directories(boost_http_zlib PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_include_directories(boost_http_zlib PRIVATE "${PROJECT_SOURCE_DIR}")This matches the setup in the 🤖 Prompt for AI Agents |
||
|
|
||
| # Brotli | ||
| list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
| find_package(Brotli) | ||
| if (Brotli_FOUND) | ||
| file(GLOB_RECURSE BOOST_HTTP_BROTLI_HEADERS CONFIGURE_DEPENDS include/boost/http/brotli/*.hpp) | ||
| file(GLOB_RECURSE BOOST_HTTP_BROTLI_SOURCES CONFIGURE_DEPENDS src_brotli/*.cpp src_brotli/*.hpp) | ||
| source_group("" FILES "include/boost/http/brotli.hpp") | ||
| source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost/http/brotli PREFIX "include" FILES ${BOOST_HTTP_BROTLI_HEADERS}) | ||
| source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src_brotli PREFIX "src" FILES ${BOOST_HTTP_BROTLI_SOURCES}) | ||
| add_library(boost_http_brotli include/boost/http/brotli.hpp build/Jamfile ${BOOST_HTTP_BROTLI_HEADERS} ${BOOST_HTTP_BROTLI_SOURCES}) | ||
| add_library(Boost::http_brotli ALIAS boost_http_brotli) | ||
| target_link_libraries(boost_http_brotli PUBLIC boost_http) | ||
| target_link_libraries(boost_http_brotli PRIVATE Brotli::common Brotli::decoder Brotli::encoder) | ||
| target_compile_definitions(boost_http_brotli PUBLIC BOOST_HTTP_HAS_BROTLI) | ||
| target_compile_definitions(boost_http_brotli PRIVATE BOOST_HTTP_SOURCE) | ||
| endif () | ||
|
Comment on lines
+195
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "CMakeLists.txt" -type f | head -20Repository: cppalliance/http Length of output: 187 🏁 Script executed: cat -n CMakeLists.txt | sed -n '183,214p'Repository: cppalliance/http Length of output: 2407 🏁 Script executed: # Check if boost_http_zlib/brotli are exported or installed
rg -n "boost_http_zlib|boost_http_brotli" CMakeLists.txt | head -30Repository: cppalliance/http Length of output: 1079 🏁 Script executed: # Check if these targets are exported or installed
rg -n "TARGETS.*boost_http_zlib|TARGETS.*boost_http_brotli|install" CMakeLists.txt | tail -40Repository: cppalliance/http Length of output: 42 🏁 Script executed: wc -l CMakeLists.txtRepository: cppalliance/http Length of output: 78 🏁 Script executed: cat -n CMakeLists.txt | sed -n '215,232p'Repository: cppalliance/http Length of output: 554 🏁 Script executed: cat -n CMakeLists.txt | sed -n '1,100p'Repository: cppalliance/http Length of output: 4000 🏁 Script executed: cat -n CMakeLists.txt | sed -n '100,182p'Repository: cppalliance/http Length of output: 4179 🏁 Script executed: # Search for usage of boost_http_zlib and boost_http_brotli in tests
rg -r "boost_http_zlib|boost_http_brotli|Boost::http_zlib|Boost::http_brotli" test/Repository: cppalliance/http Length of output: 223 🏁 Script executed: # Check if these libraries are linked in test CMakeLists files
rg -n "boost_http_zlib|boost_http_brotli|Boost::http_zlib|Boost::http_brotli" test/CMakeLists.txt test/unit/CMakeLists.txt test/limits/CMakeLists.txtRepository: cppalliance/http Length of output: 371 🏁 Script executed: # Check if boost_http includes zlib/brotli headers directly
rg "include.*zlib|include.*brotli" include/boost/http.hpp include/boost/http/Repository: cppalliance/http Length of output: 1825 🏁 Script executed: # Check if boost_http.hpp or main boost_http headers include zlib/brotli
cat include/boost/http.hppRepository: cppalliance/http Length of output: 1828 🏁 Script executed: # Check if there are CMake config/package files that export these libraries
find . -name "*Config.cmake" -o -name "*config.cmake" -o -name "*.pc"Repository: cppalliance/http Length of output: 42 🏁 Script executed: # Check all source files to see if zlib/brotli are used in boost_http core
rg "ZLIB|Brotli|zlib|brotli" src/ include/boost/http/ --exclude="*zlib*" --exclude="*brotli*"Repository: cppalliance/http Length of output: 471 🏁 Script executed: # Check all source files to see if zlib/brotli are used in boost_http core
rg "ZLIB|Brotli" src/ include/boost/http/ -g "!*zlib*" -g "!*brotli*"Repository: cppalliance/http Length of output: 623 🏁 Script executed: # Check the library types (static vs shared) in CMakeLists.txt
rg -n "add_library" CMakeLists.txtRepository: cppalliance/http Length of output: 778 Make compression library dependencies PUBLIC for proper static linking.
Change to: target_link_libraries(boost_http_zlib PUBLIC boost_http ZLIB::ZLIB)
target_link_libraries(boost_http_brotli PUBLIC boost_http Brotli::common Brotli::decoder Brotli::encoder)This ensures proper dependency propagation in static builds and matches CMake best practices for library packaging. 🤖 Prompt for AI Agents
Comment on lines
+211
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if brotli headers are in the main include path or a separate directory
fd -t f "\.hpp$" -p "brotli" include/Repository: cppalliance/http Length of output: 3419 🏁 Script executed: # Check CMakeLists.txt for zlib configuration to see the pattern
rg -A 10 -B 2 "zlib" CMakeLists.txt | head -60Repository: cppalliance/http Length of output: 1542 🏁 Script executed: # Look for any target_include_directories calls in the entire CMakeLists.txt
rg "target_include_directories" CMakeLists.txt -A 2Repository: cppalliance/http Length of output: 595 🏁 Script executed: # Get more context around where target_include_directories is called
rg "target_include_directories" CMakeLists.txt -B 10 | head -80Repository: cppalliance/http Length of output: 1010 🏁 Script executed: # Check if there's a function or foreach loop that applies to all targets
rg "foreach|function|macro" CMakeLists.txt | head -20Repository: cppalliance/http Length of output: 381 🏁 Script executed: # Look at the complete zlib and brotli section to see full context
sed -n '184,230p' CMakeLists.txtRepository: cppalliance/http Length of output: 2519 🏁 Script executed: # Look for where boost_http_setup_properties is called
rg "boost_http_setup_properties" CMakeLists.txtRepository: cppalliance/http Length of output: 195 🏁 Script executed: # Get context around the main boost_http library creation
sed -n '160,190p' CMakeLists.txtRepository: cppalliance/http Length of output: 1345 🏁 Script executed: # Check the full CMakeLists.txt for main boost_http target setup
rg -B 5 "add_library\(boost_http" CMakeLists.txt | head -40Repository: cppalliance/http Length of output: 1816 Add explicit property setup for boost_http_brotli (and boost_http_zlib) targets. Both Example fix for brotli (apply same pattern to zlib)🤖 Prompt for AI Agents |
||
|
|
||
| #------------------------------------------------- | ||
| # | ||
| # Tests | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.