xmake icon indicating copy to clipboard operation
xmake copied to clipboard

Passing ALL_BUILD.vcproj instead of <project>.sln to msbuild cause build fail

Open gycherish opened this issue 8 months ago • 8 comments

Xmake 版本

v2.9.9

操作系统版本和架构

Windows server 2008 r2 service pack1 x64 + visual studio 2008

描述问题

项目使用 xrepo 自己管理三方库,为了能够运行在低版本的 windows 上,三方库中的日志库选择了 log4cplus 1.0.4 版本,之前使用 xmakev2.6.2 能够正常编译三方库,最近升级了 xmake 导致编译失败。

期待的结果

编译成功

工程配置

log4cplus 配置如下:

 on_load("linux", "windows", function (package)
        local libpostfix = ""
        if package:is_plat("windows") then
            -- Windows 下静态库加 "S" 后缀,debug 版本加 "D" 后缀,unicode 加 "U" 后缀
            libpostfix = libpostfix .. (package:config("shared") and "" or "S")
            if package:config("unicode") then
                package:add("defines", "UNICODE")
                table.insert(export_configs["defines"], "UNICODE")
                libpostfix = libpostfix .. "U"
            end
            libpostfix = libpostfix .. (package:debug() and "D" or "")
        end
end)

 on_install("windows", "linux", function (package)
        if is_plat("windows") then
            local argv = {
                "-DCMAKE_INSTALL_PREFIX=" .. package:installdir(),
                "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"),
                "-DLOG4CPLUS_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"),
                "-DLOG4CPLUS_BUILD_UNICODE=" .. (package:config("unicode") and "ON" or "OFF"),
            }
            import("package.tools.cmake").install(package, argv)
        end
end)

附加信息和错误日志

Image Image

gycherish avatar Jun 26 '25 07:06 gycherish

试试换成 ninja 构建 set_policy("package.cmake_generator.ninja", true)

star-hengxing avatar Jun 26 '25 09:06 star-hengxing

Bot detected the issue body's language is not English, translate it automatically.


Try changing to ninja to build set_policy("package.cmake_generator.ninja", true)

Issues-translate-bot avatar Jun 26 '25 09:06 Issues-translate-bot

升级新版本 不应该是 3.0.0 么。默认就是走的 ninja 而不是 msbuild 。。不存在这个问题

waruqi avatar Jun 27 '25 03:06 waruqi

Bot detected the issue body's language is not English, translate it automatically.


Isn't it 3.0.0 to upgrade the new version? By default, it is ninja instead of msbuild. . This problem does not exist

Issues-translate-bot avatar Jun 27 '25 03:06 Issues-translate-bot

升级新版本 不应该是 3.0.0 么。默认就是走的 ninja 而不是 msbuild 。。不存在这个问题

当时同事装的2.9.9, 不过看了 xmake 代码,3.0.0 应该存在同样的问题,虽然 xmake 现在使用 ninja 作为 cmake 默认的 generator,但是总不能不支持 visual studio 的 generator 了吧

gycherish avatar Jun 27 '25 15:06 gycherish

Bot detected the issue body's language is not English, translate it automatically.


Isn't it 3.0.0 to upgrade the new version? By default, it is ninja instead of msbuild. . This problem does not exist

At that time, my colleague installed 2.9.9, but after reading the xmake code, there should be the same problem in 3.0.0. Although xmake now uses ninja as the default generator for cmake, it is impossible not to support the visual studio generator.

Issues-translate-bot avatar Jun 27 '25 16:06 Issues-translate-bot

@ChrisCatCP 这个 patch 带进来的 https://github.com/xmake-io/xmake/pull/5523 还是去年的事情了,说明 2008 现在用的确实少。

waruqi avatar Jun 29 '25 13:06 waruqi

@ChrisCatCP 这个 patch 带进来的 #5523 还是去年的事情了,说明 2008 现在用的确实少。

all_build是正常流程,直接用sln会会有问题,所以改成all_build了

ChrisCatCP avatar Jun 29 '25 13:06 ChrisCatCP