Firebreath新建工程的过程及使用

来源:互联网 发布:linux 小数比较大小 编辑:程序博客网 时间:2024/05/01 08:04

Firebreath的官方网站:http://www.firebreath.org/display/documentation/FireBreath+Home

1、  下载firebreath源码(http://www.firebreath.org/display/documentation/Download),

2、  下载firebreath需要的boost文件(tp://www.firebreath.org/display/documentation/Download)

3、 boost的boost/and libs/这两个文件夹放到<FB_ROOT>/src/3rdParty/boost/boost/

<FB_ROOT>/src/3rdParty/boost/libs/这两个路径下

4、  打开cmd,进入firebreath文件夹里cd  c:\code\sc\firebreath

5、  通过Python建立firebreath工程c:\code\sc\firbreath>\Python27\python.exe fbgen.py

Plugin Name[]: PluginTest

 

… … …

等一系列插件的相关信息,回车之后

6、  输入c:\code\sc\firebreath>dirprojects 可以看到工程下包含的文件

7、  输入c:\code\sc\firebreath>moveprojects .. 把工程文件夹移出firebreath文件夹

8、  可以输入c:\code\sc\firebreath>cd..看一下结果

9、  输入c:\code\sc>firebreath\prep2010.cmd  projects build 用vs2010建程,也可以用prep2008.cmd即vs2008建立工程,把工程建立到build文件夹里

10、             然后在build文件夹里打开工程进行编译.

11、注册dll ,C:\code\sc\build\bin\pluginTest\Debug>regsvr32npPluginTest.dll

 

 

注意:1、NPAPI的浏览器插件要以np开头,即npxxx.dll,npxxx.so等。

      2、建立firebreath工程时需要用到Python和cmake建议把这两个都安装在firebreath目录下,避免 出现一些错误。安装完之后,不需要对他们进行任何操作。直接进入到上面的第四步即可。

      3、在用firebreath建立工程的时候,如果想在窗口上画图的话,需要把PluginConfig.cmake文件中的set (FB_GUI_DISABLED 1)一行注释掉。

 

 

第五步中输入命令行:python fbgen.py,这是将提示输入一些信息:

PluginName:插件的名称,后面生成的dll将用np+这个名字的方式;

PluginIdentifier:插件友好的名字,生成的入口cpp文件将会为这个名字;

PluginPrefix:前缀,主要用于visual studio工程;

PluginMime type:这个比较重要,NPAPI接口的浏览器使用这个标志插件,网页中创建插件时要用。例如网页中创建flash的代码:

    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"width="550" height="400" id="movie_name"align="middle"> 

        <param name="movie"value="movie_name.swf"/> 

        <!--[if !IE]>--> 

        <objecttype="application/x-shockwave-flash" data="movie_name.swf"width="550" height="400"> 

            <param name="movie"value="movie_name.swf"/> 

        <!--<![endif]--> 

            <ahref="http://www.adobe.com/go/getflash"> 

                <imgsrc="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"alt="Get Adobe Flash player"/> 

            </a> 

        <!--[if !IE]>--> 

        </object> 

        <!--<![endif]--> 

</object> 

其中type="application/x-shockwave-flash"的application/x-shockwave-flash就是 flash插件的mimePluginDescription:插件的描述信息,会生成在dll的属性里面Plugin has no UI:插件是否有UICompany Name:开发插件的公司名字CompanyIdentifier:公司标志Company Domain:公司的域名,主要是firefox浏览器需要完成后,会在projects生成对应的工程文件,其中有cpp和h文件,也有一个 PluginConfig.cmake文件,这是一个cmake脚本。

 

新建一个firebreath工程更加详细的过程可以参考http://www.firebreath.org/display/documentation/Creating+a+New+Plugin+Project

Firebreath日志输出设置http://www.firebreath.org/display/documentation/Logging

Firebreath例子的网址http://www.firebreath.org/display/documentation/FireBreath+Examples

 

 

Firebreath是使用cmake编译,PluginConfig.cmake是CMakeLists.txt的一个片段。如果想修改了 PluginConfig.cmake文件或将三方工程加入编译,可以参考src\libs目录下各个工程的cmake.txt文件。
0 0
原创粉丝点击