From a221e0f8ea7ff3052a72b997e0bb2a61704ed428 Mon Sep 17 00:00:00 2001 From: alex-eg Date: Wed, 16 Sep 2026 17:46:06 +0300 Subject: [PATCH] build the triangle on Linux too does not exist there and -framework is not a gcc flag, so the documented build line failed with no hint why. #+macosx picks the header now, and both build lines are in the file -- pkg-config carries the flags on either platform, apart from Apple's GL framework, which has no pkg-config file to carry. --- example/sdl3-triangle.sex | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/example/sdl3-triangle.sex b/example/sdl3-triangle.sex index cae2b68..06eb20c 100644 --- a/example/sdl3-triangle.sex +++ b/example/sdl3-triangle.sex @@ -8,13 +8,29 @@ ;;; triangle is and how far it has spun are passed in as uniforms, so ;;; the geometry itself is uploaded once and never touched again. ;;; -;;; Build: +;;; Build, macOS: ;;; ./sexc example/sdl3-triangle.sex -o sdl3-triangle -- `pkg-config --cflags --libs sdl3` -framework OpenGL +;;; +;;; Build, Linux: +;;; ./sexc example/sdl3-triangle.sex -o sdl3-triangle -- `pkg-config --cflags --libs sdl3 gl` +;;; +;;; The GL header is the one platform difference, and #+ / #- picks it. +;;; Apple keeps the core-profile entry points in and +;;; links them through -framework OpenGL, which no pkg-config file +;;; describes; everywhere else the prototypes come from +;;; with GL_GLEXT_PROTOTYPES defined, and -lGL -- `pkg-config --libs +;;; gl' -- resolves them. SDL3/SDL_opengl.h is not the shortcut it +;;; looks like: on Apple it resolves to the 2.1 header, which has no +;;; glGenVertexArrays and so cannot bind the VAO this program needs. -(define GL-SILENCE-DEPRECATION 1) ; OpenGL is deprecated on macOS +#+macosx (define GL-SILENCE-DEPRECATION 1) ; OpenGL is deprecated on macOS (include SDL3/SDL.h) -(include OpenGL/gl3.h) + +#+macosx (include OpenGL/gl3.h) +#-macosx (define GL-GLEXT-PROTOTYPES 1) +#-macosx (include GL/gl.h) +#-macosx (include GL/glext.h) (define WINDOW-WIDTH 800) (define WINDOW-HEIGHT 600)