MSVC Patch

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Geof Nieboer gnieboer at corpcomm.net
Sat Apr 23 14:57:45 UTC 2016


Please find attached patch for osmocom-sdr

1- Allows compilation on MSVC by conditionally adding __attribute(format
tags based on the compiler

2- Allows builders to use Glew when required, making a GlewInit call when
USING_GLEW is defined. If that is not defined, there are no changes.

Geof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20160423/6785921b/attachment.htm>
-------------- next part --------------
From 2c555f50786bfa3aa3428f6a6b86bbf7df72c8a8 Mon Sep 17 00:00:00 2001
From: gnieboer <gnieboer at corpcomm.net>
Date: Wed, 13 Apr 2016 19:57:46 +0300
Subject: [PATCH] Allows build on MSVC 
 as MSVC doesn't support __attribute((format... 
 and I needed to add glew to get it to build on
 windows, which then requires a glewInit() call.

---
 lib/fosphor/gl.c      | 8 ++++++++
 lib/fosphor/gl_font.h | 8 +++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/fosphor/gl.c b/lib/fosphor/gl.c
index 8b8fe4b..297de53 100644
--- a/lib/fosphor/gl.c
+++ b/lib/fosphor/gl.c
@@ -252,6 +252,14 @@ fosphor_gl_init(struct fosphor *self)
 	if (!gl)
 		return -ENOMEM;
 
+#ifdef USING_GLEW
+	GLenum err = glewInit();
+	if (GLEW_OK != err)
+	{
+		fprintf(stderr, "Glew initialization error: %s\n", glewGetErrorString(err));
+	}
+#endif 
+
 	self->gl = gl;
 
 	memset(gl, 0, sizeof(struct fosphor_gl_state));
diff --git a/lib/fosphor/gl_font.h b/lib/fosphor/gl_font.h
index 4a5c230..107c14b 100644
--- a/lib/fosphor/gl_font.h
+++ b/lib/fosphor/gl_font.h
@@ -35,6 +35,12 @@ struct gl_font;
 
 #define GLF_FLG_LCD	(1 << 0)
 
+#ifdef _MSC_VER
+#define PRINT_CHECK
+#else
+#define PRINT CHECK __attribute__((format(printf, 6, 7)))
+#endif 
+
 enum glf_align
 {
 	GLF_LEFT,
@@ -60,7 +66,7 @@ void glf_draw_str(const struct gl_font *glf,
 void glf_printf(const struct gl_font *glf,
                 float x, enum glf_align x_align,
                 float y, enum glf_align y_align,
-                const char *fmt, ...) __attribute__((format(printf, 6, 7)));
+                const char *fmt, ...) PRINT_CHECK;
 
 void glf_begin(const struct gl_font *glf, float fg_color[3]);
 void glf_end(void);
-- 
2.7.1.windows.1



More information about the osmocom-sdr mailing list