Build glslang using CMake (Linux, Windows, Android)
mainYou can build glslang from source using CMake. Ensure you have a C++17 compiler, CMake, and make (or ninja) installed. Python 3.x is required if using SPIRV-Tools.
Prerequisites
- Clone the repository.
- Run
./update_glslang_sources.pyto check out external projects.
Build Steps
Linux:
cmake -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
make -j4 installWindows:
cmake -B $BUILD_DIR -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
cmake --build . --config Release --target installAndroid:
Requires the Android NDK. Use the -DANDROID_TOOLCHAIN=clang and appropriate -DANDROID_ABI flags.
cmake -B $BUILD_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_HOME/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmakecmake -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
make -j4 install