|
|
@@ -1848,3 +1848,53 @@ If you don’t want to automatically generate def from dll.a, but want to borrow
|
|
|
`{dllname = xxx, arch = "xxx"}` These are optional, according to your needs.
|
|
|
|
|
|
You can also directly xmake l utils.platform.gnu2mslib xxx.lib xxx.dll.a quick test verification
|
|
|
+
|
|
|
+### cli
|
|
|
+
|
|
|
+#### cli.amalgamate
|
|
|
+
|
|
|
+- Merge into single source file
|
|
|
+
|
|
|
+This is a small utility module for quickly merging all c/c++ and header sources inside a given target into a single source file.
|
|
|
+
|
|
|
+The merge expands all the internal includes headers and generates a DAG, which is introduced by topological sorting.
|
|
|
+
|
|
|
+By default it will handle the merge of all targets, for example:
|
|
|
+
|
|
|
+```bash
|
|
|
+$ xmake l cli.amalgamate
|
|
|
+build/tbox.c generated!
|
|
|
+build/tbox.h generated!
|
|
|
+```
|
|
|
+
|
|
|
+We can also specify the targets we need for the merge:
|
|
|
+
|
|
|
+```bash
|
|
|
+$ xmake l cli.amalgamate tbox
|
|
|
+build/tbox.c generated!
|
|
|
+build/tbox.h generated!
|
|
|
+```
|
|
|
+
|
|
|
+You can also handle symbol conflicts by specifying a custom unique ID macro definition for each source file you merge.
|
|
|
+
|
|
|
+```bash
|
|
|
+$ xmake l cli.amalgamate -u MY_UNIQUEU_ID
|
|
|
+build/tbox.c generated!
|
|
|
+build/tbox.h generated!
|
|
|
+```
|
|
|
+
|
|
|
+If there are renamed symbols in multiple source files, you can determine if the `MY_UNIQUEU_ID` macro is defined, and if it is, then it is in a single file, so you can handle the renamed symbols yourself in the source code.
|
|
|
+
|
|
|
+```c
|
|
|
+#ifdef MY_UNIQUEU_ID
|
|
|
+ // do some thing
|
|
|
+#endif
|
|
|
+```
|
|
|
+
|
|
|
+We can also specify the output location:
|
|
|
+
|
|
|
+```bash
|
|
|
+$ xmake l cli.amalgamate -o /xxx
|
|
|
+/xxx/tbox.c generated!
|
|
|
+/xxx/tbox.h generated!
|
|
|
+```
|