Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and run targets with given group pattern #1913

Closed
waruqi opened this issue Dec 15, 2021 · 0 comments
Closed

Build and run targets with given group pattern #1913

waruqi opened this issue Dec 15, 2021 · 0 comments

Comments

@waruqi
Copy link
Member

waruqi commented Dec 15, 2021

Set group to targets

we can use set_group() to mark the given targets as test/benchmark/... and use set_default(false) to disable to build it by default.

related issues #1026

add_rules("mode.debug", "mode.release")

target("test1")
    set_kind("binary")
    set_default(false)
    set_group("test")
    add_files("src/*.cpp")

target("test2")
    set_kind("binary")
    set_default(false)
    set_group("test")
    add_files("src/*.cpp")

target("benchmark1")
    set_kind("binary")
    set_default(false)
    set_group("benchmark")
    add_files("src/*.cpp")

target("benchmark2")
    set_kind("binary")
    set_default(false)
    set_group("benchmark")
    add_files("src/*.cpp")

target("demo")
    set_kind("binary")
    add_files("src/*.cpp")

Build all tests

We can use this feature to build all tests.

$ xmake -g test
$ xmake --group=test

Run all tests

We can use this feature to run all tests.

$ xmake run -g test
$ xmake run --group=test

Build and run all benchmarks

$ xmake build -g benchmark
$ xmake run -g benchmark

Use group patten to match some targets

$ xmake build -g test_*
$ xmake run -g test/foo_*
$ xmake build -g bench*
$ xmake run -g bench*
@waruqi waruqi added this to the v2.6.2 milestone Dec 15, 2021
@waruqi waruqi changed the title Build and test targets with given group pattern Build and run targets with given group pattern Dec 15, 2021
@waruqi waruqi closed this as completed Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant