To be used in recent workPAG
interchangeabilityLottie
, to make it easier to read the source code, use theXCode
Compiled its source code.
1 Download source code
Compiling the source code starts with downloading the source code about thePAG
The source code can be accessed directly atgithub
Up for download.
2 Adding relevant dependencies
After downloading the source code, go to thePAG
In the project root directory, execute the following script.
./sync_deps.sh
3 Building the iOS PAGViewer Project
PAG
The project contains code under a variety of platforms, includingiOS
,Windows
,Linux
etc. We only focus oniOS
。
From the root directory, go to theiOS
directory, double-click thegen_ios
file. After execution, the directory will have an additional。
4 Setting Up XCode Signing Certificates
strike (on the keyboard)Go to
PAG
project project, do the following configuration so that thePAGViewer
Compile it on your own phone.
After setting theTeam
After that it will report an error and can be deletedBundle Identifier
and then clickSigning Certification
lowerTry Again
Button.
5 Compiling
existXCode
choose fromPAGViewer``Target
as well as toiPhone
Mobile, click to compile:.
6 Script Setup
A smooth source code compilation is often unattainable.PAG
The same goes for source code compilation.
During compilation, the following error is reported.
Look at the error message, it's compilingtgfx
project, and when running the script, the script command error isnode
Command.
first checkMac
Whether or not you have installed thenode
。
existMac
terminal operationnode -v
If the following version information is output, it means that it has been installed.
v22.5.1
Now that it's installednode
That.XCode
Why do you still report that you can't find it?
The reason.XCode
When running the script thePATH
environment variable is the same as the one in the terminalPATH
The environment variables are different.
XCode
The process environment variables for themacOS
set by the system at startup, not by the user'sShell
Configuration files (e.g.~/.bash_profile
) set directly.
That is, we installed thenode
The paths that are not in theXCode
(used form a nominal expression)PATH
under the environment variable.
In order to viewXCode
(used form a nominal expression)PATH
environment variable, which can be set as shown below, by setting theXCode
(used form a nominal expression)PATH
Environment variables are output to theXCode
(used form a nominal expression)Report
Panel.
figure aboveCMake PostBuild Rules
will execute a script, and it is this script that reports errors in compilation.
Add to the scriptecho
command, outputXCode
(used form a nominal expression)PATH
Information.
echo "Current PATH: $PATH"
Compile againPAGViewer
Target
The first is that it still fails, but theXCode
(used form a nominal expression)Report
The panel already has the following outputs.
replacing the aboveXCode
(used form a nominal expression)PATH
The information is copied and saved, and then theMac
terminal operationwhich node
command to view theMac
first (of multiple parts)node
installation directory.
localhost:~$ which node
/opt/homebrew/bin/node
It can be verified thatMac
uppernode
installation directory/opt/homebrew/bin
(euphemism) pass awayXCode
(used form a nominal expression)PATH
in the environment variables.
To fix this, we need to add this directory to theXCode
in the environment variable in the script you just created by adding aexport
Statement.
When you're done, you'll see that compilingtgfx-vendor
The same scripting problem occurs and is solved as described above:.
Finally, compiling again reveals that thePAG
The source code was successfully compiled by you!!!!