awtk/3rd/nanovg/SConscript
2019-06-27 15:28:57 +08:00

51 lines
2.3 KiB
Python

import os
import platform
def joinPath(root, subdir):
return os.path.normpath(os.path.join(root, subdir))
env=DefaultEnvironment().Clone()
LIB_DIR=os.environ['LIB_DIR'];
BIN_DIR=os.environ['BIN_DIR'];
CCFLAGS=os.environ['CCFLAGS'];
TK_3RD_ROOT=os.environ['TK_3RD_ROOT'];
OS_NAME=platform.system()
env.Library(os.path.join(LIB_DIR, 'nanovg'), Glob('base/*.c'))
env['LINKFLAGS'] = env['OS_SUBSYSTEM_CONSOLE'] + env['LINKFLAGS'];
NANOVG_BACKEND=os.environ['NANOVG_BACKEND'];
if NANOVG_BACKEND == 'AGG':
env.Library(os.path.join(LIB_DIR, 'nanovg-agg'), Glob('agg/*.cpp'))
# env['LIBS'] = ['nanovg-agg', 'agg', 'nanovg'] + env['LIBS']
# env.Program(os.path.join(BIN_DIR, 'agg_stroke'), Glob('demos/agg_stroke.c'));
# env.Program(os.path.join(BIN_DIR, 'agg_fill'), Glob('demos/agg_fill.c'));
# env.Program(os.path.join(BIN_DIR, 'agg_draw_image'), Glob('demos/agg_draw_image.c'));
elif NANOVG_BACKEND == 'AGGE':
env.Library(os.path.join(LIB_DIR, 'nanovg-agge'), Glob('agge/*.cpp'))
# env['LIBS'] = ['nanovg-agge', 'agge', 'nanovg'] + env['LIBS']
# env.Program(os.path.join(BIN_DIR, 'agge_stroke'), Glob('demos/agge_stroke.c'));
# env.Program(os.path.join(BIN_DIR, 'agge_fill'), Glob('demos/agge_fill.c'));
# env.Program(os.path.join(BIN_DIR, 'agge_draw_image'), Glob('demos/agge_draw_image.c'));
elif NANOVG_BACKEND == 'BGFX':
CPPPATH = [
joinPath(TK_3RD_ROOT, 'nanovg/base'),
joinPath(TK_3RD_ROOT, 'bgfx/bx/include'),
joinPath(TK_3RD_ROOT, 'bgfx/bgfx/include'),
joinPath(TK_3RD_ROOT, 'SDL/include')]
if OS_NAME == 'Darwin':
CCFLAGS = CCFLAGS + ' -std=c++14 '
elif OS_NAME == 'Windows':
CCFLAGS = CCFLAGS + ' /std:c++14 ';
CPPPATH = CPPPATH + [joinPath(TK_3RD_ROOT, 'bgfx/bx/include/compat/msvc')];
env.Library(os.path.join(LIB_DIR, 'nanovg-bgfx'), Glob('bgfx/*.cpp'), CPPPATH = CPPPATH, CCFLAGS = CCFLAGS)
# env['LIBS'] = ['nanovg-bgfx', 'bgfx', 'nanovg'] + env['LIBS']
# env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_fill'), Glob('demos/bgfx_sdl_fill.cpp'));
# env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_stroke'), Glob('demos/bgfx_sdl_stroke.cpp'));
# env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_draw_image'), Glob('demos/bgfx_sdl_draw_image.cpp'));
# env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_draw_text'), Glob('demos/bgfx_sdl_draw_text.cpp'));