X11: compile `GLXWorkstation` with OpenGL jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 14 Sep 2017 09:28:09 +0100
branchjv
changeset 8182 c730140a0156
parent 8181 7cd36eb4b09c
child 8183 e1c6a2aa41b6
X11: compile `GLXWorkstation` with OpenGL OpenGL compiler and linker flags are configured locally in `Make.proto` rather than in target config - this moves the configuration closer to the code. Currently all supported (and considered) platforms have OpenGL implementation. Later on one may use conditionals in makefile to deal exceptions.
Make.proto
stx_libview.st
--- a/Make.proto	Wed Sep 06 11:13:09 2017 +0200
+++ b/Make.proto	Thu Sep 14 09:28:09 2017 +0100
@@ -34,14 +34,14 @@
 # add the path(es) here:,
 # ********** OPTIONAL: MODIFY the next lines ***
 # LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES=$(OPTIONAL_SUPPORT_XLIB_INCLUDE) -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic2
+LOCALINCLUDES=$(OPTIONAL_SUPPORT_XLIB_INCLUDE) $(OPENGL_CFLAGS) -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic2
 
 
 # if you need any additional defines for embedded C code,
 # add them here:,
 # ********** OPTIONAL: MODIFY the next lines ***
 # LOCALDEFINES=-Dfoo -Dbar -DDEBUG
-LOCALDEFINES=$(XINCLUDE) $(XDEFS) $(CC_3D_FLAGS)
+LOCALDEFINES=$(XINCLUDE) $(XDEFS) $(OPENGL_DEFS)
 
 LIBNAME=libstx_libview
 STCLOCALOPT='-package=$(PACKAGE)' -I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -headerDir=. $(COMMONSYMBOLS) -varPrefix=$(LIBNAME)
@@ -50,7 +50,7 @@
 # ********** OPTIONAL: MODIFY the next line ***
 # additional C-libraries that should be pre-linked with the class-objects
 LD_OBJ_LIBS=
-LOCAL_SHARED_LIBS=-L$(X_LIB_DIR) $(LIB_GL) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_XFT) $(LIB_X) $(LIBRUN_LINK_LIB) 
+LOCAL_SHARED_LIBS=-L$(X_LIB_DIR) $(OPENGL_LIBS) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_XFT) $(LIB_X) $(LIBRUN_LINK_LIB) 
 
 
 # ********** OPTIONAL: MODIFY the next line ***
@@ -60,6 +60,10 @@
 OBJS= $(COMMON_OBJS) $(UNIX_OBJS)
 
 
+OPENGL_DEFS=-DOPENGL
+OPENGL_CFLAGS=$(shell pkg-config --cflags gl)
+OPENGL_LIBS=$(shell pkg-config --libs gl)
+
 
 all:: preMake classLibRule postMake
 
--- a/stx_libview.st	Wed Sep 06 11:13:09 2017 +0200
+++ b/stx_libview.st	Thu Sep 14 09:28:09 2017 +0100
@@ -183,6 +183,19 @@
     "Modified: / 27-09-2011 / 18:25:27 / cg"
 !
 
+additionalDefinitions_make_dot_proto
+    "allows for additional definitions/rules to be added to the make.proto file."
+
+    ^ '
+OPENGL_DEFS=-DOPENGL
+OPENGL_CFLAGS=$(shell pkg-config --cflags gl)
+OPENGL_LIBS=$(shell pkg-config --libs gl)
+'
+
+    "Created: / 14-09-2017 / 00:19:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-09-2017 / 08:39:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 additionalRules_bc_dot_mak
     ^ '#
 
@@ -206,18 +219,30 @@
 additionalSharedLinkLibraries_make_dot_proto
     "allows for additional shared libraries to be added to the make.proto file."
 
-    ^ '-L$(X_LIB_DIR) $(LIB_GL) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_XFT) $(LIB_X) $(LIBRUN_LINK_LIB) '
+    ^ '-L$(X_LIB_DIR) $(OPENGL_LIBS) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_XFT) $(LIB_X) $(LIBRUN_LINK_LIB) '
 
     "Created: / 06-09-2017 / 09:55:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 07-09-2017 / 22:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 localDefines_unix
-    ^ '$(XINCLUDE) $(XDEFS) $(CC_3D_FLAGS)'
+    ^ '$(XINCLUDE) $(XDEFS) $(OPENGL_DEFS)'
+
+    "Modified: / 14-09-2017 / 08:37:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 localIncludes
     ^ '$(OPTIONAL_SUPPORT_XLIB_INCLUDE)'
+
+    "Modified: / 14-09-2017 / 08:38:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+localIncludes_unix
+    "allow for the specification of additional include directories"
+
+    ^ super localIncludes_unix , ' $(OPENGL_CFLAGS)'
+
+    "Created: / 14-09-2017 / 00:21:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 stcOptimizationOptions