Skip to content
Snippets Groups Projects
premake4.lua 4.98 KiB
Newer Older
  • Learn to ignore specific revisions
  • newoption {
    	trigger     = "lua",
    	value       = "VM_Type",
    	description = "Virtual Machine to use for Lua, either the default one or a JIT",
    	allowed = {
    		{ "default",	"Default Lua Virtual Machine" },
    		{ "jitx86",	"LuaJIT x86" }
    	}
    }
    
    _OPTIONS.lua = _OPTIONS.lua or "default"
    
    
    dg's avatar
    dg committed
    solution "TEngine"
    	configurations { "Debug", "Release" }
    	objdir "obj"
    
    	includedirs {
    		"src",
    
    		"src/dynasm",
    
    dg's avatar
    dg committed
    		_OPTIONS.lua == "default" and "src/lua" or "src/luajit",
    
    dg's avatar
    dg committed
    		"src/luasocket",
    
    dg's avatar
    dg committed
    		"src/fov",
    
    dg's avatar
    dg committed
    		"src/physfs",
    		"src/physfs/zlib123",
    
    dg's avatar
    dg committed
    		"/usr/include/SDL",
    
    dg's avatar
    dg committed
    		"/usr/include/GL",
    
    dg's avatar
    dg committed
    	}
    
    	libdirs {
    	}
    
    
    dg's avatar
    dg committed
    configuration "windows"
    	libdirs {
    
    dg's avatar
    dg committed
    		"/e/libs/SDL-1.2.14/lib",
    		"/e/libs/SDL_ttf-2.0.9/lib",
    		"/e/libs/SDL_image-1.2.10/lib",
    		"/e/libs/SDL_mixer-1.2.11/lib",
    
    dg's avatar
    dg committed
    		"/e/apps/mingw/lib",
    	}
    	includedirs {
    
    dg's avatar
    dg committed
    		"/e/libs/SDL-1.2.14/include/SDL",
    		"/e/libs/SDL_ttf-2.0.9/include/",
    		"/e/libs/SDL_image-1.2.10/include/",
    		"/e/libs/SDL_mixer-1.2.11/include/",
    
    dg's avatar
    dg committed
    		"/e/apps/mingw/include/GL",
    	}
    
    
    dg's avatar
    dg committed
    configuration "Debug"
    	defines { }
    	flags { "Symbols" }
    	buildoptions { "-ggdb" }
    	targetdir "bin/Debug"
    
    configuration "Release"
    	defines { "NDEBUG=1" }
    
    	flags { "Optimize", "NoFramePointer" }
    	buildoptions { "-O3" }
    
    dg's avatar
    dg committed
    	targetdir "bin/Release"
    
    project "TEngine"
    	kind "WindowedApp"
    	language "C"
    	targetname "t-engine"
    	files { "src/*.c", }
    
    dg's avatar
    dg committed
    	links { "physfs", "lua".._OPTIONS.lua, "fov", "luasocket", "luaprofiler", "lualanes", "lpeg" }
    
    dg's avatar
    dg committed
    	defines { "_DEFAULT_VIDEOMODE_FLAGS_='SDL_HWSURFACE|SDL_DOUBLEBUF'" }
    
    dg's avatar
    dg committed
    	defines { [[TENGINE_HOME_PATH='".t-engine"']] }
    
    dg's avatar
    dg committed
    
    configuration "macosx"
    
    dg's avatar
    dg committed
    	linkoptions { "-framework SDL", "-framework SDL_image", "-framework SDL_ttf", "-framework SDL_mixer", "-framework Cocoa", "-framework OpenGL" }
    
    dg's avatar
    dg committed
    	files { "src/mac/SDL*" }
            links { "IOKit" }
            includedirs {
                  "/System/Library/Frameworks/OpenGL.framework/Headers",
                  "/Library/Frameworks/SDL.framework/Headers",
                  "/Library/Frameworks/SDL_net.framework/Headers",
                  "/Library/Frameworks/SDL_image.framework/Headers",
                  "/Library/Frameworks/SDL_ttf.framework/Headers",
                  "/Library/Frameworks/SDL_mixer.framework/Headers"
            }
    
    dg's avatar
    dg committed
            defines { "USE_TENGINE_MAIN", 'SELFEXE_MACOSX'  }
    
    dg's avatar
    dg committed
    	targetdir "."
    
    
    dg's avatar
    dg committed
    configuration "windows"
    
    dg's avatar
    dg committed
    	linkoptions { "-mwindows" }
    
    dg's avatar
    dg committed
    	links { "mingw32", "SDLmain", "SDL", "SDL_ttf", "SDL_image", "SDL_mixer", "OPENGL32", "GLU32", "wsock32" }
    
    dg's avatar
    dg committed
    	defines { [[TENGINE_HOME_PATH='"T-Engine"']], 'SELFEXE_WINDOWS' }
    
    configuration "linux"
    
    dg's avatar
    dg committed
    	links { "SDL", "SDL_ttf", "SDL_image", "SDL_mixer", "GL", "GLU" }
    
    dg's avatar
    dg committed
    	defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_LINUX' }
    
    dg's avatar
    dg committed
    
    
    dg's avatar
    dg committed
    
    ----------------------------------------------------------------
    ----------------------------------------------------------------
    -- Librairies used by T-Engine
    ----------------------------------------------------------------
    ----------------------------------------------------------------
    
    dg's avatar
    dg committed
    project "physfs"
    	kind "StaticLib"
    	language "C"
    	targetname "physfs"
    
    
    dg's avatar
    dg committed
    	defines {"PHYSFS_SUPPORTS_ZIP"}
    
    	files { "src/physfs/*.c", "src/physfs/zlib123/*.c", "src/physfs/archivers/*.c", }
    
    dg's avatar
    dg committed
    
    
    dg's avatar
    dg committed
    	configuration "linux"
    		files { "src/physfs/platform/unix.c", "src/physfs/platform/posix.c",  }
    	configuration "windows"
    		files { "src/physfs/platform/windows.c",  }
    
    dg's avatar
    dg committed
    	configuration "macosx"
    
    dg's avatar
    dg committed
    		files { "src/physfs/platform/macosx.c", "src/physfs/platform/posix.c",  }
    
    dg's avatar
    dg committed
                    includedirs { "/Library/Frameworks/SDL.framework/Headers" }
    
    dg's avatar
    dg committed
    
    
    if _OPTIONS.lua == "default" then
    	project "luadefault"
    		kind "StaticLib"
    		language "C"
    		targetname "lua"
    
    		files { "src/lua/*.c", }
    elseif _OPTIONS.lua == "jitx86" then
    	project "luajitx86"
    		kind "StaticLib"
    		language "C"
    		targetname "lua"
    
    		files { "src/luajit/*.c", }
    
    dg's avatar
    dg committed
    		configuration "linux"
    			defines { "LUA_USE_POSIX" }
    
    dg's avatar
    dg committed
    
    
    dg's avatar
    dg committed
    project "luasocket"
    	kind "StaticLib"
    	language "C"
    	targetname "luasocket"
    
    	configuration "not windows"
    		files {
    			"src/luasocket/auxiliar.c",
    			"src/luasocket/buffer.c",
    			"src/luasocket/except.c",
    			"src/luasocket/inet.c",
    			"src/luasocket/io.c",
    			"src/luasocket/luasocket.c",
    			"src/luasocket/options.c",
    			"src/luasocket/select.c",
    			"src/luasocket/tcp.c",
    			"src/luasocket/timeout.c",
    			"src/luasocket/udp.c",
    			"src/luasocket/usocket.c",
    			"src/luasocket/mime.c",
    		}
    	configuration "windows"
    		files {
    			"src/luasocket/auxiliar.c",
    			"src/luasocket/buffer.c",
    			"src/luasocket/except.c",
    			"src/luasocket/inet.c",
    			"src/luasocket/io.c",
    			"src/luasocket/luasocket.c",
    			"src/luasocket/options.c",
    			"src/luasocket/select.c",
    			"src/luasocket/tcp.c",
    			"src/luasocket/timeout.c",
    			"src/luasocket/udp.c",
    			"src/luasocket/wsocket.c",
    			"src/luasocket/mime.c",
    		}
    
    dg's avatar
    dg committed
    
    project "fov"
    	kind "StaticLib"
    	language "C"
    	targetname "fov"
    
    	files { "src/fov/*.c", }
    
    dg's avatar
    dg committed
    
    
    dg's avatar
    dg committed
    project "lpeg"
    	kind "StaticLib"
    	language "C"
    	targetname "lpeg"
    
    	files { "src/lpeg/*.c", }
    
    
    dg's avatar
    dg committed
    project "luaprofiler"
    	kind "StaticLib"
    	language "C"
    	targetname "luaprofiler"
    
    	files { "src/luaprofiler/*.c", }
    
    dg's avatar
    dg committed
    
    project "lualanes"
    	kind "StaticLib"
    	language "C"
    	targetname "lualanes"
    
    	files { "src/lualanes/*.c", }