use premake filters
This commit is contained in:
parent
a3a867cbdf
commit
5c7f8790f7
108
premake5.lua
108
premake5.lua
@ -37,61 +37,48 @@ if not _OPTIONS["gfxapi"] then
|
|||||||
_OPTIONS["gfxapi"] = "opengl_4"
|
_OPTIONS["gfxapi"] = "opengl_4"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- convenience function
|
|
||||||
-- for some reason configuration { x } is not working
|
|
||||||
function is_gfxapi(x)
|
|
||||||
|
|
||||||
if _OPTIONS["gfxapi"] == x then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- premake main
|
-- premake main
|
||||||
solution (solution_name)
|
workspace(solution_name)
|
||||||
location ( solution_dir .. "/" .. action )
|
|
||||||
configurations { "debug", "release" }
|
configurations { "debug", "release" }
|
||||||
platforms { "x32", "x64" }
|
location(solution_dir .. "/" .. action)
|
||||||
|
|
||||||
-- note the use of "!" before objdir to force the specified path
|
|
||||||
configuration "debug"
|
|
||||||
targetdir ( solution_dir .. action .. bin_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
|
||||||
objdir ( "!" .. solution_dir .. action .. obj_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
|
||||||
defines { "_DEBUG" }
|
|
||||||
symbols "On"
|
symbols "On"
|
||||||
rtti "Off"
|
warnings 'Extra'
|
||||||
floatingpoint "Fast"
|
|
||||||
|
|
||||||
configuration "release"
|
filter "system:windows"
|
||||||
|
platforms { "x86", "x86_x64" }
|
||||||
|
defaultplatform "x86_64"
|
||||||
|
defines { "_CRT_SECURE_NO_WARNINGS", "_WIN32", "WIN32", "_WINDOWS" }
|
||||||
|
|
||||||
|
filter "system:linux"
|
||||||
|
platforms { "x86_64" }
|
||||||
|
cppdialect "C++11"
|
||||||
|
|
||||||
|
filter {}
|
||||||
|
|
||||||
|
filter "configurations:debug"
|
||||||
|
defines { "DEBUG" }
|
||||||
|
optimize "Off"
|
||||||
targetdir ( solution_dir .. action .. bin_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
targetdir ( solution_dir .. action .. bin_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
||||||
objdir ( "!" .. solution_dir .. action .. obj_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
objdir ( "!" .. solution_dir .. action .. obj_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
||||||
|
|
||||||
|
filter "configurations:release"
|
||||||
defines { "NDEBUG" }
|
defines { "NDEBUG" }
|
||||||
optimize "On"
|
optimize "On"
|
||||||
rtti "Off"
|
targetdir ( solution_dir .. action .. bin_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
||||||
floatingpoint "Fast"
|
objdir ( "!" .. solution_dir .. action .. obj_dir .. "%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}" )
|
||||||
|
|
||||||
configuration { "vs*" }
|
filter {}
|
||||||
defines { "_CRT_SECURE_NO_WARNINGS" }
|
|
||||||
|
|
||||||
configuration { "windows" }
|
filter "options:gfxapi=opengl_2"
|
||||||
defines { "_WIN32", "WIN32", "_WINDOWS" }
|
|
||||||
|
|
||||||
if is_gfxapi("opengl_2") then
|
|
||||||
defines { "U_OPENGL_2" }
|
defines { "U_OPENGL_2" }
|
||||||
end
|
|
||||||
|
|
||||||
if is_gfxapi("opengl_4") then
|
filter "options:gfxapi=opengl_4"
|
||||||
defines { "U_OPENGL_4" }
|
defines { "U_OPENGL_4" }
|
||||||
end
|
|
||||||
|
|
||||||
filter { "language:C++", "toolset:gcc" }
|
filter {}
|
||||||
buildoptions { "-std=c++11" }
|
|
||||||
|
|
||||||
project "bounce"
|
project "bounce"
|
||||||
kind "StaticLib"
|
kind "StaticLib"
|
||||||
language "C++"
|
|
||||||
location ( solution_dir .. action )
|
location ( solution_dir .. action )
|
||||||
includedirs { bounce_inc_dir, external_dir }
|
includedirs { bounce_inc_dir, external_dir }
|
||||||
vpaths { [""] = "bounce" }
|
vpaths { [""] = "bounce" }
|
||||||
@ -109,43 +96,37 @@ solution (solution_name)
|
|||||||
includedirs { external_dir }
|
includedirs { external_dir }
|
||||||
vpaths { ["Headers"] = "**.h", ["Sources"] = "**.c" }
|
vpaths { ["Headers"] = "**.h", ["Sources"] = "**.c" }
|
||||||
|
|
||||||
configuration { "windows" }
|
filter { "system:windows", "options:gfxapi=opengl_2" }
|
||||||
if is_gfxapi("opengl_2") then
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/glad_2/khrplatform.h",
|
external_dir .. "/glad_2/khrplatform.h",
|
||||||
external_dir .. "/glad_2/glad.h",
|
external_dir .. "/glad_2/glad.h",
|
||||||
external_dir .. "/glad_2/glad.c",
|
external_dir .. "/glad_2/glad.c",
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
if is_gfxapi("opengl_4") then
|
filter { "system:windows", "options:gfxapi=opengl_4" }
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/glad_4/khrplatform.h",
|
external_dir .. "/glad_4/khrplatform.h",
|
||||||
external_dir .. "/glad_4/glad.h",
|
external_dir .. "/glad_4/glad.h",
|
||||||
external_dir .. "/glad_4/glad.c",
|
external_dir .. "/glad_4/glad.c",
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
configuration { "linux" }
|
filter { "system:linux", "options:gfxapi=opengl_2" }
|
||||||
if is_gfxapi("opengl_2") then
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/glad_2/khrplatform.h",
|
external_dir .. "/glad_2/khrplatform.h",
|
||||||
external_dir .. "/glad_2/glad_glx.h",
|
external_dir .. "/glad_2/glad_glx.h",
|
||||||
external_dir .. "/glad_2/glad_glx.c",
|
external_dir .. "/glad_2/glad_glx.c",
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
if is_gfxapi("opengl_4") then
|
filter { "system:linux", "options:gfxapi=opengl_4" }
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/glad_4/khrplatform.h",
|
external_dir .. "/glad_4/khrplatform.h",
|
||||||
external_dir .. "/glad_4/glad_glx.h",
|
external_dir .. "/glad_4/glad_glx.h",
|
||||||
external_dir .. "/glad_4/glad_glx.c",
|
external_dir .. "/glad_4/glad_glx.c",
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
project "glfw"
|
project "glfw"
|
||||||
kind "StaticLib"
|
kind "StaticLib"
|
||||||
@ -155,9 +136,6 @@ solution (solution_name)
|
|||||||
defines { "_GLFW_USE_CONFIG_H" } -- see glfw_config.h
|
defines { "_GLFW_USE_CONFIG_H" } -- see glfw_config.h
|
||||||
vpaths { ["Headers"] = "**.h", ["Sources"] = "**.c" }
|
vpaths { ["Headers"] = "**.h", ["Sources"] = "**.c" }
|
||||||
|
|
||||||
-- files
|
|
||||||
|
|
||||||
-- common
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/glfw/glfw_config.h",
|
external_dir .. "/glfw/glfw_config.h",
|
||||||
@ -172,8 +150,7 @@ solution (solution_name)
|
|||||||
external_dir .. "/glfw/window.c",
|
external_dir .. "/glfw/window.c",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- windows
|
filter "system:windows"
|
||||||
configuration { "windows" }
|
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/glfw/win32_platform.h",
|
external_dir .. "/glfw/win32_platform.h",
|
||||||
@ -191,8 +168,7 @@ solution (solution_name)
|
|||||||
external_dir .. "/glfw/egl_context.c",
|
external_dir .. "/glfw/egl_context.c",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- linux
|
filter "system:linux"
|
||||||
configuration { "linux" }
|
|
||||||
buildoptions { "-pthread" }
|
buildoptions { "-pthread" }
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
@ -237,21 +213,19 @@ solution (solution_name)
|
|||||||
external_dir .. "/imgui/imgui_draw.cpp"
|
external_dir .. "/imgui/imgui_draw.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_gfxapi("opengl_2") then
|
filter "options:gfxapi=opengl_2"
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/imgui/imgui_impl_glfw_gl2.h",
|
external_dir .. "/imgui/imgui_impl_glfw_gl2.h",
|
||||||
external_dir .. "/imgui/imgui_impl_glfw_gl2.cpp"
|
external_dir .. "/imgui/imgui_impl_glfw_gl2.cpp"
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
if is_gfxapi("opengl_4") then
|
filter "options:gfxapi=opengl_4"
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
external_dir .. "/imgui/imgui_impl_glfw_gl3.h",
|
external_dir .. "/imgui/imgui_impl_glfw_gl3.h",
|
||||||
external_dir .. "/imgui/imgui_impl_glfw_gl3.cpp"
|
external_dir .. "/imgui/imgui_impl_glfw_gl3.cpp"
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
project "rapidjson"
|
project "rapidjson"
|
||||||
kind "StaticLib"
|
kind "StaticLib"
|
||||||
@ -317,28 +291,28 @@ solution (solution_name)
|
|||||||
examples_src_dir .. "/testbed/framework/main.cpp"
|
examples_src_dir .. "/testbed/framework/main.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_gfxapi("opengl_2") then
|
filter "options:gfxapi=opengl_2"
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
examples_src_dir .. "/testbed/framework/draw_gl2.h"
|
examples_src_dir .. "/testbed/framework/draw_gl2.h"
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
if is_gfxapi("opengl_4") then
|
filter "options:gfxapi=opengl_4"
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
examples_src_dir .. "/testbed/framework/draw_gl4.h"
|
examples_src_dir .. "/testbed/framework/draw_gl4.h"
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
links { "glfw", "glad", "imgui", "bounce", "triangle" }
|
filter "system:windows"
|
||||||
|
|
||||||
configuration { "windows" }
|
|
||||||
links { "opengl32", "winmm" }
|
links { "opengl32", "winmm" }
|
||||||
|
|
||||||
configuration { "linux" }
|
filter "system:linux"
|
||||||
links { "GL", "X11", "Xrandr", "Xinerama", "Xcursor", "pthread", "dl" }
|
links { "GL", "X11", "Xrandr", "Xinerama", "Xcursor", "pthread", "dl" }
|
||||||
|
|
||||||
|
filter {}
|
||||||
|
|
||||||
|
links { "glfw", "glad", "imgui", "bounce", "triangle" }
|
||||||
|
|
||||||
project "hello_world"
|
project "hello_world"
|
||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
language "C++"
|
language "C++"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user