summaryrefslogtreecommitdiff
path: root/xmake/modules/cli/amalgamate.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-19 22:34:39 +0800
committerruki <[email protected]>2021-10-19 22:34:39 +0800
commit63a7afefde2caf98b3b4a9114b6050f9d4baecd4 (patch)
treea7c6daf0935e001b415462faa4c115a35c7f9bf7 /xmake/modules/cli/amalgamate.lua
parent632b064c26ed87080d891d193cf959ab68f09651 (diff)
improve amalgamate
Diffstat (limited to 'xmake/modules/cli/amalgamate.lua')
-rw-r--r--xmake/modules/cli/amalgamate.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/modules/cli/amalgamate.lua b/xmake/modules/cli/amalgamate.lua
index 1657fbadf..e495ae70b 100644
--- a/xmake/modules/cli/amalgamate.lua
+++ b/xmake/modules/cli/amalgamate.lua
@@ -35,6 +35,11 @@ local options =
-- generate code
function _generate_amalgamate_code(target, opt)
+ -- only for library
+ if not target:is_library() then
+ return
+ end
+
-- generate source code
local outputdir = opt.outputdir
local uniqueid = opt.uniqueid
@@ -59,7 +64,7 @@ function _generate_amalgamate_code(target, opt)
-- generate header file
local srcheaders = target:headerfiles(includedir)
- if srcheaders then
+ if srcheaders and #srcheaders > 0 then
local outputpath = path.join(outputdir, target:name() .. ".h")
local outputfile = io.open(outputpath, "w")
for _, srcheader in ipairs(srcheaders) do