Hi Jason,

Didn't check new premake yet, just comment about premake4, in case you
haven't consider it. We're working with bunch of platforms, and one of the
issues I ran into was setting different GCC compilers. I figured out the
way to specify it thru 'newoption'. This works pretty well, but it would be
nice if there is way to script these settings in the way that can be shared
with others. For example Qt has mkspecs where defaults for different
compilers are set and qmake scripts use it for building. Anyhow snippet of
how I'm setting GCC "flavor" in premake script is attached below.

Branimir

newoption {
    trigger = "gcc",
    value = "GCC",
    description = "Choose GCC flavor",
    allowed = {
        { "default", "Default GCC will be used." },
        { "mingw", "MinGW" },
        { "nacl", "Google Native Client" },
        { "android-arm7", "Google Android NDK" },
        { "clang", "Clang LLVM compiler" },
    }
}

-- Avoid error when invoking premake4 --help.
if (_ACTION == nil) then return end

if _ACTION == "gmake" then

    if nil == _OPTIONS["gcc"] then
        print("GCC flavor must be specified!")
        os.exit(1)
    end

    if "default" == _OPTIONS["gcc"] then
        location (BUILD_DIR .. "projects/" .. _ACTION .. "-default")
    end

    if "mingw" == _OPTIONS["gcc"] then

        if not os.getenv("MINGW") then
            print("Set MINGW enviroment variables.")
        end

        premake.gcc.cc = "$(MINGW)/bin/mingw32-gcc"
        premake.gcc.cxx = "$(MINGW)/bin/mingw32-g++"
        premake.gcc.ar = "$(MINGW)/bin/ar"
        location (BUILD_DIR .. "projects/" .. _ACTION .. "-mingw")
    end

    if "nacl" == _OPTIONS["gcc"] then

        if not os.getenv("NACL") then
            print("Set NACL enviroment variables.")
        end

        premake.gcc.cc = "$(NACL)/bin/x86_64-nacl-gcc"
        premake.gcc.cxx = "$(NACL)/bin/x86_64-nacl-g++"
        premake.gcc.ar = "$(NACL)/bin/x86_64-nacl-ar"
        location (BUILD_DIR .. "projects/" .. _ACTION .. "-nacl")
    end

    if "android-arm7" == _OPTIONS["gcc"] then

        if not os.getenv("ANDROID_NDK") then
            print("Set ANDROID_NDK envrionment variables.")
        end

        premake.gcc.cc = "$(ANDROID_NDK)/bin/arm-linux-androideabi-gcc"
        premake.gcc.cxx = "$(ANDROID_NDK)/bin/arm-linux-androideabi-g++"
        premake.gcc.ar = "$(ANDROID_NDK)/bin/arm-linux-androideabi-ar"
        location (BUILD_DIR .. "projects/" .. _ACTION .. "-android-arm7")
    end

    if "clang" == _OPTIONS["gcc"] then

        if not os.getenv("LLVM") or not os.getenv("MINGW") then
            print("Set LLVM and MINGW enviroment variables.")
        end

        premake.gcc.cc = "$(LLVM)/bin/clang"
        premake.gcc.cxx = "$(LLVM)/bin/clang++"
        premake.gcc.ar = "$(MINGW)/bin/ar"
        location (BUILD_DIR .. "projects/" .. _ACTION .. "-clang")
    end
end

On Wed, Jan 25, 2012 at 2:29 PM, Jason Perkins
<star...@industriousone.com>wrote:

> Thanks to a new client with a fantastically complicated multi-platform,
> multi-architecture build, I've had the opportunity to begin work on a new
> platform configuration API for Premake. The first set of changes are now in
> premake-dev (http://bitbucket.org/premake/premake-dev), and I've posted
> an overview of the new system (
> https://bitbucket.org/premake/premake-dev/wiki/Platforms) to the
> premake-dev wiki.
>
> The old API solved the most common cases and allowed Premake to support
> game consoles, but in "real world" use proved terribly limited and
> inflexible. And the code to support it was messy—I hated working on those
> bits.
>
> The new system is...ambitious, and it is going to take some time to get it
> fully implemented, so bear with me. But it is also more intuitive and far
> more flexible. It will make it much easier to support new platforms (iOS
> anyone?). And since it requires a rewrite of much of Premake's
> configuration building code, I have the opportunity to address some
> long-standing issues (such as the inability to query settings from within a
> project script).
>
> Feedback, as always, is welcomed. As are your questions, though I may not
> have answers for everything yet.
>
> Have a look, and enjoy!
>
> -st.
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Premake-users mailing list
> Premake-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/premake-users
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Premake-users mailing list
Premake-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/premake-users

Reply via email to