about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--meson.build78
-rw-r--r--meson_options.txt1
-rw-r--r--net.iotib.Pong.yml6
-rw-r--r--premake5.lua80
-rw-r--r--src/ball.c1
-rwxr-xr-xsrc/flatpak_launch.sh (renamed from src/launch.sh)0
6 files changed, 84 insertions, 82 deletions
diff --git a/meson.build b/meson.build
deleted file mode 100644
index 611408f..0000000
--- a/meson.build
+++ /dev/null
@@ -1,78 +0,0 @@
-project('Pong', 'c', license : 'GPL-3.0-only', version : '0.2', default_options : ['warning_level=3', 'werror=false', 'optimization=g', 'c_std=c11', 'prefix=/opt'])
-fs = import('fs')
-
-# Checks if on UNIX/POSIX System
-if host_machine.system() != 'windows'
-  if host_machine.system() != 'darwin'
-    set_variable('posix', true)
-  endif
-else
-  set_variable('posix', false)
-endif
-
-if get_variable('posix') == true
-  message('Cleaning raylib...')
-  # First clean up
-  run_command('make', '-C', 'raylib/src', 'clean', capture : true, check : true)
-  message('Building raylib...')
-  # Then Build
-  run_command('make', '-C', 'raylib/src', 'PLATFORM=PLATFORM_DESKTOP', 'RAYLIB_BUILD_MODE=RELEASE', capture : true, check : true)
-else
-  message('Cleaning raylib...')
-  # Have to put OS_PLATFORM=linux or makefile will complain about del command not being found.
-  run_command('mingw32-make', '-C', 'raylib/src', 'PLATFORM_OS=linux', 'clean', capture : true, check : true)
-  message('Building raylib...')
-  run_command('mingw32-make', '-C', 'raylib/src', 'PLATFORM=PLATFORM_DESKTOP', 'RAYLIB_BUILD_MODE=RELEASE', capture : true, check : true)
-endif
-
-# Find the static library
-if fs.exists('raylib/libraylib.a') == true
-    add_project_link_arguments('../raylib/libraylib.a', language : 'c')
-elif fs.exists('raylib/src/libraylib.a') == true
-    add_project_link_arguments('../raylib/src/libraylib.a', language : 'c')
-else
-    error('raylib failed to compile. Check meson-logs to see what went wrong.')
-endif
-
-message('raylib successfully compiled.')
-
-Include_Directories = include_directories('raylib/src')
-
-# Install launcher if flatpak
-if get_option('build_flatpak') == true
-    install_data('src/launch.sh', install_dir : 'bin')
-endif
-
-# Checks if on UNIX/POSIX System
-if host_machine.system() != 'windows'
-  if host_machine.system() != 'darwin'
-    set_variable('posix', true)
-  endif
-else
-  set_variable('posix', false)
-endif
-
-if get_variable('posix') == true
-  X11_Dep = dependency('x11')
-endif
-
-GL_Dep = dependency('gl')
-Threads_Dep = dependency('threads')
-
-Sources = ['src/main.c', 'src/enemy.c', 'src/ball.c', 'src/title.c', 'src/versus.c', 'src/marathon.c']
-
-if get_variable('posix') == true
-  Dependencies = [GL_Dep, Threads_Dep, X11_Dep]
-  add_project_link_arguments('-lGL', '-lm', '-lpthread', '-ldl', '-lrt', '-lX11', language : 'c')
-else
-  Dependencies = [GL_Dep, Threads_Dep]
-  add_project_link_arguments('-lopengl32', '-lgdi32', '-lwinmm', '-lpthread', '-lm', language : 'c')
-endif
-
-# If on windows, we need the c11 threads emulation layer.
-if get_variable('posix') == false
-  Include_Directories = include_directories(['raylib/src', 'src/windows'])
-endif
-
-executable('pong', Sources, dependencies : Dependencies, install : true, install_dir : 'Pong', include_directories : Include_Directories)
-install_subdir('resources', install_dir : 'Pong')
diff --git a/meson_options.txt b/meson_options.txt
deleted file mode 100644
index 4bcef13..0000000
--- a/meson_options.txt
+++ /dev/null
@@ -1 +0,0 @@
-option('build_flatpak', type : 'boolean', value : false)
\ No newline at end of file
diff --git a/net.iotib.Pong.yml b/net.iotib.Pong.yml
index b057db3..41051b4 100644
--- a/net.iotib.Pong.yml
+++ b/net.iotib.Pong.yml
@@ -7,9 +7,11 @@ sdk: org.freedesktop.Sdk
 command: launch.sh
 modules:
   - name: Pong
