We briefly introduce some commonly used project examples. More and more complete examples projects can be viewed in project examples.
We can also use the xmake create
command to create various commonly used empty projects to quickly start. For the introduction of this command and the supported project templates, you can type the following command to view:
xmake create --help
Executable Program
target("test")
set_kind("binary")
add_files("src/*.cpp")
For a complete example, execute the following command to create:
xmake create test
If we want to create c language program. We can add -l c
argument. for example:
xmake create -l c test
Static Library Program
target("foo")
set_kind("static")
add_files("src/foo/*.cpp")
target("test")
set_kind("binary")
add_files("src/*.cpp")
add_deps("foo")
We use add_deps
to link a static library to test target.
For a complete example, execute the following command to create:
xmake create -t static test
If we want to create c language program. We can add -l c
argument. for example:
xmake create -l c static test
Shared Library Program
target("foo")
set_kind("shared")
add_files("src/foo/*.cpp")
target("test")
set_kind("binary")
add_files("src/*.cpp")
add_deps("foo")
We use add_deps
to link a shared library to test target.
For a complete example, execute the following command to create:
xmake create -t shared test
If we want to create c language program. We can add -l c
argument. for example:
xmake create -l c shared test