再在 /minigui-free下创建一个miniguitmp的目录,用于安装编译以后的库文件。
2.首先修改configure文件,在文件的开头加入交叉编译的路径
CC=/opt/EmbedSky/4.6.6/bin/arm-linux-gcc
CPP=/opt/EmbedSky/4.6.6/bin/arm-linux-cpp
LD=/opt/EmbedSky/4.6.6/bin/arm-linux-ld
AR=/opt/EmbedSky/4.6.6/bin/arm-linux-ar
RANLIB=/opt/EmbedSky/4.6.6/bin/arm-linux-ranlib
STRIP=/opt/EmbedSky/4.6.6/bin/arm-linux-strip
3.然后在libminigui-1.6.10目录下建立bash文件mysetup.sh,内容如下:
/* mysetup.sh */
./configure --prefix=/minigui-free/miniguitmp/ \
--host=arm-unknown-linux \
--target=arm-unknown-linux
然后执行[root@localhost libminigui-1.6.10]# ./mysetup.sh
4.make make install.
5.
修改configure.linux文件,指明TOPDIR= /minigui-free/miniguitmp,
执行make install,
执行后会在/minigui-free/miniguitmp/ 下生成usr/local/lib/minigui/res 相关目录,以下为res目录下的子目录,用户有兴趣可以进入以下目录查看其中的内容: bmp cursor font icon imetab
6.修改Minigui.cfg
[system]
# GAL engine and default options
gal_engine=fbcon
defaultmode=320x240-16bpp
# IAL engine
#ial_engine=qvfb
#mdev=/dev/input/mice
#ial_engine=console
ial_engine=dummy
mdev=/dev/mouse
mtype=IMPS2
[fbcon]
defaultmode=320x240-16bpp
[qvfb]
defaultmode=320x240-16bpp
display=0
一般就上面几个地方要修改
然后把MiniGUI.cfg下载到开发板的/etc/目录下:
[root@EmbedSky etc]# cp MiniGUI.cfg /etc
把PC上/ minigui-free/miniguitmp/lib中所有的运行库下载到开发板上的/usr/lib目录下:
[root@EmbedSky lib]# cp * /usr/lib
把pc机上/minigui-free/miniguitmp/usr/local/lib/minigui/res中的内容拷贝到目标板/usr/local/lib/minigui/res中。res目录下有5个文件夹,一个一个创建和复制很麻烦,可以写一个批处理来做,那样简单多了。至于批处理很简单,这里就不说了。
最后:/* helloWorld.c */
#include <stdio.h>
#include<minigui/common.h>
#include<minigui/minigui.h>
#include<minigui/gdi.h>
#include<minigui/window.h>
#include <minigui/control.h>
static int helloProc(HWND hWnd,int message,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
switch (message)
{
case MSG_PAINT:
hdc = BeginPaint(hWnd);
TextOut(hdc,50,50,"Helllo MiniGUi");
EndPaint(hWnd,hdc);
return 0;
case MSG_CLOSE:
DestroyMainWindow(hWnd);
PostQuitMessage(hWnd);
return 0;
}
return DefaultMainWinProc(hWnd,message,wParam,lParam);
}
int MiniGUIMain(int argc,const char* argv[])
{
MSG Msg;
HWND hMainWnd;
MAINWINCREATE CreateInfo;
#ifdef _LITE_VERSION
SetDesktopRect(0,0,640,480);
#endif
CreateInfo.dwStyle = WS_VISIBLE|WS_BORDER|WS_CAPTION;
CreateInfo.dwExStyle = WS_EX_NONE;
CreateInfo.spCaption = "hello";
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor(0);
CreateInfo.hIcon = 0;
CreateInfo.MainWindowProc = helloProc;
CreateInfo.lx = 0;
CreateInfo.ty = 0;
CreateInfo.rx = 200;
CreateInfo.by = 200;
CreateInfo.iBkColor = COLOR_lightwhite;
CreateInfo.dwAddData = 0;
CreateInfo.hHosting = HWND_DESKTOP;
hMainWnd = CreateMainWindow(&CreateInfo);
if(hMainWnd == HWND_INVALID)
return 1;
ShowWindow(hMainWnd,SW_SHOWNORMAL);
while(GetMessage(&Msg,hMainWnd))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
MainWindowThreadCleanup(hMainWnd);
return 0;
}
#ifndef _LITE_VERSION
#include <minigui/dti.c>
#endif
上面是源程序
,下面是makefile 注意修改下面两个tab字符。
:DEP = helloWorld.c
SRC_FILE = helloWorld.c
CC = /opt/EmbedSky/4.3.3/bin/arm-linux-gcc
LIB_MINIGUI = /minigui-free/miniguitmp/lib
INCLUDE_MINIGUI = /minigui-free/miniguitmp/include
PROJECT_DIR =
hello:$(DEP)
$(CC) -o helloWorld $(SRC_FILE) -lpthread -lminigui -lsqlite3 -lm -lmgext -lpng -ljpeg -L$(LIB_MINIGUI) -I$(INCLUDE_MINIGUI)
#.PHONY: install
#install:
# cp helloWorld $(PROJECT_DIR)/target/
# @echo "moving the TARGET to ../target ."
.PHONY: clean
clean:
rm helloWorld
@echo "it is cleaning."