improvements (?) to premakefile

This commit is contained in:
aap 2020-04-29 11:44:26 +02:00
parent 4e630a1a38
commit 0bdb558804
5 changed files with 44 additions and 12 deletions

View file

@ -11,7 +11,7 @@ install:
- cmd: >- - cmd: >-
git submodule update --init --recursive git submodule update --init --recursive
premake5 vs2019 premake5 vs2019 --with-librw
build: build:
project: build/re3.sln project: build/re3.sln

View file

@ -1 +1 @@
premake5 vs2015 premake5 vs2015 --with-librw

View file

@ -1 +1 @@
premake5 vs2017 premake5 vs2017 --with-librw

View file

@ -1 +1 @@
premake5 vs2019 premake5 vs2019 --with-librw

View file

@ -1,4 +1,27 @@
Librw = os.getenv("LIBRW") or "librw" newoption {
trigger = "glewdir",
value = "PATH",
description = "Directory of GLEW",
default = "glew-2.1.0"
}
newoption {
trigger = "glfwdir",
value = "PATH",
description = "Directory of glfw",
default = "glfw-3.3.2.bin.WIN32"
}
newoption {
trigger = "with-librw",
description = "Build and use librw from this solution"
}
if(_OPTIONS["with-librw"]) then
Librw = "librw"
else
Librw = os.getenv("LIBRW") or "librw"
end
workspace "re3" workspace "re3"
language "C++" language "C++"
@ -28,12 +51,18 @@ workspace "re3"
filter { "platforms:*librw_d3d9*" } filter { "platforms:*librw_d3d9*" }
defines { "RW_D3D9" } defines { "RW_D3D9" }
if(not _OPTIONS["with-librw"]) then
libdirs { path.join(Librw, "lib/win-x86-d3d9/%{cfg.buildcfg}") }
end
filter "platforms:*librw_gl3_glfw*" filter "platforms:*librw_gl3_glfw*"
defines { "RW_GL3" } defines { "RW_GL3" }
if(not _OPTIONS["with-librw"]) then
libdirs { path.join(Librw, "lib/win-x86-gl3/%{cfg.buildcfg}") }
end
defines { "GLEW_STATIC" } defines { "GLEW_STATIC" }
includedirs { "glfw-3.3.2.bin.WIN32/include" } includedirs { path.join(_OPTIONS["glfwdir"], "include") }
includedirs { "glew-2.1.0/include" } includedirs { path.join(_OPTIONS["glewdir"], "include") }
filter {} filter {}
pbcommands = { pbcommands = {
@ -62,6 +91,7 @@ workspace "re3"
--targetdir ("bin/%{prj.name}/" .. scriptspath) --targetdir ("bin/%{prj.name}/" .. scriptspath)
end end
if(_OPTIONS["with-librw"]) then
project "librw" project "librw"
kind "StaticLib" kind "StaticLib"
targetname "rw" targetname "rw"
@ -71,6 +101,7 @@ project "librw"
filter "platforms:*RW33*" filter "platforms:*RW33*"
flags { "ExcludeFromBuild" } flags { "ExcludeFromBuild" }
filter {} filter {}
end
project "re3" project "re3"
kind "WindowedApp" kind "WindowedApp"
@ -145,7 +176,9 @@ project "re3"
files { "src/fakerw/*.*" } files { "src/fakerw/*.*" }
includedirs { "src/fakerw" } includedirs { "src/fakerw" }
includedirs { Librw } includedirs { Librw }
libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" } if(_OPTIONS["with-librw"]) then
libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" }
end
links { "rw" } links { "rw" }
filter "platforms:*d3d*" filter "platforms:*d3d*"
@ -156,7 +189,6 @@ project "re3"
links { "d3d9" } links { "d3d9" }
filter "platforms:*gl3_glfw*" filter "platforms:*gl3_glfw*"
libdirs { "glew-2.1.0/lib/Release/Win32" } libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }
libdirs { "glfw-3.3.2.bin.WIN32/lib-" .. string.gsub(_ACTION, "vs", "vc") } libdirs { path.join(_OPTIONS["glfwdir"], "lib-" .. string.gsub(_ACTION, "vs", "vc")) }
links { "opengl32", "glew32s", "glfw3" } links { "opengl32", "glew32s", "glfw3" }