1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

sokol: fix building of examples and ci tests

This commit is contained in:
Delyan Angelov
2020-01-17 21:05:45 +02:00
committed by Alexander Medvednikov
parent 3d57d3bb7b
commit 24d34a4f2c
12 changed files with 181 additions and 183 deletions

33
vlib/sokol/c/c.v Normal file
View File

@@ -0,0 +1,33 @@
module c
pub const (
used_import = 1
)
#flag -I @VROOT/thirdparty/sokol
#flag -I @VROOT/thirdparty/sokol/util
#flag darwin -fobjc-arc
#flag linux -lX11 -lGL
// METAL
// #flag -DSOKOL_METAL
// #flag darwin -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
// OPENGL
#flag -DSOKOL_GLCORE33
#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore
// for simplicity, all header includes are here because import order matters and we dont have any way
// to ensure import order with V yet
#define SOKOL_IMPL
#define SOKOL_NO_ENTRY
#include "sokol_app.h"
#define SOKOL_IMPL
#define SOKOL_NO_DEPRECATED
#include "sokol_gfx.h"
#define SOKOL_GL_IMPL
#include "util/sokol_gl.h"

28
vlib/sokol/f/f.v Normal file
View File

@@ -0,0 +1,28 @@
module f
import fontstash
pub const (
used_import = 1 + fontstash.used_import
)
#flag windows -I @VROOT/thirdparty/freetype/include
#flag windows -L @VROOT/thirdparty/freetype/win64
#flag linux -I/usr/include/freetype2
#flag darwin -I/usr/local/include/freetype2
#flag darwin -I/opt/local/include/freetype2
#flag darwin -I/usr/local/Cellar/freetype/2.10.0/include/freetype2/
#flag freebsd -I/usr/local/include/freetype2
#flag freebsd -Wl -L/usr/local/lib
#flag -lfreetype
#flag darwin -lpng -lbz2 -lz
#flag linux -I.
#include "ft2build.h"
#define FONS_USE_FREETYPE
#define SOKOL_FONTSTASH_IMPL
#include "util/sokol_fontstash.h"

View File

@@ -27,7 +27,7 @@ pub:
enable_clipboard bool /* enable clipboard access, default is false */
clipboard_size int /* max size of clipboard content in bytes */
html5_canvas_name byteptr /* the name (id) of the HTML5 canvas element, default is "canvas" */
html5_canvas_name byteptr /* the name (id) of the HTML5 canvas element, default is "canvas" */
html5_canvas_resize bool /* if true, the HTML5 canvas size is set to sapp_desc.width/height, otherwise canvas size is tracked */
html5_preserve_drawing_buffer bool /* HTML5 only: whether to preserve default framebuffer content between frames */
html5_premultiplied_alpha bool /* HTML5 only: whether the rendered pixels use premultiplied alpha convention */

View File

@@ -1,7 +1,11 @@
module sfons
import fontstash
#flag -I fontstash/thirdparty
const (
// keep v from warning about unused imports
used_import = fontstash.used_import + 1
)
[inline]
pub fn sfons_create(width int, height int, flags int) &C.FONScontext {

View File

@@ -1,39 +1,8 @@
module sokol
#flag -I @VROOT/thirdparty/sokol
#flag -I @VROOT/thirdparty/sokol/util
import sokol.c
import sokol.f
#flag darwin -fobjc-arc
#flag linux -lX11 -lGL
#flag darwin -I/usr/local/Cellar/freetype/2.10.0/include/freetype2/
#flag -lfreetype
// METAL
// #flag -DSOKOL_METAL
// #flag darwin -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
// OPENGL
#flag -DSOKOL_GLCORE33
#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore
// for simplicity, all header includes are here because import order matters and we dont have any way
// to ensure import order with V yet
#define SOKOL_IMPL
#define SOKOL_NO_ENTRY
#include "sokol_app.h"
#define SOKOL_IMPL
#define SOKOL_NO_DEPRECATED
#include "sokol_gfx.h"
#define SOKOL_GL_IMPL
#include "util/sokol_gl.h"
#define FONS_USE_FREETYPE
#define FONTSTASH_IMPLEMENTATION
#include "fontstash.h"
#define SOKOL_FONTSTASH_IMPL
#include "util/sokol_fontstash.h"
pub const (
used_import = c.used_import + f.used_import
)