fix single header freetype on windows compile error

This commit is contained in:
xianjimli 2019-08-30 05:40:27 +08:00
parent b71133f0fc
commit bf77da8bdd
4 changed files with 12 additions and 24 deletions

View File

@ -162,7 +162,7 @@ elif OS_NAME == 'Windows':
if not os.path.exists(os.path.abspath(TK_LIB_DIR)) : if not os.path.exists(os.path.abspath(TK_LIB_DIR)) :
os.makedirs(os.path.abspath(TK_LIB_DIR)) os.makedirs(os.path.abspath(TK_LIB_DIR))
if TOOLS_NAME == '' : if TOOLS_NAME == '' :
OS_LIBS=['freetype.lib', 'gdi32', 'user32','winmm.lib','imm32.lib','version.lib','shell32.lib','ole32.lib','Oleaut32.lib','Advapi32.lib','DelayImp.lib','psapi.lib'] OS_LIBS=['gdi32', 'user32','winmm.lib','imm32.lib','version.lib','shell32.lib','ole32.lib','Oleaut32.lib','Advapi32.lib','DelayImp.lib','psapi.lib']
OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /Od /FS /Z7 ' OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /Od /FS /Z7 '
if TARGET_ARCH == 'x86': if TARGET_ARCH == 'x86':
OS_FLAGS += OS_FLAGS + ' /MD ' OS_FLAGS += OS_FLAGS + ' /MD '
@ -177,7 +177,7 @@ elif OS_NAME == 'Windows':
OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS ' OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS '
COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D_WIN64 ' COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D_WIN64 '
elif TOOLS_NAME == 'mingw' : elif TOOLS_NAME == 'mingw' :
OS_LIBS=['freetype','kernel32', 'gdi32', 'user32', 'winmm','imm32','version','shell32','ole32','Oleaut32','Advapi32','oleaut32','uuid','stdc++'] OS_LIBS=['kernel32', 'gdi32', 'user32', 'winmm','imm32','version','shell32','ole32','Oleaut32','Advapi32','oleaut32','uuid','stdc++']
OS_FLAGS='-DWINDOWS -D_CONSOLE -g -Wall' OS_FLAGS='-DWINDOWS -D_CONSOLE -g -Wall'
COMMON_CFLAGS=COMMON_CFLAGS+' -std=gnu99 ' COMMON_CFLAGS=COMMON_CFLAGS+' -std=gnu99 '
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_DOUBLE_FLOAT -DUNICODE ' COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_DOUBLE_FLOAT -DUNICODE '
@ -187,8 +187,7 @@ elif OS_NAME == 'Windows':
COMMON_CCFLAGS = COMMON_CCFLAGS + '-D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_HAS_EXCEPTIONS=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_ITERATOR_DEBUG_LEVEL=0 -D_SCL_SECURE=0' COMMON_CCFLAGS = COMMON_CCFLAGS + '-D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_HAS_EXCEPTIONS=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_ITERATOR_DEBUG_LEVEL=0 -D_SCL_SECURE=0'
COMMON_CCFLAGS = COMMON_CCFLAGS + '-D_SECURE_SCL=0 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE ' COMMON_CCFLAGS = COMMON_CCFLAGS + '-D_SECURE_SCL=0 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE '
OS_PROJECTS=['3rd/SDL/SConscript'] OS_PROJECTS=['3rd/SDL/SConscript']
OS_CPPPATH = [joinPath(TK_3RD_ROOT, 'freetype-windows/include')] COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FT_FONT '
COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FT_FONT -DUSE_SYSTEM_FREETYPE '
CFLAGS=COMMON_CFLAGS CFLAGS=COMMON_CFLAGS
@ -235,21 +234,3 @@ os.environ['NANOVG_BACKEND'] = NANOVG_BACKEND;
os.environ['NATIVE_WINDOW'] = NATIVE_WINDOW; os.environ['NATIVE_WINDOW'] = NATIVE_WINDOW;
os.environ['FRAME_BUFFER_FORMAT'] = FRAME_BUFFER_FORMAT; os.environ['FRAME_BUFFER_FORMAT'] = FRAME_BUFFER_FORMAT;
def copy_freetype_after_build():
TARGET_LIB_DIR=TK_LIB_DIR
TARGET_BIN_DIR=os.environ['BIN_DIR']
if OS_NAME == 'Windows':
if TOOLS_NAME == '' :
if TARGET_ARCH == 'x86':
copyfile(joinPath(TK_3RD_ROOT, 'freetype-windows/win32/freetype.lib'), joinPath(TARGET_LIB_DIR, 'freetype.lib'));
copyfile(joinPath(TK_3RD_ROOT, 'freetype-windows/win32/freetype.dll'), joinPath(TARGET_BIN_DIR, 'freetype.dll'));
else:
copyfile(joinPath(TK_3RD_ROOT, 'freetype-windows/win64/freetype.lib'), joinPath(TARGET_LIB_DIR, 'freetype.lib'));
copyfile(joinPath(TK_3RD_ROOT, 'freetype-windows/win64/freetype.dll'), joinPath(TARGET_BIN_DIR, 'freetype.dll'));
elif TOOLS_NAME == 'mingw' :
copyfile(joinPath(TK_3RD_ROOT, 'freetype-windows/mingw32/libfreetype.a'), joinPath(TARGET_LIB_DIR, 'libfreetype.a'));
copyfile(joinPath(TK_3RD_ROOT, 'freetype-windows/mingw32/freetype6.dll'), joinPath(TARGET_BIN_DIR, 'freetype6.dll'));
print('copy_freetype_after_build: TARGET_BIN_DIR=' + TARGET_BIN_DIR + " TARGET_LIB_DIR=" + TARGET_LIB_DIR);
import atexit
atexit.register(copy_freetype_after_build)

