diff options
| author | ruki <[email protected]> | 2019-01-17 22:51:37 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-01-17 11:09:44 +0800 |
| commit | eb91261789a1f11e9114709571b11a918902a819 (patch) | |
| tree | bfdf621dce7bba547d32e383a4972635e16980ba | |
| parent | 6e7bedfc63217b0e1d02a55b01de6f5e5457ec1a (diff) | |
fix build version
| -rw-r--r-- | core/src/luajit/xmake.lua | 7 | ||||
| -rw-r--r-- | core/src/sv/xmake.lua | 6 | ||||
| -rw-r--r-- | core/src/tbox/src/tbox/xmake.lua | 21 | ||||
| -rw-r--r-- | xmake/actions/config/configheader.lua | 10 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 25 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/project.lua | 13 |
6 files changed, 56 insertions, 26 deletions
diff --git a/core/src/luajit/xmake.lua b/core/src/luajit/xmake.lua index 964c50538..b342fbb67 100644 --- a/core/src/luajit/xmake.lua +++ b/core/src/luajit/xmake.lua @@ -22,12 +22,9 @@ target("luajit") set_languages("gnu99") end - -- set the object files directory - set_objectdir("$(buildir)/.objs") - -- add headers - add_headers("src/(*.h)") - set_headerdir("$(buildir)/luajit") + add_headerfiles("src/(*.h)") + add_headerdirs("src") -- add include directories add_includedirs("src", autogendir) diff --git a/core/src/sv/xmake.lua b/core/src/sv/xmake.lua index dce59f136..cb7c6fa97 100644 --- a/core/src/sv/xmake.lua +++ b/core/src/sv/xmake.lua @@ -20,9 +20,9 @@ target("sv") set_default(true) set_languages("c99") set_kind("$(kind)") - set_headerdir("$(buildir)/include") - add_headers("include/(*.h)") - add_includedirs("$(buildir)", "include") + add_headerfiles("include/(*.h)") + add_headerdirs("include") + add_includedirs("include") add_files("src/*.c") includes("test") diff --git a/core/src/tbox/src/tbox/xmake.lua b/core/src/tbox/src/tbox/xmake.lua index 961e27365..b21eb34af 100644 --- a/core/src/tbox/src/tbox/xmake.lua +++ b/core/src/tbox/src/tbox/xmake.lua @@ -8,17 +8,22 @@ target("tbox") add_defines("__tb_prefix__=\"tbox\"") -- set the auto-generated config.h - set_config_header("$(buildir)/tbox/tbox.config.h", {prefix = "TB_CONFIG", version = "1.6.2", build = "%Y%m%d%H%M"}) + set_config_header("$(buildir)/$(plat)/$(arch)/$(mode)/tbox.config.h", {prefix = "TB_CONFIG", version = "1.6.2", buildversion = "%Y%m%d%H%M"}) - -- add includes directory - add_includedirs("$(buildir)") - add_includedirs("$(buildir)/tbox") + -- add include directories + add_includedirs("..") + add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)") + + -- add public header directories + add_headerdirs("..") + add_headerdirs("$(buildir)/$(plat)/$(arch)/$(mode)") -- add the header files for installing - add_headers("../(tbox/**.h)|**/impl/**.h") - add_headers("../(tbox/prefix/**/prefix.S)") - add_headers("../(tbox/math/impl/*.h)") - add_headers("../(tbox/utils/impl/*.h)") + add_headerfiles("../(tbox/**.h)|**/impl/**.h") + add_headerfiles("../(tbox/prefix/**/prefix.S)") + add_headerfiles("../(tbox/math/impl/*.h)") + add_headerfiles("../(tbox/utils/impl/*.h)") + add_headerfiles("$(buildir)/$(plat)/$(arch)/$(mode)/tbox.config.h", {prefixdir = "tbox"}) -- add packages add_options("zlib", "mysql", "sqlite3", "openssl", "polarssl", "mbedtls", "pcre2", "pcre") diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua index 0480077ff..307a9bf83 100644 --- a/xmake/actions/config/configheader.lua +++ b/xmake/actions/config/configheader.lua @@ -48,8 +48,14 @@ function _make_for_target(target) -- make version local version, version_build = target:configversion() - if not version then - version, version_build = project.version() + if not version or not version_build then + local project_version, project_version_build = project.version() + if not version then + version = project_version + end + if not version_build then + version_build = project_version_build + end end if version then file:print("// version") diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index a67175750..e8024ecb6 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1032,6 +1032,9 @@ function target:headerfiles(outputdir, only_deprecated) local headerdir = outputdir or (only_deprecated and self:headerdir() or path.join(self:installdir(), "include")) assert(headerdir) + -- get the extra information + local extrainfo = table.wrap(self:get("__extra_headerfiles")) + -- get the source pathes and destinate pathes local srcheaders = {} local dstheaders = {} @@ -1054,15 +1057,24 @@ function target:headerfiles(outputdir, only_deprecated) -- add the source headers table.join2(srcheaders, srcpathes) + -- get the prefix directory + local prefixdir = (extrainfo[header] or {}).prefixdir + -- add the destinate headers for _, srcpath in ipairs(srcpathes) do + -- get the destinate directory + local dstdir = headerdir + if prefixdir then + dstdir = path.join(dstdir, prefixdir) + end + -- the destinate header local dstheader = nil if rootdir then - dstheader = path.absolute(path.relative(srcpath, rootdir), headerdir) + dstheader = path.absolute(path.relative(srcpath, rootdir), dstdir) else - dstheader = path.join(headerdir, path.filename(srcpath)) + dstheader = path.join(dstdir, path.filename(srcpath)) end assert(dstheader) @@ -1423,7 +1435,14 @@ function target:configversion() local configheader_extra = self:get("__extra_config_header") if type(configheader_extra) == "table" then version = table.wrap(configheader_extra[configheader]).version - buildversion = table.wrap(configheader_extra[configheader]).buildversion + buildversion = self._CONFIGHEADER_BUILDVERSION + if not buildversion then + buildversion = table.wrap(configheader_extra[configheader]).buildversion + if buildversion then + buildversion = os.date(buildversion, os.time()) + end + self._CONFIGHEADER_BUILDVERSION = buildversion + end end -- ok? diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index 19dc75a37..ae8376a3d 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -162,14 +162,17 @@ function sandbox_core_project.version() -- get version and build version local version = project.get("version") - local version_build = sandbox_core_project._version_build + local version_build = nil if version then local version_extra = project.get("__extra_version") if version_extra then - version_build = table.wrap(version_extra[version]).build - if type(version_build) == "string" then - version_build = os.date(version_build, os.time()) - sandbox_core_project._version_build = version_build + version_build = sandbox_core_project._VERSION_BUILD + if not version_build then + version_build = table.wrap(version_extra[version]).build + if type(version_build) == "string" then + version_build = os.date(version_build, os.time()) + sandbox_core_project._VERSION_BUILD = version_build + end end end end |
