diff options
| author | ruki <[email protected]> | 2024-03-12 23:21:08 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-03-12 23:21:08 +0800 |
| commit | 1448c9aeefe9ab76c6e17a348e5bf69e7676e3b1 (patch) | |
| tree | 6060d18f943bd88bf91599a61e285cadc8e15147 /xmake/modules | |
| parent | f35a5e08721df2c61905e4258a5fb4a2f7295356 (diff) | |
fix trybuild/msbuild
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/action/trybuild/msbuild.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/xmake/modules/private/action/trybuild/msbuild.lua b/xmake/modules/private/action/trybuild/msbuild.lua index 245c3b6b3..c09a178af 100644 --- a/xmake/modules/private/action/trybuild/msbuild.lua +++ b/xmake/modules/private/action/trybuild/msbuild.lua @@ -25,18 +25,24 @@ import("core.tool.toolchain") import("lib.detect.find_file") import("lib.detect.find_tool") +-- find project file +function _find_projectfile() + return find_file("*.sln", os.curdir()) +end + -- detect build-system and configuration file function detect() if is_subhost("windows") then - return find_file("*.sln", os.curdir()) + return _find_projectfile() end end -- do clean function clean() + local projectfile = _find_projectfile() local runenvs = toolchain.load("msvc"):runenvs() local msbuild = find_tool("msbuild", {envs = runenvs}) - os.vexecv(msbuild.program, {configfile, "-nologo", "-t:Clean", "-p:Configuration=Release", "-p:Platform=" .. (is_arch("x64") and "x64" or "Win32")}, {envs = runenvs}) + os.vexecv(msbuild.program, {projectfile, "-nologo", "-t:Clean", "-p:Configuration=Release", "-p:Platform=" .. (is_arch("x64") and "x64" or "Win32")}, {envs = runenvs}) end -- do build @@ -46,9 +52,9 @@ function build() assert(is_subhost(config.plat()), "msbuild: %s not supported!", config.plat()) -- do build - local configfile = find_file("*.sln", os.curdir()) + local projectfile = _find_projectfile() local runenvs = toolchain.load("msvc"):runenvs() local msbuild = find_tool("msbuild", {envs = runenvs}) - os.vexecv(msbuild.program, {configfile, "-nologo", "-t:Build", "-p:Configuration=Release", "-p:Platform=" .. (is_arch("x64") and "x64" or "Win32")}, {envs = runenvs}) + os.vexecv(msbuild.program, {projectfile, "-nologo", "-t:Build", "-p:Configuration=Release", "-p:Platform=" .. (is_arch("x64") and "x64" or "Win32")}, {envs = runenvs}) cprint("${color.success}build ok!") end |
