Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

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.webp
  • Now choose a name for your project and set the path to scons executable in build tool (to find the path you can type where scons in a terminal).

../../../_images/xcode_2_set_external_build_project_parameters.webp
  • Open the main target from the Targets section and select the Info tab.

../../../_images/xcode_3_configure_scons.webp
  • Fill out the form with the following settings:

    引数

    See ビルドシステムの説明 for a full list of arguments.

    Directory

    A full path to the Godot root folder

  • Add a Command Line Tool target which will be used for indexing the project by choosing File > New > Target....

../../../_images/xcode_4_add_new_target.webp
  • Select macOS > Application > Command Line Tool.

../../../_images/xcode_5_select_command_line_target.webp

注釈

このターゲットでコンパイルしてはいけないことがわかるように名前をつけてください (例: GodotXcodeIndex`)。

  • このターゲットの場合、 Build Settings タブを開き、 Header Search Paths を探します。

  • ヘッダ検索パス をGodotのルートフォルダへの絶対パスに設定してください。サブディレクトリも含める必要があります。そのためには、パスの最後にアスタリスク (**) を2つ追加してください。 例えば、 /Users/me/repos/godot-source/** のように。

  • Add the Godot source to the project by dragging and dropping it into the project file browser.

  • Select Create groups for the Added folders option and check only your command line indexing target in the Add to targets section.

../../../_images/xcode_6_after_add_godot_source_to_project.webp
  • 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.

  • 外部ビルドターゲットのスキームエディタを開きます。

  • ビルド > ポストアクション セクションにあります。

  • Add a new script run action

  • Under Provide build settings from select your project. This allows to reference the project directory within the script.

  • Xcodeが認識できる名前をバイナリに与えるスクリプトを作成します。例:

ln -f ${PROJECT_DIR}/godot/bin/godot.macos.tools.64 ${PROJECT_DIR}/godot/bin/godot
../../../_images/xcode_7_setup_build_post_action.webp
  • 外部ビルドターゲットをビルドします。

  • スキームエディタを再度開き、 実行 を選択します。

../../../_images/xcode_8_setup_run_scheme.webp
  • ビルド後のアクションスクリプトでリンクしたファイルに 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).

To check that everything is working, put a breakpoint in platform/macos/godot_main_macos.mm and run the project.

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