game/godot

Godot - Cross-compiling for iOS on Linux

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

Cross-compiling for iOS on Linux

The procedure for this is somewhat complex and requires a lot of steps, but once you have the environment properly configured it will be easy to compile Godot for iOS anytime you want.
이 절차는 다소 복잡하고 많은 단계가 필요하지만 일단 환경을 적절하게 구성하면 원하는 때에 언제든지 Godot을 iOS 용으로 쉽게 컴파일 할 수 있습니다.

Disclaimer

While it is possible to compile for iOS on a Linux environment, Apple is very restrictive about the tools to be used (especially hardware-wise), allowing pretty much only their products to be used for development. So this is not official. However, a statement from Apple in 2010 says they relaxed some of the App Store review guidelines to allow any tool to be used, as long as the resulting binary does not download any code, which means it should be OK to use the procedure described here and cross-compiling the binary.
Linux 환경에서 iOS 용으로 컴파일하는 것이 가능하지만 Apple은 사용되는 도구 (특히 하드웨어별로)에 대해 매우 제한적이므로 제품 개발에만 사용할 수 있습니다. 그래서 이것은 공식적인 것이 아닙니다. 그러나 2010년 Apple의 성명서에 따르면 결과 바이너리가 코드를 다운로드하지 않는 한 어떤 도구도 사용할 수 있도록 App Store 리뷰 가이드 라인을 다소 완화 시켰습니다. 따라서 바이너리를 크로스 컴파일하는 것은 여기에 설명 된 절차를 사용하는 것이 좋습니다.

Requirements

  • XCode with the iOS SDK (a dmg image)
    iOS SDK가있는 XCode (dmg 이미지)
  • Clang >= 3.5 for your development machine installed and in the PATH. It has to be version >= 3.5 to target arm64 architecture.
    개발 기계와 PATH에 대해 Clang> = 3.5입니다. arm64 아키텍처를 대상으로하려면 버전이 3.5 이상이어야합니다.
  • Fuse for mounting and umounting the dmg image.
    dmg 이미지 마운트 및 마운트 해제를 위한 퓨즈.
  • darling-dmg, which needs to be built from source. The procedure for that is explained below.
    darling-dmg는 근원지에서 만들어야합니다. 그 절차는 아래에 설명되어 있습니다.
    • For building darling-dmg, you'll need the development packages of the following libraries: fuse, icu, openssl, zlib, bzip2.
      darling-dmg를 빌드하려면 fuse, icu, openssl, zlib, bzip2와 같은 라이브러리의 개발 패키지가 필요합니다.
  • cctools-port for the needed build tools. The procedure for building is quite peculiar and is described below.
    필요한 빌드 도구를위한 cctools-port. building 절차는 아주 특이하며 아래에 설명되어 있습니다.
    • This also has some extra dependencies: automake, autogen, libtool.
      또한 automake, autogen, libtool과 같은 몇 가지 추가 종속성이 있습니다.

Configuring the environment

darling-dmg

Clone the repository on your machine:

$ git clone https://github.com/darlinghq/darling-dmg.git

Build it:

$ cd darling-dmg
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ make -j 4  # The number is the amount of cores your processor has, for faster build
$ cd ../..

Preparing the SDK

Mount the XCode image:

$ mkdir xcode
$ ./darling-dmg/build/darling-dmg /path/to/Xcode_7.1.1.dmg xcode
[...]
Everything looks OK, disk mounted

Extract the iOS SDK:

