Skip to content

Commit

Permalink
remove deprecated headers
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Aug 1, 2023
1 parent c252ce1 commit ba319fe
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 385 deletions.
115 changes: 0 additions & 115 deletions xmake/actions/config/configheader.lua

This file was deleted.

4 changes: 0 additions & 4 deletions xmake/actions/config/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import("core.cache.localcache")
import("scangen")
import("menuconf", {alias = "menuconf_show"})
import("configfiles", {alias = "generate_configfiles"})
import("configheader", {alias = "generate_configheader"})
import("private.action.require.check", {alias = "check_packages"})
import("private.action.require.install", {alias = "install_packages"})
import("private.service.remote_build.action", {alias = "remote_build_action"})
Expand Down Expand Up @@ -404,9 +403,6 @@ force to build in current directory via run `xmake -P .`]], os.projectdir())

-- update the config files
generate_configfiles({force = recheck})
if recheck then
generate_configheader()
end
end

-- dump config
Expand Down
6 changes: 0 additions & 6 deletions xmake/actions/package/oldpkg/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ function _package_library(target)
end
end

-- copy the config.h to the output directory (deprecated)
local configheader = target:configheader()
if configheader then
os.vcp(configheader, format("%s/%s.pkg/$(plat)/$(arch)/include/%s", outputdir, targetname, path.filename(configheader)))
end

-- copy headers
local srcheaders, dstheaders = target:headerfiles(format("%s/%s.pkg/$(plat)/$(arch)/include", outputdir, targetname))
if srcheaders and dstheaders then
Expand Down
122 changes: 0 additions & 122 deletions xmake/core/project/deprecated/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,130 +32,8 @@ local config = require("project/config")
local platform = require("platform/platform")
local deprecated = require("base/deprecated")

-- add_headers for target
function deprecated_project._api_target_add_headers(interp)

-- get api function
local apifunc = interp:_api_within_scope("target", "add_headers")
assert(apifunc)

-- register api
interp:_api_within_scope_set("target", "add_headers", function (value, ...)

-- deprecated
deprecated.add("add_headerfiles(%s)", "add_headers(%s)", tostring(value))

-- dispatch it
apifunc(value, ...)
end)
end

-- set_config_header for target
function deprecated_project._api_target_set_config_header(interp)

-- get api function
local apifunc = interp:_api_within_scope("target", "set_config_header")
assert(apifunc)

-- register api
interp:_api_within_scope_set("target", "set_config_header", function (value, ...)

-- deprecated
deprecated.add("add_configfiles(%s.in)", "set_config_header(%s)", tostring(value))

-- dispatch it
apifunc(value, ...)
end)
end

-- set_headerdir for target
function deprecated_project._api_target_set_headerdir(interp)

-- get api function
local apifunc = interp:_api_within_scope("target", "set_headerdir")
assert(apifunc)

-- register api
interp:_api_within_scope_set("target", "set_headerdir", function (value, ...)

-- deprecated
deprecated.add(false, "set_headerdir(%s)", tostring(value))

-- dispatch it
apifunc(value, ...)
end)
end

-- set_tools for target
function deprecated_project._api_target_set_tools(interp)

-- get api function
local apifunc = interp:_api_within_scope("target", "set_tools")
assert(apifunc)

-- register api
interp:_api_within_scope_set("target", "set_tools", function (key, value, ...)

-- deprecated
deprecated.add("set_toolset(%s, %s)", "set_tools(%s, %s)", tostring(key), tostring(value))

-- dispatch it
apifunc(key, value, ...)
end)
end

-- set_toolchain for target
function deprecated_project._api_target_set_toolchain(interp)

-- get api function
local apifunc = interp:_api_within_scope("target", "set_toolchain")
assert(apifunc)

-- register api
interp:_api_within_scope_set("target", "set_toolchain", function (key, value, ...)

-- deprecated
deprecated.add("set_toolset(%s, %s)", "set_toolchain(%s, %s)", tostring(key), tostring(value))

-- dispatch it
apifunc(key, value, ...)
end)
end

