local_package_old.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>xmake</title>
  6. <link rel="icon" href="/assets/img/favicon.ico">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  8. <meta name="description" content="Description">
  9. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  10. <link href="/assets/npm/github-markdown/github-markdown.min.css" rel="stylesheet">
  11. <style>
  12. .markdown-body {
  13. box-sizing: border-box;
  14. min-width: 200px;
  15. max-width: 980px;
  16. margin: 0 auto;
  17. padding: 45px;
  18. }
  19. @media (max-width: 767px) {
  20. .markdown-body {
  21. padding: 15px;
  22. }
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <article class="markdown-body">
  28. <h4>This is a mirror page, please see the original page: </h4><a href="https://xmake.io/#/package/local_package_old">https://xmake.io/#/package/local_package_old</a>
  29. <div id="wwads-panel" class="wwads-cn wwads-vertical wwads-sticky" data-id="239" style="max-width:180px;bottom:20px;right:20px;width:200px;height:260px;background:#fff;position:fixed"></div>
  30. </br>
  31. <script type="text/javascript" charset="UTF-8" src="https://cdn.wwads.cn/js/makemoney.js" async></script>
  32. <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CE7I52QU&placement=xmakeio" id="_carbonads_js"></script>
  33. <style>
  34. #carbonads {
  35. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
  36. Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
  37. }
  38. #carbonads {
  39. display: flex;
  40. max-width: 330px;
  41. background-color: hsl(0, 0%, 98%);
  42. box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
  43. }
  44. #carbonads a {
  45. color: inherit;
  46. text-decoration: none;
  47. }
  48. #carbonads a:hover {
  49. color: inherit;
  50. }
  51. #carbonads span {
  52. position: relative;
  53. display: block;
  54. overflow: hidden;
  55. }
  56. #carbonads .carbon-wrap {
  57. display: flex;
  58. }
  59. .carbon-img {
  60. display: block;
  61. margin: 0;
  62. line-height: 1;
  63. }
  64. .carbon-img img {
  65. display: block;
  66. }
  67. .carbon-text {
  68. font-size: 13px;
  69. padding: 10px;
  70. line-height: 1.5;
  71. text-align: left;
  72. }
  73. .carbon-poweredby {
  74. display: block;
  75. padding: 8px 10px;
  76. background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
  77. text-align: center;
  78. text-transform: uppercase;
  79. letter-spacing: .5px;
  80. font-weight: 600;
  81. font-size: 9px;
  82. line-height: 1;
  83. }
  84. </style>
  85. <h3 id="note">Note</h3>
  86. <p>This is a very early packaging solution, incompatible with <code>add_requires()</code> and <code>add_packages()</code>, and is gradually being deprecated.</p>
  87. <p>2.5.5 Start to adopt the new local package solution, see for details: <a href="/mirror/package/local_package.html">New local package solution</a>.</p>
  88. <p>If you still want to use the old packaging method, you can execute the following command to specify the package format: <code>oldpkg</code></p>
  89. <pre><code class="lang-console">$ xmake package -f oldpkg
  90. </code></pre>
  91. <p>To replace the previous</p>
  92. <pre><code class="lang-console">$ xmake package
  93. </code></pre>
  94. <h3 id="packaginginstructions">Packaging instructions</h3>
  95. <p>By including a dependency package directory and some binary library files in the project, it is convenient to integrate some third-party dependency libraries. This method is relatively simple and straightforward, but the disadvantages are also obvious and inconvenient to manage.</p>
  96. <p>Take the tbox project as an example. The dependency package is as follows:</p>
  97. <pre><code>- base.pkg
  98. - zlib.pkg
  99. - polarssl.pkg
  100. - openssl.pkg
  101. - mysql.pkg
  102. - pcre.pkg
  103. - ...
  104. </code></pre><p>If you want the current project to recognize loading these packages, you first need to specify the package directory path, for example:</p>
  105. <pre><code class="lang-lua">add_packagedirs("packages")
  106. </code></pre>
  107. <p>Once specified, you can add integration package dependencies in the target scope via the <a href="/mirror/manual/project_target.html#targetadd_packages">add_packages</a> interface, for example:</p>
  108. <pre><code class="lang-lua">target("tbox")
  109. add_packages("zlib", "polarssl", "pcre", "mysql")
  110. </code></pre>
  111. <p>So how to generate a *.pkg package, if it is based on xmake project, the generation method is very simple, only need:</p>
  112. <pre><code class="lang-console">$ cd tbox
  113. $ xmake package
  114. </code></pre>
  115. <p>You can generate a tbox.pkg cross-platform package in the build directory for use by third-party projects. I can also directly set the output directory and compile and generate it into the other project, for example:</p>
  116. <pre><code class="lang-console">$ cd tbox
  117. $ xmake package -o ../test/packages
  118. </code></pre>
  119. <p>In this way, the test project can pass <a href="/mirror/manual/project_target.html#targetadd_packages">add_packages</a> and <a href="/mirror/manual/global_interfaces.html#add_packagedirs">add_packagedirs</a> to configure and use the tbox.pkg package.</p>
  120. <p>For a detailed description of the built-in package, you can also refer to the following related article, which is described in detail: <a href="https://tboox.org/cn/2016/08/06/add-package-and-autocheck/">Dependency package addition and automatic detection mechanism</a></p>
  121. </article>
  122. </body>
  123. </html>