Mac executables or shared libraries that statically link with
libjpeg-turbo, then YASM must be used when building libjpeg-turbo.
* If building on Windows, **nasm.exe**/**yasm.exe** should be in your `PATH`.
+ * NASM and YASM are located in the CRB (Code Ready Builder) repository on
+ Red Hat Enterprise Linux 8 and in the PowerTools repository on CentOS 8,
+ which is not enabled by default.
The binary RPMs released by the NASM project do not work on older Linux
systems, such as Red Hat Enterprise Linux 5. On such systems, you can easily
install the Java Developer Package, which can be downloaded from
<http://developer.apple.com/downloads> (Apple ID required.) For other
systems, you can obtain the Oracle Java Development Kit from
- <http://www.java.com>.
+ <http://www.oracle.com/technetwork/java/javase/downloads>.
+ * If using JDK 11 or later, CMake 3.10.x or later must also be used.
### Windows
appropriate compiler paths automatically set.
- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
- can be downloaded from <http://www.java.com>.
+ can be downloaded from
+ <http://www.oracle.com/technetwork/java/javase/downloads>.
+
+ * If using JDK 11 or later, CMake 3.10.x or later must also be used.
Out-of-Tree Builds
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
export CFLAGS="-mfloat-abi=softfp -march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -miphoneos-version-min=3.0"
+ cd {build_directory}
+
cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER ${IOS_PLATFORMDIR}/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2)
EOF
- cd {build_directory}
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
[additional CMake flags] {source_directory}
export CFLAGS="-mfloat-abi=softfp -arch armv7 -miphoneos-version-min=3.0"
export ASMFLAGS="-no-integrated-as"
+ cd {build_directory}
+
cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang)
EOF
- cd {build_directory}
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
[additional CMake flags] {source_directory}
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
export CFLAGS="-Wall -mfloat-abi=softfp -march=armv7s -mcpu=swift -mtune=swift -mfpu=neon -miphoneos-version-min=6.0"
+ cd {build_directory}
+
cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER ${IOS_PLATFORMDIR}/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2)
EOF
- cd {build_directory}
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
[additional CMake flags] {source_directory}
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
export CFLAGS="-Wall -arch arm64 -miphoneos-version-min=7.0 -funwind-tables"
+ cd {build_directory}
+
cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang)
EOF
- cd {build_directory}
cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
[additional CMake flags] {source_directory}
Building libjpeg-turbo for Android
----------------------------------
-Building libjpeg-turbo for Android platforms requires the
+Building libjpeg-turbo for Android platforms requires v13b or later of the
[Android NDK](https://developer.android.com/tools/sdk/ndk).
needs.
# Set these variables to suit your needs
- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
- BUILD_PLATFORM={the platform name for the NDK package you installed--
- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
- toolchain directory under ${NDK_PATH}/toolchains/.}
- ANDROID_VERSION={The minimum version of Android to support-- for example,
+ NDK_PATH={full path to the NDK directory-- for example,
+ /opt/android/android-ndk-r16b}
+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r16b and earlier,
+ and "clang" must be used with NDK r17c and later}
+ ANDROID_VERSION={the minimum version of Android to support-- for example,
"16", "19", etc.}
- # It should not be necessary to modify the rest
- HOST=arm-linux-androideabi
- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
- export CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
- -D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
- -isystem ${NDK_PATH}/sysroot/usr/include \
- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
- export LDFLAGS=-pie
- TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
-
- cat <<EOF >toolchain.cmake
- set(CMAKE_SYSTEM_NAME Linux)
- set(CMAKE_SYSTEM_PROCESSOR arm)
- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
- EOF
-
cd {build_directory}
- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
+ cmake -G"Unix Makefiles" \
+ -DANDROID_ABI=armeabi-v7a \
+ -DANDROID_ARM_MODE=arm \
+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
+ -DCMAKE_ASM_FLAGS="--target=arm-linux-androideabi${ANDROID_VERSION}" \
+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make
needs.
# Set these variables to suit your needs
- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
- BUILD_PLATFORM={the platform name for the NDK package you installed--
- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
- toolchain directory under ${NDK_PATH}/toolchains/.}
- ANDROID_VERSION={The minimum version of Android to support. "21" or later
+ NDK_PATH={full path to the NDK directory-- for example,
+ /opt/android/android-ndk-r16b}
+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
+ and "clang" must be used with NDK r17c and later}
+ ANDROID_VERSION={the minimum version of Android to support. "21" or later
is required for a 64-bit build.}
- # It should not be necessary to modify the rest
- HOST=aarch64-linux-android
- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64
- export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
- -isystem ${NDK_PATH}/sysroot/usr/include \
- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
- export LDFLAGS=-pie
- TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
-
- cat <<EOF >toolchain.cmake
- set(CMAKE_SYSTEM_NAME Linux)
- set(CMAKE_SYSTEM_PROCESSOR aarch64)
- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
- EOF
-
cd {build_directory}
- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
+ cmake -G"Unix Makefiles" \
+ -DANDROID_ABI=arm64-v8a \
+ -DANDROID_ARM_MODE=arm \
+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
+ -DCMAKE_ASM_FLAGS="--target=aarch64-linux-android${ANDROID_VERSION}" \
+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make
needs.
# Set these variables to suit your needs
- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
- BUILD_PLATFORM={the platform name for the NDK package you installed--
- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
- toolchain directory under ${NDK_PATH}/toolchains/.}
+ NDK_PATH={full path to the NDK directory-- for example,
+ /opt/android/android-ndk-r16b}
+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
+ and "clang" must be used with NDK r17c and later}
ANDROID_VERSION={The minimum version of Android to support-- for example,
"16", "19", etc.}
- # It should not be necessary to modify the rest
- HOST=i686-linux-android
- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-x86
- export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
- -isystem ${NDK_PATH}/sysroot/usr/include \
- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
- export LDFLAGS=-pie
- TOOLCHAIN=${NDK_PATH}/toolchains/x86-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
-
- cat <<EOF >toolchain.cmake
- set(CMAKE_SYSTEM_NAME Linux)
- set(CMAKE_SYSTEM_PROCESSOR i386)
- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
- EOF
-
cd {build_directory}
- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
+ cmake -G"Unix Makefiles" \
+ -DANDROID_ABI=x86 \
+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make
needs.
# Set these variables to suit your needs
- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
- BUILD_PLATFORM={the platform name for the NDK package you installed--
- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
- toolchain directory under ${NDK_PATH}/toolchains/.}
- ANDROID_VERSION={The minimum version of Android to support. "21" or later
+ NDK_PATH={full path to the NDK directory-- for example,
+ /opt/android/android-ndk-r16b}
+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
+ and "clang" must be used with NDK r17c and later}
+ ANDROID_VERSION={the minimum version of Android to support. "21" or later
is required for a 64-bit build.}
- # It should not be necessary to modify the rest
- HOST=x86_64-linux-android
- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-x86_64
- export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
- -isystem ${NDK_PATH}/sysroot/usr/include \
- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
- export LDFLAGS=-pie
- TOOLCHAIN=${NDK_PATH}/toolchains/x86_64-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
-
- cat <<EOF >toolchain.cmake
- set(CMAKE_SYSTEM_NAME Linux)
- set(CMAKE_SYSTEM_PROCESSOR x86_64)
- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
- EOF
-
cd {build_directory}
- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
+ cmake -G"Unix Makefiles" \
+ -DANDROID_ABI=x86_64 \
+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make
-If building for Android 4.0.x (API level < 16) or earlier, remove
-`-DCMAKE_POSITION_INDEPENDENT_CODE=1` from the CMake arguments and `-pie` from
-`LDFLAGS`.
-
-
Advanced CMake Options
----------------------