• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# GN脚本生成工具IntelliJ插件说明(暂不支持)
2
3## 简介
4
5GN脚本生成工具,它可以根据用户给定三方库项目的CMakeLists.txt文件,转换生成BUILD.gn文件。目前工具支持可执行文件、VS Code插件、IntelliJ插件三种入口,本文主要介绍IntelliJ插件使用说明。
6
7## 目录
8
9	├── napi_generator/src/intellij_plugin/cmake2gn             # GN脚本生成工具
10	│   ├── gn_IntelliJ_plugin
11	│   │   ├── docs                                            # IntelliJ插件说明
12	│   │   ├── resources                                       # IntelliJ插件所需资源文件
13	│   │   ├── src    				                            # IntelliJ插件源码
14	│   │   └── README_zh
15
16## 约束
17
18系统:不限
19
20依赖版本:JDK 11
21
22开发工具:DevEco stdio、IDEA Community 2021.3.3
23
24## 使用方法
25
26### 使用对象
27
28系统开发者
29
30### 使用场景
31
321)移植CMakeLists.txt编译方式的三方库到OpenHarmony源码中。
33
34### 工具使用
35
36插件下载路径如下:
37
38[下载链接](暂无)
39
40具体的工具使用步骤,可以左键单击以下链接了解:
41
42[工具使用说明](https://gitee.com/openharmony/napi_generator/tree/master/src/intellij_plugin/cmake2gn/gn_IntelliJ_plugin/docs/usage/INSTRUCTION_ZH.md)
43
44### 工具输出
45
46根据使用者指定三方库的CMakeLists.txt文件,工具会输出对应的BUILD.gn文件。为了方便使用者快速上手工具,可供测试的三方库项目目录如下:
47
48	harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project$ ls
49	CMakeLists.txt  main.c
50
51CMakeLists.txt文件内容如下:
52
53	CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
54	PROJECT(hello)
55	AUX_SOURCE_DIRECTORY(. SRC_LIST)
56	ADD_EXECUTABLE(hello ${SRC_LIST})
57
58在linux环境下的,根据输入三方库项目的CMakeLists.txt文件,生成的输出文件,如下所示:
59
60	harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project$ ls
61	build_tmp  CMakeLists.txt  main.c
62	harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project$ cd build_tmp/
63	harmony@Ubuntu-64:~/OpenHarmony/third_party/test_project/build_tmp$ ls
64	BUILD.gn  CMakeCache.txt  CMakeFiles  cmake_install.cmake  hello  Makefile  ohos.toolchain.cmake
65
66其中生成的BUILD.gn文件,内容如下所示:
67
68![](../figures/build_file.png)
69
70## 开发说明
71
72### 对象
73
74工具的开发者
75
76### 开发场景
77
78若当前工具的功能已经不能满足开发者的全部需求,则开发者可以基于已有的源码对工具进行二次开发,来增强工具的能力,编译打包生成自定义的可执行文件和插件。
79
80### 开发步骤
81
82开发者可以根据如下的步骤来完成对工具IntelliJ插件的开发:
83
84[工具开发说明](https://gitee.com/openharmony/napi_generator/tree/master/src/intellij_plugin/cmake2gn/gn_IntelliJ_plugin/docs/guide/DEVELOP_ZH.md)
85
86## FAQ
87
88对于常见问题解决方法指导如下:
89
90[FAQ](https://gitee.com/openharmony/napi_generator/tree/master/src/cli/cmake2gn/docs/guide/FAQ.md)
91
92## 相关仓
93
94暂无