improve bgfx build on windows

This commit is contained in:
lixianjing 2024-05-01 18:31:13 +08:00
parent f217efe6c3
commit 50be0ad05d
6 changed files with 27 additions and 8 deletions

View File

@ -22,10 +22,13 @@ BgfxSources = [
'bimg/src/image_gnf.cpp', 'bimg/src/image_gnf.cpp',
'bgfx/src/amalgamated.cpp' 'bgfx/src/amalgamated.cpp'
] ]
BgfxSources += Glob('bimg/3rdparty/astc-encoder/source/*.cpp')
if OS_NAME == 'Windows': if OS_NAME == 'Windows':
CCFLAGS = CCFLAGS + ' /std:c++17 '; CCFLAGS = CCFLAGS + ' /std:c++17 /Zc:__cplusplus ';
BgfxCppPath = BgfxCppPath + ['bx/include/compat/msvc','bgfx/3rdparty/dxsdk/include'] BgfxCppPath = BgfxCppPath + ['bx/include/compat/msvc',
'bgfx/3rdparty/dxsdk/include',
'bgfx/3rdparty/directx-headers/include/directx']
elif OS_NAME == 'Darwin': elif OS_NAME == 'Darwin':
CCFLAGS = CCFLAGS + ' -std=c++17 ' CCFLAGS = CCFLAGS + ' -std=c++17 '
BgfxCppPath= BgfxCppPath + ['bx/include/compat/osx'] BgfxCppPath= BgfxCppPath + ['bx/include/compat/osx']

View File

@ -39,7 +39,7 @@ elif NANOVG_BACKEND == 'BGFX':
if OS_NAME == 'Darwin': if OS_NAME == 'Darwin':
CCFLAGS = CCFLAGS + ' -std=c++17 ' CCFLAGS = CCFLAGS + ' -std=c++17 '
elif OS_NAME == 'Windows': elif OS_NAME == 'Windows':
CCFLAGS = CCFLAGS + ' /std:c++17 '; CCFLAGS = CCFLAGS + ' /std:c++17 /Zc:__cplusplus ';
CPPPATH = CPPPATH + [joinPath(TK_3RD_ROOT, 'bgfx/bx/include/compat/msvc')]; CPPPATH = CPPPATH + [joinPath(TK_3RD_ROOT, 'bgfx/bx/include/compat/msvc')];
CCFLAGS += ' -DBX_CONFIG_DEBUG -DBIMG_DECODE_ENABLE=0 ' CCFLAGS += ' -DBX_CONFIG_DEBUG -DBIMG_DECODE_ENABLE=0 '

View File

@ -67,8 +67,9 @@ else:
BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_soft.c'] BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_soft.c']
else: else:
BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_gl.c'] BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_gl.c']
BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_gl2.c']
BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_gl3.c'] BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_gl2.c']
BASE_SOURCES += ['vgcanvas/vgcanvas_nanovg_gl3.c']
if os.environ['INPUT_ENGINE'] == 'null': if os.environ['INPUT_ENGINE'] == 'null':
BASE_SOURCES += Glob('input_engines/input_engine_null.c') BASE_SOURCES += Glob('input_engines/input_engine_null.c')

View File

@ -65,9 +65,9 @@ static ret_t vgcanvas_nanovg_create_fbo(vgcanvas_t* vgcanvas, uint32_t w, uint32
static ret_t vgcanvas_nanovg_destroy_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { static ret_t vgcanvas_nanovg_destroy_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) {
struct NVGLUframebuffer* handle = (struct NVGLUframebuffer*)fbo->handle; struct NVGLUframebuffer* handle = (struct NVGLUframebuffer*)fbo->handle;
uint32_t index = getBgfxFboViewId(handle);
nvgluDeleteFramebufferEx(handle); nvgluDeleteFramebufferEx(handle);
arrayViewId[getBgfxFboViewId(handle)] = false; arrayViewId[index] = false;
curViewId = 0; curViewId = 0;
(void)vgcanvas; (void)vgcanvas;
return RET_OK; return RET_OK;

View File

@ -26,5 +26,12 @@
#define WITH_NANOVG_GL2 1 #define WITH_NANOVG_GL2 1
#define VGCANVAS_CREATE_GL vgcanvas_create_gl2 #define VGCANVAS_CREATE_GL vgcanvas_create_gl2
#if !defined(WITH_GPU)
#include "base/vgcanvas.h"
vgcanvas_t* VGCANVAS_CREATE_GL(uint32_t w, uint32_t h, uint32_t stride, bitmap_format_t format,
void* win) {
return NULL;
}
#else
#include "vgcanvas_nanovg_gl_common.inc" #include "vgcanvas_nanovg_gl_common.inc"
#endif/*WIN32*/

View File

@ -26,5 +26,13 @@
#define WITH_NANOVG_GL3 1 #define WITH_NANOVG_GL3 1
#define VGCANVAS_CREATE_GL vgcanvas_create_gl3 #define VGCANVAS_CREATE_GL vgcanvas_create_gl3
#if !defined(WITH_GPU)
#include "base/vgcanvas.h"
vgcanvas_t* VGCANVAS_CREATE_GL(uint32_t w, uint32_t h, uint32_t stride, bitmap_format_t format,
void* win) {
return NULL;
}
#else
#include "vgcanvas_nanovg_gl_common.inc" #include "vgcanvas_nanovg_gl_common.inc"
#endif/*WIN32*/