-    buildsystem: meson
+    buildsystem: simple
     config-opts:
-      - -Dbuild_flatpak=true
+      - premake5 --prefix=/app --flatpak=true gmake2
+      - make
+      - premake5 install
     sources:
       - type: file
         path: meson.build
diff --git a/premake5.lua b/premake5.lua
new file mode 100644
index 0000000..1f312d1
--- /dev/null
+++ b/premake5.lua
@@ -0,0 +1,80 @@
+workspace("Pong")
+    configurations {"Debug", "Release"}
+
+project("Pong")
+    kind("WindowedApp")
+    language("C")
+    files {"src/*.c", "src/*.h", }
+    includedirs {"raylib/src"}
+    -- Prefix Option
+    newoption {
+        trigger     = "prefix",
+        value       = "path",
+        description = "Prefix for where the game is to be installed."
+    }
+    prefix = _OPTIONS["prefix"] or "app"
+
+    -- Flatpak
+    newoption {
+        trigger     = "flatpak",
+        value       = "bool",
+        description = "Build a flatpak."
+    }
+    flatpak = _OPTIONS["flatpak"] or "false"
+
+    -- Find raylib
+    RaylibStaticLibrary = os.findlib("libraylib.a", "raylib", "raylib/src")
+    if(RaylibStaticLibrary == nil) then
+        os.exit(1)
+    end
+    libdirs {RaylibStaticLibrary}
+
+    -- 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") then
+            links {RaylibStaticLibrary, "m", "pthread", "glfw"}
+        elseif(BSD_OS_NAME == "freebsd") then
+            links {RaylibStaticLibrary, "m", "glfw", "stdthreads"}
+        elseif(BSD_OS_NAME == "openbsd") then
+            print("Openbsd doesn't work currently due to lack of c11 threads support.")
+            links {RaylibStaticLibrary, "m", "glfw", "pthread"}
+        else
+            print("Couldn't figure out BSD, assuming freebsd.")
+            links {RaylibStaticLibrary, "m", "glfw", "stdthreads"}
+        end
+    elseif(os.ishost("windows") == true) then
+        print("This script is expecting a MSYS2 or Cygwin environment. You've been warned.")
+    else
+        links {RaylibStaticLibrary, "m", "pthread", "dl"}
+    end
+    newaction {
+        trigger = "install",
+        description = "Install the game to prefix.",
+        execute = function()
+            os.executef("mkdir -pv %s/Pong", prefix)
+            os.executef("cp -rv resources/ %s/Pong/", prefix)
+            os.executef("install -Dvm755 bin/*/Pong %s/Pong/pong", prefix)
+            if(flatpak == true) then
+                os.executef("install -Dvm755 src/flatpak_launch.sh %s/bin/launch.sh", prefix)
+            end
+        end
+    }
+    newaction {
+        trigger = "clean",
+        description = "Clean the work environment.",
+        execute = function()
+            os.executef("rm -rvf %s/obj", _MAIN_SCRIPT_DIR)
+            os.executef("rm -rvf %s/bin", _MAIN_SCRIPT_DIR)
+            os.executef("rm -rvf %s/app", _MAIN_SCRIPT_DIR)
+            os.executef("rm -vf %s/Makefile", _MAIN_SCRIPT_DIR)
+            os.executef("rm -vf %s/Pong.make", _MAIN_SCRIPT_DIR)
+        end
+    }
\ No newline at end of file
diff --git a/src/ball.c b/src/ball.c
index 4fc1eb4..35e0651 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -1,4 +1,3 @@
-#include "raylib.h"
 #include "pong.h"
 
 void ball(Rectangle *Player, Rectangle *Enemy, struct Balls *Ball, int *PlayerScore, int *EnemyScore) {
diff --git a/src/launch.sh b/src/flatpak_launch.sh
index 1312ef3..1312ef3 100755
--- a/src/launch.sh
+++ b/src/flatpak_launch.sh