diff options
| -rw-r--r-- | xmake/actions/build/trybuild.lua | 16 | ||||
| -rw-r--r-- | xmake/actions/require/action/download.lua | 7 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_package.lua | 2 |
3 files changed, 17 insertions, 8 deletions
diff --git a/xmake/actions/build/trybuild.lua b/xmake/actions/build/trybuild.lua index 268e6295a..847aa955d 100644 --- a/xmake/actions/build/trybuild.lua +++ b/xmake/actions/build/trybuild.lua @@ -29,25 +29,31 @@ import("lib.detect.find_file") -- try building for makefile function _build_for_makefile(buildfile) - os.vrun("make") + os.vrun("make -j4") end -- try building for configure function _build_for_configure(buildfile) - os.vrun("./configure") - os.vrun("make") + os.vrun("./configure --prefix=%s", path.absolute("install")) + os.vrun("make -j4") + os.vrun("make install") end -- try building for cmakelist function _build_for_cmakelists(buildfile) os.mkdir("build") os.cd("build") - os.vrun("cmake -a %s ..", os.arch()) + os.vrun("cmake -a %s -DCMAKE_INSTALL_PREFIX=\"%s\" ..", os.arch(), path.absolute("install")) if is_host("windows") then + local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!") os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=Release -p:Platform=%s", slnfile, os.arch() == "x64" and "x64" or "Win32") + + local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj" + os.vrun("msbuild \"%s\" /property:configuration=Release", projfile) else - os.vrun("make") + os.vrun("make -j4") + os.vrun("make install") end end diff --git a/xmake/actions/require/action/download.lua b/xmake/actions/require/action/download.lua index 6833f5df1..61d64d124 100644 --- a/xmake/actions/require/action/download.lua +++ b/xmake/actions/require/action/download.lua @@ -133,7 +133,7 @@ function _urls(package) for _, url in ipairs(package:urls()) do if git.checkurl(url) then table.insert(urls[1], url) - else + elseif package:sha256(package:url_alias(url)) then table.insert(urls[2], url) end end @@ -156,8 +156,11 @@ function main(package) -- enter the working directory local oldir = os.cd(workdir) - -- download package from urls + -- get urls local urls = _urls(package) + assert(#urls > 0, "cannot get url of package(%s)", package:name()) + + -- download package from urls for idx, url in ipairs(urls) do -- get url alias diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua index 57db255b3..39b08a78a 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua @@ -144,7 +144,7 @@ function sandbox_lib_detect_find_package._find_from_prefixdirs(name, opt) end -- find the package list file, .e.g zlib-1.2.11.txt - local prefixfile = find_file(name .. "-*.txt", prefixdirs, {suffixes = ".list"}) + local prefixfile = find_file(name .. "-*.txt", prefixdirs, {suffixes = ".info"}) -- get the include and link directories local linkdirs = {} |
