about summary refs log tree commit diff stats
path: root/premake5.lua
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-08 00:25:47 -0400
committerCharadon <dev@iotib.net>2022-06-08 00:25:47 -0400
commit73f8ca5389c3d2d777e1dc5d25cbb61501a07691 (patch)
treec027053460fc4607a26c02fffb071d9688b38b6d /premake5.lua
parentb8dda4d4a5385772c3ee997ae3948d52026a06e2 (diff)
downloadPong-C-73f8ca5389c3d2d777e1dc5d25cbb61501a07691.tar.gz
More portability efforts
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua91
1 files changed, 44 insertions, 47 deletions
diff --git a/premake5.lua b/premake5.lua
index 6278272..01ac96d 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -8,7 +8,7 @@ project("Pong")
         execute = function()
             os.executef("mkdir -p %s/Pong/resources", prefix)
             os.executef("cp -v resources/* %s/Pong/resources/", prefix)
-            os.executef("install -Dm755 bin/*/Pong %s/Pong/pong", prefix)
+            os.executef("install -m755 bin/*/Pong %s/Pong/pong", prefix)
             os.exit(0)
         end
     }
@@ -34,7 +34,48 @@ project("Pong")
         trigger = "check_deps",
         description = "Check if you have all the dependencies installed.",
         execute = function()
-            os.exit(0)
+            io.write("Pkg-config: ")
+            io.flush()
+            Pkgconf_Result = os.executef("which pkgconf")
+            AllGood = true
+            if(Pkgconf_Result == nil)
+            then
+                print("You do not have pkgconf installed. Aborting.")
+                os.exit(1)
+            end
+            io.write("Raylib: ")
+            io.flush()
+            if(os.executef("pkgconf --modversion raylib") == nil)
+            then
+                print("Can't find raylib.")
+                AllGood = false
+            end
+            io.write("SDL2: ")
+            io.flush()
+            if(os.executef("pkgconf --modversion sdl2") == nil)
+            then
+                print("Can't find SDL2.")
+                AllGood = false
+            end
+            io.write("SDL2_mixer: ")
+            io.flush()
+            if (os.executef("pkgconf --modversion SDL2_mixer") == nil)
+            then
+                print("Can't find SDL2_mixer.")
+                AllGood = false
+            end
+            io.write("GLFW3: ")
+            io.flush()
+            if (os.executef("pkgconf --modversion glfw3") == nil)
+            then
+                print("Can't find GLFW.")
+                AllGood = false
+            end
+            if(AllGood == true)
+            then
+                os.exit(0)
+            end
+            os.exit(1)
         end
     }
 
@@ -59,53 +100,9 @@ project("Pong")
     }
     flatpak = _OPTIONS["flatpak"] or "false"
 
-    -- Check for pkgconf
-    Pkgconf_Result = os.executef("pkgconf --version")
-    if(Pkgconf_Result == nil)
-    then
-        print("You do not have pkgconf installed. Aborting.")
-        os.exit(1)
-    end
-
     if (flatpak == true)
     then
         linkoptions {"-L/app/lib"}
     end
 
-    linkoptions {"-lraylib", "`pkgconf --libs glfw3`", "`pkgconf --libs gl`", "`pkgconf --libs sdl2`", "`pkgconf --libs SDL2_mixer`"}
-
-    -- Detect OS
-    if(os.ishost("linux") == true) then
-        links {RaylibStaticLibrary, "m", "pthread", "dl"}
-    elseif(os.ishost("bsd") == true) then
-        print("It is required you build raylib to an external glfw library when on bsd.")    
-        -- Which BSD?
-        BSD_OS = io.popen("uname")
-        BSD_OS_NAME = BSD_OS:read("*a")
-        BSD_OS:close()
-        -- Check Result
-        if(BSD_OS_NAME == "NetBSD\n") then
-            links {RaylibStaticLibrary, "m", "pthread"}
-        elseif(BSD_OS_NAME == "FreeBSD\n") then
-            links {RaylibStaticLibrary, "m", "stdthreads", "pthread"}
-        elseif(BSD_OS_NAME == "OpenBSD\n") then
-	    
-	    -- Work around the fact openbsd doesn't have c11 threads.
-	    includedirs {"src/openbsd"}
-	    files {"src/openbsd/*.c", "src/openbsd/*.h"}
-
-	    -- Tell compiler where libraries are.
-	    libdirs {"/usr/local/lib"}
-            links {RaylibStaticLibrary, "m", "pthread"}
-
-        else
-            print("Couldn't figure out BSD, assuming freebsd.")
-            links {RaylibStaticLibrary, "m", "stdthreads"}
-        end
-    elseif(os.ishost("windows") == true) then
-        print("This script is expecting a MSYS2 or Cygwin environment. You've been warned.")
-        links {RaylibStaticLibrary, "-lopengl32", "-lgdi32", "-lwinmm", "-lpthread", "-lm"}
-        includedirs {"raylib/src", "src/windows"}
-    else
-        links {RaylibStaticLibrary, "m", "pthread", "dl"}
-    end
+    linkoptions {"`pkgconf --libs raylib`", "`pkgconf --libs glfw3`", "`pkgconf --libs gl`", "`pkgconf --libs sdl2`", "`pkgconf --libs SDL2_mixer`"}