Build
This chapter will introduce the compilation methods for the GPUPixel library on various system platforms.
TIP
Starting from version v1.1.0, the source code is compiled using CMake. The latest precompiled libraries for various platforms can be found here.
iOS
Execute the following commands at the root directory of the project.
Generate Project
cmake -G Xcode -B build -S src -DCMAKE_TOOLCHAIN_FILE=../toolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DCMAKE_BUILD_TYPE=Release
Compile
cmake --build build --config Release
cmake --build build --config Debug
Output
The compilation output is located in the output
path under the root directory of the project, containing the following:
output
├── include # Header files
├── library # Library files
└── resources # Resource files
For iOS, you only need to use the .framework
library under library
, which already contains header files and resource files.
MacOS
Execute the following commands at the root directory of the project.
Generate Project
cmake -G Xcode -B build -S src -DCMAKE_TOOLCHAIN_FILE=../toolchain/ios.toolchain.cmake -DPLATFORM=MAC_ARM64 -DCMAKE_BUILD_TYPE=Release
cmake -G Xcode -B build -S src -DCMAKE_TOOLCHAIN_FILE=../toolchain/ios.toolchain.cmake -DPLATFORM=MAC
Compile
cmake --build build --config Release
cmake --build build --config Debug
Output
The compilation output is located in the output
path under the root directory of the project, containing the following:
output
├── include # Header files
├── library # Library files
└── resources # Resource files
For macOS, you only need to use the .framework
library under library
, which already contains header files and resource files.
Android
Open the directory src/android/java
with Android Studio, which will automatically start downloading dependencies such as Gradle.
Project Structure
Includes demo and gpupixel module, as follows:
Compile
Double-click gradle -> gpupixel -> build -> assemble
to start compiling.
Output
Switch to the project view, the output is located at: src/android/java/gpupixel/build/outputs/aar
Gradle Command Compile
If the Gradle command environment has been configured, you can also use gradlew
to compile.
./gradlew :gpupixel:assembleRelease
The output is located at: src/android/java/gpupixel/build/outputs/aar
Windows
Compiling on Windows requires the installation of CMake and MinGW64.
Generate Project
cmake -G "MinGW Makefiles" -B build -S src -DCMAKE_BUILD_TYPE=Release
cmake -G "MinGW Makefiles" -B build -S src -DCMAKE_BUILD_TYPE=Debug
:::
Compile
cmake --build build --config Release
cmake --build build --config Debug
Output
The compilation output is located in the output
path under the root directory of the project, containing the following:
output
├── include # Header files
├── library # Library files
└── resources # Resource files
Linux (Tested on Ubuntu)
Environment Configuration
# Install cmake
sudo apt-get install cmake pkg-config
# Install dependent libraries
sudo apt-get install mesa-utils libglu1-mesa-dev freeglut3-dev mesa-common-dev libglfw3-dev
Generate Project
cmake -B build -S src -DCMAKE_BUILD_TYPE=Release
cmake -B build -S src -DCMAKE_BUILD_TYPE=Debug
:::
Compile
cmake --build build --config Release
cmake --build build --config Debug
Output
The compilation output is located in the output
path under the root directory of the project, containing the following:
output
├── include # Header files
├── library # Library files
└── resources # Resource files
GitHub Workflows
Automated compilation can refer to GPUPixel GitHub Build Workflows, which scripts the compilation commands mentioned above for various platforms.