-- add_tools for target
function deprecated_project._api_target_add_tools(interp)

-- get api function
local apifunc = interp:_api_within_scope("target", "add_tools")
assert(apifunc)

-- register api
interp:_api_within_scope_set("target", "add_tools", function (key, value, ...)

-- deprecated
deprecated.add("set_toolset(%s, %s)", "add_tools(%s, %s)", tostring(key), tostring(value))

-- dispatch it
apifunc(key, value, ...)
end)
end

-- register api
function deprecated_project.api_register(interp)

-- register api: add_headers() to target
deprecated_project._api_target_add_headers(interp)

-- register api: set_config_header() to option/target
deprecated_project._api_target_set_config_header(interp)

-- register api: set_headerdir() to target
deprecated_project._api_target_set_headerdir(interp)

-- register api: set_toolchain/set_tools/add_tools() to target
deprecated_project._api_target_set_tools(interp)
deprecated_project._api_target_add_tools(interp)
deprecated_project._api_target_set_toolchain(interp)
end

-- return module: deprecated_project
Expand Down
89 changes: 11 additions & 78 deletions xmake/core/project/target.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2025,78 +2025,6 @@ function _instance:script(name, generic)
return result
end

-- TODO get the config header version (deprecated)
function _instance:configversion()

-- get the config version and build version
local version = nil
local buildversion = nil
local configheader = self:get("config_header")
local configheader_extra = self:get("__extra_config_header")
if type(configheader_extra) == "table" then
version = table.wrap(configheader_extra[configheader]).version
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?
return version, buildversion
end

-- get the config header prefix
function _instance:configprefix()

-- get the config prefix
local configprefix = nil
local configheader = self:get("config_header")
local configheader_extra = self:get("__extra_config_header")
if type(configheader_extra) == "table" then
configprefix = table.wrap(configheader_extra[configheader]).prefix
end
return configprefix
end

-- get the config header files (deprecated)
function _instance:configheader(outputdir)

-- get config header
local configheader = self:get("config_header")
if not configheader then
return
end

-- get the root directory
local rootdir, count = configheader:gsub("|.*$", ""):gsub("%(.*%)$", "")
if count == 0 then
rootdir = nil
end
if rootdir and rootdir:trim() == "" then
rootdir = "."
end

-- remove '(' and ')'
configheader = configheader:gsub("[%(%)]", "")

-- get the output header
local outputheader = nil
if outputdir then
if rootdir then
outputheader = path.absolute(path.relative(configheader, rootdir), outputdir)
else
outputheader = path.join(outputdir, path.filename(configheader))
end
end

-- ok
return configheader, outputheader
end

-- get the precompiled header file (xxx.[h|hpp|inl])
--
-- @param langkind c/cxx
Expand Down Expand Up @@ -2506,6 +2434,12 @@ function target.apis()
, "target.add_languages"
, "target.add_vectorexts"
, "target.add_toolchains"
, "target.add_defines"
, "target.add_undefines"
, "target.add_frameworks"
, "target.add_rpathdirs" -- @note do not translate path, it's usually an absolute path or contains $ORIGIN/@loader_path
, "target.add_links"
, "target.add_syslinks"
}
, keyvalues =
{
Expand All @@ -2530,6 +2464,11 @@ function target.apis()
, "target.set_installdir"
, "target.set_rundir"
-- target.add_xxx
, "target.add_headerfiles"
, "target.add_linkdirs"
, "target.add_includedirs"
, "target.add_sysincludedirs"
, "target.add_frameworkdirs"
, "target.add_files"
, "target.add_cleanfiles"
, "target.add_configfiles"
Expand All @@ -2540,12 +2479,6 @@ function target.apis()
, "target.remove_files"
, "target.remove_headerfiles"
}
, dictionary =
{
-- target.set_xxx
"target.set_tools" -- TODO: deprecated
, "target.add_tools" -- TODO: deprecated
}
, script =
{
-- target.on_xxx
Expand Down
Loading

0 comments on commit ba319fe

Please sign in to comment.