2020-01-17 22:05:45 +03:00
|
|
|
module c
|
|
|
|
|
2023-01-11 12:29:38 +03:00
|
|
|
pub const used_import = 1
|
2020-01-17 22:05:45 +03:00
|
|
|
|
2021-04-19 19:01:47 +03:00
|
|
|
#flag -I @VEXEROOT/thirdparty/sokol
|
|
|
|
#flag -I @VEXEROOT/thirdparty/sokol/util
|
2020-12-26 11:08:16 +03:00
|
|
|
#flag freebsd -I /usr/local/include
|
2020-01-17 22:05:45 +03:00
|
|
|
#flag darwin -fobjc-arc
|
2023-07-28 02:27:43 +03:00
|
|
|
|
2021-05-16 20:21:18 +03:00
|
|
|
#flag linux -lX11 -lGL -lXcursor -lXi -lpthread
|
2020-12-26 11:08:16 +03:00
|
|
|
#flag freebsd -L/usr/local/lib -lX11 -lGL -lXcursor -lXi
|
2022-04-26 13:14:00 +03:00
|
|
|
#flag openbsd -L/usr/X11R6/lib -lX11 -lGL -lXcursor -lXi
|
2020-01-18 08:27:39 +03:00
|
|
|
#flag windows -lgdi32
|
2023-07-28 02:27:43 +03:00
|
|
|
|
|
|
|
// Note that -lm is needed *only* for sokol_gl.h's usage of sqrtf(),
|
|
|
|
// but without -lm, this fails:
|
|
|
|
// `v -cc gcc ~/.vmodules/sdl/examples/sdl_opengl_and_sokol/`
|
|
|
|
// With tcc, this succeeds with or without -lm:
|
|
|
|
// `v ~/.vmodules/sdl/examples/sdl_opengl_and_sokol/`
|
|
|
|
$if !tinyc {
|
|
|
|
#flag linux -lm
|
|
|
|
}
|
|
|
|
|
2020-01-17 22:05:45 +03:00
|
|
|
// METAL
|
2021-04-13 14:38:55 +03:00
|
|
|
$if macos {
|
2022-03-31 16:52:21 +03:00
|
|
|
$if darwin_sokol_glcore33 ? {
|
|
|
|
#flag darwin -DSOKOL_GLCORE33 -framework OpenGL -framework Cocoa -framework QuartzCore
|
|
|
|
} $else {
|
|
|
|
#flag -DSOKOL_METAL
|
|
|
|
#flag -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
|
|
|
|
}
|
2021-04-12 19:35:06 +03:00
|
|
|
}
|
|
|
|
$if ios {
|
|
|
|
#flag -DSOKOL_METAL
|
|
|
|
#flag -framework Foundation -framework Metal -framework MetalKit -framework UIKit
|
|
|
|
}
|
2022-09-20 00:17:13 +03:00
|
|
|
|
|
|
|
$if emscripten ? {
|
|
|
|
#flag -DSOKOL_GLES2
|
|
|
|
#flag -DSOKOL_NO_ENTRY
|
|
|
|
#flag -s ERROR_ON_UNDEFINED_SYMBOLS=0
|
|
|
|
#flag -s ASSERTIONS=1
|
|
|
|
#flag -s MODULARIZE
|
|
|
|
}
|
|
|
|
|
2020-01-17 22:05:45 +03:00
|
|
|
// OPENGL
|
2020-01-21 05:22:18 +03:00
|
|
|
#flag linux -DSOKOL_GLCORE33
|
2020-12-26 11:08:16 +03:00
|
|
|
#flag freebsd -DSOKOL_GLCORE33
|
2022-04-26 13:14:00 +03:00
|
|
|
#flag openbsd -DSOKOL_GLCORE33
|
2020-01-21 05:22:18 +03:00
|
|
|
//#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore
|
2020-07-08 22:43:27 +03:00
|
|
|
// D3D
|
2020-08-18 00:34:51 +03:00
|
|
|
#flag windows -DSOKOL_GLCORE33
|
|
|
|
//#flag windows -DSOKOL_D3D11
|
2020-01-17 22:05:45 +03:00
|
|
|
// 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
|
2020-08-19 12:00:15 +03:00
|
|
|
// TODO should not be defined for android graphic (apk/aab using sokol) builds, but we have no ways to undefine
|
|
|
|
//#define SOKOL_NO_ENTRY
|
|
|
|
#flag linux -DSOKOL_NO_ENTRY
|
|
|
|
#flag darwin -DSOKOL_NO_ENTRY
|
|
|
|
#flag windows -DSOKOL_NO_ENTRY
|
2020-12-31 14:38:55 +03:00
|
|
|
#flag windows -DSOKOL_WIN32_FORCE_MAIN
|
2020-08-19 12:00:15 +03:00
|
|
|
#flag freebsd -DSOKOL_NO_ENTRY
|
2022-04-26 13:14:00 +03:00
|
|
|
#flag openbsd -DSOKOL_NO_ENTRY
|
2020-08-19 12:00:15 +03:00
|
|
|
#flag solaris -DSOKOL_NO_ENTRY
|
|
|
|
// TODO end
|
2021-03-29 12:27:34 +03:00
|
|
|
|
2021-05-14 14:28:53 +03:00
|
|
|
#flag linux -ldl
|
|
|
|
|
2022-06-30 13:47:59 +03:00
|
|
|
// To allow for thirdparty initializing window / acceleration contexts
|
|
|
|
// but still be able to use sokol.gfx e.g. SDL+sokol_gfx
|
|
|
|
$if !no_sokol_app ? {
|
|
|
|
#include "sokol_app.h"
|
|
|
|
}
|
2020-01-17 22:05:45 +03:00
|
|
|
#define SOKOL_IMPL
|
|
|
|
#define SOKOL_NO_DEPRECATED
|
|
|
|
#include "sokol_gfx.h"
|
|
|
|
#define SOKOL_GL_IMPL
|
|
|
|
#include "util/sokol_gl.h"
|
2021-10-13 21:22:58 +03:00
|
|
|
#include "sokol_v.post.h"
|