diff --git a/.gitignore b/.gitignore index c8d2841..6b550b8 100644 --- a/.gitignore +++ b/.gitignore @@ -399,3 +399,4 @@ FodyWeavers.xsd build_files raylib-master Makefile +/*.sln diff --git a/build/external/premake_external.lua b/build/external/premake_external.lua deleted file mode 100644 index 8cbd596..0000000 --- a/build/external/premake_external.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/build/premake5.lua b/build/premake5.lua index 7661ffe..6fcbb7e 100644 --- a/build/premake5.lua +++ b/build/premake5.lua @@ -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{}