2
0

quickstart.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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/#/guide/quickstart">https://xmake.io/#/guide/quickstart</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. <h2 id="usagevideo">Usage Video</h2>
  86. <p><a href="https://asciinema.org/a/133693"><img src="https://asciinema.org/a/133693.png" alt="asciicast"></a></p>
  87. <h2 id="createproject">Create Project</h2>
  88. <pre><code class="lang-bash">$ xmake create -l c -P ./hello
  89. </code></pre>
  90. <p>And xmake will generate some files for c language project:</p>
  91. <pre><code>hello
  92. ├── src
  93. │ └── main.c
  94. └── xmake.lua
  95. </code></pre><p>It is a simple console program only for printing <code>hello xmake!</code></p>
  96. <p>The content of <code>xmake.lua</code> is very simple:</p>
  97. <pre><code class="lang-lua">target("hello")
  98. set_kind("binary")
  99. add_files("src/*.c")
  100. </code></pre>
  101. <p>Supported Languages</p>
  102. <ul>
  103. <li>C</li>
  104. <li>C++</li>
  105. <li>Objective-C and Objective-C++</li>
  106. <li>Swift</li>
  107. <li>Assembly</li>
  108. <li>Golang</li>
  109. <li>Rust</li>
  110. <li>Dlang</li>
  111. <li>Fortran</li>
  112. <li>Cuda</li>
  113. <li>Zig</li>
  114. <li>Vala</li>
  115. <li>Pascal</li>
  116. <li>Nim</li>
  117. </ul>
  118. <p><p class="tip"><br> If you want to known more options, please run: <code>xmake create --help</code><br></p>
  119. </p>
  120. <h2 id="buildproject">Build Project</h2>
  121. <pre><code class="lang-bash">$ cd hello
  122. $ xmake
  123. </code></pre>
  124. <h2 id="runprogram">Run Program</h2>
  125. <pre><code class="lang-bash">$ xmake run hello
  126. </code></pre>
  127. <h2 id="debugprogram">Debug Program</h2>
  128. <p>To debug the hello, you need change to the debug mode and build it.</p>
  129. <pre><code class="lang-bash">$ xmake config -m debug
  130. $ xmake
  131. </code></pre>
  132. <p>Then run the following command to debug target program.</p>
  133. <pre><code class="lang-bash">$ xmake run -d hello
  134. </code></pre>
  135. <p>It will start the debugger (.e.g lldb, gdb, windbg, vsjitdebugger, ollydbg ..) to load our program.</p>
  136. <pre><code class="lang-bash">[lldb]$target create "build/hello"
  137. Current executable set to &#39;build/hello&#39; (x86_64).
  138. [lldb]$b main
  139. Breakpoint 1: where = hello`main, address = 0x0000000100000f50
  140. [lldb]$r
  141. Process 7509 launched: &#39;/private/tmp/hello/build/hello&#39; (x86_64)
  142. Process 7509 stopped
  143. * thread #1: tid = 0x435a2, 0x0000000100000f50 hello`main, queue = &#39;com.apple.main-thread&#39;, stop reason = breakpoint 1.1
  144. frame #0: 0x0000000100000f50 hello`main
  145. hello`main:
  146. -> 0x100000f50 <+0>: pushq %rbp
  147. 0x100000f51 <+1>: movq %rsp, %rbp
  148. 0x100000f54 <+4>: leaq 0x2b(%rip), %rdi ; "hello world!"
  149. 0x100000f5b <+11>: callq 0x100000f64 ; symbol stub for: puts
  150. [lldb]$
  151. </code></pre>
  152. <p>To study more debug command, please click the url <a href="https://lldb.llvm.org/use/map.html">GDB to LLDB command map</a></p>
  153. <p>If you want to use the specify debugger, try</p>
  154. <pre><code class="lang-bash">$ xmake f --debugger=gdb
  155. $ xmake run -d hello
  156. </code></pre>
  157. <p>!> You can also use short command option, for example: <code>xmake r</code> or <code>xmake run</code></p>
  158. </article>
  159. </body>
  160. </html>