{"id":419153,"date":"2021-03-24T02:45:02","date_gmt":"2021-03-23T18:45:02","guid":{"rendered":"http:\/\/4563.org\/?p=419153"},"modified":"2021-03-24T02:45:02","modified_gmt":"2021-03-23T18:45:02","slug":"%e5%bc%80%e6%ba%90-c-c-%e5%ba%93%e5%be%81%e9%9b%86","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=419153","title":{"rendered":"\u5f00\u6e90 C\/C++ \u5e93\u5f81\u96c6"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5f00\u6e90 C\/C++ \u5e93\u5f81\u96c6               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : waruqi <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>xmake \u4e00\u76f4\u5728\u52aa\u529b\u89e3\u51b3 C\/C++ \u5305\u4f9d\u8d56\u7ba1\u7406\u548c\u4f7f\u7528\u95ee\u9898\uff0c\u4e3a\u4e86\u65b9\u4fbf C\/C++ \u5f00\u53d1\u8005\u80fd\u591f\u5feb\u901f\u96c6\u6210\u4f7f\u7528 C\/C++ \u4f9d\u8d56\u5305\uff0c\u6211\u4eec\u5728 xmake-repo \u5305\u4ed3\u5e93\u4e2d\u5df2\u7ecf\u7ef4\u62a4\u4e86\u5c06\u8fd1 300 \u4e2a\u5e38\u7528\u5305<\/p>\n<p>\u5c3d\u7ba1\u8fd8\u8fdc\u8fdc\u4e0d\u5982 vcpkg, conan \u63d0\u4f9b\u7684\u5305\u591a\uff0c\u4f46\u662f\u6211\u4eec\u63d0\u4f9b\u4e86\u66f4\u52a0\u5f3a\u5927\u7684\u7279\u6027\u652f\u6301\uff1a<em>\u7248\u672c\u8bed\u4e49\u652f\u6301<\/em>\uff0c<em>\u4ea4\u53c9\u7f16\u8bd1\u5305\u652f\u6301<\/em>\uff0c<em>\u66f4\u591a\u7684\u5e73\u53f0\u652f\u6301<\/em>\uff0c<em>\u5b9a\u5236\u5316\u5305\u914d\u7f6e\u7f16\u8bd1\u5b89\u88c5<\/em>\uff0c<em>\u7f16\u8bd1\u5de5\u5177\u94fe\u5305\u8fdc\u7a0b\u62c9\u53d6\u652f\u6301<\/em>\u7b49\u7b49<\/p>\n<p>\u4e3a\u4e86\u66f4\u52a0\u4e30\u5bcc\u6211\u4eec\u7684\u5305\u4ed3\u5e93\uff0c\u63d0\u4f9b\u66f4\u591a\u4f18\u8d28\u7684 C\/C++ \u5e93\u7ed9\u7528\u6237\u5feb\u901f\u96c6\u6210\u548c\u4f7f\u7528\uff0c\u73b0\u5411\u5e7f\u5927\u5f00\u6e90\u4f5c\u8005\u5f81\u96c6 C\/C++ \u5e93\u3002<\/p>\n<p>\u5982\u679c\u4f60\u662f C\/C++ \u5e93\u5f00\u6e90\u4f5c\u8005\uff0c\u53ea\u8981\u60a8\u7684\u5e93\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\uff1a<\/p>\n<ol>\n<li>github star &gt;=300<\/li>\n<li>\u957f\u671f\u6d3b\u8dc3\u7ef4\u62a4<\/li>\n<li>\u6709\u5b8c\u5584\u7684 README \u4ecb\u7ecd<\/li>\n<li>\u6709\u81f3\u5c11\u4e00\u79cd\u6784\u5efa\u5de5\u5177\u7ef4\u62a4\uff1aautotools, cmake, xmake, scons, meson, gnumake &#8230;<\/li>\n<\/ol>\n<p>\u90a3\u4e48\uff0c\u53ef\u4ee5\u901a\u8fc7\u56de\u590d\u7559\u8a00\u7684\u65b9\u5f0f\uff0c\u544a\u77e5\u4e8e\u6211\uff0c\u6211\u90fd\u4f1a\u9646\u7eed\u5c06\u5176\u6536\u5f55\u5230\u6211\u4eec\u7684\u5305\u4ed3\u5e93\uff0c\u65b9\u4fbf\u7528\u6237\u80fd\u591f\u5feb\u901f\u4f7f\u7528\u60a8\u7684\u5e93\u3002<\/p>\n<p>\u56de\u590d\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li>\u5e93\u63cf\u8ff0\uff1axxx<\/li>\n<li>\u4ed3\u5e93\u5730\u5740\uff1axxx<\/li>\n<li>\u4e3b\u8981\u8d21\u732e\u8005\uff1axxx<\/li>\n<\/ul>\n<p>\u4e0d\u8fc7\u7531\u4e8e\u6211\u4e2a\u4eba\u65f6\u95f4\u7cbe\u529b\u6709\u9650\uff0c\u5177\u4f53\u6536\u5f55\u65f6\u95f4\u4f1a\u6709\u4e9b\u6ede\u540e\uff0c\u5982\u679c\u6ca1\u6709\u53ca\u65f6\u6536\u5f55\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85<\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u4f60\u6709\u65f6\u95f4\uff0c\u4e5f\u53ef\u4ee5\u53c2\u8003\u6587\u6863\uff0c\u81ea\u5df1\u63d0\u4ea4\u5230\u6211\u4eec\u7684\u4ed3\u5e93\uff0c\u8fc7\u7a0b\u4e5f\u975e\u5e38\u7b80\u5355\uff1a\u63d0\u4ea4\u5305\u5230 xmake \u4ed3\u5e93\u8bf4\u660e<\/p>\n<p>\u5176\u5b9e\u5c31\u662f\u7c7b\u4f3c homebrew \u7684\u7ef4\u62a4\u65b9\u5f0f\uff0c\u4e00\u4e2a\u5305\u7684\u5b9a\u4e49\u5927\u6982\u5c31\u662f\u4e0b\u9762\u8fd9\u6837<\/p>\n<pre><code>package(\"libogg\")      set_homepage(\"https:\/\/www.xiph.org\/ogg\/\")     set_description(\"Ogg Bitstream Library\")      set_urls(\"https:\/\/gitlab.xiph.org\/xiph\/ogg\/-\/archive\/$(version)\/ogg-$(version).tar.gz\",              \"https:\/\/gitlab.xiph.org\/xiph\/ogg.git\")     add_versions(\"v1.3.4\", \"62cc64b9fd3cf57bde3a9033e94534ba34313d2bb9698029f623121a4e47bb9b\")     add_patches(\"v1.3.4\", path.join(os.scriptdir(), \"patches\", \"1.3.4\", \"macos_fix.patch\"), \"e12c41ad71206777f399c1048914e5e5a2fe44e18d0d50ebe9bedbfbe0624c35\")      add_deps(\"cmake\")     if is_plat(\"cross\") and is_subhost(\"windows\") then         add_deps(\"make\")     end      on_install(\"windows\", \"macosx\", \"linux\", \"mingw\", \"iphoneos\", \"android\", \"cross\", function (package)         local configs = {\"-DBUILD_TESTING=OFF\"}         table.insert(configs, \"-DCMAKE_BUILD_TYPE=\" .. (package:debug() and \"Debug\" or \"Release\"))         table.insert(configs, \"-DBUILD_SHARED_LIBS=\" .. (package:config(\"shared\") and \"ON\" or \"OFF\"))         table.insert(configs, \"-DCMAKE_POSITION_INDEPENDENT_CODE=ON\")         import(\"package.tools.cmake\").install(package, configs)     end)      on_test(function (package)         assert(package:has_cfuncs(\"ogg_sync_init\", {includes = {\"stdint.h\", \"ogg\/ogg.h\"}}))     end) <\/code><\/pre>\n<p>\u5982\u679c\u60a8\u4e0d\u662f\u5f00\u6e90\u5e93\u4f5c\u8005\uff0c\u4f46\u662f\u6709\u60f3\u4f7f\u7528\u7684 C\/C++ \u5e93\uff0c\u4e5f\u53ef\u4ee5\u56de\u590d\u5230 issues#10\uff0c\u540e\u7eed\u6709\u65f6\u95f4\uff0c\u6211\u4e5f\u4f1a\u8003\u8651\u6536\u5f55\u3002<\/p>\n<h3>xmake \u4ecb\u7ecd<\/h3>\n<p>xmake\u662f\u4e00\u4e2a\u73b0\u4ee3\u5316\u7684 C\/C++ \u6784\u5efa\u5de5\u5177\uff0c\u5b83\u63d0\u4f9b\u4e86\u65b9\u4fbf\u5feb\u6377\u7684 C\/C++ \u4f9d\u8d56\u5305\u7ba1\u7406\u548c\u96c6\u6210\u652f\u6301<\/p>\n<p>xmake \u4e0d\u4ec5\u80fd\u591f\u5feb\u901f\u96c6\u6210\u4f7f\u7528 vcpkg, conan, brew, pacman, clib, dub \u7b49\u5305\u7ba1\u7406\u5668\u4e2d\u7684\u5305\uff0c\u4e5f\u6709\u81ea\u5efa\u7684\u5305\u7ba1\u7406\u5668\uff0c\u4ee5\u53ca\u81ea\u6709\u5305\u4ed3\u5e93\u7ef4\u62a4 xmake-repo <\/p>\n<p>\u96c6\u6210\u4f7f\u7528\u65b9\u5f0f\u975e\u5e38\u7b80\u5355\uff0c\u540c\u65f6\u652f\u6301\u591a\u7248\u672c\u8bed\u4e49\u652f\u6301\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>add_requires(\"tbox &gt;1.6.1\", \"libuv master\", \"vcpkg::ffmpeg\", \"brew::pcre2\/libpcre2-8\") add_requires(\"conan::openssl\/1.1.1g\", {alias = \"openssl\", optional = true, debug = true}) target(\"test\")     set_kind(\"binary\")     add_files(\"src\/*.c\")     add_packages(\"tbox\", \"libuv\", \"vcpkg::ffmpeg\", \"brew::pcre2\/libpcre2-8\", \"openssl\") <\/code><\/pre>\n<p>\u540c\u65f6\uff0c\u6211\u4eec\u4e5f\u63d0\u4f9b\u4e86\u72ec\u7acb\u7684 cli \u5305\u7ba1\u7406\u5de5\u5177 xrepo\uff0c\u7528\u4e8e\u65b9\u4fbf\u7ba1\u7406\u7ef4\u62a4 c\/c++ \u5305\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>$ xrepo install \"zlib 1.2.x\" $ xrepo install zlib \"tbox &gt;=1.6\" $ xrepo install -p iphoneos -a arm64 zlib $ xrepo install -p android [--ndk=\/xxx] zlib $ xrepo install -p mingw [--mingw=\/xxx] zlib $ xrepo install -p cross --sdk=\/xxx\/arm-linux-musleabi-cross zlib <\/code><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/04\/20210401_6065932cb90fd.gif\" alt=\"\u5f00\u6e90 C\/C++ \u5e93\u5f81\u96c6\" \/><\/p>\n<h3>\u76f8\u5173\u94fe\u63a5<\/h3>\n<ul>\n<li>xmake<\/li>\n<li>xmake-repo<\/li>\n<li>xrepo<\/li>\n<\/ul><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5594018\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yitingbai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             C++\u7684\u5305\u7ba1\u7406\u771f\u662f\u6c38\u8fdc\u7684\u75db                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594019\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : waruqi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yitingbai \u4f7f\u7528 xmake \u53ef\u4ee5\u51cf\u5c11\u75db\u82e6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594020\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Chenamy2017 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u7740\u4e0d\u9519\u554a\uff0c\u70b9\u8d5e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594021\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : QBugHunter <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6bd4 Cmake \u7684\u4f18\u52bf\u662f\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594022\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : waruqi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @QBugHunter cmake \u6ca1\u6709\u5185\u7f6e\u7684\u5305\u7ba1\u7406\uff0c\u53ea\u80fd\u5bf9\u63a5 vcpkg\/conan\uff0c\u5e76\u4e14 xmake \u8fd8\u652f\u6301\u8fdc\u7a0b\u81ea\u52a8\u62c9\u53d6\u4ea4\u53c9\u7f16\u8bd1\u5de5\u5177\u94fe\uff0c\u4ee5\u53ca\u5bf9\u4f9d\u8d56\u5305\u505a\u4ea4\u53c9\u7f16\u8bd1\uff0c\u5373\u4f7f\u662f vcpkg\/conan \u4e5f\u4e0d\u652f\u6301\u7f16\u8bd1\u5de5\u5177\u94fe\u7684\u7ba1\u7406                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594023\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dbskcnc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u652f\u6301\uff0c\u867d\u7136\u8fd8\u6ca1\u7528\u4e0a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594024\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : joshua7v <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4e86\u4e0b ffmpeg \u8fd8\u6ca1\u652f\u6301 windows \uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594025\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : waruqi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @joshua7v \u6709\u4e9b\u5e93\u8fd8\u6ca1\uff0c\u5f97\u770b\u5e93\u81ea\u8eab\u7684\u6784\u5efa\u7cfb\u7edf\u652f\u6301\uff0c\u5982\u679c\u662f cmake\/scons\/meson\/xmake \u7ef4\u62a4\u7684\uff0cwindows \u57fa\u672c\u4e0a\u90fd\u80fd\u5feb\u901f\u652f\u6301\uff0c\u800c ffmpeg \u4ec5\u6709 autotools\uff0c\u7406\u8bba\u4e0a\u4e5f\u80fd\u505a\u6210 windows \u652f\u6301\uff0c\u81f3\u5c11 mingw on msys2 \u7684\u53ef\u4ee5\u641e<\/p>\n<p>\u4f46\u662f\u9700\u8981\u76ee\u524d\u4ee5\u6211\u4e00\u4e2a\u4eba\u7684\u4eba\u529b \u6682\u65f6\u6ca1\u65f6\u95f4\u5f04\uff0c\u5bf9\u4e8e\u4e0d\u652f\u6301\u7684\u5e73\u53f0\uff0c\u6682\u65f6\u53ef\u4ee5\u5207\u5230 vcpkg\/conan \u5305\uff0c\u4e5f\u8bb8\u5c06\u6765\u6709\u65f6\u95f4\u4e86\uff0c\u6211\u4e5f\u4f1a\u6574\u8fdb\u53bb                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594026\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : waruqi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6302\u4e86\u4e00\u5929 \u4e5f\u6ca1\u6765\u4e00\u4e2a\u5e93\uff0c\u54ce\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5594027\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zoumouse <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u652f\u6301\u4e0b grpc gflags brpc braft \u7b49                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5f00\u6e90 C\/C++ \u5e93\u5f81\u96c6 \u8cc7\u6df1\u5927\u4f6c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/419153"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=419153"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/419153\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=419153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=419153"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=419153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}