# hello-gn **Repository Path**: xiaojye/hello-gn ## Basic Information - **Project Name**: hello-gn - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-22 - **Last Updated**: 2025-05-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Hello GN ### 构建hello 1. 清理输出目录(首次构建可忽略此步骤) `./gn clean out/Default` 2. 基于gn生成ninja文件 `./gn gen out/Default` 3. 使用ninja编译目标 `ninja -C out/Default hello` 4. 运行编译产物 `out/Default/hello/hello` ### GN 指南 #### gn命令 - analyze: Analyze which targets are affected by a list of files. - args: Display or configure arguments declared by the build. - check: Check header dependencies. - clean: Cleans the output directory. - clean_stale: Cleans the stale output files from the output directory. - desc: Show lots of insightful information about a target or config. - format: Format .gn files. - gen: Generate ninja files. - help: Does what you think. - ls: List matching targets. - meta: List target metadata collection results. - outputs: Which files a source/target make. - path: Find paths between two targets. - refs: Find stuff referencing a target or file. #### target类型 - executable, shared_library, static_library - loadable_module: 运行时加载模块 - source_set: 被编译的源文件集合,这种编译不会生成任何库文件 - group: 声明一组target,你可以写一个group,里面放不同的库target,使用的时候就用group的名字代表这些targets - copy: 拷贝文件 - action, action _foreach: 运行一个脚本时所用 - bundle_data, create_bundle: Mac & iOS - component: shared library or source set depending on mode - test - app: executable or iOS application + bundle - android_apk, generate_jni, etc.: Lots of Android ones!