diff --git a/BUILD.bazel b/BUILD.bazel index c89ffa4ce..efcc9378a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -16,6 +16,7 @@ cc_library( "include", "include/ylt", "include/ylt/thirdparty", + "include/ylt/standalone", "src/include", ], linkopts = ["-lpthread"], @@ -33,6 +34,7 @@ cc_test( includes = [ "include", "include/ylt/thirdparty", + "include/ylt/standalone", "src/include", ], deps = [":ylt"], @@ -47,6 +49,7 @@ cc_binary( includes = [ "include", "include/ylt/thirdparty", + "include/ylt/standalone", "src/include", ], deps = [":ylt"], @@ -60,6 +63,7 @@ cc_binary( "include", "include/ylt", "include/ylt/thirdparty", + "include/ylt/standalone", "src/include", ], linkopts = ["-lpthread"], @@ -74,6 +78,7 @@ cc_binary( "include", "include/ylt", "include/ylt/thirdparty", + "include/ylt/standalone", "src/include", ], linkopts = ["-lpthread"], @@ -88,6 +93,7 @@ cc_binary( "include", "include/ylt", "include/ylt/thirdparty", + "include/ylt/standalone", "src/include", ], linkopts = ["-lpthread"], diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dc203728..f422c7118 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ if(CMAKE_PROJECT_NAME STREQUAL "yaLanTingLibs") # if ylt is top-level project # add include path include_directories(include) include_directories(include/ylt/thirdparty) + include_directories(include/ylt/standalone) include_directories(src/include) include(cmake/utils.cmake) diff --git a/README.md b/README.md index dc9e51434..2942e941e 100644 --- a/README.md +++ b/README.md @@ -129,11 +129,11 @@ target_compile_features(main PRIVATE cxx_std_20) ### Compile Manually: -1. Add `include/` directory to include path(skip it if you have install ylt into system default path). -2. Add `include/ylt/thirdparty` to include path(skip it if you have install thirdparty independency by the cmake option -DINSTALL_INDEPENDENT_THIRDPARTY=ON). -3. Enable `c++20` standard by option `-std=c++20`(g++/clang++) or `/std:c++20`(msvc) -3. If you use any header with `coro_` prefix, add link option `-pthread` in linux and add option `-fcoroutines` when you use g++. -4. That's all. We could find other options in `example/cmakelist.txt`. +1. Add `include/` directory to include path(skip it if you have install ylt into default include path). +2. Add `include/ylt/thirdparty` to include path(skip it if you have install ylt by cmake). +3. Add `include/ylt/standalone` to include path(skip it if you have install ylt by cmake). +4. Enable `c++20` standard by option `-std=c++20`(g++/clang++) or `/std:c++20`(msvc) +5. If you use any header with `coro_` prefix, add link option `-pthread` in linux, add option `-fcoroutines` when you use g++10. ### More Details: For more details, see the cmake file [here](https://github.com/alibaba/yalantinglibs/blob/main/CMakeLists.txt) and [there](https://github.com/alibaba/yalantinglibs/tree/main/cmake). @@ -450,17 +450,22 @@ These option maybe useful for your project. You can enable it in your project if |YLT_ENABLE_STRUCT_PACK_UNPORTABLE_TYPE|OFF|enable unportable type(like wstring, int128_t) for struct_pack| |YLT_ENABLE_STRUCT_PACK_OPTIMIZE|OFF|optimize struct_pack by radical template unwinding(will cost more compile time)| -## thirdparty installation option +## installation option -In default, yalantinglibs will install thirdparty librarys in `ylt/thirdparty`. You need add it to include path when compile. +In default, yalantinglibs will install thirdparty librarys and standalone sublibrarires in your install path independently. -If you don't want to install the thirdparty librarys, you can turn off cmake option `-DINSTALL_THIRDPARTY=OFF`. -If you want to install the thirdparty independently (direct install it in system include path so that you don't need add `ylt/thirdparty` to include path), you can use turn on cmake option `-DINSTALL_INDEPENDENT_THIRDPARTY=ON`. +If you don't want to install the thirdparty librarys(you need install it manually), you can turn off cmake option `-DINSTALL_THIRDPARTY=OFF`. + +If you want to install the thirdparty dependently. (install thirdparty librarys and standalone sublibrarires in `ylt/thirdparty` and `ylt/standalone` ), you can use turn off cmake option `-DINSTALL_INDEPENDENT_THIRDPARTY=OFF` and `-DINSTALL_INDEPENDENT_STANDALONE=OFF`. |option|default value| |----------|------------| |INSTALL_THIRDPARTY|ON| -|INSTALL_INDEPENDENT_THIRDPARTY|OFF| +|INSTALL_STANDALONE|ON| +|INSTALL_INDEPENDENT_THIRDPARTY|ON| +|INSTALL_INDEPENDENT_STANDALONE|ON| + +Those options only work in installation. ## develop option @@ -481,39 +486,37 @@ These CMake options is used for yalantinglibs developing/installing itself. They Here are the thirdparty libraries we used(Although async_simple is a part of ylt, it open source first, so we import it as a independence thirdparty library). -### coro_io - -- [asio](https://think-async.com/Asio) -- [async_simple](https://github.com/alibaba/async_simple) -- [openssl](https://www.openssl.org/) (optional) +### coro_io/coro_rpc/coro_http -### coro_rpc +Those dependency will by install by default. you can control it by cmake option. - [asio](https://think-async.com/Asio) - [async_simple](https://github.com/alibaba/async_simple) - [openssl](https://www.openssl.org/) (optional) -### coro_http -- [asio](https://think-async.com/Asio) -- [async_simple](https://github.com/alibaba/async_simple) -- [cinatra](https://github.com/qicosmos/cinatra) + ### easylog No dependency. -### struct_pack +### struct_pack, struct_json, struct_xml, struct_yaml No dependency. ### struct_pb (optional) +In default, struct_pb wont be installed. You need install protobuf manually. + - [protobuf](https://protobuf.dev/) -### struct_json、struct_xml、struct_yaml -- [iguana](https://github.com/qicosmos/iguana) +## Standalone sublibraries + +coro_http is implemented by a standalone sublibrary [cinatra](https://github.com/qicosmos/cinatra) + +struct_json、struct_xml、struct_yaml are implemented by a standalone sublibrary [iguana](https://github.com/qicosmos/iguana) ## Benchmark diff --git a/cmake/install.cmake b/cmake/install.cmake index aba2eaed5..ebc2d53a7 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -1,8 +1,11 @@ message(STATUS "-------------YLT INSTALL SETTING------------") option(INSTALL_THIRDPARTY "Install thirdparty" ON) -option(INSTALL_THIRDPARTY_BY_PACKAGE_MANAGER "Install thirdparty by package manager" OFF) +option(INSTALL_STANDALONE "Install standalone" ON) message(STATUS "INSTALL_THIRDPARTY: " ${INSTALL_THIRDPARTY}) + +message(STATUS "INSTALL_STANDALONE: " ${INSTALL_STANDALONE}) option(INSTALL_INDEPENDENT_THIRDPARTY "Install independent thirdparty" ON) +option(INSTALL_INDEPENDENT_STANDALONE "Install independent standalone" ON) include(CMakePackageConfigHelpers) write_basic_package_version_file( @@ -45,7 +48,7 @@ install(EXPORT yalantinglibsTargets DESTINATION ${ConfigPackageLocation} ) -install(DIRECTORY "${yaLanTingLibs_SOURCE_DIR}/include/" DESTINATION include REGEX "${yaLanTingLibs_SOURCE_DIR}/include/ylt/thirdparty" EXCLUDE) +install(DIRECTORY "${yaLanTingLibs_SOURCE_DIR}/include/" DESTINATION include REGEX "${yaLanTingLibs_SOURCE_DIR}/include/ylt/thirdparty" EXCLUDE REGEX "${yaLanTingLibs_SOURCE_DIR}/include/ylt/standalone" EXCLUDE) if (INSTALL_THIRDPARTY) message(STATUS "INSTALL_INDEPENDENT_THIRDPARTY: " ${INSTALL_INDEPENDENT_THIRDPARTY}) @@ -57,11 +60,15 @@ if (INSTALL_THIRDPARTY) $ ) endif() -elseif(INSTALL_THIRDPARTY_BY_PACKAGE_MANAGER) - install(DIRECTORY "${yaLanTingLibs_SOURCE_DIR}/include/ylt/thirdparty/cinatra" DESTINATION include/ylt/thirdparty/cinatra) - install(DIRECTORY "${yaLanTingLibs_SOURCE_DIR}/include/ylt/thirdparty/iguana" DESTINATION include/ylt/thirdparty/iguana) - target_include_directories(yalantinglibs INTERFACE - $ - ) +endif() +if(INSTALL_STANDALONE) + message(STATUS "INSTALL_INDEPENDENT_STANDALONE: " ${INSTALL_INDEPENDENT_STANDALONE}) + if (INSTALL_INDEPENDENT_STANDALONE) + install(DIRECTORY "${yaLanTingLibs_SOURCE_DIR}/include/ylt/standalone/" DESTINATION include) + else() + install(DIRECTORY "${yaLanTingLibs_SOURCE_DIR}/include/ylt/standalone/" DESTINATION include/ylt/standalone) + target_include_directories(yalantinglibs INTERFACE + $) + endif() endif() message(STATUS "--------------------------------------------") \ No newline at end of file diff --git a/include/ylt/thirdparty/cinatra/cinatra_log_wrapper.hpp b/include/ylt/standalone/cinatra/cinatra_log_wrapper.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/cinatra_log_wrapper.hpp rename to include/ylt/standalone/cinatra/cinatra_log_wrapper.hpp diff --git a/include/ylt/thirdparty/cinatra/cookie.hpp b/include/ylt/standalone/cinatra/cookie.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/cookie.hpp rename to include/ylt/standalone/cinatra/cookie.hpp diff --git a/include/ylt/thirdparty/cinatra/coro_http_client.hpp b/include/ylt/standalone/cinatra/coro_http_client.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/coro_http_client.hpp rename to include/ylt/standalone/cinatra/coro_http_client.hpp diff --git a/include/ylt/thirdparty/cinatra/coro_http_connection.hpp b/include/ylt/standalone/cinatra/coro_http_connection.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/coro_http_connection.hpp rename to include/ylt/standalone/cinatra/coro_http_connection.hpp diff --git a/include/ylt/thirdparty/cinatra/coro_http_request.hpp b/include/ylt/standalone/cinatra/coro_http_request.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/coro_http_request.hpp rename to include/ylt/standalone/cinatra/coro_http_request.hpp diff --git a/include/ylt/thirdparty/cinatra/coro_http_response.hpp b/include/ylt/standalone/cinatra/coro_http_response.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/coro_http_response.hpp rename to include/ylt/standalone/cinatra/coro_http_response.hpp diff --git a/include/ylt/thirdparty/cinatra/coro_http_router.hpp b/include/ylt/standalone/cinatra/coro_http_router.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/coro_http_router.hpp rename to include/ylt/standalone/cinatra/coro_http_router.hpp diff --git a/include/ylt/thirdparty/cinatra/coro_http_server.hpp b/include/ylt/standalone/cinatra/coro_http_server.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/coro_http_server.hpp rename to include/ylt/standalone/cinatra/coro_http_server.hpp diff --git a/include/ylt/thirdparty/cinatra/coro_radix_tree.hpp b/include/ylt/standalone/cinatra/coro_radix_tree.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/coro_radix_tree.hpp rename to include/ylt/standalone/cinatra/coro_radix_tree.hpp diff --git a/include/ylt/thirdparty/cinatra/define.h b/include/ylt/standalone/cinatra/define.h similarity index 100% rename from include/ylt/thirdparty/cinatra/define.h rename to include/ylt/standalone/cinatra/define.h diff --git a/include/ylt/thirdparty/cinatra/gzip.hpp b/include/ylt/standalone/cinatra/gzip.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/gzip.hpp rename to include/ylt/standalone/cinatra/gzip.hpp diff --git a/include/ylt/thirdparty/cinatra/http_parser.hpp b/include/ylt/standalone/cinatra/http_parser.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/http_parser.hpp rename to include/ylt/standalone/cinatra/http_parser.hpp diff --git a/include/ylt/thirdparty/cinatra/io_service_pool.hpp b/include/ylt/standalone/cinatra/io_service_pool.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/io_service_pool.hpp rename to include/ylt/standalone/cinatra/io_service_pool.hpp diff --git a/include/ylt/thirdparty/cinatra/mime_types.hpp b/include/ylt/standalone/cinatra/mime_types.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/mime_types.hpp rename to include/ylt/standalone/cinatra/mime_types.hpp diff --git a/include/ylt/thirdparty/cinatra/multipart.hpp b/include/ylt/standalone/cinatra/multipart.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/multipart.hpp rename to include/ylt/standalone/cinatra/multipart.hpp diff --git a/include/ylt/thirdparty/cinatra/picohttpparser.h b/include/ylt/standalone/cinatra/picohttpparser.h similarity index 100% rename from include/ylt/thirdparty/cinatra/picohttpparser.h rename to include/ylt/standalone/cinatra/picohttpparser.h diff --git a/include/ylt/thirdparty/cinatra/response_cv.hpp b/include/ylt/standalone/cinatra/response_cv.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/response_cv.hpp rename to include/ylt/standalone/cinatra/response_cv.hpp diff --git a/include/ylt/thirdparty/cinatra/session.hpp b/include/ylt/standalone/cinatra/session.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/session.hpp rename to include/ylt/standalone/cinatra/session.hpp diff --git a/include/ylt/thirdparty/cinatra/session_manager.hpp b/include/ylt/standalone/cinatra/session_manager.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/session_manager.hpp rename to include/ylt/standalone/cinatra/session_manager.hpp diff --git a/include/ylt/thirdparty/cinatra/sha1.hpp b/include/ylt/standalone/cinatra/sha1.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/sha1.hpp rename to include/ylt/standalone/cinatra/sha1.hpp diff --git a/include/ylt/thirdparty/cinatra/smtp_client.hpp b/include/ylt/standalone/cinatra/smtp_client.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/smtp_client.hpp rename to include/ylt/standalone/cinatra/smtp_client.hpp diff --git a/include/ylt/thirdparty/cinatra/string_resize.hpp b/include/ylt/standalone/cinatra/string_resize.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/string_resize.hpp rename to include/ylt/standalone/cinatra/string_resize.hpp diff --git a/include/ylt/thirdparty/cinatra/time_util.hpp b/include/ylt/standalone/cinatra/time_util.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/time_util.hpp rename to include/ylt/standalone/cinatra/time_util.hpp diff --git a/include/ylt/thirdparty/cinatra/uri.hpp b/include/ylt/standalone/cinatra/uri.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/uri.hpp rename to include/ylt/standalone/cinatra/uri.hpp diff --git a/include/ylt/thirdparty/cinatra/url_encode_decode.hpp b/include/ylt/standalone/cinatra/url_encode_decode.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/url_encode_decode.hpp rename to include/ylt/standalone/cinatra/url_encode_decode.hpp diff --git a/include/ylt/thirdparty/cinatra/use_asio.hpp b/include/ylt/standalone/cinatra/use_asio.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/use_asio.hpp rename to include/ylt/standalone/cinatra/use_asio.hpp diff --git a/include/ylt/thirdparty/cinatra/utils.hpp b/include/ylt/standalone/cinatra/utils.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/utils.hpp rename to include/ylt/standalone/cinatra/utils.hpp diff --git a/include/ylt/thirdparty/cinatra/websocket.hpp b/include/ylt/standalone/cinatra/websocket.hpp similarity index 100% rename from include/ylt/thirdparty/cinatra/websocket.hpp rename to include/ylt/standalone/cinatra/websocket.hpp diff --git a/include/ylt/thirdparty/cinatra/ws_define.h b/include/ylt/standalone/cinatra/ws_define.h similarity index 100% rename from include/ylt/thirdparty/cinatra/ws_define.h rename to include/ylt/standalone/cinatra/ws_define.h diff --git a/include/ylt/thirdparty/iguana/define.h b/include/ylt/standalone/iguana/define.h similarity index 100% rename from include/ylt/thirdparty/iguana/define.h rename to include/ylt/standalone/iguana/define.h diff --git a/include/ylt/thirdparty/iguana/detail/charconv.h b/include/ylt/standalone/iguana/detail/charconv.h similarity index 100% rename from include/ylt/thirdparty/iguana/detail/charconv.h rename to include/ylt/standalone/iguana/detail/charconv.h diff --git a/include/ylt/thirdparty/iguana/detail/dragonbox.h b/include/ylt/standalone/iguana/detail/dragonbox.h similarity index 100% rename from include/ylt/thirdparty/iguana/detail/dragonbox.h rename to include/ylt/standalone/iguana/detail/dragonbox.h diff --git a/include/ylt/thirdparty/iguana/detail/dragonbox_to_chars.h b/include/ylt/standalone/iguana/detail/dragonbox_to_chars.h similarity index 100% rename from include/ylt/thirdparty/iguana/detail/dragonbox_to_chars.h rename to include/ylt/standalone/iguana/detail/dragonbox_to_chars.h diff --git a/include/ylt/thirdparty/iguana/detail/fast_float.h b/include/ylt/standalone/iguana/detail/fast_float.h similarity index 100% rename from include/ylt/thirdparty/iguana/detail/fast_float.h rename to include/ylt/standalone/iguana/detail/fast_float.h diff --git a/include/ylt/thirdparty/iguana/detail/itoa.hpp b/include/ylt/standalone/iguana/detail/itoa.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/detail/itoa.hpp rename to include/ylt/standalone/iguana/detail/itoa.hpp diff --git a/include/ylt/thirdparty/iguana/detail/string_stream.hpp b/include/ylt/standalone/iguana/detail/string_stream.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/detail/string_stream.hpp rename to include/ylt/standalone/iguana/detail/string_stream.hpp diff --git a/include/ylt/thirdparty/iguana/detail/traits.hpp b/include/ylt/standalone/iguana/detail/traits.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/detail/traits.hpp rename to include/ylt/standalone/iguana/detail/traits.hpp diff --git a/include/ylt/thirdparty/iguana/detail/utf.hpp b/include/ylt/standalone/iguana/detail/utf.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/detail/utf.hpp rename to include/ylt/standalone/iguana/detail/utf.hpp diff --git a/include/ylt/thirdparty/iguana/enum_reflection.hpp b/include/ylt/standalone/iguana/enum_reflection.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/enum_reflection.hpp rename to include/ylt/standalone/iguana/enum_reflection.hpp diff --git a/include/ylt/thirdparty/iguana/error_code.h b/include/ylt/standalone/iguana/error_code.h similarity index 100% rename from include/ylt/thirdparty/iguana/error_code.h rename to include/ylt/standalone/iguana/error_code.h diff --git a/include/ylt/thirdparty/iguana/json_reader.hpp b/include/ylt/standalone/iguana/json_reader.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/json_reader.hpp rename to include/ylt/standalone/iguana/json_reader.hpp diff --git a/include/ylt/thirdparty/iguana/json_util.hpp b/include/ylt/standalone/iguana/json_util.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/json_util.hpp rename to include/ylt/standalone/iguana/json_util.hpp diff --git a/include/ylt/thirdparty/iguana/json_writer.hpp b/include/ylt/standalone/iguana/json_writer.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/json_writer.hpp rename to include/ylt/standalone/iguana/json_writer.hpp diff --git a/include/ylt/thirdparty/iguana/prettify.hpp b/include/ylt/standalone/iguana/prettify.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/prettify.hpp rename to include/ylt/standalone/iguana/prettify.hpp diff --git a/include/ylt/thirdparty/iguana/reflection.hpp b/include/ylt/standalone/iguana/reflection.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/reflection.hpp rename to include/ylt/standalone/iguana/reflection.hpp diff --git a/include/ylt/thirdparty/iguana/util.hpp b/include/ylt/standalone/iguana/util.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/util.hpp rename to include/ylt/standalone/iguana/util.hpp diff --git a/include/ylt/thirdparty/iguana/value.hpp b/include/ylt/standalone/iguana/value.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/value.hpp rename to include/ylt/standalone/iguana/value.hpp diff --git a/include/ylt/thirdparty/iguana/xml_reader.hpp b/include/ylt/standalone/iguana/xml_reader.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/xml_reader.hpp rename to include/ylt/standalone/iguana/xml_reader.hpp diff --git a/include/ylt/thirdparty/iguana/xml_util.hpp b/include/ylt/standalone/iguana/xml_util.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/xml_util.hpp rename to include/ylt/standalone/iguana/xml_util.hpp diff --git a/include/ylt/thirdparty/iguana/xml_writer.hpp b/include/ylt/standalone/iguana/xml_writer.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/xml_writer.hpp rename to include/ylt/standalone/iguana/xml_writer.hpp diff --git a/include/ylt/thirdparty/iguana/yaml_reader.hpp b/include/ylt/standalone/iguana/yaml_reader.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/yaml_reader.hpp rename to include/ylt/standalone/iguana/yaml_reader.hpp diff --git a/include/ylt/thirdparty/iguana/yaml_util.hpp b/include/ylt/standalone/iguana/yaml_util.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/yaml_util.hpp rename to include/ylt/standalone/iguana/yaml_util.hpp diff --git a/include/ylt/thirdparty/iguana/yaml_writer.hpp b/include/ylt/standalone/iguana/yaml_writer.hpp similarity index 100% rename from include/ylt/thirdparty/iguana/yaml_writer.hpp rename to include/ylt/standalone/iguana/yaml_writer.hpp diff --git a/src/struct_pb/protoc-plugin/CMakeLists.txt b/src/struct_pb/protoc-plugin/CMakeLists.txt index d3f7a94fc..368d25d33 100644 --- a/src/struct_pb/protoc-plugin/CMakeLists.txt +++ b/src/struct_pb/protoc-plugin/CMakeLists.txt @@ -11,7 +11,7 @@ if (Protobuf_FOUND) RUNTIME DESTINATION bin ) else () - message(INFO "struct_pb is skipped. To build struct_pb protoc plugin, you must install libprotoc first\n" + message(STATUS "struct_pb is skipped. To build struct_pb protoc plugin, you must install libprotoc first\n" "see https://alibaba.github.io/yalantinglibs/en/struct_pb/struct_pb_generating_your_struct.html" ) diff --git a/website/docs/en/guide/what_is_yalantinglibs.md b/website/docs/en/guide/what_is_yalantinglibs.md index 44238a3d8..9db7b5e2e 100644 --- a/website/docs/en/guide/what_is_yalantinglibs.md +++ b/website/docs/en/guide/what_is_yalantinglibs.md @@ -129,11 +129,11 @@ target_compile_features(main PRIVATE cxx_std_20) ### Compile Manually: -1. Add `include/` directory to include path(skip it if you have install ylt into system default path). -2. Add `include/ylt/thirdparty` to include path(skip it if you have install thirdparty independency by the cmake option -DINSTALL_INDEPENDENT_THIRDPARTY=ON). -3. Enable `c++20` standard by option `-std=c++20`(g++/clang++) or `/std:c++20`(msvc) -3. If you use any header with `coro_` prefix, add link option `-pthread` in linux and add option `-fcoroutines` when you use g++. -4. That's all. We could find other options in `example/cmakelist.txt`. +1. Add `include/` directory to include path(skip it if you have install ylt into default include path). +2. Add `include/ylt/thirdparty` to include path(skip it if you have install ylt by cmake). +3. Add `include/ylt/standalone` to include path(skip it if you have install ylt by cmake). +4. Enable `c++20` standard by option `-std=c++20`(g++/clang++) or `/std:c++20`(msvc). The serialization and log libraries need at least c++17, the network and coroutine libraries need at least c++20. +5. If you use any header with `coro_` prefix, add link option `-pthread` in linux, add option `-fcoroutines` when you use g++10. ### More Details: For more details, see the cmake file [here](https://github.com/alibaba/yalantinglibs/blob/main/CMakeLists.txt) and [there](https://github.com/alibaba/yalantinglibs/tree/main/cmake). @@ -450,17 +450,22 @@ These option maybe useful for your project. You can enable it in your project if |YLT_ENABLE_STRUCT_PACK_UNPORTABLE_TYPE|OFF|enable unportable type(like wstring, int128_t) for struct_pack| |YLT_ENABLE_STRUCT_PACK_OPTIMIZE|OFF|optimize struct_pack by radical template unwinding(will cost more compile time)| -## thirdparty installation option +## installation option -In default, yalantinglibs will install thirdparty librarys in `ylt/thirdparty`. You need add it to include path when compile. +In default, yalantinglibs will install thirdparty librarys and standalone sublibrarires in your install path independently. -If you don't want to install the thirdparty librarys, you can turn off cmake option `-DINSTALL_THIRDPARTY=OFF`. -If you want to install the thirdparty independently (direct install it in system include path so that you don't need add `ylt/thirdparty` to include path), you can use turn on cmake option `-DINSTALL_INDEPENDENT_THIRDPARTY=ON`. +If you don't want to install the thirdparty librarys(you need install it manually), you can turn off cmake option `-DINSTALL_THIRDPARTY=OFF`. + +If you want to install the thirdparty dependently. (install thirdparty librarys and standalone sublibrarires in `ylt/thirdparty` and `ylt/standalone` ), you can use turn off cmake option `-DINSTALL_INDEPENDENT_THIRDPARTY=OFF` and `-DINSTALL_INDEPENDENT_STANDALONE=OFF`. |option|default value| |----------|------------| |INSTALL_THIRDPARTY|ON| -|INSTALL_INDEPENDENT_THIRDPARTY|OFF| +|INSTALL_STANDALONE|ON| +|INSTALL_INDEPENDENT_THIRDPARTY|ON| +|INSTALL_INDEPENDENT_STANDALONE|ON| + +Those options only work in installation. ## develop option @@ -481,39 +486,37 @@ These CMake options is used for yalantinglibs developing/installing itself. They Here are the thirdparty libraries we used(Although async_simple is a part of ylt, it open source first, so we import it as a independence thirdparty library). -### coro_io - -- [asio](https://think-async.com/Asio) -- [async_simple](https://github.com/alibaba/async_simple) -- [openssl](https://www.openssl.org/) (optional) +### coro_io/coro_rpc/coro_http -### coro_rpc +Those dependency will by install by default. you can control it by cmake option. - [asio](https://think-async.com/Asio) - [async_simple](https://github.com/alibaba/async_simple) - [openssl](https://www.openssl.org/) (optional) -### coro_http -- [asio](https://think-async.com/Asio) -- [async_simple](https://github.com/alibaba/async_simple) -- [cinatra](https://github.com/qicosmos/cinatra) + ### easylog No dependency. -### struct_pack +### struct_pack, struct_json, struct_xml, struct_yaml No dependency. ### struct_pb (optional) +In default, struct_pb wont be installed. You need install protobuf manually. + - [protobuf](https://protobuf.dev/) -### struct_json、struct_xml、struct_yaml -- [iguana](https://github.com/qicosmos/iguana) +## Standalone sublibraries + +coro_http is implemented by a standalone sublibrary [cinatra](https://github.com/qicosmos/cinatra) + +struct_json、struct_xml、struct_yaml are implemented by a standalone sublibrary [iguana](https://github.com/qicosmos/iguana) ## Benchmark diff --git a/website/docs/zh/guide/what_is_yalantinglibs.md b/website/docs/zh/guide/what_is_yalantinglibs.md index bec17e71e..ebe6d6008 100644 --- a/website/docs/zh/guide/what_is_yalantinglibs.md +++ b/website/docs/zh/guide/what_is_yalantinglibs.md @@ -97,9 +97,10 @@ cmake --build . - 手动编译: 1. 将 `include/`加入到头文件包含路径中(如果已安装到系统默认路径,可跳过该步骤) -2. 将 `include/ylt/thirdparty` 加入到头文件包含路径中(如果已通过Cmake 选项 -DINSTALL_INDEPENDENT_THIRDPARTY=ON 安装了第三方依赖,可跳过该步骤) -3. 如果你使用了 `coro_` 开头的任何头文件, 在linux系统下需要添加选项 `-pthread` . 使用`g++`编译器时需要添加选项 `-fcoroutines`。 -4. 全部搞定. 更多细节请参考 `example/cmakelist.txt`. +2. 将 `include/ylt/thirdparty` 加入到头文件包含路径中(如果已通过cmake安装了yalantinglibs,可跳过该步骤) +3. 将 `include/ylt/standalone` 加入到头文件包含路径中(如果已通过cmake安装了yalantinglibs,可跳过该步骤) +4. 通过选项`-std=c++20`(g++/clang++) or `/std:c++20`(msvc)启用C++20标准。(序列化库和日志库至少需要c++17,网络库与协程至少需要C++20) +5. 如果你使用了 `coro_` 开头的任何头文件, 在linux系统下需要添加选项 `-pthread` . 使用`g++10`编译器需要添加选项 `-fcoroutines`。 - 更多细节: 如需查看更多细节, 除了`example/cmakelist.txt`,你还可以参考 [here](https://github.com/alibaba/yalantinglibs/tree/main/CmakeLists.txt) and [there](https://github.com/alibaba/yalantinglibs/tree/main/cmake). @@ -377,18 +378,20 @@ yalantinglibs工程自身支持如下配置项,如果你使用cmake find_packa |YLT_ENABLE_STRUCT_PACK_UNPORTABLE_TYPE|OFF|struct_pack启用对不跨平台的特殊类型的支持(如wstring, in128_t)| |YLT_ENABLE_STRUCT_PACK_OPTIMIZE|OFF|struct_pack启用激进的模板展开优化(会花费更多编译时间)| -## 第三方安装选项 +## 安装选项 -默认情况下,ylt会把第三方依赖安装到`ylt/thirdparty`目录下,你需要将它添加到头文件包含路径中。 +默认情况下,ylt会把第三方依赖和子库直接安装到安装目录下。 如果你不想让ylt安装第三方依赖,你可以使用选项:`-DINSTALL_THIRDPARTY=OFF`。 -如果你想让ylt将第三方依赖直接独立安装到系统默认的包含路径中,你可以开启选项:`-DINSTALL_INDEPENDENT_THIRDPARTY=ON`。 +如果你想让ylt将第三方依赖和子库安装到`ylt/thirdparty` 和`ylt/standalone`下,你可以开启选项:`-DINSTALL_INDEPENDENT_THIRDPARTY=OFF` 和`-DINSTALL_INDEPENDENT_STANDALONE=OFF`. |选项|默认值| |----------|------------| |INSTALL_THIRDPARTY|ON| -|INSTALL_INDEPENDENT_THIRDPARTY|OFF| +|INSTALL_STANDALONE|ON| +|INSTALL_INDEPENDENT_THIRDPARTY|ON| +|INSTALL_INDEPENDENT_STANDALONE|ON| ## 开发选项 @@ -408,47 +411,33 @@ yalantinglibs工程自身支持如下配置项,如果你使用cmake find_packa 以下是我们使用的第三方依赖(async_simple虽然也是ylt的一部分,但其首先开源,故计为一个独立的第三方依赖) -### coro_io +### coro_io/coro_rpc/coro_http -- [asio](https://think-async.com/Asio) -- [async_simple](https://github.com/alibaba/async_simple) -- [openssl](https://www.openssl.org/) (optional) - -### coro_rpc +这些依赖会被默认安装,可以通过安装选项来控制。 - [asio](https://think-async.com/Asio) - [async_simple](https://github.com/alibaba/async_simple) - [openssl](https://www.openssl.org/) (optional) -### coro_http - -- [asio](https://think-async.com/Asio) -- [async_simple](https://github.com/alibaba/async_simple) -- [cinatra](https://github.com/qicosmos/cinatra) - ### easylog 无依赖。 -### struct_pack +### struct_pack, struct_json, struct_xml, struct_yaml 无依赖。 -### struct_json +### struct_pb (可选) -- [iguana](https://github.com/qicosmos/iguana) - -### struct_pb (optional) +默认情况下我们不会安装struct_pb, 你需要手动安装以下依赖: - [protobuf](https://protobuf.dev/) -### struct_xml - -- [iguana](https://github.com/qicosmos/iguana) +## 独立子仓库 -### struct_yaml +coro_http 由独立子仓库实现: [cinatra](https://github.com/qicosmos/cinatra) -- [iguana](https://github.com/qicosmos/iguana) +struct_json、struct_xml、struct_yaml 由独立子仓库实现: [iguana](https://github.com/qicosmos/iguana) ## Benchmark