From ccee9ca0d112c179c839cb348ff46c8d58c861d0 Mon Sep 17 00:00:00 2001 From: DxrxDev Date: Sun, 4 Feb 2024 15:08:16 +0000 Subject: [PATCH] added basic premake functionality --- .gitignore | 3 ++ premake5.lua | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 premake5.lua diff --git a/.gitignore b/.gitignore index 6ff0e2346..44ad86dbf 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,6 @@ docgen_tmp/ # Parser stuff parser/raylib_parser + +# Ignore Makefile made by premake +Makefile diff --git a/premake5.lua b/premake5.lua new file mode 100644 index 000000000..2412c331b --- /dev/null +++ b/premake5.lua @@ -0,0 +1,78 @@ +function raylib_link( pathToRaylib ) + links { "raylib" } + dependson { "raylib" } + includedirs { pathToRaylib .. "src" } + + libdirs { pathToRaylib .. "bin/%{cfg.buildcfg}" } + filter { "system:linux" } + links { "m", "GL", "pthread", "dl", "rt", "X11" } -- only supporting X11 with linux rn + filter { "system:macosx" } + links { "OpenGL.framework", "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", "CoreAudio.framework", "CoreVideo.framework", "AudioToolbox.framework" } + filter { "system:windows" } + links { "winmm", "kernel32", "opengl32", "gdi32" } + defines { "_WIN32" } + filter { "action:" } + filter {} +end + +newoption { + trigger = "platform", default = "desktop", value = "Platform type", + description = "what platform youre using", + allowed = { + { "desktop", "Desktop OSs" }, + { "desktop-sdl", "Desktop OS with SDL backend" }, + { "web", "HTML5 with WebAssembly"}, + { "drm", "RaspberryPi and such" }, + { "android", "Android (ARM, ARM64)" } + } +} + +-- Choose what opengl versoin you want to work with + +--desktopGL = "GRAPHICS_API_OPENGL_11" +--desktopGL = "GRAPHICS_API_OPENGL_21" +desktopGL = "GRAPHICS_API_OPENGL_33" +--desktopGL = "GRAPHICS_API_OPENGL_43" + +embededGL = "GRAPHICS_API_OPENGL_ES2" + +libType = "StaticLib" +--libType = "SharedLib" + +project "raylib" + language "C" + cdialect "C99" + kind (libType) + + objdir "obj/%{cfg.buildcfg}" + targetdir "bin/%{cfg.buildcfg}" + + files { + "src/*.c", + "src/*.h" + } + includedirs { "src/external/glfw/include" } + + filter { "options:platform=desktop" } + defines { desktopGL, "PLATFORM_DESKTOP" } + filter { "options:platform=desktop-sdl" } + defines { desktopGL, "PLATFORM_DESKTOP_SDL" } + filter { "options:platform=web" } + defines { embededGL, "PLATFORM_WEB", "_DEFAULT_SOURCE" } + filter { "options:platform=drm" } + defines { embededGL, "PLATFORM_DRM" } + filter { "options:platform=android" } + defines { embededGL, "PLATFORM_ANDROID" } + filter {} + + filter { "system:linux" } + defines { "_GNU_SOURCE", "PLATFORM_OS=LINUX" } + filter { "system:macosx" } + disablewarnings {"deprecated-declarations" } + defines { "PLATOFRM_OS=OSX" } + filter { "system:bsd" } + defines { "PLATFORM_OS=BSD" } + filter { "system:windows" } + defines { "PLATFORM_OS=WINDOWS" } + filter {} +