move iguana and cinatra to standalone subdir (#639)
This commit is contained in:
parent
b7b01c5836
commit
a414eea434
|
@ -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"],
|
||||
|
|
|
@ -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)
|
||||
|
|
49
README.md
49
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
|
||||
### coro_io/coro_rpc/coro_http
|
||||
|
||||
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_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
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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)
|
|||
$<INSTALL_INTERFACE:include/ylt/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
|
||||
$<INSTALL_INTERFACE:include/ylt/thirdparty>
|
||||
)
|
||||
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
|
||||
$<INSTALL_INTERFACE:include/ylt/standalone>)
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "--------------------------------------------")
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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
|
||||
### coro_io/coro_rpc/coro_http
|
||||
|
||||
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_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
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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)
|
||||
coro_http 由独立子仓库实现: [cinatra](https://github.com/qicosmos/cinatra)
|
||||
|
||||
### struct_yaml
|
||||
|
||||
- [iguana](https://github.com/qicosmos/iguana)
|
||||
struct_json、struct_xml、struct_yaml 由独立子仓库实现: [iguana](https://github.com/qicosmos/iguana)
|
||||
|
||||
## Benchmark
|
||||
|
||||
|
|
Loading…
Reference in New Issue