use a single script file.
autogenerate the extern folder
This commit is contained in:
parent
9049a646a1
commit
8d0485eafc
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -399,3 +399,4 @@ FodyWeavers.xsd
|
||||||
build_files
|
build_files
|
||||||
raylib-master
|
raylib-master
|
||||||
Makefile
|
Makefile
|
||||||
|
/*.sln
|
||||||
|
|
28
build/external/premake_external.lua
vendored
28
build/external/premake_external.lua
vendored
|
@ -1,28 +0,0 @@
|
||||||
function download_progress(total, current)
|
|
||||||
local ratio = current / total;
|
|
||||||
ratio = math.min(math.max(ratio, 0), 1);
|
|
||||||
local percent = math.floor(ratio * 100);
|
|
||||||
print("Download progress (" .. percent .. "%/100%)")
|
|
||||||
end
|
|
||||||
|
|
||||||
function check_raylib()
|
|
||||||
os.chdir("external")
|
|
||||||
if(os.isdir("raylib-master") == false) then
|
|
||||||
if(not os.isfile("raylib-master.zip")) then
|
|
||||||
print("Raylib not found, downloading from github")
|
|
||||||
local result_str, response_code = http.download("https://github.com/raysan5/raylib/archive/refs/heads/master.zip", "raylib-master.zip", {
|
|
||||||
progress = download_progress,
|
|
||||||
headers = { "From: Premake", "Referer: Premake" }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
print("Unzipping to " .. os.getcwd())
|
|
||||||
zip.extract("raylib-master.zip", os.getcwd())
|
|
||||||
os.remove("raylib-master.zip")
|
|
||||||
end
|
|
||||||
os.chdir("../")
|
|
||||||
end
|
|
||||||
|
|
||||||
function build_externals()
|
|
||||||
print("calling externals")
|
|
||||||
check_raylib()
|
|
||||||
end
|
|
|
@ -12,6 +12,35 @@ newoption
|
||||||
default = "opengl33"
|
default = "opengl33"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function download_progress(total, current)
|
||||||
|
local ratio = current / total;
|
||||||
|
ratio = math.min(math.max(ratio, 0), 1);
|
||||||
|
local percent = math.floor(ratio * 100);
|
||||||
|
print("Download progress (" .. percent .. "%/100%)")
|
||||||
|
end
|
||||||
|
|
||||||
|
function check_raylib()
|
||||||
|
os.chdir("external")
|
||||||
|
if(os.isdir("raylib-master") == false) then
|
||||||
|
if(not os.isfile("raylib-master.zip")) then
|
||||||
|
print("Raylib not found, downloading from github")
|
||||||
|
local result_str, response_code = http.download("https://github.com/raysan5/raylib/archive/refs/heads/master.zip", "raylib-master.zip", {
|
||||||
|
progress = download_progress,
|
||||||
|
headers = { "From: Premake", "Referer: Premake" }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
print("Unzipping to " .. os.getcwd())
|
||||||
|
zip.extract("raylib-master.zip", os.getcwd())
|
||||||
|
os.remove("raylib-master.zip")
|
||||||
|
end
|
||||||
|
os.chdir("../")
|
||||||
|
end
|
||||||
|
|
||||||
|
function build_externals()
|
||||||
|
print("calling externals")
|
||||||
|
check_raylib()
|
||||||
|
end
|
||||||
|
|
||||||
function platform_defines()
|
function platform_defines()
|
||||||
defines{"PLATFORM_DESKTOP"}
|
defines{"PLATFORM_DESKTOP"}
|
||||||
|
|
||||||
|
@ -64,6 +93,10 @@ if (os.isdir('build_files') == false) then
|
||||||
os.mkdir('build_files')
|
os.mkdir('build_files')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (os.isdir('external') == false) then
|
||||||
|
os.mkdir('external')
|
||||||
|
end
|
||||||
|
|
||||||
workspace (workspaceName)
|
workspace (workspaceName)
|
||||||
location "../"
|
location "../"
|
||||||
configurations { "Debug", "Release"}
|
configurations { "Debug", "Release"}
|
||||||
|
@ -89,9 +122,10 @@ workspace (workspaceName)
|
||||||
|
|
||||||
targetdir "bin/%{cfg.buildcfg}/"
|
targetdir "bin/%{cfg.buildcfg}/"
|
||||||
|
|
||||||
include ("external/premake_external.lua")
|
|
||||||
build_externals()
|
build_externals()
|
||||||
|
|
||||||
|
startproject(workspaceName)
|
||||||
|
|
||||||
project (workspaceName)
|
project (workspaceName)
|
||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
location "build_files/"
|
location "build_files/"
|
||||||
|
@ -127,7 +161,7 @@ workspace (workspaceName)
|
||||||
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
|
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
|
||||||
dependson {"raylib"}
|
dependson {"raylib"}
|
||||||
links {"raylib.lib"}
|
links {"raylib.lib"}
|
||||||
characterset ("MBCS")
|
characterset ("Unicode")
|
||||||
buildoptions { "/Zc:__cplusplus" }
|
buildoptions { "/Zc:__cplusplus" }
|
||||||
|
|
||||||
filter "system:windows"
|
filter "system:windows"
|
||||||
|
@ -155,7 +189,7 @@ workspace (workspaceName)
|
||||||
|
|
||||||
filter "action:vs*"
|
filter "action:vs*"
|
||||||
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
|
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
|
||||||
characterset ("MBCS")
|
characterset ("Unicode")
|
||||||
buildoptions { "/Zc:__cplusplus" }
|
buildoptions { "/Zc:__cplusplus" }
|
||||||
filter{}
|
filter{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue