|
| 1 | +# AI Q&A Optimization {#ai-qa-optimization} |
| 2 | + |
| 3 | +When asking questions about xmake to AI assistants (such as ChatGPT, Claude, Cursor, etc.), using some techniques can help AI better understand the context and provide more accurate, higher-quality answers. |
| 4 | + |
| 5 | +## Provide Reference Documentation Links |
| 6 | + |
| 7 | +When asking questions, explicitly providing xmake's LLMs reference documentation link can help AI quickly understand xmake's complete API and features. |
| 8 | + |
| 9 | +Reference documentation link: [https://xmake.io/llms-full.txt](https://xmake.io/llms-full.txt) |
| 10 | + |
| 11 | +``` |
| 12 | +Please refer to https://xmake.io/llms-full.txt before answering my question: ... |
| 13 | +``` |
| 14 | + |
| 15 | +Or more specifically: |
| 16 | + |
| 17 | +``` |
| 18 | +Please read https://xmake.io/llms-full.txt first to understand xmake's API and features, then answer: |
| 19 | +How do I configure a target that uses C++20 modules? |
| 20 | +``` |
| 21 | + |
| 22 | +## Provide Complete Context Information |
| 23 | + |
| 24 | +When asking questions, try to provide complete context information, including: |
| 25 | + |
| 26 | +- **Project Type**: Is it a C/C++ project, Swift project, or other language |
| 27 | +- **Target Platform**: Windows, Linux, macOS, Android, iOS, etc. |
| 28 | +- **Compiler**: Toolchain used (gcc, clang, msvc, etc.) |
| 29 | +- **Specific Requirements**: What functionality you want to implement or what problem you want to solve |
| 30 | +- **Error Messages**: If you encounter problems, provide complete error messages |
| 31 | + |
| 32 | +Example: |
| 33 | + |
| 34 | +``` |
| 35 | +Please refer to https://xmake.io/llms-full.txt to help me solve the following problem: |
| 36 | +
|
| 37 | +Project Type: C++ project |
| 38 | +Platform: Linux |
| 39 | +Compiler: gcc-12 |
| 40 | +Problem: I want to configure a target in xmake.lua that uses C++20 modules, but I don't know how to set it up. |
| 41 | +Current xmake.lua content: |
| 42 | +[Paste your xmake.lua content] |
| 43 | +``` |
| 44 | + |
| 45 | +## Reference Specific API Documentation |
| 46 | + |
| 47 | +If the question involves specific APIs, you can reference relevant documentation links when asking: |
| 48 | + |
| 49 | +``` |
| 50 | +Please refer to the target-related APIs in https://xmake.io/llms-full.txt to help me configure: |
| 51 | +1. How to set the target's compilation mode (debug/release) |
| 52 | +2. How to add precompiled header file support |
| 53 | +``` |
| 54 | + |
| 55 | +## Provide Code Examples |
| 56 | + |
| 57 | +When asking questions, if possible, provide your current code or configuration: |
| 58 | + |
| 59 | +``` |
| 60 | +Please refer to https://xmake.io/llms-full.txt to help me optimize the following xmake.lua configuration: |
| 61 | +
|
| 62 | +target("mytarget") |
| 63 | + set_kind("binary") |
| 64 | + add_files("src/*.cpp") |
| 65 | +
|
| 66 | +I want to add the following features: |
| 67 | +- Enable C++20 standard |
| 68 | +- Add precompiled header files |
| 69 | +- Configure different optimization options for debug and release modes |
| 70 | +``` |
| 71 | + |
| 72 | +## Clarify Question Type |
| 73 | + |
| 74 | +When asking questions, clearly state the question type: |
| 75 | + |
| 76 | +- **Configuration Question**: How to configure a certain feature |
| 77 | +- **Compilation Question**: Errors encountered during compilation |
| 78 | +- **Performance Question**: Build speed optimization |
| 79 | +- **Best Practice**: How to better use a certain feature |
| 80 | + |
| 81 | +Example: |
| 82 | + |
| 83 | +``` |
| 84 | +Please refer to https://xmake.io/llms-full.txt. This is a configuration question: |
| 85 | +
|
| 86 | +I want to configure CUDA project compilation in xmake, and need: |
| 87 | +1. Specify CUDA SDK version |
| 88 | +2. Set GPU architecture |
| 89 | +3. Configure compilation options |
| 90 | +``` |
| 91 | + |
| 92 | +## Ask Step by Step |
| 93 | + |
| 94 | +For complex questions, you can ask step by step: |
| 95 | + |
| 96 | +``` |
| 97 | +Please refer to https://xmake.io/llms-full.txt to help me configure step by step: |
| 98 | +
|
| 99 | +Step 1: How to create a basic C++ target |
| 100 | +Step 2: How to add dependency packages |
| 101 | +Step 3: How to configure cross-compilation |
| 102 | +``` |
| 103 | + |
| 104 | +## Verify Answer Accuracy |
| 105 | + |
| 106 | +AI answers may not be completely accurate. It is recommended to: |
| 107 | + |
| 108 | +1. **Consult Official Documentation**: Verify whether the APIs and usage provided by AI are correct. You can refer to the [API Reference](/api/description/specification) and [Guide](/guide/introduction) |
| 109 | +2. **Actually Test**: Actually test the configuration provided by AI in your project |
| 110 | +3. **Cross-verify**: If possible, ask questions in different ways to verify answer consistency |
| 111 | + |
| 112 | +## Example: Complete Question Template |
| 113 | + |
| 114 | +``` |
| 115 | +Please refer to https://xmake.io/llms-full.txt to understand xmake's complete API and features. |
| 116 | +
|
| 117 | +Project Information: |
| 118 | +- Type: C++ project |
| 119 | +- Platform: Linux |
| 120 | +- Compiler: clang-15 |
| 121 | +- Standard: C++20 |
| 122 | +
|
| 123 | +Current Problem: |
| 124 | +I want to configure a target that uses C++20 modules, but encountered a compilation error. |
| 125 | +
|
| 126 | +Current Configuration: |
| 127 | +target("mymodule") |
| 128 | + set_kind("binary") |
| 129 | + set_languages("c++20") |
| 130 | + add_files("src/*.cpp") |
| 131 | +
|
| 132 | +Error Message: |
| 133 | +[Paste error message] |
| 134 | +
|
| 135 | +Please help me: |
| 136 | +1. Analyze the cause of the problem |
| 137 | +2. Provide the correct configuration method |
| 138 | +3. Give a complete example code |
| 139 | +``` |
| 140 | + |
| 141 | +Through the above methods, you can help AI better understand your needs and provide more accurate and useful answers. |
| 142 | + |
0 commit comments