game/godot

Godot - Compiling with Mono

C/H 2018. 12. 1. 08:30

Compiling with Mono

Requirements

  • Mono 5.12.0 or greater
  • MSBuild
  • pkg-config

Environment variables

By default, SCons will try to find Mono in the Windows Registry on Windows or via pkg-config on other platforms. You can specify a different installation directory by using the following environment variables for the respective bits option: MONO32_PREFIX and MONO64_PREFIX.
기본적으로 SCons는 Windows의 Windows 레지스트리 또는 다른 플랫폼의 pkg-config를 통해 Mono를 찾으려고 시도합니다. 각각의 비트 옵션에 대해 MONO32_PREFIX 및 MONO64_PREFIX 환경 변수를 사용하여 다른 설치 디렉토리를 지정할 수 있습니다.

The specified directory must contain the subdirectories bin, include, and lib.
지정된 디렉토리에는 bin, include 및 lib 하위 디렉토리가 있어야합니다.

Enable the Mono module

By default, the mono module is disabled for builds. To enable it you can pass the option module_mono_enabled=yes to your SCons command.
기본적으로 모노 모듈은 빌드에 사용할 수 없습니다. 이를 사용하려면 SCons 명령에 module_mono_enabled=yes 옵션을 전달하면됩니다.

Generate the glue

The glue sources are the wrapper functions that will be called by managed methods. These source files must be generated before building your final binaries. In order to generate them, first, you must build a temporary Godot binary with the options tools=yes and mono_glue=no
풀 소스는 관리되는 메소드에 의해 호출 될 래퍼 함수입니다. 이러한 소스 파일은 최종 바이너리를 빌드하기 전에 생성되어야합니다. 우선 생성하기 위해서 tools=yes와 mono_glue=no 옵션을 사용하여 임시 Godot 바이너리를 빌드해야합니다:

scons p<platform> tools=yes module_mono_enabled=yes mono_glue=no

After the build finishes, you need to run the compiled executable with the parameter --generate-mono-glue followed by the path to an output directory. This path must be modules/mono/glue in the Godot directory.
빌드가 끝나면 컴파일 된 실행 파일을 -generate-mono-glue 매개 변수와 함께 출력 디렉토리의 경로로 실행해야합니다. 이 경로는 Godot 디렉토리의 modules/mono/glue 여야합니다.

<godot_binary> --generate-mono-glue modules/mono/glue

This command will tell Godot to generate the file modules/mono/glue/mono_glue.gen.cpp. Once this file is generated, you can build Godot for all the desired targets without the need to repeat this process.
이 명령은 Godot에게 modules/mono/glue/mono_glue.gen.cpp 파일을 생성하도록 지시합니다. 이 파일이 생성되면이 프로세스를 반복하지 않고도 원하는 모든 대상에 대해 Godot을 빌드 할 수 있습니다.

<godot_binary> refers to the tools binary you compiled above with the Mono module enabled. Its exact name will differ based on your system and configuration, but should be of the form bin/godot.<platform>.tools.<bits>.mono, e.g. bin/godot.x11.tools.64.mono or bin/godot.windows.tools.64.exe. Be especially aware of the .mono suffix! If you compiled Godot without Mono support previously, you might have similarly named binaries without this suffix which can't be used to generate the Mono glue.
<godot_binary>는 Mono 모듈이 활성화된 상태로 위에서 컴파일 한 도구 바이너리를 나타냅니다. 정확한 이름은 시스템 및 구성에 따라 다르지만 bin/godot.<platform>.tools.<bits> .mono 형식이어야합니다. 예로 bin/godot.x11.tools.64.mono 또는 bin/godot.windows.tools.64.exe 입니다. .mono 접미사를 특히주의하십시오! 이전에 모노 지원을하지 않고 Godot을 컴파일 한 경우 Mono glue를 생성하는데 사용할 수 없는 접미어가없는 바이너리 이름을 사용했을 수 있습니다.

Notes

  • Do not build your final binaries with mono_glue=no. This disables C# scripting. This option must be used only for the temporary binary that will generate the glue. Godot will print a warning at startup if it was built without the glue sources.
    mono_glue=no로 최종 바이너리를 빌드하지 마십시오. 이렇게하면 C# 스크립팅이 비활성화됩니다. 이 옵션은 접착제를 생성 할 임시 바이너리에만 사용해야합니다. Godot은 glue source없이 구축된 경우 시작시 경고를 인쇄합니다.
  • The glue sources must be regenerated every time the ClassDB bindings changes. That is, for example, when a new method is added to ClassDB or one of the parameter of such a method changes. Godot will print an error at startup if there is an API mismatch between ClassDB and the glue sources.
    glue source는 ClassDB binding이 변경 될 때마다 재생성 되어야합니다. 예를 들어, 새로운 메소드가 ClassDB에 추가되거나 그러한 메소드의 매개 변수 중 하나가 변경되는 경우입니다. Godod는 ClassDB와 glue source간에 API 불일치가 있을 경우 시작시 오류를 인쇄합니다.

Rebuild with Mono glue

Once you have generated the Mono glue, you can build the final binary with mono_glue=yes. It's the default value for mono_glue so you can also omit it. You can build the Mono-enabled editor:
mono glue를 생성하면 mono_glue=yes로 최종 바이너리를 빌드 할 수 있습니다. mono_glue의 기본값이기 때문에 생략 할 수도 있습니다. 모노 지원 편집기를 빌드 할 수 있습니다.

scons p=<platform> tools=yes module_mono_enabled=yes mono_glue=yes

And Mono-enabled export templates:
모노 지원 내보내기 템플릿:

scons p=<platform> tools=no module_mono_enabled=yes mono_glue=yes

Examples

Example (Windows)

# Build temporary binary
scons p=windows tools=yes module_mono_enabled=yes mono_glue=no
# Generate glue sources
bin\godot.windows.tools.64.mono --generate-mono-glue modules/mono/glue

### Build binaries normally
# Editor
scons p=windows target=release_debug tools=yes module_mono_enabled=yes
# Export templates
scons p=windows target=debug tools=no module_mono_enabled=yes
scons p=windows target=release tools=no module_mono_enabled=yes

Example (X11)

# Build temporary binary
scons p=x11 tools=yes module_mono_enabled=yes mono_glue=no
# Generate glue sources
bin/godot.x11.tools.64.mono --generate-mono-glue modules/mono/glue

### Build binaries normally
# Editor
scons p=x11 target=release_debug tools=yes module_mono_enabled=yes
# Export templates
scons p=x11 target=debug tools=no module_mono_enabled=yes
scons p=x11 target=release tools=no module_mono_enabled=yes

If everything went well, apart from the normal output, SCons should have also built the GodotSharpTools.dll assembly and copied it together with the mono runtime shared library to the bin subdirectory.
정상적인 출력을 제외하고 모든 것이 잘 수행되면 SCons는 GodotSharpTools.dll 어셈블리를 빌드하고이를 모노 런타임 공유 라이브러리와 함께 bin 하위 디렉토리에 복사해야합니다.

Command-line options

The following is the list of command-line options available when building with the mono module:
모노 모듈로 빌드 할 때 사용할 수있는 명령 행 옵션 목록은 다음과 같습니다:

  • module_mono_enabled: Build Godot with the mono module enabled (yes|no)
    모노 모듈이 활성화 된 Godot 빌드
  • mono_glue: Whether to include the glue source files in the build and define MONO_GLUE_DISABLED as a preprocessor macro (yes|no)
    빌드에 접착제 소스 파일을 포함할지 여부와 전 처리기 매크로로 MONO_GLUE_DISABLED 정의
  • xbuild_fallback: Whether to fallback to xbuild if MSBuild is not available (yes|no)
    MSBuild를 사용할 수없는 경우 xbuild로 폴백할지 여부
  • mono_static: Whether to link the mono runtime statically (yes|no)
    모노 런타임을 정적으로 연결할지 여부
  • copy_mono_root: Whether to copy the Mono framework assemblies and configuration files required by the Godot editor ( yes | no )
    Godot 편집기에 필요한 Mono 프레임 워크 어셈블리 및 구성 파일을 복사할지 여부
  • mono_assemblies_output_dir: Path to the directory where all the managed assemblies will be copied to. The '#' token indicates de top of the source directory, the directory in which SConstruct is located default: #bin
    모든 관리되는 어셈블리를 복사 할 디렉터리의 경로입니다. '#' 토큰은 소스 디렉토리의 최상위 디렉토리, SConstruct가 위치한 디렉토리를 나타냅니다.


반응형

'game > godot' 카테고리의 다른 글

Godot - Compiling for Universal Windows Platform  (0) 2018.12.04
Godot - Compiling for the Web  (0) 2018.12.03
Godot - Packaging Godot  (0) 2018.11.30
Godot - Optimizing a build for size  (0) 2018.11.29
Gdoot - Platform-specific  (0) 2018.11.28