$ mkdir -p iPhoneSDK/iPhoneOS9.1.sdk
$ cp -r xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/* iPhoneSDK/iPhoneOS9.1.sdk
$ cp -r xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/* iPhoneSDK/iPhoneOS9.1.sdk/usr/include/c++
$ fusermount -u xcode  # unmount the image

Pack the SDK:

$ cd iPhoneSDK
$ tar -cf - * | xz -9 -c - > iPhoneOS9.1.sdk.tar.xz

Toolchain

Build cctools:

$ git clone https://github.com/tpoechtrager/cctools-port.git
$ cd cctools-port/usage_examples/ios_toolchain
$ ./build.sh /path/iPhoneOS9.1.sdk.tar.xz arm64

Copy the tools to a nicer place. Note that the SCons scripts for building will look under usr/bin inside the directory you provide for the toolchain binaries, so you must copy to such subdirectory, akin to the following commands:
도구를 더 멋진 곳으로 복사하십시오. 빌드를위한 SCons 스크립트는 toolchain 바이너리 용으로 제공 한 디렉토리 내에서 usr/bin 아래에 있으므로, 다음 명령과 비슷한 서브 디렉토리로 복사해야합니다 :

$ mkdir -p /home/user/iostoolchain/usr
$ cp -r target/bin /home/user/iostoolchain/usr/

Now you should have the iOS toolchain binaries in /home/user/iostoolchain/usr/bin.
이제 /home/user/iostoolchain/usr/bin에 iOS 툴 체인 바이너리가 있어야합니다.

Compiling Godot for iPhone

Once you've done the above steps, you should keep two things in your environment: the built toolchain and the iPhoneOS SDK directory. Those can stay anywhere you want since you have to provide their paths to the SCons build command.
위의 단계를 완료하면 환경에서 빌드 된 툴체인과 iPhoneOS SDK 디렉토리의 두 가지를 유지해야합니다. 그것들은 SCons 빌드 명령에 대한 경로를 제공해야하므로 원하는 곳에서 머물 수 있습니다.

For the iPhone platform to be detected, you need the OSXCROSS_IOS environment variable defined to anything.
iPhone 플랫폼이 감지 되려면 OSXCROSS_IOS 환경 변수가 필요합니다.

$ export OSXCROSS_IOS=anything

Now you can compile for iPhone using SCons like the standard Godot way, with some additional arguments to provide the correct paths:
이제 표준 Godot 방식과 같은 SCons를 사용하여 iPhone 용으로 컴파일하고 올바른 경로를 제공하는 몇가지 추가 인수를 사용할 수 있습니다.

$ scons -j 4 platform=iphone arch=arm target=release_debug IPHONESDK="/path/to/iPhoneSDK" IPHONEPATH="/path/to/iostoolchain" ios_triple="arm-apple-darwin11-"
$ scons -j 4 platform=iphone arch=arm64 target=release_debug IPHONESDK="/path/to/iPhoneSDK" IPHONEPATH="/path/to/iostoolchain" ios_triple="arm-apple-darwin11-"

Producing fat binaries

Apple requires a fat binary with both architectures (armv7 and arm64) in a single file. To do this, use the arm-apple-darwin11-lipo executable. The following example assumes you are in the root Godot source directory:
Apple은 하나의 파일에 두 아키텍처 (armv7 및 arm64)가있는 강력한 바이너리가 필요합니다. 이를 수행하려면 arm-apple-darwin11-lipo 실행 파일을 사용하십시오. 다음 예는 사용자가 root Godot 소스 디렉토리에 있다고 가정합니다.

$ /path/to/iostoolchain/usr/bin/arm-apple-darwin11-lipo -create bin/godot.iphone.opt.debug.arm bin/godot.iphone.opt.debug.arm64 -output bin/godot.iphone.opt.debug.fat

Then you will have an iOS fat binary in bin/godot.iphone.opt.debug.fat.
그러면 bin/godot.iphone.opt.debug.fat에 iOS fat 바이너리가 생깁니다.

반응형

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

Godot - Compiling for macOS  (0) 2018.12.07
Godot - Compiling for iOS  (0) 2018.12.06
Godot - Compiling for Universal Windows Platform  (0) 2018.12.04
Godot - Compiling for the Web  (0) 2018.12.03
Godot - Compiling with Mono  (0) 2018.12.01