Jump to content

Cilyan

Community Newbie
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Cilyan

  1. Hello all !

    I worked a little bit on 0AD so it uses as much as possible system libraries and tools. As a first step, there was a very simple tweak to use premake 3.7. I saw you are planning on moving to SCons or CMake but by the mean time, maybe you would be interested by this little patch. I wanted the script to be able to run with premake 3.7 (last version in 3.x series) on my Linux (ArchLinux). Finally, it comes out that it also runs fine with premake 3.1 (the one shipped in svn). The problem was a simple deprecation in lua, the syntax

    for i,v in dirs do

    is obsolete and should be replaced by

    for i,v in pairs(dirs) do

    .

    I suppose it will run on other 3.x versions of premake and on other plateforms, but I have not conducted more tests. Here is the final patch :


    Index: build/premake/premake.lua
    ===================================================================
    --- build/premake/premake.lua (révision 7027)
    +++ build/premake/premake.lua (copie de travail)
    @@ -260,13 +260,13 @@
    -- (e.g. "lib/precompiled.h")
    tinsert(package.includepaths, source_root)

    - for i,v in rel_include_dirs do
    + for i,v in pairs(rel_include_dirs) do
    tinsert(package.includepaths, source_root .. v)
    end


    if extra_params["extra_files"] then
    - for i,v in extra_params["extra_files"] do
    + for i,v in pairs(extra_params["extra_files"]) do
    tinsert(package.files, source_root .. v)
    end
    end
    @@ -288,7 +288,7 @@
    pch_dir..source
    })
    end
    - for i,v in project.configs do
    + for i,v in pairs(project.configs) do
    tinsert(package.config[v].defines, "USING_PCH")
    end
    end
    @@ -489,7 +489,7 @@
    windows = { "lib/sysdep/os/win", "lib/sysdep/os/win/wposix", "lib/sysdep/os/win/whrt" },
    macosx = { "lib/sysdep/os/osx", "lib/sysdep/os/unix" },
    }
    - for i,v in sysdep_dirs[OS] do
    + for i,v in pairs(sysdep_dirs[OS]) do
    tinsert(source_dirs, v);
    end

    @@ -903,7 +903,7 @@
    -- desired */tests/* files. this is a bit slow, but hey.

    local all_files = matchrecursive(root .. "*.h")
    - for i,v in all_files do
    + for i,v in pairs(all_files) do
    -- header file in subdirectory test
    if string.sub(v, -2) == ".h" and string.find(v, "/tests/") then
    -- don't include sysdep tests on the wrong sys
    Index: build/premake/functions.lua
    ===================================================================
    --- build/premake/functions.lua (révision 7027)
    +++ build/premake/functions.lua (copie de travail)
    @@ -1,6 +1,6 @@
    function sourcesfromdirs(root, dirs)
    local res = {}
    - for i,v in dirs do
    + for i,v in pairs(dirs) do
    local prefix
    if v == "" then prefix = root..v else prefix = root..v.."/" end
    local files = matchfiles(
    @@ -14,13 +14,13 @@
    end

    function trimrootdir(root, dirs)
    - for i,v in dirs do
    + for i,v in pairs(dirs) do
    dirs[i] = strsub(v, strlen(root))
    end
    end

    function listconcat(list, values)
    - for i,v in values do
    + for i,v in pairs(values) do
    table.insert(list, v)
    end
    end
    Index: build/premake/extern_libs.lua
    ===================================================================
    --- build/premake/extern_libs.lua (révision 7027)
    +++ build/premake/extern_libs.lua (copie de travail)
    @@ -260,7 +260,7 @@
    tinsert(package.linkoptions, "-framework " .. name)
    end
    else
    - for i,name in names do
    + for i,name in pairs(names) do
    tinsert(package.config["Debug" ].links, name .. suffix)
    -- 'Testing' config uses 'Debug' DLLs
    tinsert(package.config["Testing"].links, name .. suffix)
    @@ -277,7 +277,7 @@
    -- extern_libs: table of library names [string]
    function package_add_extern_libs(extern_libs)

    - for i,extern_lib in extern_libs do
    + for i,extern_lib in pairs(extern_libs) do
    local def = extern_lib_defs[extern_lib]
    assert(def, "external library " .. extern_lib .. " not defined")

    I hope it will help.

×
×
  • Create New...