summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-16 23:18:53 +0800
committerruki <[email protected]>2021-10-16 23:18:53 +0800
commit194e8abb709553c79d5ee34d9bd4a714aa3004d7 (patch)
tree919729e21b2c434e63d3d8d671fdc83adebf53b5 /xmake/modules
parentbbe1a5c2f7418d085304d1dcd0462cf4b2193497 (diff)
add headeronly kind for target
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/target/action/install/cmake_importfiles.lua8
-rw-r--r--xmake/modules/target/action/install/pkgconfig_importfiles.lua10
-rw-r--r--xmake/modules/target/action/install/unix.lua4
-rw-r--r--xmake/modules/target/action/install/windows.lua4
-rw-r--r--xmake/modules/target/action/uninstall/unix.lua4
-rw-r--r--xmake/modules/target/action/uninstall/windows.lua4
6 files changed, 20 insertions, 14 deletions
diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua
index e4e5d118e..ea53ab519 100644
--- a/xmake/modules/target/action/install/cmake_importfiles.lua
+++ b/xmake/modules/target/action/install/cmake_importfiles.lua
@@ -40,7 +40,7 @@ end
function _get_builtinvars(target, installdir)
return {TARGETNAME = target:name(),
PROJECTNAME = project.name() or target:name(),
- TARGETFILENAME = _get_libfile(target, installdir),
+ TARGETFILENAME = target:targetfile() and _get_libfile(target, installdir),
TARGETKIND = target:is_shared() and "SHARED" or "STATIC",
PACKAGE_VERSION = target:get("version") or "1.0.0",
TARGET_PTRBYTES = target:is_arch("x86", "i386") and "4" or "8"}
@@ -85,7 +85,7 @@ function _append_cmake_configfile(target, installdir, filename, opt)
local builtinvars = _get_builtinvars(target, installdir)
-- generate the file if not exist / file is outdated
- if not os.isfile(importfile_dst) or os.mtime(importfile_dst) < os.mtime(target:targetfile()) then
+ if target:is_headeronly() or not os.isfile(importfile_dst) or os.mtime(importfile_dst) < os.mtime(target:targetfile()) then
_install_cmake_configfile(target, installdir, filename, opt)
end
@@ -151,7 +151,9 @@ function main(target, opt)
_append_cmake_configfile(target, installdir, "xxxConfig.cmake", opt)
_install_cmake_configfile(target, installdir, "xxxConfigVersion.cmake", opt)
_install_cmake_targetfile(target, installdir, "xxxTargets.cmake", opt)
- if is_mode("debug") then
+ if target:is_headeronly() then
+ _install_cmake_targetfile(target, installdir, "xxxTargets-headeronly.cmake", opt)
+ elseif is_mode("debug") then
_install_cmake_targetfile(target, installdir, "xxxTargets-debug.cmake", opt)
else
_install_cmake_targetfile(target, installdir, "xxxTargets-release.cmake", opt)
diff --git a/xmake/modules/target/action/install/pkgconfig_importfiles.lua b/xmake/modules/target/action/install/pkgconfig_importfiles.lua
index 1187bb5e6..0cad0d267 100644
--- a/xmake/modules/target/action/install/pkgconfig_importfiles.lua
+++ b/xmake/modules/target/action/install/pkgconfig_importfiles.lua
@@ -66,7 +66,9 @@ function main(target, opt)
if file then
file:print("prefix=%s", installdir)
file:print("exec_prefix=${prefix}")
- file:print("libdir=${exec_prefix}/lib")
+ if not target:is_headeronly() then
+ file:print("libdir=${exec_prefix}/lib")
+ end
file:print("includedir=${prefix}/include")
file:print("")
file:print("Name: %s", target:name())
@@ -75,8 +77,10 @@ function main(target, opt)
if version then
file:print("Version: %s", version)
end
- file:print("Libs: %s", libs)
- file:print("Libs.private: ")
+ if not target:is_headeronly() then
+ file:print("Libs: %s", libs)
+ file:print("Libs.private: ")
+ end
file:print("Cflags: %s", cflags)
file:close()
end
diff --git a/xmake/modules/target/action/install/unix.lua b/xmake/modules/target/action/install/unix.lua
index 165d8650e..af641e5bc 100644
--- a/xmake/modules/target/action/install/unix.lua
+++ b/xmake/modules/target/action/install/unix.lua
@@ -127,7 +127,7 @@ function install_static(target, opt)
_install_headers(target, opt)
end
--- install phony
-function install_phony(target, opt)
+-- install headeronly library
+function install_headeronly(target, opt)
_install_headers(target, opt)
end
diff --git a/xmake/modules/target/action/install/windows.lua b/xmake/modules/target/action/install/windows.lua
index 448415fa6..0ea1e22b6 100644
--- a/xmake/modules/target/action/install/windows.lua
+++ b/xmake/modules/target/action/install/windows.lua
@@ -135,7 +135,7 @@ function install_static(target, opt)
_install_headers(target, opt)
end
--- install phony
-function install_phony(target, opt)
+-- install headeronly
+function install_headeronly(target, opt)
_install_headers(target, opt)
end
diff --git a/xmake/modules/target/action/uninstall/unix.lua b/xmake/modules/target/action/uninstall/unix.lua
index 614d59448..e11446dd4 100644
--- a/xmake/modules/target/action/uninstall/unix.lua
+++ b/xmake/modules/target/action/uninstall/unix.lua
@@ -96,7 +96,7 @@ function uninstall_static(target, opt)
_uninstall_headers(target, opt)
end
--- uninstall phony
-function uninstall_phony(target, opt)
+-- uninstall headeronly library
+function uninstall_headeronly(target, opt)
_uninstall_headers(target, opt)
end
diff --git a/xmake/modules/target/action/uninstall/windows.lua b/xmake/modules/target/action/uninstall/windows.lua
index cb9dcf16e..73c43cc0a 100644
--- a/xmake/modules/target/action/uninstall/windows.lua
+++ b/xmake/modules/target/action/uninstall/windows.lua
@@ -101,7 +101,7 @@ function uninstall_static(target, opt)
_uninstall_headers(target, opt)
end
--- uninstall phony
-function uninstall_phony(target, opt)
+-- uninstall headeronly library
+function uninstall_headeronly(target, opt)
_uninstall_headers(target, opt)
end