Xcode

Xcode is a free macOS-only IDE. You can download it from the Mac App Store.

导入项目

  • From Xcode's main screen create a new project using the Other > External Build System template.
../../../_images/xcode_1_create_external_build_project.png
  • Open your build targets from the Targets section and select the Info tab.

  • Fill out the form with the following settings:

    Build Tool A full path to the scons executable, e.g. /usr/local/bin/scons
    参数 See 构建系统介绍 for a full list of arguments.
    Directory A full path to the Godot root folder
../../../_images/xcode_2_configure_scons.png
  • Add a Command Line Tool target which will be used for indexing the project by choosing File > New > Target....
../../../_images/xcode_3_add_new_target.png
  • Select OS X > Application > Command Line Tool.
../../../_images/xcode_4_select_command_line_target.png

注解

为它命名,以使您知道不使用该目标进行编译(例如``GodotXcodeIndex``)。

  • 前往新创建的目标(target)的 构建设置(Build Settings)**选项卡, 搜索 **标头搜索路径(标头搜索路径)
  • 将“标题搜索路径”设置为Godot根文件夹的绝对路径。 您还需要包括子目录。 为此,请在路径末尾添加两个星号(**),例如 / Users / me / repos / godot-source / **
  • Add the Godot source to the project by dragging and dropping it into the project file browser.
  • 取消勾选 创建外部构建系统(Create External Build System).
../../../_images/xcode_5_after_add_godot_source_to_project.png
  • 接下来,为**添加的文件夹(Added folders)**选项选择**创建组(Create groups)**,并在**添加到目标(Add to targets)**部分中选中*仅*您的命令行索引目标。
../../../_images/xcode_6_after_add_godot_source_to_project_2.png
  • Xcode will now index the files. This may take a few minutes.
  • Once Xcode is done indexing, you should have jump-to-definition, autocompletion, and full syntax highlighting.

Debugging the project

To enable debugging support you need to edit the external build target's build and run schemes.

  • 打开外部构建目标的方案编辑器。
  • 定位到 Build > Post Actions 区。
  • Add a new script run action
  • Under Provide build settings from select your project. This allows to reference the project directory within the script.
  • Create a script that will give the binary a name that Xcode can recognize, e.g.:
ln -f ${PROJECT_DIR}/godot/bin/godot.osx.tools.64 ${PROJECT_DIR}/godot/bin/godot
../../../_images/xcode_7_setup_build_post_action.png
  • 构建外部构建目标。
  • 再次打开方案编辑器,然后选择**运行**。
../../../_images/xcode_8_setup_run_scheme.png
  • 可执行文件(Executable) 设置为您在传递构建动作脚本中链接的文件.
  • 勾选 调试可执行文件(Debug executable) (如果还未准备好)。
  • You can add two arguments on the Arguments tab: the -e flag opens the editor instead of the project manager, and the --path argument tells the executable to open the specified project (must be provided as an absolute path to the project root, not the project.godot file).

要检查一切是否正常,请在 ``platform/osx/godot_main_osx.mm``中放置一个断点并运行项目。

If you run into any issues, ask for help in one of Godot's community channels.