diff options
| author | ruki <[email protected]> | 2019-01-30 00:48:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-01-29 22:51:03 +0800 |
| commit | e5aa64826addb4fb5c036615d324a2b1149dbd7d (patch) | |
| tree | 4271fcc5858bcc359f33b351a2668cf5cf25b511 | |
| parent | bdda5b943ca44eb8162e117420c884f59b8d4162 (diff) | |
improve install_package for conan
| -rw-r--r-- | xmake/core/package/package.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/find_package.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/package/manager/conan/install_package.lua | 35 |
3 files changed, 36 insertions, 4 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 12c1e97cc..f27142a96 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -411,7 +411,7 @@ function _instance:requireinfo_set(requireinfo) -- get version local version = requireinfo and requireinfo.version or nil local limitversion = version and version ~= "master" and version ~= "lastest" - if requireinfo then + if requireinfo and not self:is3rd() then -- switch to local package if exists package configuration or debug package or limit version if requireinfo.config or requireinfo.debug or limitversion then @@ -591,7 +591,7 @@ function _instance:fetch(opt) local system = opt.system or self:requireinfo().system -- only fetch it from the xmake repository first - if not fetchinfo and system ~= true and not self:from("system") then + if not fetchinfo and system ~= true and not self:is3rd() then fetchinfo = self._find_package("xmake::" .. self:name(), {prefixdirs = self:prefixdir(), mode = self:mode(), islocal = self:from("local"), diff --git a/xmake/modules/lib/detect/find_package.lua b/xmake/modules/lib/detect/find_package.lua index 63745c48d..dc9286c54 100644 --- a/xmake/modules/lib/detect/find_package.lua +++ b/xmake/modules/lib/detect/find_package.lua @@ -87,6 +87,7 @@ function main(name, opt) if opt.verbose or option.get("verbose") then if result then cprint("checking for the %s ... ${color.success}%s", name, result.version and result.version or "${text.success}") + dprint(result) else cprint("checking for the %s ... ${color.nothing}${text.nothing}", name) end diff --git a/xmake/modules/package/manager/conan/install_package.lua b/xmake/modules/package/manager/conan/install_package.lua index f3b56b61e..90a88abb0 100644 --- a/xmake/modules/package/manager/conan/install_package.lua +++ b/xmake/modules/package/manager/conan/install_package.lua @@ -61,7 +61,7 @@ end -- install package -- -- @param name the package name, e.g. conan::OpenSSL/1.0.2n@conan/stable --- @param opt the options, .e.g {verbose = true, mode = "release", plat = , arch = , build = "all", options = {}, imports = {}, build_requires = {}} +-- @param opt the options, .e.g {verbose = true, mode = "release", plat = , arch = , remote = "", build = "all", options = {}, imports = {}, build_requires = {}} -- -- @return true or false -- @@ -88,7 +88,6 @@ function main(name, opt) -- generate conanfile.txt _conan_generate_conanfile(name, opt) - -- TODO --remote=, --compiler=, .. -- install package local argv = {"install", "."} if opt.build then @@ -98,10 +97,42 @@ function main(name, opt) table.insert(argv, "--build=" .. opt.build) end end + + -- set platform + table.insert(argv, "-s") + if opt.plat == "macosx" then + table.insert(argv, "os=Macos") + elseif opt.plat == "linux" then + table.insert(argv, "os=Linux") + elseif opt.plat == "windows" then + table.insert(argv, "os=Windows") + else + raise("cannot install package(%s) on platform(%s)!", name, opt.plat) + end + + -- set architecture + table.insert(argv, "-s") + if opt.arch == "x86_64" or opt.arch == "x64" then + table.insert(argv, "arch=x86_64") + elseif opt.arch == "i386" or opt.arch == "x86" then + table.insert(argv, "arch=x86") + else + raise("cannot install package(%s) for arch(%s)!", name, opt.arch) + end + + -- set build mode if opt.mode == "debug" then table.insert(argv, "-s") table.insert(argv, "build_type=Debug") end + + -- set remote + if opt.remote then + table.insert(argv, "-r") + table.insert(argv, opt.remote) + end + + -- do install os.vrunv(conan.program, argv) -- leave build directory |
