mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Worked a little bit on the premake file.
This commit is contained in:
437
premake4.lua
437
premake4.lua
@@ -1,8 +1,11 @@
|
||||
link_list = { }
|
||||
os_links = { }
|
||||
|
||||
function args_contains( element )
|
||||
for _, value in pairs(_ARGS) do
|
||||
if value == element then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -19,15 +22,54 @@ function multiple_insert( parent_table, insert_table )
|
||||
end
|
||||
end
|
||||
|
||||
solution "eepp"
|
||||
location("./make/" .. os.get() .. "/")
|
||||
targetdir("./")
|
||||
configurations { "debug", "release" }
|
||||
objdir("obj/" .. os.get() .. "/premake4/")
|
||||
|
||||
link_list = { }
|
||||
os_links = { }
|
||||
function build_base_configuration( package_name )
|
||||
includedirs { "src/eepp/helper/zlib" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall", "-std=gnu99" }
|
||||
targetname ( package_name .. "-debug" )
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall", "-std=gnu99" }
|
||||
targetname ( package_name )
|
||||
end
|
||||
|
||||
function build_link_configuration( package_name )
|
||||
links { link_list }
|
||||
|
||||
if package_name ~= "eepp" and package_name ~= "eepp-static" then
|
||||
links { "eepp-static" }
|
||||
add_static_links()
|
||||
end
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG", "EE_DEBUG", "EE_MEMORY_MANAGER" }
|
||||
|
||||
if package_name == "eepp" then
|
||||
defines { "EE_DYNAMIC", "EE_EXPORTS" }
|
||||
end
|
||||
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall -Wno-long-long" }
|
||||
targetname ( package_name .. "-debug" )
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
|
||||
if package_name == "eepp" then
|
||||
defines { "EE_DYNAMIC", "EE_EXPORTS" }
|
||||
end
|
||||
|
||||
flags { "Optimize" }
|
||||
buildoptions { "-fno-strict-aliasing -O3 -s -ffast-math" }
|
||||
targetname ( package_name )
|
||||
end
|
||||
|
||||
function generate_os_links()
|
||||
if os.is("linux") then
|
||||
multiple_insert( os_links, { "rt", "pthread", "X11", "openal", "GL", "Xcursor" } )
|
||||
elseif os.is("windows") then
|
||||
@@ -39,7 +81,9 @@ solution "eepp"
|
||||
elseif os.is("haiku") then
|
||||
multiple_insert( os_links, { "openal", "GL" } )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function parse_args()
|
||||
if args_contains( "GLES2" ) then
|
||||
defines { "EE_GLES2", "SOIL_GLES2" }
|
||||
end
|
||||
@@ -48,306 +92,217 @@ solution "eepp"
|
||||
defines { "EE_GLES1", "SOIL_GLES1" }
|
||||
end
|
||||
|
||||
if not args_contains( "STATIC_FT2" ) then
|
||||
if not args_contains( "STATIC_FT2" ) and os.findlib("freetype") then
|
||||
table.insert( link_list, "freetype" )
|
||||
end
|
||||
end
|
||||
|
||||
function add_static_links()
|
||||
links { "SOIL2-static",
|
||||
"chipmunk-static",
|
||||
"glew-static",
|
||||
"haikuttf-static",
|
||||
"libzip-static",
|
||||
"stb_vorbis-static",
|
||||
"jpeg-compressor-static"
|
||||
}
|
||||
|
||||
if args_contains( "STATIC_FT2" ) or not os.findlib("freetype") then
|
||||
links { "freetype-static", "z" }
|
||||
end
|
||||
end
|
||||
|
||||
function select_backend()
|
||||
local selected = false
|
||||
|
||||
if args_contains( "SDL2" ) then
|
||||
table.insert( link_list, "SDL2" )
|
||||
files { "src/eepp/window/backend/SDL2/*.cpp" }
|
||||
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_2" }
|
||||
selected = true
|
||||
elseif args_contains( "SDL" ) then
|
||||
table.insert( link_list, "SDL" )
|
||||
files { "src/eepp/window/backend/SDL/*.cpp" }
|
||||
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_1_2" }
|
||||
selected = true
|
||||
end
|
||||
|
||||
if args_contains( "allegro5" ) then
|
||||
table.insert( link_list, "allegro5" )
|
||||
files { "src/eepp/window/backend/allegro5/*.cpp" }
|
||||
defines { "EE_BACKEND_ALLEGRO_ACTIVE" }
|
||||
selected = true
|
||||
end
|
||||
|
||||
if args_contains( "SFML" ) then
|
||||
table.insert( link_list, "SFML" )
|
||||
files { "src/eepp/window/backend/SFML/*.cpp" }
|
||||
defines { "EE_BACKEND_SFML_ACTIVE" }
|
||||
selected = true
|
||||
end
|
||||
|
||||
if not selected then
|
||||
if os.findlib("SDL2") then
|
||||
table.insert( link_list, "SDL2" )
|
||||
files { "src/eepp/window/backend/SDL2/*.cpp" }
|
||||
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_2" }
|
||||
else
|
||||
table.insert( link_list, "SDL" )
|
||||
files { "src/eepp/window/backend/SDL/*.cpp" }
|
||||
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_1_2" }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function build_eepp( build_name )
|
||||
includedirs { "include", "src", "src/eepp/helper/freetype2/include" }
|
||||
|
||||
add_static_links()
|
||||
|
||||
if os.is("windows") then
|
||||
files { "src/eepp/system/platform/win/*.cpp" }
|
||||
else
|
||||
files { "src/eepp/system/platform/posix/*.cpp" }
|
||||
end
|
||||
|
||||
files { "src/eepp/base/*.cpp",
|
||||
"src/eepp/math/*.cpp",
|
||||
"src/eepp/system/*.cpp",
|
||||
"src/eepp/audio/*.cpp",
|
||||
"src/eepp/graphics/*.cpp",
|
||||
"src/eepp/graphics/renderer/*.cpp",
|
||||
"src/eepp/window/*.cpp",
|
||||
"src/eepp/window/platform/null/*.cpp",
|
||||
"src/eepp/ui/*.cpp",
|
||||
"src/eepp/ui/tools/*.cpp",
|
||||
"src/eepp/physics/*.cpp",
|
||||
"src/eepp/physics/constraints/*.cpp",
|
||||
"src/eepp/gaming/*.cpp",
|
||||
"src/eepp/gaming/mapeditor/*.cpp"
|
||||
}
|
||||
|
||||
select_backend()
|
||||
|
||||
multiple_insert( link_list, os_links )
|
||||
|
||||
links { link_list }
|
||||
|
||||
configuration "windows"
|
||||
files { "src/eepp/window/platform/win/*.cpp" }
|
||||
linkoptions { "static-libgcc", "static-libstdc++", "mwindows" }
|
||||
|
||||
configuration "linux"
|
||||
files { "src/eepp/window/platform/x11/*.cpp" }
|
||||
|
||||
configuration "macosx"
|
||||
files { "src/eepp/window/platform/osx/*.cpp" }
|
||||
|
||||
build_link_configuration( build_name )
|
||||
end
|
||||
|
||||
solution "eepp"
|
||||
location("./make/" .. os.get() .. "/")
|
||||
targetdir("./")
|
||||
configurations { "debug", "release" }
|
||||
objdir("obj/" .. os.get() .. "/premake4/")
|
||||
|
||||
generate_os_links()
|
||||
parse_args()
|
||||
|
||||
project "SOIL2-static"
|
||||
kind "StaticLib"
|
||||
language "C"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/SOIL2/src/SOIL2/*.c" }
|
||||
includedirs { "include/eepp/helper/SOIL2" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "SOIL2-debug"
|
||||
build_base_configuration( "SOIL2" )
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "SOIL2"
|
||||
|
||||
project "glew-static"
|
||||
kind "StaticLib"
|
||||
language "C"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/glew/*.c" }
|
||||
includedirs { "include/eepp/helper/glew" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "glew-debug"
|
||||
build_base_configuration( "glew" )
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "glew"
|
||||
|
||||
project "zlib-static"
|
||||
kind "StaticLib"
|
||||
language "C"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/zlib/*.c" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "zlib-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "zlib"
|
||||
|
||||
project "libzip-static"
|
||||
kind "StaticLib"
|
||||
language "C"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/libzip/*.c" }
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/zlib/*.c", "src/eepp/helper/libzip/*.c" }
|
||||
includedirs { "src/eepp/helper/zlib" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "libzip-debug"
|
||||
build_base_configuration( "libzip" )
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "libzip"
|
||||
project "freetype-static"
|
||||
kind "StaticLib"
|
||||
language "C"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
defines { "FT2_BUILD_LIBRARY" }
|
||||
files { "src/eepp/helper/freetype2/src/**.c" }
|
||||
includedirs { "src/eepp/helper/freetype2/include" }
|
||||
build_base_configuration( "freetype" )
|
||||
|
||||
project "stb_vorbis-static"
|
||||
kind "StaticLib"
|
||||
language "C"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/stb_vorbis/*.c" }
|
||||
build_base_configuration( "stb_vorbis" )
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "stb_vorbis-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "stb_vorbis"
|
||||
|
||||
project "chipmunk-static"
|
||||
kind "StaticLib"
|
||||
language "C"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/chipmunk/*.c", "src/eepp/helper/chipmunk/constraints/*.c" }
|
||||
includedirs { "include/eepp/helper/chipmunk" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall", "-std=gnu99" }
|
||||
targetname "chipmunk-debug"
|
||||
build_base_configuration( "chipmunk" )
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall", "-std=gnu99" }
|
||||
targetname "chipmunk"
|
||||
|
||||
project "haikuttf-static"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/haikuttf/*.cpp" }
|
||||
includedirs { "src/eepp/helper/freetype2/include" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "haikuttf-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "haikuttf"
|
||||
build_base_configuration( "haikuttf" )
|
||||
|
||||
project "jpeg-compressor-static"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
targetdir("libs/" .. os.get() .. "/helpers/")
|
||||
files { "src/eepp/helper/jpeg-compressor/*.cpp" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "jpeg-compressor-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions{ "-Wall" }
|
||||
targetname "jpeg-compressor"
|
||||
build_base_configuration( "jpeg-compressor" )
|
||||
|
||||
project "eepp-shared"
|
||||
kind "SharedLib"
|
||||
language "C++"
|
||||
targetdir("libs/" .. os.get() .. "/")
|
||||
includedirs { "include", "src", "src/eepp/helper/freetype2/include" }
|
||||
links { "SOIL2-static",
|
||||
"chipmunk-static",
|
||||
"glew-static",
|
||||
"haikuttf-static",
|
||||
"zlib-static",
|
||||
"libzip-static",
|
||||
"stb_vorbis-static",
|
||||
"jpeg-compressor-static"
|
||||
}
|
||||
|
||||
if os.is("windows") then
|
||||
files { "src/eepp/system/platform/win/*.cpp" }
|
||||
else
|
||||
files { "src/eepp/system/platform/posix/*.cpp" }
|
||||
end
|
||||
build_eepp( "eepp" )
|
||||
|
||||
files { "src/eepp/base/*.cpp",
|
||||
"src/eepp/math/*.cpp",
|
||||
"src/eepp/system/*.cpp",
|
||||
"src/eepp/audio/*.cpp",
|
||||
"src/eepp/graphics/*.cpp",
|
||||
"src/eepp/graphics/renderer/*.cpp",
|
||||
"src/eepp/window/*.cpp",
|
||||
"src/eepp/window/platform/null/*.cpp",
|
||||
"src/eepp/ui/*.cpp",
|
||||
"src/eepp/ui/tools/*.cpp",
|
||||
"src/eepp/physics/*.cpp",
|
||||
"src/eepp/physics/constraints/*.cpp",
|
||||
"src/eepp/gaming/*.cpp",
|
||||
"src/eepp/gaming/mapeditor/*.cpp"
|
||||
}
|
||||
|
||||
if args_contains( "SDL2" ) then
|
||||
table.insert( link_list, "SDL2" )
|
||||
files { "src/eepp/window/backend/SDL2/*.cpp" }
|
||||
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_2" }
|
||||
elseif args_contains( "SDL" ) then
|
||||
table.insert( link_list, "SDL" )
|
||||
files { "src/eepp/window/backend/SDL/*.cpp" }
|
||||
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_1_2" }
|
||||
end
|
||||
|
||||
if args_contains( "allegro5" ) then
|
||||
table.insert( link_list, "allegro5" )
|
||||
files { "src/eepp/window/backend/allegro5/*.cpp" }
|
||||
defines { "EE_BACKEND_ALLEGRO_ACTIVE" }
|
||||
end
|
||||
|
||||
if args_contains( "SFML" ) then
|
||||
table.insert( link_list, "SFML" )
|
||||
files { "src/eepp/window/backend/SFML/*.cpp" }
|
||||
defines { "EE_BACKEND_SFML_ACTIVE" }
|
||||
end
|
||||
|
||||
if next(link_list) == nil then
|
||||
table.insert( link_list, "SDL" )
|
||||
files { "src/eepp/window/backend/SDL/*.cpp" }
|
||||
defines { "EE_BACKEND_SDL_ACTIVE", "EE_SDL_VERSION_1_2" }
|
||||
end
|
||||
|
||||
multiple_insert( link_list, os_links )
|
||||
|
||||
links { link_list }
|
||||
|
||||
configuration "windows"
|
||||
files { "src/eepp/window/platform/win/*.cpp" }
|
||||
linkoptions { "static-libgcc", "static-libstdc++", "mwindows" }
|
||||
|
||||
configuration "linux"
|
||||
files { "src/eepp/window/platform/x11/*.cpp" }
|
||||
|
||||
configuration "macosx"
|
||||
files { "src/eepp/window/platform/osx/*.cpp" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG", "EE_DEBUG", "EE_MEMORY_MANAGER", "EE_DYNAMIC", "EE_EXPORTS" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall -Wno-long-long" }
|
||||
targetname "eepp-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG", "EE_DYNAMIC", "EE_EXPORTS" }
|
||||
flags { "Optimize" }
|
||||
buildoptions { "-fno-strict-aliasing -O3 -s -ffast-math" }
|
||||
targetname "eepp"
|
||||
|
||||
project "eepp-static"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
targetdir("libs/" .. os.get() .. "/")
|
||||
build_eepp( "eepp-static" )
|
||||
|
||||
project "eepp-test"
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
links { link_list, "eepp-shared" }
|
||||
|
||||
files { "src/test/*.cpp" }
|
||||
includedirs { "include", "src" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall -Wno-long-long" }
|
||||
targetname "eetest-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions { "-fno-strict-aliasing -O3 -s -ffast-math" }
|
||||
targetname "eetest-release"
|
||||
build_link_configuration( "eetest" )
|
||||
|
||||
project "eepp-es"
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
links { link_list, "eepp-shared" }
|
||||
|
||||
files { "src/examples/external_shader/*.cpp" }
|
||||
includedirs { "include", "src" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall -Wno-long-long" }
|
||||
targetname "eees-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions { "-fno-strict-aliasing -O3 -s -ffast-math" }
|
||||
targetname "eees-release"
|
||||
build_link_configuration( "eees" )
|
||||
|
||||
project "eepp-ew"
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
links { link_list, "eepp-shared" }
|
||||
|
||||
files { "src/examples/empty_window/*.cpp" }
|
||||
includedirs { "include", "src" }
|
||||
|
||||
configuration "debug"
|
||||
defines { "DEBUG" }
|
||||
flags { "Symbols" }
|
||||
buildoptions{ "-Wall -Wno-long-long" }
|
||||
targetname "eeew-debug"
|
||||
|
||||
configuration "release"
|
||||
defines { "NDEBUG" }
|
||||
flags { "Optimize" }
|
||||
buildoptions { "-fno-strict-aliasing -O3 -s -ffast-math" }
|
||||
targetname "eeew-release"
|
||||
build_link_configuration( "eeew" )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by Qt Creator 2.6.0, 2012-12-16T01:10:29. -->
|
||||
<!-- Written by Qt Creator 2.6.0, 2012-12-16T02:56:48. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
|
||||
@@ -53,7 +53,7 @@ void cEETest::Init() {
|
||||
|
||||
mWindow = EE->CreateWindow( WinSettings, ConSettings );
|
||||
|
||||
run = ( mWindow->Created() && PAK->IsOpen() );
|
||||
run = ( NULL != mWindow && mWindow->Created() && PAK->IsOpen() );
|
||||
|
||||
if ( run ) {
|
||||
SetScreen( StartScreen );
|
||||
|
||||
Reference in New Issue
Block a user