ITADN

Might we generate llhttp .c/.h without JavaScript?

#786OpenRodrigoDornelles 创建于 2025-12-30
While the project is a core component of Node.js, like **libuv**, it is a versatile library that can be used outside the JavaScript ecosystem, such as in Julia or Luvit. Notably, **llhttp** pairs well with libuv, as it was designed with that integration in mind. Non-JavaScript projects would only need JavaScript in the toolchain to generate the required `.c` and `.h` files, which can be handled with simple scripts. **C++** is a suitable choice: it offers a rich STL, high-level abstractions, and most environments with a C compiler will also have a C++ compiler, allowing generation to be orchestrated directly via CMake. This approach keeps generator scripts maintainable and allows projects in Go, C, C++, etc., to use **llhttp** without introducing JavaScript into their toolchain. If integrated via `CMakeLists.txt` alone, it can be managed as an external project. ```cmake FetchContent_Declare( llhttp GIT_REPOSITORY https://github.com/nodejs/llhttp.git GIT_TAG v9.3.0 ) FetchContent_MakeAvailable(llhttp) target_include_directories(${PROJECT_NAME} PRIVATE ${llhttp_SOURCE_DIR}/include) target_link_libraries(${PROJECT_NAME} PRIVATE llhttp) ```
2 条评论