Skia is a graphics library (skia.org). The documentation explains how to build the library after cloning the project via git. But the documentation is unclear as of this date, how to build a C++ project with XCode which uses the Skia library.
I tried all what is written in the documentation, but can't find a way of how to link the skia library in a C++ XCode project.
Any solution?
How to Solve the Problem:
Add Library Search Path
This screenshot shows where to do these steps: Add Skia Library Path Image
libskia.a
library file which you built earlier. (Note: I used the static build option to create a static library. If you want to link a dynamic.so
library, the settings are slightly different)Statically Link with libskia.a
The following steps should be performed inside the same main window division as the steps before.
-lskia
to statically link thelibskia.a
library when building the project.Make Shure Header Include Paths Are Set
The following steps should be performed inside the same main window division as the steps before.
Add Mac OSX Specific Dependencies of Skia
The following steps should be performed inside the same main window division as the steps before. This screenshot shows where to do these steps: Add Skia Mac OSX Specific Dependencies Image
+
sign.Testcode
You may test these settings with the following example code:
Appendix
Compiling With the Terminal
You may accomplish the same by writing a make file or by invoking the g++ compiler directly in the terminal. Here is an example:
g++ -std=c++11 main.cpp -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework CoreServices -L[path_to_your_Skia_library]/skia/out/Static_m58 -lskia -I[path_to_your_Skia_library]/skia/include/core -I[path_to_your_Skia_library]/skia/include/config -I[path_to_your_Skia_library]/skia/include/utils -I[path_to_your_Skia_library]/skia/third_party/externals/sdl/include -I[path_to_your_Skia_library]/skia/include/gpu -I[path_to_your_Skia_library]/skia/src/gpu -o main
How I found the solution
Finding all this stuff out took me around 12 hours. If you are interested in the steps which finally lead to the solution, I'll explain them here. Just let me know.