dneprDroid / thrift_generator_xcode

Configure Xcode project with CMake to build thrift generator with Swift support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile Thrift generator binary from sources for Swift 3/4


  1. Install brew from brew site.
  2. Install cmake from cmake site.
  3. Optional Install JDK from oracle site. (my backed written on JAVA)
  4. Install packages from brew:
  • openssl
  • libevent
  • bison
  1. Clone repo apocolipse/thrift
  2. Open Cmake app. Specify where thrift sources located and where to build you app (first image below).
  3. Set variables for: (look images below)
  • openssl
  • libevent
  • bison
  1. Generate Xcode project in Cmake app.
  2. Open Xcode. Build schemes:
  • all_build
  • parse
  • thrift_compier
  • install

Xcode errors:

.../thrift-master/compiler/cpp/src/thrift/thrifty.yy, invalid directive: `%code`

Replace %code required { } with %{...%}


Additional info:

Open SSL

OpenSSL cmake variables:

https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
Bison
If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/bison/lib

Generate thrift file

thrift --gen swift:async_clients,debug_descriptions -out ~/Desktop/ my_interface.thrift


Cmake images

Thrift sources sources-binaries-cmake

Set this variables manualy

bison_variables

libevent-variables

openssl-variables

General view of cmake variables for Swift

cmake-variables-1

cmake-variables-2

cmake-variables-3

cmake-variables-4

About

Configure Xcode project with CMake to build thrift generator with Swift support.

License:Creative Commons Attribution Share Alike 4.0 International