hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/premake5.lua
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-25 04:08:12 +0200
committerhachem <im@hachem.wtf>2026-08-25 04:08:12 +0200
commit4be19ce68041b813c04f91cb39fed7e2a7bef2e6 (patch)
tree5e42539e07508abe0e7e65b381592ca59dc74f54 /premake5.lua
parent5f6e1d8a85988de603c507c0f0663c5349ba61ee (diff)
feat: window seperation and run loop
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua186
1 files changed, 180 insertions, 6 deletions
diff --git a/premake5.lua b/premake5.lua
index 79c1165..a464f28 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -1,3 +1,17 @@
+-- premake5's built-in `clean` action is unported ("has not yet been ported"),
+-- so provide our own: wipe the build output and the generated project files.
+newaction {
+ trigger = "clean",
+ description = "Remove build output (bin, bin-int) and generated project files",
+ execute = function()
+ os.rmdir("bin")
+ os.rmdir("bin-int")
+ os.remove("Makefile")
+ for _, f in ipairs(os.matchfiles("*.make")) do os.remove(f) end
+ print("Cleaned: bin/, bin-int/, Makefile, *.make")
+ end
+}
+
workspace "icsohs"
architecture "x64"
startproject "icsohs"
@@ -18,7 +32,146 @@ workspace "icsohs"
defines "ICSOHS_MACOS"
architecture "ARM64"
-local outputdir = "%{cfg.buildcfg}-%{cfg.system}/%{prj.name}"
+outputdir = "%{cfg.buildcfg}-%{cfg.system}/%{prj.name}"
+includedir = {}
+includedir["glfw"] = "ext/glfw/include"
+
+group "dependencies"
+project "GLFW"
+ kind "StaticLib"
+ language "C"
+ staticruntime "on"
+ warnings "off"
+
+ targetdir ("bin/" .. outputdir)
+ objdir ("bin-int/" .. outputdir)
+
+ files
+ {
+ "ext/glfw/src/context.c",
+ "ext/glfw/src/init.c",
+ "ext/glfw/src/input.c",
+ "ext/glfw/src/monitor.c",
+ "ext/glfw/src/platform.c",
+ "ext/glfw/src/vulkan.c",
+ "ext/glfw/src/window.c",
+
+ "ext/glfw/src/internal.h",
+ "ext/glfw/src/platform.h",
+ "ext/glfw/src/mappings.h",
+
+ "ext/glfw/src/null_init.c",
+ "ext/glfw/src/null_joystick.c",
+ "ext/glfw/src/null_joystick.h",
+ "ext/glfw/src/null_monitor.c",
+ "ext/glfw/src/null_platform.h",
+ "ext/glfw/src/null_window.c",
+ }
+
+ filter "system:linux"
+ pic "On"
+ systemversion "latest"
+
+ files
+ {
+ "ext/glfw/src/x11_init.c",
+ "ext/glfw/src/x11_monitor.c",
+ "ext/glfw/src/x11_platform.h",
+ "ext/glfw/src/x11_window.c",
+ "ext/glfw/src/xkb_unicode.c",
+ "ext/glfw/src/xkb_unicode.h",
+
+ "ext/glfw/src/wl_init.c",
+ "ext/glfw/src/wl_monitor.c",
+ "ext/glfw/src/wl_platform.h",
+ "ext/glfw/src/wl_window.c",
+
+ "ext/glfw/src/posix_module.c",
+ "ext/glfw/src/posix_time.c",
+ "ext/glfw/src/posix_time.h",
+ "ext/glfw/src/posix_thread.c",
+ "ext/glfw/src/posix_thread.h",
+
+ "ext/glfw/src/glx_context.c",
+ "ext/glfw/src/egl_context.c",
+ "ext/glfw/src/osmesa_context.c",
+
+ "ext/glfw/src/linux_joystick.c",
+ "ext/glfw/src/linux_joystick.h"
+ }
+
+ defines
+ {
+ "_GLFW_X11"
+ }
+
+ filter "system:macosx"
+ pic "On"
+
+ files
+ {
+ "ext/glfw/src/cocoa_init.m",
+ "ext/glfw/src/cocoa_joystick.h",
+ "ext/glfw/src/cocoa_joystick.m",
+ "ext/glfw/src/cocoa_monitor.m",
+ "ext/glfw/src/cocoa_platform.h",
+ "ext/glfw/src/macos_time.c",
+ "ext/glfw/src/macos_time.h",
+ "ext/glfw/src/cocoa_window.m",
+
+ "ext/glfw/src/nsgl_context.m",
+ "ext/glfw/src/egl_context.c",
+ "ext/glfw/src/osmesa_context.c",
+
+ "ext/glfw/src/posix_module.c",
+ "ext/glfw/src/posix_thread.c",
+ "ext/glfw/src/posix_thread.h"
+ }
+
+ defines
+ {
+ "_GLFW_COCOA"
+ }
+
+ filter "system:windows"
+ systemversion "latest"
+
+ files
+ {
+ "ext/glfw/src/win32_init.c",
+ "ext/glfw/src/win32_joystick.c",
+ "ext/glfw/src/win32_joystick.h",
+ "ext/glfw/src/win32_module.c",
+ "ext/glfw/src/win32_monitor.c",
+ "ext/glfw/src/win32_platform.h",
+ "ext/glfw/src/win32_thread.c",
+ "ext/glfw/src/win32_thread.h",
+ "ext/glfw/src/win32_time.c",
+ "ext/glfw/src/win32_time.h",
+ "ext/glfw/src/win32_window.c",
+ "ext/glfw/src/wgl_context.c",
+ "ext/glfw/src/egl_context.c",
+ "ext/glfw/src/osmesa_context.c"
+ }
+
+ defines
+ {
+ "_GLFW_WIN32",
+ "_CRT_SECURE_NO_WARNINGS",
+ }
+
+ filter "configurations:debug"
+ runtime "Debug"
+ symbols "on"
+ filter "configurations:release"
+ runtime "Release"
+ optimize "speed"
+ filter "configurations:dist"
+ runtime "Release"
+ optimize "speed"
+ symbols "off"
+group ""
+
project "icsohs"
kind "ConsoleApp"
@@ -29,10 +182,8 @@ project "icsohs"
targetdir ("bin/" .. outputdir)
objdir ("bin-int/" .. outputdir)
- defines
- {
- "_CRT_SECURE_NO_WARNINGS",
- }
+ includedirs "src"
+ defines "_CRT_SECURE_NO_WARNINGS"
files
{
@@ -40,10 +191,33 @@ project "icsohs"
"src/**.c",
}
- includedirs "src"
+ links
+ {
+ "GLFW"
+ }
+
+ externalincludedirs
+ {
+ "%{includedir.glfw}"
+ }
filter "system:windows"
systemversion "latest"
+ filter "system:macosx"
+ defines
+ {
+ "_GLFW_COCOA",
+ "GL_SILENCE_DEPRECATION"
+ }
+ links
+ {
+ "Cocoa.framework",
+ "IOKit.framework",
+ "CoreFoundation.framework",
+ "CoreVideo.framework",
+ "OpenGL.framework",
+ "QuartzCore.framework",
+ }
filter "configurations:debug"
defines "ICSOHS_DEBUG"