drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.57k stars 1.12k forks source link

Please explain why Jsoncpp is not provided by a submodule #1482

Closed evilenzo closed 6 months ago

evilenzo commented 1 year ago

Describe the bug Currently when you try to just clone drogon, init submodules and try to use it on a clean PC in your CMakeLists like add_subdirectory(third_party/drogon) You get error that Jsoncpp not found

CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Jsoncpp (missing: JSONCPP_INCLUDE_DIRS JSONCPP_LIBRARIES)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  third_party/drogon/cmake_modules/FindJsoncpp.cmake:36 (find_package_handle_standard_args)
  third_party/drogon/CMakeLists.txt:200 (find_package)

And that's right because I have no Jsoncpp on my machine. And it is ok when you have Linux and can install this lib from distributive repos but on Windows it is just a pain. I already tried vcpkg and no, it didn't work because as I can see jsoncpp in vcpkg has another name so your lib just can't find it.

To Reproduce Clone repo on clean machine and try to build it.

Expected behavior I expect that all the needed modules for this lib are shipped as submodules. Why do I need to install Jsoncpp and waste my time since it is REALLY hard on Windows? I already saw that someone had the same problem in issues and now it is just closed. But the problem is not solved. Just add Jsoncpp as a submodule. I can do a PR with correct CMake and Jsoncpp if you want so

Desktop Windows 10

hwc0919 commented 1 year ago

Thanks for you feedback.

As the wiki points out, jsoncpp is treated as a dependency just like other libs(uuid, zlib, etc.). You wouldn't expect us to make those libs as submodules too, would you?

On windows, drogon can be easily installed by a single command vcpkg install drogon , no need to do any environment preparing.. I just tried it on my laptop and it worked fine. I'm posting the whole log below.

Anyway, feel free to ask questions if you still have problems on installation.

hwc0919 commented 1 year ago

You can see the install log here

If you want to install x64 version, use vcpkg install drogon[ctl]:x64-windows