alibaba / alibaba/PhotonLibOS

Do I need to manually add source files like net/http/*.cpp to my CMakeLists.txt when using Photon?

Open
#804 9 comments 0 reactions 0 assignees View on GitHub
Done
Dominant language
C++
Stars
1.2k
Forks
179
Avg merge
1d 15h
Merged PRs (30d)
26

Description

Hi, I'm trying to use Photon’s HTTP client in my project and I noticed that to use classes like photon::net::http::Client, I had to not only #include the header in my .cpp file, but also explicitly add the corresponding .cpp files from photon-src/net/http/ to my CMakeLists.txt, like this:

////

add_executable(client_https
client_https.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/client.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/headers.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/message.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/body.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/url.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/common/estring.cpp
)

////

Normally, I expect that after linking the Photon library via CMake and including the right headers, the implementation should already be compiled and linked. Like normally, when I want to use any file in /common, /io, /thread I just need to include the right headers. But in this case, I need to manually include the .cpp files from net/http.

👉 My questions:

Is this expected behavior for the HTTP client and related modules in Photon?

Are the net/http/*.cpp files intentionally not built into the main Photon static/shared library?

If I use other submodules like net/rsocket, will I also need to manually include their .cpp files?

I'm just trying to understand the intended integration model, whether those are optional utilities or meant to be built into the core Photon lib.

Thank you so much for your help.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the project's CMakeLists.txt and the photon-src/net/http/*.cpp paths named in the report. Compare how the HTTP sources are included with the common, io, thread, and net/rsocket modules. Done means documenting the intended linking model and whether consumers should add these sources manually.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, networking
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.