GuiLite 2.0 发布:Golang 的 GUI 外衣

  

简介

Golang作为新生的高级语言,因为其独特的优势,迅速获得了开发者的支持,作者本身也对Golang简洁,优美的语言特性,分外喜欢。
不过遗憾的是:没有很多GUI与之搭配使用。为了响应广大开发者的期盼,我们为HostMonitor制作了Golang版本,用代码详细描述了如何用Golang调用GuiLite的C++代码。
简单的来说,Golang可以方便的调用C语言,但无法直接调用C++;所以,需要将C++接口函数,用extern "C"关键字封装成C函数即可。

代码位置:https://gitee.com/idea4good/GuiLiteSamples/tree/master/HostMonitor/BuildGo

编译步骤(也可以见HostMonitor下的readme文件)

1. Build UIcode:
        cd HostMonitor/UIcode
        If x64/raspberry pi:
            cmake .
            make
            cp libUIcode.a ../BuildGo/libs/amd64/
        If ARM32:
            cmake -D CMAKE_C_COMPILER="/usr/bin/arm-linux-gnueabi-gcc" -D CMAKE_CXX_COMPILER="/usr/bin/arm-linux-gnueabi-g++" .
        make
        cp libUIcode.a ../BuildGo/libs/arm/
2. Build Golang:
    cd HostMonitor/BuildGo
    go build -o HostMonitor

3. 在Linux上的运行方法:
    Run with framebuffer:
    sudo ./HostMonitor /dev/fb0    /dev/fb0: The path of framebuffer device file.
    Run inside QT APP(display-xxx is a QT APP for display, skip this if you haven't installed QT):
    If x64: sudo ./display-x64 1 1024 768 | ./HostMonitor shared-fb
    If ARM/Raspberry Pi: sudo ./display-arm 1 1024 768 | ./HostMonitor shared-fb

最后,遇到任何问题,都欢迎大家在开发群里面讨论,我们会尽力给大家提供帮助,谢谢!
 

猜你喜欢

转载自www.oschina.net/news/105154/guilite-2-0-released