use a single script file.

autogenerate the extern folder
This commit is contained in:
Jeffery Myers 2024-08-20 16:16:17 -07:00
parent 9049a646a1
commit 8d0485eafc
3 changed files with 38 additions and 31 deletions

1
.gitignore vendored
View file

@ -399,3 +399,4 @@ FodyWeavers.xsd
build_files
raylib-master
Makefile
/*.sln

View file

@ -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

View file

@ -12,6 +12,35 @@ newoption
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()
defines{"PLATFORM_DESKTOP"}
@ -64,6 +93,10 @@ if (os.isdir('build_files') == false) then
os.mkdir('build_files')
end
if (os.isdir('external') == false) then
os.mkdir('external')
end
workspace (workspaceName)
location "../"
configurations { "Debug", "Release"}
@ -89,9 +122,10 @@ workspace (workspaceName)
targetdir "bin/%{cfg.buildcfg}/"
include ("external/premake_external.lua")
build_externals()
startproject(workspaceName)
project (workspaceName)
kind "ConsoleApp"
location "build_files/"
@ -127,7 +161,7 @@ workspace (workspaceName)
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
dependson {"raylib"}
links {"raylib.lib"}
characterset ("MBCS")
characterset ("Unicode")
buildoptions { "/Zc:__cplusplus" }
filter "system:windows"
@ -155,7 +189,7 @@ workspace (workspaceName)
filter "action:vs*"
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
characterset ("MBCS")
characterset ("Unicode")
buildoptions { "/Zc:__cplusplus" }
filter{}