Premake

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Premake

Postby Bird » Wed Jun 20, 2012 9:42 pm

Hi Julio,

I'm by no means a Premake expert but I've been learning to use it in my own projects and it seems like it's getting to be mature enough so that it might be useful for a complex project like Newton.

As a test, I made a Premake script ( uses Lua ) that will generate solution and project files for the platforms that Newton supports. This script only supports static libraries at the moment.
If you're interested, you can just drop it in the coreLibrary_300/ folder ... the script must be named "premake4.lua".

You'll need to download and install Premake 4.4 beta. http://industriousone.com/topic/premake-44-beta4-released
and then run "premake4" in a shell with options like "vs2008", "vs2010", "gmake", "xcode3", or "xcode4" to generate the project files for the various platforms

The script will generate "build" and "libs" folders in the coreLibrary_300 folder that will contain the projects and binaries organized by platform/compiler. One thing I like about this way of organizing is that it's much easier to link against Newton since the libraries are all in one place and aren't deeply nested like they are now.

-Bird


Code: Select all
debugSuffix = "d"
suffix32 = "_32";
suffix64 = "_64"

solution "Newton"
    configurations { "Debug", "Release"}
   location ("build/" .. _ACTION)
   
   defines {"_NEWTON_STATIC_LIB"}
   
   --  -------------------------------------------------------- core -----------------------------------------------------------------------
    project "core"
      kind "StaticLib"
      language "C++"
      files { "./source/core/**.h", "./source/core/**.cpp"}
     platforms {"x32", "x64"}
     includedirs {
      "./source/core", "../packages/thirdParty/pthreads.2"
     }
   if os.get() == "windows" then
     configuration "vs*"
      defines { "NOMINMAX", "_CRT_SECURE_NO_WARNINGS", "WIN32", "_WINDOWS" }
      buildoptions {"-MP", "/Zp8", "/W4", "/GS-"}
   end
   
   configuration {"xcode*"}
      defines {"_MAC_VER"}
   
   configuration(_ACTION)
      location ("build/" .. _ACTION)
      targetdir ("libs/" .. _ACTION)
 
   configuration("Debug")
      defines { "DEBUG" }
      flags { "Symbols" }
 
   configuration("Release")
      defines { "NDEBUG" }
      flags { "Optimize" } 
 
   configuration {"Debug","x32"}
      targetsuffix (suffix32 .. debugSuffix)
 
    configuration {"Release","x32"}
      targetsuffix (suffix32)
      
   configuration {"x64"}
         -- vs2010  express needs to look in  C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64 for some libraries like kernel32.lib
         if( _ACTION == "vs2010") then
            libdirs {"C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"}   
         end
 
    configuration {"Debug","x64"}
      targetsuffix (suffix64 .. debugSuffix)
 
    configuration {"Release","x64"}   
      targetsuffix (suffix64)
      
         
   --  -------------------------------------------------------- physics -----------------------------------------------------------------------
    project "physics"
      kind "StaticLib"
      language "C++"
      files { "./source/physics/**.h", "./source/physics/**.cpp"}
     platforms {"x32", "x64"}
     includedirs {
      "./source/physics", "./source/core","./source/meshUtil","../packages/thirdParty/pthreads.2"
     }
    
    excludes { "./source/physics/dgVehicleConstraint*" }
      
   if os.get() == "windows" then
     configuration "vs*"
      defines { "NOMINMAX", "_CRT_SECURE_NO_WARNINGS", "WIN32", "_WINDOWS" }
      buildoptions {"-MP", "/Zp8", "/W4", "/GS-"}
   end
   
   configuration {"xcode*"}
      defines {"_MAC_VER"}
   
   configuration(_ACTION)
      location ("build/" .. _ACTION)
      targetdir ("libs/" .. _ACTION)
 
   configuration("Debug")
      defines { "DEBUG" }
      flags { "Symbols" }
 
   configuration("Release")
      defines { "NDEBUG" }
      flags { "Optimize" } 
 
   configuration {"Debug","x32"}
      targetsuffix (suffix32 .. debugSuffix)
 
    configuration {"Release","x32"}
      targetsuffix (suffix32)
      
   configuration {"x64"}
         -- vs2010  express needs to look in  C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64 for some libraries like kernel32.lib
         if( _ACTION == "vs2010") then
            libdirs {"C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"}   
         end
 
    configuration {"Debug","x64"}
      targetsuffix (suffix64 .. debugSuffix)
 
    configuration {"Release","x64"}   
      targetsuffix (suffix64)
      
   --  -------------------------------------------------------- meshUtil -----------------------------------------------------------------------
    project "meshUtil"
      kind "StaticLib"
      language "C++"
      files { "./source/meshUtil/**.h", "./source/meshUtil/**.cpp"}
     platforms {"x32", "x64"}
     includedirs {
      "./source/meshUtil", "./source/core", "./source/physics", "../packages/thirdParty/pthreads.2"
     }
   if os.get() == "windows" then
     configuration "vs*"
      defines { "NOMINMAX", "_CRT_SECURE_NO_WARNINGS", "WIN32", "_WINDOWS" }
      buildoptions {"-MP", "/Zp8", "/W4", "/GS-"}
   end
   
   configuration {"xcode*"}
      defines {"_MAC_VER"}
   
   configuration(_ACTION)
      location ("build/" .. _ACTION)
      targetdir ("libs/" .. _ACTION)
 
   configuration("Debug")
      defines { "DEBUG" }
      flags { "Symbols" }
 
   configuration("Release")
      defines { "NDEBUG" }
      flags { "Optimize" } 
 
   configuration {"Debug","x32"}
      targetsuffix (suffix32 .. debugSuffix)
 
    configuration {"Release","x32"}
      targetsuffix (suffix32)
      
   configuration {"x64"}
         -- vs2010  express needs to look in  C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64 for some libraries like kernel32.lib
         if( _ACTION == "vs2010") then
            libdirs {"C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"}   
         end
 
    configuration {"Debug","x64"}
      targetsuffix (suffix64 .. debugSuffix)
 
    configuration {"Release","x64"}   
      targetsuffix (suffix64)
      
   --  -------------------------------------------------------- ai -----------------------------------------------------------------------
    project "ai"
      kind "StaticLib"
      language "C++"
      files { "./source/ai/**.h", "./source/ai/**.cpp"}
     platforms {"x32", "x64"}
     includedirs {
      "./source/ai", "./source/core", "./source/physics", "../packages/thirdParty/pthreads.2"
     }
   if os.get() == "windows" then
     configuration "vs*"
      defines { "NOMINMAX", "_CRT_SECURE_NO_WARNINGS", "WIN32", "_WINDOWS" }
      buildoptions {"-MP", "/Zp8", "/W4", "/GS-"}
   end
   
   configuration {"xcode*"}
      defines {"_MAC_VER"}
   
   configuration(_ACTION)
      location ("build/" .. _ACTION)
      targetdir ("libs/" .. _ACTION)
 
   configuration("Debug")
      defines { "DEBUG" }
      flags { "Symbols" }
 
   configuration("Release")
      defines { "NDEBUG" }
      flags { "Optimize" } 
 
   configuration {"Debug","x32"}
      targetsuffix (suffix32 .. debugSuffix)
 
    configuration {"Release","x32"}
      targetsuffix (suffix32)
      
   configuration {"x64"}
         -- vs2010  express needs to look in  C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64 for some libraries like kernel32.lib
         if( _ACTION == "vs2010") then
            libdirs {"C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"}   
         end
 
    configuration {"Debug","x64"}
      targetsuffix (suffix64 .. debugSuffix)
 
    configuration {"Release","x64"}   
      targetsuffix (suffix64)
      
   --  -------------------------------------------------------- newton -----------------------------------------------------------------------
    project "newton"
      kind "StaticLib"
      language "C++"
      files { "./source/newton/**.h", "./source/newton/**.cpp"}
     platforms {"x32", "x64"}
     includedirs {
      "./source/newton", "./source/core", "./source/physics", "./source/meshUtil", "../packages/thirdParty/pthreads.2"
     }
   if os.get() == "windows" then
     configuration "vs*"
      defines { "NOMINMAX", "_CRT_SECURE_NO_WARNINGS", "WIN32", "_WINDOWS" }
      buildoptions {"-MP", "/Zp8", "/W4", "/GS-"}
   end
   
   configuration {"xcode*"}
      defines {"_MAC_VER"}
   
   configuration(_ACTION)
      location ("build/" .. _ACTION)
      targetdir ("libs/" .. _ACTION)
 
   configuration("Debug")
      defines { "DEBUG" }
      flags { "Symbols" }
 
   configuration("Release")
      defines { "NDEBUG" }
      flags { "Optimize" } 
 
   configuration {"Debug","x32"}
      targetsuffix (suffix32 .. debugSuffix)
 
    configuration {"Release","x32"}
      targetsuffix (suffix32)
      
   configuration {"x64"}
         -- vs2010  express needs to look in  C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64 for some libraries like kernel32.lib
         if( _ACTION == "vs2010") then
            libdirs {"C:\Program Files/Microsoft SDKs/Windows/v7.1/Lib/x64"}   
         end
 
    configuration {"Debug","x64"}
      targetsuffix (suffix64 .. debugSuffix)
 
    configuration {"Release","x64"}   
      targetsuffix (suffix64)
      
      
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: Premake

Postby Julio Jerez » Wed Jun 20, 2012 10:28 pm

Ok I will try place in teh folrder and see how it goes.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron