{"id":13436573,"url":"https://github.com/idealvin/coost","last_synced_at":"2025-05-14T12:12:41.312Z","repository":{"id":37510286,"uuid":"220810918","full_name":"idealvin/coost","owner":"idealvin","description":"A tiny boost library in C++11.","archived":false,"fork":false,"pushed_at":"2024-09-04T10:44:38.000Z","size":3263,"stargazers_count":4093,"open_issues_count":43,"forks_count":571,"subscribers_count":136,"default_branch":"master","last_synced_at":"2025-05-04T23:03:06.837Z","etag":null,"topics":["benchmark","config","coroutine","json","log","rpc","unit-test"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idealvin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["idealvin"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://coostdocs.github.io/en/about/sponsor/","https://coostdocs.gitee.io/cn/about/sponsor/"]}},"created_at":"2019-11-10T15:40:14.000Z","updated_at":"2025-05-01T12:01:10.000Z","dependencies_parsed_at":"2024-03-05T07:44:51.206Z","dependency_job_id":"7b4b33f2-d0ff-45ff-b882-4290d13d3325","html_url":"https://github.com/idealvin/coost","commit_stats":null,"previous_names":["idealvin/cocoyaxi","idealvin/co"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealvin%2Fcoost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealvin%2Fcoost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealvin%2Fcoost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealvin%2Fcoost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idealvin","download_url":"https://codeload.github.com/idealvin/coost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253540762,"owners_count":21924535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","config","coroutine","json","log","rpc","unit-test"],"created_at":"2024-07-31T03:00:50.306Z","updated_at":"2025-05-14T12:12:41.246Z","avatar_url":"https://github.com/idealvin.png","language":"C++","funding_links":["https://github.com/sponsors/idealvin","https://coostdocs.github.io/en/about/sponsor/","https://coostdocs.gitee.io/cn/about/sponsor/"],"categories":["Frameworks","HarmonyOS","C++","Containers \u0026 Language Extentions \u0026 Linting","C/C++ 程序设计"],"sub_categories":["Windows Manager","For C++/C","网络服务_其他"],"readme":"# Coost\r\n\r\nEnglish | [简体中文](readme_cn.md)\r\n\r\n[![Linux Build](https://img.shields.io/github/actions/workflow/status/idealvin/coost/linux.yml?branch=master\u0026logo=linux)](https://github.com/idealvin/coost/actions?query=workflow%3ALinux)\r\n[![Windows Build](https://img.shields.io/github/actions/workflow/status/idealvin/coost/win.yml?branch=master\u0026logo=windows)](https://github.com/idealvin/coost/actions?query=workflow%3AWindows)\r\n[![Mac Build](https://img.shields.io/github/actions/workflow/status/idealvin/coost/macos.yml?branch=master\u0026logo=apple)](https://github.com/idealvin/coost/actions?query=workflow%3AmacOS)\r\n[![Release](https://img.shields.io/github/release/idealvin/coost.svg)](https://github.com/idealvin/coost/releases)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n**[A tiny boost library in C++11.](https://github.com/idealvin/coost)**\r\n\r\n\r\n\r\n## 0. Introduction\r\n\r\n**[coost](https://github.com/idealvin/coost)** is an elegant and efficient cross-platform C++ base library. Its goal is to create a sword of C++ to make C++ programming easy and enjoyable.\r\n\r\nCoost, **co** for short, is like [boost](https://www.boost.org/), but more lightweight, **the static library built on linux or mac is only about 1MB in size**. However, it still provides enough powerful features:\r\n\r\n\u003ctable\u003e\r\n\u003ctr\u003e\u003ctd width=33% valign=top\u003e\r\n\r\n- Command line and config file parser (flag)\r\n- **High performance log library (log)**\r\n- Unit testing framework\r\n- Bechmark testing framework\r\n- **go-style coroutine**\r\n- Coroutine-based network library\r\n- **JSON RPC framework**\r\n\r\n\u003c/td\u003e\u003ctd width=34% valign=top\u003e\r\n\r\n- Atomic operation (atomic)\r\n- **Efficient stream (fastream)**\r\n- Efficient string (fastring)\r\n- String utility (str)\r\n- Time library (time)\r\n- Thread library (thread)\r\n- Timed Task Scheduler\r\n\r\n\u003c/td\u003e\u003ctd valign=top\u003e\r\n\r\n- **God-oriented programming**\r\n- Efficient JSON library\r\n- Hash library\r\n- Path library\r\n- File utilities (fs)\r\n- System operations (os)\r\n- **Fast memory allocator**\r\n \r\n\u003c/td\u003e\u003c/tr\u003e\r\n\u003c/table\u003e\r\n\r\n\r\n\r\n\r\n## 1. Sponsor\r\n\r\nCoost needs your help. If you are using it or like it, you may consider becoming a sponsor. Thank you very much!\r\n\r\n- [Github Sponsors](https://github.com/sponsors/idealvin)\r\n- [A cup of coffee](https://coostdocs.github.io/en/about/sponsor/)\r\n\r\n\r\n\r\n\r\n## 2. Documents\r\n\r\n- English: [github](https://coostdocs.github.io/en/about/co/) | [gitee](https://coostdocs.gitee.io/en/about/co/)\r\n- 简体中文: [github](https://coostdocs.github.io/cn/about/co/) | [gitee](https://coostdocs.gitee.io/cn/about/co/)\r\n\r\n\r\n\r\n\r\n## 3. Core features\r\n\r\n\r\n### 3.0 God-oriented programming\r\n\r\n[co/god.h](https://github.com/idealvin/coost/blob/master/include/co/god.h) provides some features based on templates.\r\n\r\n```cpp\r\n#include \"co/god.h\"\r\n\r\nvoid f() {\r\n    god::bless_no_bugs();\r\n    god::is_same\u003cT, int, bool\u003e(); // T is int or bool?\r\n}\r\n```\r\n\r\n\r\n\r\n### 3.1 flag\r\n\r\n**[flag](https://coostdocs.github.io/en/co/flag/)** is a command line and config file parser. It is similar to gflags, but more powerful:\r\n- Support parameters from both command-line and config file.\r\n- Support automatic generation of the config file.\r\n- Support flag aliases.\r\n- Flag of integer type, the value can take a unit `k,m,g,t,p`.\r\n\r\n```cpp\r\n#include \"co/flag.h\"\r\n#include \"co/cout.h\"\r\n\r\nDEF_bool(x, false, \"x\");\r\nDEF_bool(y, true, \"y\");\r\nDEF_bool(debug, false, \"dbg\", d);\r\nDEF_uint32(u, 0, \"xxx\");\r\nDEF_string(s, \"\", \"xx\");\r\n\r\nint main(int argc, char** argv) {\r\n    flag::parse(argc, argv);\r\n    cout \u003c\u003c \"x: \" \u003c\u003c FLG_x \u003c\u003c '\\n';\r\n    cout \u003c\u003c \"y: \" \u003c\u003c FLG_y \u003c\u003c '\\n';\r\n    cout \u003c\u003c \"debug: \" \u003c\u003c FLG_debug \u003c\u003c '\\n';\r\n    cout \u003c\u003c \"u: \" \u003c\u003c FLG_u \u003c\u003c '\\n';\r\n    cout \u003c\u003c FLG_s \u003c\u003c \"|\" \u003c\u003c FLG_s.size() \u003c\u003c '\\n';\r\n    return 0;\r\n}\r\n```\r\n\r\nIn the above example, the macros start with `DEF_` define 4 flags. Each flag corresponds to a global variable, whose name is `FLG_` plus the flag name. The flag `debug` has an alias `d`. After building, the above code can run as follow:\r\n\r\n```sh\r\n./xx                  # Run with default configs\r\n./xx -x -s good       # x -\u003e true, s -\u003e \"good\"\r\n./xx -debug           # debug -\u003e true\r\n./xx -xd              # x -\u003e true, debug -\u003e true\r\n./xx -u 8k            # u -\u003e 8192\r\n\r\n./xx -mkconf          # Automatically generate a config file: xx.conf\r\n./xx xx.conf          # run with a config file\r\n./xx -conf xx.conf    # Same as above\r\n```\r\n\r\n\r\n\r\n### 3.2 log\r\n\r\n**[log](https://coostdocs.github.io/en/co/log/)** is a high-performance log library, some components in coost use it to print logs.\r\n\r\nlog supports two types of logs: one is level log, which is divided into 5 levels: debug, info, warning, error and fatal, **printing a fatal log will terminate the program**; the other is topic log, logs are grouped by topic, and logs of different topics are written to different files.\r\n\r\n```cpp\r\n#include \"co/log.h\"\r\n\r\nint main(int argc, char** argv) {\r\n    flag::parse(argc, argv);\r\n\r\n    TLOG(\"xx\") \u003c\u003c \"s\" \u003c\u003c 23; // topic log\r\n    DLOG \u003c\u003c \"hello \" \u003c\u003c 23;  // debug\r\n    LOG \u003c\u003c \"hello \" \u003c\u003c 23;   // info\r\n    WLOG \u003c\u003c \"hello \" \u003c\u003c 23;  // warning\r\n    ELOG \u003c\u003c \"hello \" \u003c\u003c 23;  // error\r\n    FLOG \u003c\u003c \"hello \" \u003c\u003c 23;  // fatal\r\n\r\n    return 0;\r\n}\r\n```\r\n\r\nco/log also provides a series of `CHECK` macros, which is an enhanced version of `assert`, and they will not be cleared in debug mode.\r\n\r\n```cpp\r\nvoid* p = malloc(32);\r\nCHECK(p != NULL) \u003c\u003c \"malloc failed..\";\r\nCHECK_NE(p, NULL) \u003c\u003c \"malloc failed..\";\r\n```\r\n\r\nlog is very fast, the following are some test results:\r\n\r\n| platform | glog | co/log | speedup |\r\n| ------ | ------ | ------ | ------ |\r\n| win2012 HHD | 1.6MB/s | 180MB/s | 112.5 |\r\n| win10 SSD | 3.7MB/s | 560MB/s | 151.3 |\r\n| mac SSD | 17MB/s | 450MB/s | 26.4 |\r\n| linux SSD | 54MB/s | 1023MB/s | 18.9 |\r\n\r\nThe above is the write speed of co/log and glog (single thread, 1 million logs). It can be seen that co/log is nearly two orders of magnitude faster than glog.\r\n\r\n| threads | linux co/log | linux spdlog | win co/log | win spdlog | speedup |\r\n| ------ | ------ | ------ | ------ | ------ | ------ |\r\n| 1 | 0.087235 | 2.076172 | 0.117704 | 0.461156 | 23.8/3.9 |\r\n| 2 | 0.183160 | 3.729386 | 0.158122 | 0.511769 | 20.3/3.2 |\r\n| 4 | 0.206712 | 4.764238 | 0.316607 | 0.743227 | 23.0/2.3 |\r\n| 8 | 0.302088 | 3.963644 | 0.406025 | 1.417387 | 13.1/3.5 |\r\n\r\nThe above is the time of [printing 1 million logs with 1, 2, 4, and 8 threads](https://github.com/idealvin/coost/tree/benchmark), in seconds. Speedup is the performance improvement of co/log compared to spdlog on linux and windows platforms.\r\n\r\n\r\n\r\n### 3.3 unitest\r\n\r\n[unitest](https://coostdocs.github.io/en/co/unitest/) is a simple and easy-to-use unit test framework. Many components in coost use it to write unit test code, which guarantees the stability of coost.\r\n\r\n```cpp\r\n#include \"co/unitest.h\"\r\n#include \"co/os.h\"\r\n\r\nDEF_test(os) {\r\n    DEF_case(homedir) {\r\n        EXPECT_NE(os::homedir(), \"\");\r\n    }\r\n\r\n    DEF_case(cpunum) {\r\n        EXPECT_GT(os::cpunum(), 0);\r\n    }\r\n}\r\n \r\nint main(int argc, char** argv) {\r\n    flag::parse(argc, argv);\r\n    unitest::run_tests();\r\n    return 0;\r\n}\r\n```\r\n\r\nThe above is a simple example. The `DEF_test` macro defines a test unit, which is actually a function (a method in a class). The `DEF_case` macro defines test cases, and each test case is actually a code block.\r\n\r\nThe directory [unitest](https://github.com/idealvin/coost/tree/master/unitest) contains the unit test code in coost. Users can run unitest with the following commands:\r\n\r\n```sh\r\nxmake r unitest      # Run all test cases\r\nxmake r unitest -os  # Run test cases in the os unit\r\n```\r\n\r\n\r\n\r\n### 3.4 JSON\r\n\r\nIn coost v3.0, **[Json](https://github.com/idealvin/coost/blob/master/include/co/json.h)** provides **fluent APIs**, which is more convenient to use.\r\n\r\n```cpp\r\n// {\"a\":23,\"b\":false,\"s\":\"123\",\"v\":[1,2,3],\"o\":{\"xx\":0}}\r\nco::Json x = {\r\n    { \"a\", 23 },\r\n    { \"b\", false },\r\n    { \"s\", \"123\" },\r\n    { \"v\", {1,2,3} },\r\n    { \"o\", {\r\n        {\"xx\", 0}\r\n    }},\r\n};\r\n\r\n// equal to x\r\nco::Json y = Json()\r\n    .add_member(\"a\", 23)\r\n    .add_member(\"b\", false)\r\n    .add_member(\"s\", \"123\")\r\n    .add_member(\"v\", Json().push_back(1).push_back(2).push_back(3))\r\n    .add_member(\"o\", Json().add_member(\"xx\", 0));\r\n\r\nx.get(\"a\").as_int();       // 23\r\nx.get(\"s\").as_string();    // \"123\"\r\nx.get(\"s\").as_int();       // 123, string -\u003e int\r\nx.get(\"v\", 0).as_int();    // 1\r\nx.get(\"v\", 2).as_int();    // 3\r\nx.get(\"o\", \"xx\").as_int(); // 0\r\n\r\nx[\"a\"] == 23;          // true\r\nx[\"s\"] == \"123\";       // true\r\nx.get(\"o\", \"xx\") != 0; // false\r\n```\r\n\r\n| os | co/json stringify | co/json parse | rapidjson stringify | rapidjson parse | speedup |\r\n| ------ | ------ | ------ | ------ | ------ | ------ |\r\n| win | 569 | 924 | 2089 | 2495 | 3.6/2.7 |\r\n| mac | 783 | 1097 | 1289 | 1658 | 1.6/1.5 |\r\n| linux | 468 | 764 | 1359 | 1070 | 2.9/1.4 |\r\n\r\nThe above is the average time of stringifying and parsing minimized [twitter.json](https://raw.githubusercontent.com/simdjson/simdjson/master/jsonexamples/twitter.json), in microseconds (us), speedup is the performance improvement of co/json compared to rapidjson.\r\n\r\n\r\n\r\n### 3.5 Coroutine\r\n\r\ncoost has implemented a [go-style](https://github.com/golang/go) coroutine, which has the following features:\r\n\r\n- Support multi-thread scheduling, the default number of threads is the number of system CPU cores.\r\n- Shared stack, coroutines in the same thread share several stacks (the default size is 1MB), and the memory usage is low.\r\n- There is a flat relationship between coroutines, and new coroutines can be created from anywhere (including in coroutines).\r\n- Support coroutine synchronization events, coroutine locks, channels, and waitgroups.\r\n\r\n```cpp\r\n#include \"co/co.h\"\r\n\r\nint main(int argc, char** argv) {\r\n    flag::parse(argc, argv);\r\n\r\n    co::wait_group wg;\r\n    wg.add(2);\r\n\r\n    go([wg](){\r\n        LOG \u003c\u003c \"hello world\";\r\n        wg.done();\r\n    });\r\n\r\n    go([wg](){\r\n        LOG \u003c\u003c \"hello again\";\r\n        wg.done();\r\n    });\r\n\r\n    wg.wait();\r\n    return 0;\r\n}\r\n```\r\n\r\nIn the above code, the coroutines created by `go()` will be distributed to different scheduling threads. Users can also control the scheduling of coroutines by themselves:\r\n\r\n```cpp\r\n// run f1 and f2 in the same scheduler\r\nauto s = co::next_sched();\r\ns-\u003ego(f1);\r\ns-\u003ego(f2);\r\n\r\n// run f in all schedulers\r\nfor (auto\u0026 s : co::scheds()) {\r\n    s-\u003ego(f);\r\n}\r\n```\r\n\r\n\r\n\r\n### 3.6 network programming\r\n\r\ncoost provides a coroutine-based network programming framework:\r\n\r\n- **[coroutineized socket API](https://coostdocs.github.io/en/co/net/sock/)**, similar in form to the system socket API, users familiar with socket programming can easily write high-performance network programs in a synchronous manner.\r\n- [TCP](https://coostdocs.github.io/en/co/net/tcp/), [HTTP](https://coostdocs.github.io/en/co/net/http/), [RPC](https://coostdocs.github.io/en/co/net/rpc/) and other high-level network programming components, compatible with IPv6, also support SSL, it is more convenient to use than socket API.\r\n\r\n\r\n**RPC server**\r\n\r\n```cpp\r\n#include \"co/co.h\"\r\n#include \"co/rpc.h\"\r\n#include \"co/time.h\"\r\n\r\nint main(int argc, char** argv) {\r\n    flag::parse(argc, argv);\r\n\r\n    rpc::Server()\r\n        .add_service(new xx::HelloWorldImpl)\r\n        .start(\"127.0.0.1\", 7788, \"/xx\");\r\n\r\n    for (;;) sleep::sec(80000);\r\n    return 0;\r\n}\r\n```\r\n\r\n`rpc::Server` also supports HTTP protocol, you may use the POST method to call the RPC service:\r\n\r\n```sh\r\ncurl http://127.0.0.1:7788/xx --request POST --data '{\"api\":\"ping\"}'\r\n```\r\n\r\n\r\n**Static web server**\r\n\r\n```cpp\r\n#include \"co/flag.h\"\r\n#include \"co/http.h\"\r\n\r\nDEF_string(d, \".\", \"root dir\"); // docroot for the web server\r\n\r\nint main(int argc, char** argv) {\r\n    flag::parse(argc, argv);\r\n    so::easy(FLG_d.c_str()); // mum never have to worry again\r\n    return 0;\r\n}\r\n```\r\n\r\n\r\n**HTTP server**\r\n\r\n```cpp\r\nvoid cb(const http::Req\u0026 req, http::Res\u0026 res) {\r\n    if (req.is_method_get()) {\r\n        if (req.url() == \"/hello\") {\r\n            res.set_status(200);\r\n            res.set_body(\"hello world\");\r\n        } else {\r\n            res.set_status(404);\r\n        }\r\n    } else {\r\n        res.set_status(405); // method not allowed\r\n    }\r\n}\r\n\r\n// http\r\nhttp::Server().on_req(cb).start(\"0.0.0.0\", 80);\r\n\r\n// https\r\nhttp::Server().on_req(cb).start(\r\n    \"0.0.0.0\", 443, \"privkey.pem\", \"certificate.pem\"\r\n);\r\n```\r\n\r\n\r\n**HTTP client**\r\n\r\n```cpp\r\nvoid f() {\r\n    http::Client c(\"https://github.com\");\r\n\r\n    c.get(\"/\");\r\n    LOG \u003c\u003c \"response code: \"\u003c\u003c c.status();\r\n    LOG \u003c\u003c \"body size: \"\u003c\u003c c.body().size();\r\n    LOG \u003c\u003c \"Content-Length: \"\u003c\u003c c.header(\"Content-Length\");\r\n    LOG \u003c\u003c c.header();\r\n\r\n    c.post(\"/hello\", \"data xxx\");\r\n    LOG \u003c\u003c \"response code: \"\u003c\u003c c.status();\r\n}\r\n\r\ngo(f);\r\n```\r\n\r\n\r\n\r\n\r\n## 4. Code composition\r\n\r\n- [include](https://github.com/idealvin/coost/tree/master/include)\r\n\r\n  Header files of coost.\r\n\r\n- [src](https://github.com/idealvin/coost/tree/master/src)\r\n\r\n  Source files of coost, built as libco.\r\n\r\n- [test](https://github.com/idealvin/coost/tree/master/test)\r\n\r\n  Test code, each `.cc` file will be compiled into a separate test program.\r\n\r\n- [unitest](https://github.com/idealvin/coost/tree/master/unitest)\r\n\r\n  Unit test code, each `.cc` file corresponds to a different test unit, and all code will be compiled into a single test program.\r\n\r\n- [gen](https://github.com/idealvin/coost/tree/master/gen)\r\n\r\n  A code generator for the RPC framework.\r\n\r\n\r\n\r\n\r\n## 5. Building\r\n\r\n### 5.1 Compilers required\r\n\r\nTo build coost, you need a compiler that supports C++11:\r\n\r\n- Linux: [gcc 4.8+](https://gcc.gnu.org/projects/cxx-status.html#cxx11)\r\n- Mac: [clang 3.3+](https://clang.llvm.org/cxx_status.html)\r\n- Windows: [vs2015+](https://visualstudio.microsoft.com/)\r\n\r\n\r\n### 5.2 Build with xmake\r\n\r\ncoost recommends using [xmake](https://github.com/xmake-io/xmake) as the build tool.\r\n\r\n\r\n#### 5.2.1 Quick start\r\n\r\n```sh\r\n# All commands are executed in the root directory of coost (the same below)\r\nxmake      # build libco by default\r\nxmake -a   # build all projects (libco, gen, test, unitest)\r\n```\r\n\r\n\r\n#### 5.2.2 Build shared library\r\n\r\n```sh\r\nxmake f -k shared\r\nxmake -v\r\n```\r\n\r\n#### 5.2.3 Build with mingw\r\n\r\n```sh\r\nxmake f -p mingw\r\nxmake -v\r\n```\r\n\r\n\r\n#### 5.2.4 Enable HTTP/SSL features\r\n\r\n```sh\r\nxmake f --with_libcurl=true --with_openssl=true\r\nxmake -v\r\n```\r\n\r\n\r\n#### 5.2.5 Install libco\r\n\r\n```sh\r\n# Install header files and libco by default.\r\nxmake install -o pkg         # package related files to the pkg directory\r\nxmake i -o pkg               # the same as above\r\nxmake install -o /usr/local  # install to the /usr/local directory\r\n```\r\n\r\n\r\n#### 5.2.6 Install libco from xrepo\r\n\r\n```sh\r\nxrepo install -f \"openssl=true,libcurl=true\" coost\r\n```\r\n\r\n\r\n\r\n### 5.3 Build with cmake\r\n\r\n[izhengfan](https://github.com/izhengfan) helped to provide cmake support, [SpaceIm](https://github.com/SpaceIm) improved it and made it perfect.\r\n\r\n\r\n#### 5.3.1 Build libco\r\n\r\n```sh\r\nmkdir build \u0026\u0026 cd build\r\ncmake ..\r\nmake -j8\r\n```\r\n\r\n\r\n#### 5.3.2 Build all projects\r\n\r\n```sh\r\nmkdir build \u0026\u0026 cd build\r\ncmake .. -DBUILD_ALL=ON\r\nmake -j8\r\n```\r\n\r\n\r\n#### 5.3.3 Enable HTTP/SSL features\r\n\r\n```sh\r\nmkdir build \u0026\u0026 cd build\r\ncmake .. -DWITH_LIBCURL=ON -DWITH_OPENSSL=ON\r\nmake -j8\r\n```\r\n\r\n\r\n#### 5.3.4 Build shared library\r\n\r\n```sh\r\ncmake .. -DBUILD_SHARED_LIBS=ON\r\nmake -j8\r\n```\r\n\r\n\r\n#### 5.3.5 Find coost in Cmake\r\n\r\n```cmake\r\nfind_package(coost REQUIRED CONFIG)\r\ntarget_link_libraries(userTarget coost::co)\r\n```\r\n\r\n\r\n#### 5.3.6 vcpkg \u0026 conan\r\n\r\n```sh\r\nvcpkg install coost:x64-windows\r\n\r\n# HTTP \u0026 SSL support\r\nvcpkg install coost[libcurl,openssl]:x64-windows\r\n\r\nconan install coost\r\n```\r\n\r\n\r\n\r\n\r\n## 6. License\r\n\r\nThe MIT license. coost contains codes from some other projects, which have their own licenses, see details in [LICENSE.md](https://github.com/idealvin/coost/blob/master/LICENSE.md).\r\n\r\n\r\n\r\n\r\n## 7. Special thanks\r\n\r\n- The code of [co/context](https://github.com/idealvin/coost/tree/master/src/co/context) is from [tbox](https://github.com/tboox/tbox) by [ruki](https://github.com/waruqi), special thanks!\r\n- The early English documents of co are translated by [Leedehai](https://github.com/Leedehai) and [daidai21](https://github.com/daidai21), special thanks!\r\n- [ruki](https://github.com/waruqi) has helped to improve the xmake building scripts, thanks in particular!\r\n- [izhengfan](https://github.com/izhengfan) provided cmake building scripts, thank you very much!\r\n- [SpaceIm](https://github.com/SpaceIm) has improved the cmake building scripts, and provided support for `find_package`. Really great help, thank you!\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidealvin%2Fcoost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidealvin%2Fcoost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidealvin%2Fcoost/lists"}