Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xrepo install 指定的includes脚本路径透传支持 #1216

Closed
wzc0066 opened this issue Jan 28, 2021 · 1 comment
Closed

xrepo install 指定的includes脚本路径透传支持 #1216

wzc0066 opened this issue Jan 28, 2021 · 1 comment

Comments

@wzc0066
Copy link

wzc0066 commented Jan 28, 2021

以lua这个包为例,是通过内置动态生成的一段编译脚本进行编译的。

如果用户自定义了toolchain 脚本,那么该脚本路径也需要透传到内置脚本里面,否则只是透传了toolchain的话,会提示找不到。

如果自定义toolchain脚本路径也透传了,下面的两行就无需添加了:

            includes("/xxx/xxx/xxx/*.lua")
            set_toolchains("my_toolchain")

lua脚本片段如下:

    on_install("cross", "linux", "macosx", "windows", "android", "bsd", function (package)
        local sourcedir = os.isdir("src") and "src/" or "" -- for tar.gz or git source
        io.writefile("xmake.lua", format([[
            local sourcedir = "%s"
            includes("/xxx/xxx/xxx/*.lua")
            set_toolchains("my_toolchain")
            target("lualib")
                set_kind("static")
                set_basename("lua")
                add_headerfiles(sourcedir .. "*.h", {prefixdir = "lua"})
                add_files(sourcedir .. "*.c|lua.c|luac.c|onelua.c")
                add_defines("LUA_COMPAT_5_2", "LUA_COMPAT_5_1")
                if is_plat("cross", "linux", "bsd") then                                                                                                                                                           
                    add_defines("LUA_USE_LINUX")
                    add_defines("LUA_DL_DLOPEN")
                elseif is_plat("macosx") then
                    add_defines("LUA_USE_MACOSX")
                    add_defines("LUA_DL_DYLD")
                elseif is_plat("windows") then
                    -- Lua already detects Windows and sets according defines
                    if is_kind("shared") then
                        add_defines("LUA_BUILD_AS_DLL", {public = true})
                    end
                end

            target("lua")
                set_kind("binary")
                add_files(sourcedir .. "lua.c")
                add_deps("lualib")
                if not is_plat("windows") then
                    add_syslinks("dl")
                end
                ...
@waruqi waruqi added this to the v2.5.2 milestone Jan 28, 2021
@waruqi
Copy link
Member

waruqi commented Jan 28, 2021

可以了 你再试试 更新到 dev 版本

@wzc0066 wzc0066 closed this as completed Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants