From c4dba2b40ba47dfb1a75e2533200714c231ba675 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Fri, 1 Jun 2012 19:55:56 -0700 Subject: [PATCH] Reorganized premake scripts. --- premake/bgfx.lua | 40 ++++++++ premake/ddsdump.lua | 18 ++++ premake/helloworld.lua | 28 ++++++ premake/makedisttex.lua | 14 +++ premake/premake4.lua | 202 +++++++--------------------------------- premake/shaderc.lua | 54 +++++++++++ 6 files changed, 190 insertions(+), 166 deletions(-) create mode 100644 premake/bgfx.lua create mode 100644 premake/ddsdump.lua create mode 100644 premake/helloworld.lua create mode 100644 premake/makedisttex.lua create mode 100644 premake/shaderc.lua diff --git a/premake/bgfx.lua b/premake/bgfx.lua new file mode 100644 index 000000000..dd1fb79e6 --- /dev/null +++ b/premake/bgfx.lua @@ -0,0 +1,40 @@ +project "bgfx" + uuid "2dc7fd80-ed76-11e0-be50-0800200c9a66" + kind "StaticLib" + + includedirs { + BGFX_DIR .. "../bx/include", + } + + configuration { "nacl" } + buildoptions { + "-Wall", + } + + configuration { "windows" } + includedirs { + BGFX_DIR .. "3rdparty/glext", + } + + defines { +-- "BGFX_CONFIG_RENDERER_OPENGL=1", + } + + configuration "Debug" + defines { + "BGFX_CONFIG_DEBUG=1", + } + + configuration {} + + includedirs { + BGFX_DIR .. "include", + } + + files { + BGFX_DIR .. "include/**.h", + BGFX_DIR .. "src/**.cpp", + BGFX_DIR .. "src/**.h", + } + +-- copyLib() diff --git a/premake/ddsdump.lua b/premake/ddsdump.lua new file mode 100644 index 000000000..7ec2f5f4b --- /dev/null +++ b/premake/ddsdump.lua @@ -0,0 +1,18 @@ +project "ddsdump" + uuid "838801ee-7bc3-11e1-9f19-eae7d36e7d26" + kind "ConsoleApp" + + includedirs { + BGFX_DIR .. "../bx/include", + BGFX_DIR .. "include", + BGFX_DIR .. "src", + } + + files { + BGFX_DIR .. "src/dds.*", + BGFX_DIR .. "tools/ddsdump.cpp", + } + + links { + "bgfx", + } diff --git a/premake/helloworld.lua b/premake/helloworld.lua new file mode 100644 index 000000000..0362bdd36 --- /dev/null +++ b/premake/helloworld.lua @@ -0,0 +1,28 @@ +project "helloworld" + uuid "ff2c8450-ebf4-11e0-9572-0800200c9a66" + kind "WindowedApp" + + includedirs { + BGFX_DIR .. "../bx/include", + BGFX_DIR .. "include", + } + + files { + BGFX_DIR .. "examples/common/**.cpp", + BGFX_DIR .. "examples/common/**.h", + BGFX_DIR .. "examples/helloworld/**.cpp", + BGFX_DIR .. "examples/helloworld/**.h", + } + + links { + "bgfx", + } + + configuration { "nacl" } + targetextension ".nexe" + + configuration { "nacl", "Release" } + postbuildcommands { + "@echo Stripping symbols.", + "@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\"" + } diff --git a/premake/makedisttex.lua b/premake/makedisttex.lua new file mode 100644 index 000000000..5255b988a --- /dev/null +++ b/premake/makedisttex.lua @@ -0,0 +1,14 @@ +project "makedisttex" + uuid "b0561b30-91bb-11e1-b06e-023ad46e7d26" + kind "ConsoleApp" + + includedirs { + BGFX_DIR .. "../bx/include", + BGFX_DIR .. "3rdparty/edtaa3", + BGFX_DIR .. "3rdparty/stb_image", + } + + files { + BGFX_DIR .. "3rdparty/edtaa3/**", + BGFX_DIR .. "tools/makedisttex.cpp", + } diff --git a/premake/premake4.lua b/premake/premake4.lua index 1d6ab8c0a..70b440ff8 100644 --- a/premake/premake4.lua +++ b/premake/premake4.lua @@ -30,14 +30,14 @@ newoption { -- Avoid error when invoking premake4 --help. if (_ACTION == nil) then return end -ROOT_DIR = (path.getabsolute("..") .. "/") -BUILD_DIR = (ROOT_DIR .. ".build/") -THIRD_PARTY_DIR = (ROOT_DIR .. "3rdparty/") +BGFX_DIR = (path.getabsolute("..") .. "/") +local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/") +local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/") local XEDK = os.getenv("XEDK") if not XEDK then XEDK = "" end -location (BUILD_DIR .. "projects/" .. _ACTION) +location (BGFX_BUILD_DIR .. "projects/" .. _ACTION) if _ACTION == "gmake" then @@ -65,7 +65,7 @@ if _ACTION == "gmake" then 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") + location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-nacl") end end @@ -80,10 +80,6 @@ flags { "Symbols", } -includedirs { - ROOT_DIR .. "../bx/include", -} - configuration "Debug" targetsuffix "Debug" @@ -107,27 +103,27 @@ configuration { "vs*" } configuration { "x32", "vs*" } defines { "WIN32" } - targetdir (BUILD_DIR .. "win32_" .. _ACTION .. "/bin") - objdir (BUILD_DIR .. "win32_" .. _ACTION .. "/obj") - includedirs { THIRD_PARTY_DIR .. "compiler/msvc" } + targetdir (BGFX_BUILD_DIR .. "win32_" .. _ACTION .. "/bin") + objdir (BGFX_BUILD_DIR .. "win32_" .. _ACTION .. "/obj") + includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/msvc" } configuration { "x64", "vs*" } defines { "WIN32" } - targetdir (BUILD_DIR .. "win64_" .. _ACTION .. "/bin") - objdir (BUILD_DIR .. "win64_" .. _ACTION .. "/obj") - includedirs { THIRD_PARTY_DIR .. "compiler/msvc" } + targetdir (BGFX_BUILD_DIR .. "win64_" .. _ACTION .. "/bin") + objdir (BGFX_BUILD_DIR .. "win64_" .. _ACTION .. "/obj") + includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/msvc" } configuration { "x32", "mingw" } defines { "WIN32" } - targetdir (BUILD_DIR .. "win32_mingw" .. "/bin") - objdir (BUILD_DIR .. "win32_mingw" .. "/obj") - includedirs { THIRD_PARTY_DIR .. "compiler/mingw" } + targetdir (BGFX_BUILD_DIR .. "win32_mingw" .. "/bin") + objdir (BGFX_BUILD_DIR .. "win32_mingw" .. "/obj") + includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/mingw" } configuration { "x64", "mingw" } defines { "WIN32" } - targetdir (BUILD_DIR .. "win64_mingw" .. "/bin") - objdir (BUILD_DIR .. "win64_mingw" .. "/obj") - includedirs { THIRD_PARTY_DIR .. "compiler/mingw" } + targetdir (BGFX_BUILD_DIR .. "win64_mingw" .. "/bin") + objdir (BGFX_BUILD_DIR .. "win64_mingw" .. "/obj") + includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/mingw" } configuration { "nacl" } defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600" } @@ -135,7 +131,7 @@ configuration { "nacl" } "ppapi", "ppapi_gles2", } - includedirs { THIRD_PARTY_DIR .. "compiler/nacl" } + includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/nacl" } buildoptions { "-std=c++0x", "-U__STRICT_ANSI__", @@ -154,165 +150,39 @@ configuration { "nacl" } } configuration { "x32", "nacl" } - targetdir (BUILD_DIR .. "nacl-x86" .. "/bin") - objdir (BUILD_DIR .. "nacl-x86" .. "/obj") - libdirs { THIRD_PARTY_DIR .. "lib/nacl-x86" } + targetdir (BGFX_BUILD_DIR .. "nacl-x86" .. "/bin") + objdir (BGFX_BUILD_DIR .. "nacl-x86" .. "/obj") + libdirs { BGFX_THIRD_PARTY_DIR .. "lib/nacl-x86" } linkoptions { "-melf32_nacl", } configuration { "x64", "nacl" } - targetdir (BUILD_DIR .. "nacl-x64" .. "/bin") - objdir (BUILD_DIR .. "nacl-x64" .. "/obj") - libdirs { THIRD_PARTY_DIR .. "lib/nacl-x64" } + targetdir (BGFX_BUILD_DIR .. "nacl-x64" .. "/bin") + objdir (BGFX_BUILD_DIR .. "nacl-x64" .. "/obj") + libdirs { BGFX_THIRD_PARTY_DIR .. "lib/nacl-x64" } linkoptions { "-melf64_nacl", } configuration { "x32", "linux" } - targetdir (BUILD_DIR .. "linux32" .. "/bin") - objdir (BUILD_DIR .. "linux32" .. "/obj") + targetdir (BGFX_BUILD_DIR .. "linux32" .. "/bin") + objdir (BGFX_BUILD_DIR .. "linux32" .. "/obj") configuration { "x64", "linux" } - targetdir (BUILD_DIR .. "linux64" .. "/bin") - objdir (BUILD_DIR .. "linux64" .. "/obj") + targetdir (BGFX_BUILD_DIR .. "linux64" .. "/bin") + objdir (BGFX_BUILD_DIR .. "linux64" .. "/obj") configuration { "Xbox360" } defines { "_XBOX", "NOMINMAX" } - targetdir (BUILD_DIR .. "xbox360" .. "/bin") - objdir (BUILD_DIR .. "xbox360" .. "/obj") - includedirs { THIRD_PARTY_DIR .. "compiler/msvc" } + targetdir (BGFX_BUILD_DIR .. "xbox360" .. "/bin") + objdir (BGFX_BUILD_DIR .. "xbox360" .. "/obj") + includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/msvc" } configuration {} -- reset configuration -project "bgfx" - uuid "f4c51860-ebf4-11e0-9572-0800200c9a66" - kind "StaticLib" - - includedirs { - "../include", - ROOT_DIR .. "../bx/include", - THIRD_PARTY_DIR .. "glew-1.5.4/include", - } - - files { - "../include/**.h", - "../src/**.cpp", - "../src/**.h", - } - -project "shaderc" - uuid "f3cd2e90-52a4-11e1-b86c-0800200c9a66" - kind "ConsoleApp" - - local GLSL_OPTIMIZER = (THIRD_PARTY_DIR .. "glsl-optimizer/") - - configuration { "vs*" } - includedirs { GLSL_OPTIMIZER .. "src/glsl/msvc" } - - configuration {} - - includedirs { - ROOT_DIR .. "../bx/include", - - THIRD_PARTY_DIR .. "fcpp", - - GLSL_OPTIMIZER .. "include", - GLSL_OPTIMIZER .. "include/c99", - GLSL_OPTIMIZER .. "src/mesa", - GLSL_OPTIMIZER .. "src/mapi", - GLSL_OPTIMIZER .. "src/glsl", - } - - files { - ROOT_DIR .. "tools/shaderc.cpp", - THIRD_PARTY_DIR .. "fcpp/**.h", - THIRD_PARTY_DIR .. "fcpp/cpp1.c", - THIRD_PARTY_DIR .. "fcpp/cpp2.c", - THIRD_PARTY_DIR .. "fcpp/cpp3.c", - THIRD_PARTY_DIR .. "fcpp/cpp4.c", - THIRD_PARTY_DIR .. "fcpp/cpp5.c", - THIRD_PARTY_DIR .. "fcpp/cpp6.c", - THIRD_PARTY_DIR .. "fcpp/cpp6.c", - - GLSL_OPTIMIZER .. "src/mesa/**.c", - GLSL_OPTIMIZER .. "src/glsl/**.cpp", - GLSL_OPTIMIZER .. "src/mesa/**.h", - GLSL_OPTIMIZER .. "src/glsl/**.c", - GLSL_OPTIMIZER .. "src/glsl/**.cpp", - GLSL_OPTIMIZER .. "src/glsl/**.h", - } - - excludes { - GLSL_OPTIMIZER .. "src/glsl/glcpp/glcpp.c", - GLSL_OPTIMIZER .. "src/glsl/glcpp/tests/**", - GLSL_OPTIMIZER .. "src/glsl/main.cpp", - GLSL_OPTIMIZER .. "src/glsl/builtin_stubs.cpp", - } - - links { - "d3dx9", - } - -project "ddsdump" - uuid "838801ee-7bc3-11e1-9f19-eae7d36e7d26" - kind "ConsoleApp" - - includedirs { - ROOT_DIR .. "../bx/include", - ROOT_DIR .. "include", - ROOT_DIR .. "src", - } - - files { - ROOT_DIR .. "src/dds.*", - ROOT_DIR .. "tools/ddsdump.cpp", - } - - links { - "bgfx", - } - -project "makedisttex" - uuid "b0561b30-91bb-11e1-b06e-023ad46e7d26" - kind "ConsoleApp" - - includedirs { - ROOT_DIR .. "../bx/include", - THIRD_PARTY_DIR .. "edtaa3", - THIRD_PARTY_DIR .. "stb_image", - } - - files { - THIRD_PARTY_DIR .. "edtaa3/**", - ROOT_DIR .. "tools/makedisttex.cpp", - } - -project "helloworld" - uuid "ff2c8450-ebf4-11e0-9572-0800200c9a66" - kind "WindowedApp" - - includedirs { - ROOT_DIR .. "include", - } - - files { - ROOT_DIR .. "examples/common/**.cpp", - ROOT_DIR .. "examples/common/**.h", - ROOT_DIR .. "examples/helloworld/**.cpp", - ROOT_DIR .. "examples/helloworld/**.h", - } - - links { - "bgfx", - } - - configuration { "nacl" } - targetextension ".nexe" - - configuration { "nacl", "Release" } - postbuildcommands { - "@echo Stripping symbols.", - "@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\"" - } - +dofile "bgfx.lua" +dofile "ddsdump.lua" +dofile "helloworld.lua" +dofile "makedisttex.lua" +dofile "shaderc.lua" diff --git a/premake/shaderc.lua b/premake/shaderc.lua new file mode 100644 index 000000000..6cf63a6e2 --- /dev/null +++ b/premake/shaderc.lua @@ -0,0 +1,54 @@ +project "shaderc" + uuid "f3cd2e90-52a4-11e1-b86c-0800200c9a66" + kind "ConsoleApp" + + local GLSL_OPTIMIZER = (BGFX_DIR .. "3rdparty/glsl-optimizer/") + + configuration { "vs*" } + includedirs { + GLSL_OPTIMIZER .. "src/glsl/msvc", + } + + configuration {} + + includedirs { + BGFX_DIR .. "../bx/include", + + BGFX_DIR .. "3rdparty/fcpp", + + GLSL_OPTIMIZER .. "include", + GLSL_OPTIMIZER .. "include/c99", + GLSL_OPTIMIZER .. "src/mesa", + GLSL_OPTIMIZER .. "src/mapi", + GLSL_OPTIMIZER .. "src/glsl", + } + + files { + BGFX_DIR .. "3rdparty/tools/shaderc.cpp", + BGFX_DIR .. "3rdparty/fcpp/**.h", + BGFX_DIR .. "3rdparty/fcpp/cpp1.c", + BGFX_DIR .. "3rdparty/fcpp/cpp2.c", + BGFX_DIR .. "3rdparty/fcpp/cpp3.c", + BGFX_DIR .. "3rdparty/fcpp/cpp4.c", + BGFX_DIR .. "3rdparty/fcpp/cpp5.c", + BGFX_DIR .. "3rdparty/fcpp/cpp6.c", + BGFX_DIR .. "3rdparty/fcpp/cpp6.c", + + GLSL_OPTIMIZER .. "src/mesa/**.c", + GLSL_OPTIMIZER .. "src/glsl/**.cpp", + GLSL_OPTIMIZER .. "src/mesa/**.h", + GLSL_OPTIMIZER .. "src/glsl/**.c", + GLSL_OPTIMIZER .. "src/glsl/**.cpp", + GLSL_OPTIMIZER .. "src/glsl/**.h", + } + + excludes { + GLSL_OPTIMIZER .. "src/glsl/glcpp/glcpp.c", + GLSL_OPTIMIZER .. "src/glsl/glcpp/tests/**", + GLSL_OPTIMIZER .. "src/glsl/main.cpp", + GLSL_OPTIMIZER .. "src/glsl/builtin_stubs.cpp", + } + + links { + "d3dx9", + }