From e1e4635d3112cd627b80f47cc06ee4f5140ad3fe Mon Sep 17 00:00:00 2001 From: Yc7521 <40235757+Yc7521@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:51:20 +0800 Subject: Update cmake_importfiles --- xmake/modules/target/action/install/cmake_importfiles.lua | 12 +++++++++++- xmake/scripts/cmake_importfiles/xxxTargets-debug.cmake | 1 + xmake/scripts/cmake_importfiles/xxxTargets-release.cmake | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua index 1249c9c8b..814ff0fb5 100644 --- a/xmake/modules/target/action/install/cmake_importfiles.lua +++ b/xmake/modules/target/action/install/cmake_importfiles.lua @@ -43,7 +43,7 @@ function _get_builtinvars(target, installdir) TARGETFILENAME = target:targetfile() and _get_libfile(target, installdir), TARGETKIND = target:is_headeronly() and "INTERFACE" or (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"} + TARGET_PTRBYTES = target:is_arch("armeabi", "armeabi-v7a", "x86", "mips", "i386", "armv7", "armv7s", "mipsel", "wasm32") and "4" or "8"} end -- install cmake config file @@ -130,6 +130,16 @@ function _install_cmake_targetfile(target, installdir, filename, opt) local value = builtinvars[variable] return type(value) == "function" and value() or value end) + local libfile = path.filename(target:targetfile()) + local postfix = is_mode("debug") and "DEBUG" or "RELEASE" + if target:is_shared() and (_get_libfile(target, installdir) ~= libfile) then + -- On DLL platforms, the import library is named differently from the target file + content = content:gsub("# IMPORTED_IMPLIB_" .. postfix, "IMPORTED_IMPLIB_" .. postfix) + content = content:gsub( + "IMPORTED_LOCATION_" .. postfix .. " \"${_IMPORT_PREFIX}/lib/.-\"", + "IMPORTED_LOCATION_" .. postfix .. " \"${_IMPORT_PREFIX}/bin/" .. libfile .. "\"" + ) + end io.writefile(importfile_dst, content) end end diff --git a/xmake/scripts/cmake_importfiles/xxxTargets-debug.cmake b/xmake/scripts/cmake_importfiles/xxxTargets-debug.cmake index a6328bb79..7b752bd8f 100644 --- a/xmake/scripts/cmake_importfiles/xxxTargets-debug.cmake +++ b/xmake/scripts/cmake_importfiles/xxxTargets-debug.cmake @@ -9,6 +9,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1) set_property(TARGET @PROJECTNAME@::@TARGETNAME@ APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties(@PROJECTNAME@::@TARGETNAME@ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "ASM_NASM;C" + # IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/lib/@TARGETFILENAME@" IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/@TARGETFILENAME@" ) diff --git a/xmake/scripts/cmake_importfiles/xxxTargets-release.cmake b/xmake/scripts/cmake_importfiles/xxxTargets-release.cmake index c720fb79b..074050a68 100644 --- a/xmake/scripts/cmake_importfiles/xxxTargets-release.cmake +++ b/xmake/scripts/cmake_importfiles/xxxTargets-release.cmake @@ -9,6 +9,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1) set_property(TARGET @PROJECTNAME@::@TARGETNAME@ APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(@PROJECTNAME@::@TARGETNAME@ PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "ASM_NASM;C" + # IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/@TARGETFILENAME@" IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/@TARGETFILENAME@" ) -- cgit v1.3.1 From 36c57592f64510d08d494f943487b57dd9ec3705 Mon Sep 17 00:00:00 2001 From: Yc7521 <40235757+Yc7521@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:18:18 +0800 Subject: Update cmake_importfiles.lua --- xmake/modules/target/action/install/cmake_importfiles.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua index 814ff0fb5..98c142273 100644 --- a/xmake/modules/target/action/install/cmake_importfiles.lua +++ b/xmake/modules/target/action/install/cmake_importfiles.lua @@ -136,8 +136,8 @@ function _install_cmake_targetfile(target, installdir, filename, opt) -- On DLL platforms, the import library is named differently from the target file content = content:gsub("# IMPORTED_IMPLIB_" .. postfix, "IMPORTED_IMPLIB_" .. postfix) content = content:gsub( - "IMPORTED_LOCATION_" .. postfix .. " \"${_IMPORT_PREFIX}/lib/.-\"", - "IMPORTED_LOCATION_" .. postfix .. " \"${_IMPORT_PREFIX}/bin/" .. libfile .. "\"" + "IMPORTED_LOCATION_" .. postfix .. " \"%%${_IMPORT_PREFIX}/lib/.-\"", + "IMPORTED_LOCATION_" .. postfix .. " \"%%${_IMPORT_PREFIX}/bin/" .. libfile .. "\"" ) end io.writefile(importfile_dst, content) -- cgit v1.3.1 From a1b91de32f4742de082bb2b3382827260717eb9a Mon Sep 17 00:00:00 2001 From: Yc7521 <40235757+Yc7521@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:17:39 +0800 Subject: Update cmake_importfiles.lua --- xmake/modules/target/action/install/cmake_importfiles.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua index 98c142273..64c2a2268 100644 --- a/xmake/modules/target/action/install/cmake_importfiles.lua +++ b/xmake/modules/target/action/install/cmake_importfiles.lua @@ -136,8 +136,8 @@ function _install_cmake_targetfile(target, installdir, filename, opt) -- On DLL platforms, the import library is named differently from the target file content = content:gsub("# IMPORTED_IMPLIB_" .. postfix, "IMPORTED_IMPLIB_" .. postfix) content = content:gsub( - "IMPORTED_LOCATION_" .. postfix .. " \"%%${_IMPORT_PREFIX}/lib/.-\"", - "IMPORTED_LOCATION_" .. postfix .. " \"%%${_IMPORT_PREFIX}/bin/" .. libfile .. "\"" + "IMPORTED_LOCATION_" .. postfix .. " \"%${_IMPORT_PREFIX}/lib/.-\"", + "IMPORTED_LOCATION_" .. postfix .. " \"${_IMPORT_PREFIX}/bin/" .. libfile .. "\"" ) end io.writefile(importfile_dst, content) -- cgit v1.3.1