View File

@ -1,4 +1,7 @@
# 最新动态 # 最新动态
* 2019/08/30
* 修改windows下使用单头文件freetype的问题(感谢陈谭提供补丁)。
* 2019/08/29 * 2019/08/29
* 修改重载new的问题(感谢陈谭提供补丁)。 * 修改重载new的问题(感谢陈谭提供补丁)。
* 修改combox在dialog上焦点设置错误的问题。 * 修改combox在dialog上焦点设置错误的问题。
@ -7,8 +10,8 @@
* 修改 children layouter的 BUG感谢尧燊提供补丁 * 修改 children layouter的 BUG感谢尧燊提供补丁
* 2019/08/28 * 2019/08/28
* 增加widget_reset_canvas用于designer打开新工程时清除vgcanvas中的资源。 * 增加widget\_reset\_canvas用于designer打开新工程时清除vgcanvas中的资源。
* hscroll_label 支持右对齐(感谢智明提供补丁)。 * hscroll\_label 支持右对齐(感谢智明提供补丁)。
* 修改密码编辑器的BUG(感谢俊杰提供补丁)。 * 修改密码编辑器的BUG(感谢俊杰提供补丁)。
* vgcanvas 支持设置assets manager, 以便从指定的assets manager加载字体。 * vgcanvas 支持设置assets manager, 以便从指定的assets manager加载字体。

View File

@ -50,6 +50,7 @@ static ret_t widget_destroy_sync(widget_t* widget);
static ret_t widget_destroy_async(widget_t* widget); static ret_t widget_destroy_async(widget_t* widget);
static ret_t widget_ensure_style_mutable(widget_t* widget); static ret_t widget_ensure_style_mutable(widget_t* widget);
static ret_t widget_destroy_in_idle(const idle_info_t* info); static ret_t widget_destroy_in_idle(const idle_info_t* info);
static ret_t widget_dispatch_blur_event(widget_t* widget);
static ret_t widget_on_paint_done(widget_t* widget, canvas_t* c); static ret_t widget_on_paint_done(widget_t* widget, canvas_t* c);
static ret_t widget_real_destroy(widget_t* widget) { static ret_t widget_real_destroy(widget_t* widget) {

View File

@ -16,6 +16,9 @@
#include <freetype/ftpfr.h> #include <freetype/ftpfr.h>
#include <freetype/ftadvanc.h> #include <freetype/ftadvanc.h>
#else #else
#ifdef WIN32
#undef interface
#endif/*WIN32*/
/*3rd/freetype_single_header/freetype.h*/ /*3rd/freetype_single_header/freetype.h*/
#include "freetype_single_header/freetype.h" #include "freetype_single_header/freetype.h"
#endif /*USE_SYSTEM_FREETYPE*/ #endif /*USE_SYSTEM_FREETYPE*/