-
-
Notifications
You must be signed in to change notification settings - Fork 774
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
Feature request: Unity build #1019
Comments
|
This seems to be a great optimization feature, and I will consider supporting this feature in future versions. But the current 2.3.9 version focuses on improving package management, so I do not plan to add support for it in 2.3.9 version. |
|
This file contains the implementation detail for unity build mode: writing a file like There are some rules for files to be included, for instance, any files with different compiler definitions can't be included in one block. For information about UNIQUE_ID, see |
|
I have supported it. #1749 C Unityadd_rules("c.unity_build")C++ Unityadd_rules("c++.unity_build")Batch mode (default mode)We can use target("test")
set_kind("binary")
add_includedirs("src")
add_rules("c++.unity_build", {batchsize = 2})
add_files("src/*.c", "src/*.cpp")Group modetarget("test")
set_kind("binary")
add_rules("c++.unity_build", {batchsize = 0}) -- disable batch mode
add_files("src/*.c", "src/*.cpp")
add_files("src/foo/*.c", {unity_group = "foo"})
add_files("src/bar/*.c", {unity_group = "bar"})Batch and group modetarget("test")
set_kind("binary")
add_includedirs("src")
add_rules("c++.unity_build", {batchsize = 2})
add_files("src/*.c", "src/*.cpp")
add_files("src/foo/*.c", {unity_group = "foo"})
add_files("src/bar/*.c", {unity_group = "bar"})Ignore the given filestarget("test")
set_kind("binary")
add_includedirs("src")
add_rules("c++.unity_build", {batchsize = 2})
add_files("src/*.c", "src/*.cpp")
add_files("src/test/*.c", {unity_ignored = true}) -- ignore these files$ xmake -r
[ 11%]: ccache compiling.release build/.gens/test/unity_build/unity_642A245F.c
[ 11%]: ccache compiling.release build/.gens/test/unity_build/unity_bar.c
[ 11%]: ccache compiling.release build/.gens/test/unity_build/unity_73161A20.c
[ 11%]: ccache compiling.release build/.gens/test/unity_build/unity_F905F036.c
[ 11%]: ccache compiling.release build/.gens/test/unity_build/unity_foo.c
[ 11%]: ccache compiling.release build/.gens/test/unity_build/unity_642A245F.cpp
[ 77%]: linking.release test
[100%]: build okUnique IDtarget("test")
set_kind("binary")
add_includedirs("src")
add_rules("c++.unity_build", {batchsize = 2, uniqueid = "MY_UNITY_ID"})
add_files("src/*.c", "src/*.cpp") |
|
That's nice ! Thanks a lot |
|
I have supported Unique ID. |
Is your feature request related to a problem? Please describe.
with CMake we have this fantastic feature: https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html
which at work help us to reduce the compilation time by ~4-5 times, do you think it's possible to have the equivalent ?
Describe the solution you'd like
Same unity build as CMake with possibility to exclude some source from the unity such as (obj-c) file
Describe alternatives you've considered
Using CMake
The text was updated successfully, but these errors were encountered: