Integration
This chapter will introduce the integration methods of GPUPixel across different systems. The latest precompiled libraries for each platform can be downloaded from here.
iOS & MacOS
The linking methods for iOS and MacOS libraries are the same, so they are discussed together.
Adding Dependencies
Copy the GPUPixel library to your project directory.
├── gpupixel.framework
├── gpupixel.framework
Select Project -> Targets -> Build Phases -> Link Binary With Libraries
.
Click the +
button at the bottom left to add the dependencies as shown above. CoreMedia.framework
and AVFoundation.framework
are system libraries that provide capabilities such as camera capture.
Framework Search Path
Select Project -> Targets -> Build Settings -> Search Paths -> Framework Search Paths
, and enter the path where GPUPixel is stored.
Embedding Framework
Select Project -> Targets -> General -> Frameworks, Libraries, and Embedded Content
.
Set the GPUPixel library to Embed & Sign
, and choose Do Not Embed
for the system libraries.
Objective-C Invocation
Since GPUPixel is written in C++, to call C++ from Objective-C, you need to change the file extension of the Objective-C source files from .m
to .mm
. This allows mixing Objective-C and C++.
All GPUPixel headers are included in gpupixel.h
. Simply import
#import <gpupixel/gpupixel.h>
to access all methods. For detailed method invocations, refer to here.
Swift Invocation
After Swift 5.9, direct interaction with C++ is possible through a bridging header, eliminating the need for Objective-C as an intermediary. You can refer to this article or the official Swift documentation on Mixing Swift and C++.
Android
Download the latest gpupixel-release.aar
and place it in your Android project directory, such as the libs
folder.
Add the dependency in Gradle:
dependencies {
implementation files('libs/gpupixel-release.aar')
}
Then sync the project. For reference, see the Android Demo.
Reference article: Importing AAR Packages in Android
Windows and Linux
Refer to the demo and CMake configuration.