See #56 for discussion.
Fixes #21, Fixes #29, Fixes #37, Closes #56, Fixes #58, Closes #73
Obviates #82
See also:
https://sourceforge.net/p/libjpeg-turbo/feature-requests/5/
https://sourceforge.net/p/libjpeg-turbo/patches/5/
--- /dev/null
+/.travis.yml export-ignore
+/appveyor.yml export-ignore
+/ci export-ignore
+/.gitattributes export-ignore
+++ /dev/null
-.DS_Store
-Makefile.in
-aclocal.m4
-ar-lib
-autom4te.cache
-compile
-config.guess
-config.h.in
-config.sub
-configure
-depcomp
-install-sh
-ltmain.sh
-missing
dist: trusty
compiler: clang
env:
- CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
- CONFIGURE_FLAGS="--disable-shared"
+ CMAKE_BUILD_TYPE=RelWithDebInfo
+ CFLAGS_RELWITHDEBINFO="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
+ CMAKE_FLAGS="-DENABLE_SHARED=0"
ASAN_OPTIONS="detect_leaks=1 symbolize=1"
addons:
apt:
packages:
- nasm
- os: linux
+ dist: trusty
compiler: gcc
- env: CONFIGURE_FLAGS="--with-12bit"
+ env: CMAKE_FLAGS="-DWITH_12BIT=1"
- os: linux
dist: trusty
compiler: gcc
- env: CONFIGURE_FLAGS="--with-jpeg8"
+ env: CMAKE_FLAGS="-DWITH_JPEG8=1"
addons:
apt:
packages:
- nasm
- os: linux
+ dist: trusty
compiler: gcc
- env: CONFIGURE_FLAGS="--without-simd"
+ env: CMAKE_FLAGS="-DWITH_SIMD=0"
before_install:
- if [ "${BUILD_OFFICIAL:-}" != "" ]; then
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
docker pull dcommander/buildljt;
fi &&
- git clone --depth=1 https://github.com/libjpeg-turbo/buildscripts.git ~/src/buildscripts &&
+ git clone --depth=1 https://github.com/libjpeg-turbo/buildscripts.git -b $TRAVIS_BRANCH ~/src/buildscripts &&
openssl aes-256-cbc -K $encrypted_f92e8533f6f1_key -iv $encrypted_f92e8533f6f1_iv -in ci/keys.enc -out ci/keys -d &&
tar xf ci/keys &&
rm ci/keys &&
fi
fi
- if [ "${BUILD_OFFICIAL:-}" == "" ]; then
- autoreconf -fiv &&
mkdir build &&
pushd build &&
- ../configure ${CONFIGURE_FLAGS} &&
+ cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE "-DCMAKE_C_FLAGS_RELWITHDEBINFO=$CFLAGS_RELWITHDEBINFO" $CMAKE_FLAGS .. &&
make -j &&
- if [[ "${CONFIGURE_FLAGS}" =~ "with-12bit" ||
- "${CONFIGURE_FLAGS}" =~ "without-simd" ]]; then
- make test FLOATTEST=32bit;
- else
- make test FLOATTEST=sse &&
- JSIMD_FORCESSE2=1 make test FLOATTEST=sse &&
- JSIMD_FORCENONE=1 make test FLOATTEST=32bit;
+ make test &&
+ if [[ ! "${CMAKE_FLAGS[0]}" =~ "WITH_12BIT" &&
+ ! "${CMAKE_FLAGS[0]}" =~ "WITH_SIMD" ]]; then
+ JSIMD_FORCESSE2=1 make test &&
+ cmake -DFLOATTEST=32bit .. &&
+ JSIMD_FORCENONE=1 make test;
fi &&
popd;
fi
-Un*x Platforms (including Mac and Cygwin)
-=========================================
+Building libjpeg-turbo
+======================
Build Requirements
------------------
-- autoconf 2.56 or later
-- automake 1.7 or later
-- libtool 1.4 or later
- * If using Xcode 4.3 or later on OS X, autoconf and automake are no longer
- provided. The easiest way to obtain them is from
- [MacPorts](http://www.MacPorts.org) or [Homebrew](http://brew.sh/).
+
+### All Systems
+
+- [CMake](http://www.cmake.org) v2.8.12 or later
- [NASM](http://www.nasm.us) or [YASM](http://yasm.tortall.net)
(if building x86 or x86-64 SIMD extensions)
* If using NASM, 2.10 or later is required.
- * If using NASM, 2.10 or later (except 2.11.08) is required for an x86-64
- Mac build (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD
- code when building macho64 objects.) NASM or YASM can be obtained from
+ * If using NASM, 2.10 or later (except 2.11.08) is required for an x86-64 Mac
+ build (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code
+ when building macho64 objects.) NASM or YASM can be obtained from
[MacPorts](http://www.macports.org/) or [Homebrew](http://brew.sh/).
* If using YASM, 1.2.0 or later is required.
+ * If building on Windows, **nasm.exe**/**yasm.exe** should be in your `PATH`.
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
NOTE: the NASM build will fail if texinfo is not installed.
+
+### Un*x Platforms (including Linux, Mac, FreeBSD, Solaris, and Cygwin)
+
- GCC v4.1 (or later) or Clang recommended for best performance
- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
<http://www.java.com>.
+### Windows
+
+- Microsoft Visual C++ 2005 or later
+
+ If you don't already have Visual C++, then the easiest way to get it is by
+ installing the
+ [Windows SDK](http://msdn.microsoft.com/en-us/windows/bb980924.aspx).
+ The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
+ everything necessary to build libjpeg-turbo.
+
+ * You can also use Microsoft Visual Studio Express/Community Edition, which
+ is a free download. (NOTE: versions prior to 2012 can only be used to
+ build 32-bit code.)
+ * If you intend to build libjpeg-turbo from the command line, then add the
+ appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and
+ `PATH` environment variables. This is generally accomplished by
+ executing `vcvars32.bat` or `vcvars64.bat` and `SetEnv.cmd`.
+ `vcvars32.bat` and `vcvars64.bat` are part of Visual C++ and are located in
+ the same directory as the compiler. `SetEnv.cmd` is part of the Windows
+ SDK. You can pass optional arguments to `SetEnv.cmd` to specify a 32-bit
+ or 64-bit build environment.
+
+ ... OR ...
+
+- MinGW
+
+ [MSYS2](http://msys2.github.io/) or [tdm-gcc](http://tdm-gcc.tdragon.net/)
+ recommended if building on a Windows machine. Both distributions install a
+ Start Menu link that can be used to launch a command prompt with the
+ 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>.
+
+
Out-of-Tree Builds
------------------
Binary objects, libraries, and executables are generated in the directory from
-which `configure` is executed (the "binary directory"), and this directory need
-not necessarily be the same as the libjpeg-turbo source directory. You can
-create multiple independent binary directories, in which different versions of
+which CMake is executed (the "binary directory"), and this directory need not
+necessarily be the same as the libjpeg-turbo source directory. You can create
+multiple independent binary directories, in which different versions of
libjpeg-turbo can be built from the same source tree using different compilers
or settings. In the sections below, *{build_directory}* refers to the binary
directory, whereas *{source_directory}* refers to the libjpeg-turbo source
Build Procedure
---------------
+NOTE: The build procedures below assume that CMake is invoked from the command
+line, but all of these procedures can be adapted to the CMake GUI as
+well.
+
+
+### Un*x
+
The following procedure will build libjpeg-turbo on Unix and Unix-like systems.
(On Solaris, this generates a 32-bit build. See "Build Recipes" below for
64-bit build instructions.)
- cd {source_directory}
- autoreconf -fiv
cd {build_directory}
- sh {source_directory}/configure [additional configure flags]
+ cmake -G"Unix Makefiles" [additional CMake flags] {source_directory}
make
-NOTE: Running autoreconf in the source directory is not necessary if building
-libjpeg-turbo from one of the official release tarballs.
-
-This will generate the following files under **.libs/**:
+This will generate the following files under *{build_directory}*:
**libjpeg.a**<br>
Static link library for the libjpeg API
Import library for the TurboJPEG API
-### libjpeg v7 or v8 API/ABI Emulation
+### Visual C++ (Command Line)
-Add `--with-jpeg7` to the `configure` command line to build a version of
-libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `--with-jpeg8`
-to the `configure` command to build a version of libjpeg-turbo that is
-API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more
-information about libjpeg v7 and v8 emulation.
+ cd {build_directory}
+ cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory}
+ nmake
+This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
+on which version of **cl.exe** is in the `PATH`.
-### In-Memory Source/Destination Managers
+The following files will be generated under *{build_directory}*:
-When using libjpeg v6b or v7 API/ABI emulation, add `--without-mem-srcdst` to
-the `configure` command line to build a version of libjpeg-turbo that lacks the
-`jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not
-part of the original libjpeg v6b and v7 APIs, so removing them ensures strict
-conformance with those APIs. See [README.md](README.md) for more information.
+**jpeg-static.lib**<br>
+Static link library for the libjpeg API
+**jpeg{version}.dll**<br>
+DLL for the libjpeg API
-### Arithmetic Coding Support
+**jpeg.lib**<br>
+Import library for the libjpeg API
-Since the patent on arithmetic coding has expired, this functionality has been
-included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
-based on the implementation in libjpeg v8, but it works when emulating libjpeg
-v7 or v6b as well. The default is to enable both arithmetic encoding and
-decoding, but those who have philosophical objections to arithmetic coding can
-add `--without-arith-enc` or `--without-arith-dec` to the `configure` command
-line to disable encoding or decoding (respectively.)
+**turbojpeg-static.lib**<br>
+Static link library for the TurboJPEG API
+**turbojpeg.dll**<br>
+DLL for the TurboJPEG API
-### TurboJPEG Java Wrapper
+**turbojpeg.lib**<br>
+Import library for the TurboJPEG API
-Add `--with-java` to the `configure` command line to incorporate an optional
-Java Native Interface (JNI) wrapper into the TurboJPEG shared library and build
-the Java front-end classes to support it. This allows the TurboJPEG shared
-library to be used directly from Java applications. See
-[java/README](java/README) for more details.
+*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
+v8 emulation is enabled.
-You can set the `JAVAC`, `JAR`, and `JAVA` configure variables to specify
-alternate commands for javac, jar, and java (respectively.) You can also
-set the `JAVACFLAGS` configure variable to specify arguments that should be
-passed to the Java compiler when building the TurboJPEG classes, and
-`JNI_CFLAGS` to specify arguments that should be passed to the C compiler when
-building the JNI wrapper. Run `configure --help` for more details.
+### Visual C++ (IDE)
-Build Recipes
--------------
+Choose the appropriate CMake generator option for your version of Visual Studio
+(run `cmake` with no arguments for a list of available generators.) For
+instance:
+ cd {build_directory}
+ cmake -G"Visual Studio 10" [additional CMake flags] {source_directory}
-### 32-bit Build on 64-bit Linux
+NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10
+Win64") to build a 64-bit version of libjpeg-turbo. A separate build directory
+must be used for 32-bit and 64-bit builds.
-Add
+You can then open **ALL_BUILD.vcproj** in Visual Studio and build one of the
+configurations in that project ("Debug", "Release", etc.) to generate a full
+build of libjpeg-turbo.
- --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
+This will generate the following files under *{build_directory}*:
-to the `configure` command line.
+**{configuration}/jpeg-static.lib**<br>
+Static link library for the libjpeg API
+**{configuration}/jpeg{version}.dll**<br>
+DLL for the libjpeg API
-### 64-bit Build on 64-bit OS X
+**{configuration}/jpeg.lib**<br>
+Import library for the libjpeg API
-Add
+**{configuration}/turbojpeg-static.lib**<br>
+Static link library for the TurboJPEG API
- --host x86_64-apple-darwin NASM=/opt/local/bin/nasm
+**{configuration}/turbojpeg.dll**<br>
+DLL for the TurboJPEG API
-to the `configure` command line. NASM 2.10 or later from MacPorts or Homebrew
-must be installed. If using Homebrew, then replace `/opt/local` with
-`/usr/local`.
+**{configuration}/turbojpeg.lib**<br>
+Import library for the TurboJPEG API
+*{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending
+on the configuration you built in the IDE, and *{version}* is 62, 7, or 8,
+depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
-### 32-bit Build on 64-bit OS X
-Add
+### MinGW
- --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32
+NOTE: This assumes that you are building on a Windows machine using the MSYS
+environment. If you are cross-compiling on a Un*x platform (including Mac and
+Cygwin), then see "Build Recipes" below.
-to the `configure` command line.
+ cd {build_directory}
+ cmake -G"MSYS Makefiles" [additional CMake flags] {source_directory}
+ make
+This will generate the following files under *{build_directory}*:
-### 64-bit Backward-Compatible Build on 64-bit OS X
+**libjpeg.a**<br>
+Static link library for the libjpeg API
-Add
+**libjpeg-{version}.dll**<br>
+DLL for the libjpeg API
- --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \
- CFLAGS='-mmacosx-version-min=10.5 -O3' \
- LDFLAGS='-mmacosx-version-min=10.5'
+**libjpeg.dll.a**<br>
+Import library for the libjpeg API
-to the `configure` command line. NASM 2.10 or later from MacPorts or Homebrew
-must be installed. If using Homebrew, then replace `/opt/local` with
-`/usr/local`.
+**libturbojpeg.a**<br>
+Static link library for the TurboJPEG API
+
+**libturbojpeg.dll**<br>
+DLL for the TurboJPEG API
+
+**libturbojpeg.dll.a**<br>
+Import library for the TurboJPEG API
+
+*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
+v8 emulation is enabled.
+
+
+### Debug Build
+Add `-DCMAKE_BUILD_TYPE=Debug` to the CMake command line. Or, if building
+with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default
+with NMake.)
+
+
+### libjpeg v7 or v8 API/ABI Emulation
+
+Add `-DWITH_JPEG7=1` to the CMake command line to build a version of
+libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1`
+to the CMake command line to build a version of libjpeg-turbo that is
+API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more
+information about libjpeg v7 and v8 emulation.
+
+
+### In-Memory Source/Destination Managers
+
+When using libjpeg v6b or v7 API/ABI emulation, add `-DWITH_MEM_SRCDST=0` to
+the CMake command line to build a version of libjpeg-turbo that lacks the
+`jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not
+part of the original libjpeg v6b and v7 APIs, so removing them ensures strict
+conformance with those APIs. See [README.md](README.md) for more information.
+
+
+### Arithmetic Coding Support
+
+Since the patent on arithmetic coding has expired, this functionality has been
+included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
+based on the implementation in libjpeg v8, but it works when emulating libjpeg
+v7 or v6b as well. The default is to enable both arithmetic encoding and
+decoding, but those who have philosophical objections to arithmetic coding can
+add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the CMake command line to
+disable encoding or decoding (respectively.)
+
+
+### TurboJPEG Java Wrapper
+
+Add `-DWITH_JAVA=1` to the CMake command line to incorporate an optional Java
+Native Interface (JNI) wrapper into the TurboJPEG shared library and build the
+Java front-end classes to support it. This allows the TurboJPEG shared library
+to be used directly from Java applications. See [java/README](java/README) for
+more details.
+
+If Java is not in your `PATH`, or if you wish to use an alternate JDK to
+build/test libjpeg-turbo, then (prior to running CMake) set the `JAVA_HOME`
+environment variable to the location of the JDK that you wish to use. The
+`Java_JAVAC_EXECUTABLE`, `Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE`
+CMake variables can also be used to specify alternate commands or locations for
+javac, jar, and java (respectively.) You can also set the
+`CMAKE_JAVA_COMPILE_FLAGS` CMake variable or the `JAVAFLAGS` environment
+variable to specify arguments that should be passed to the Java compiler when
+building the TurboJPEG classes, and the `JAVAARGS` CMake variable to specify
+arguments that should be passed to the JRE when running the TurboJPEG Java unit
+tests.
-### 32-bit Backward-Compatible Build on OS X
-Add
+Build Recipes
+-------------
- --host i686-apple-darwin \
- CFLAGS='-mmacosx-version-min=10.5 -O3 -m32' \
- LDFLAGS='-mmacosx-version-min=10.5 -m32'
-to the `configure` command line.
+### 32-bit Build on 64-bit Linux/Unix/Mac
+Use export/setenv to set the following environment variables before running
+CMake:
-### 64-bit Build on 64-bit Solaris
+ CFLAGS=-m32
+ LDFLAGS=-m32
-Add
- --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64
+### 64-bit Build on Solaris
-to the `configure` command line.
+Use export/setenv to set the following environment variables before running
+CMake:
+ CFLAGS=-m64
+ LDFLAGS=-m64
-### 32-bit Build on 64-bit FreeBSD
-Add
+### Other Compilers
- --host i386-unknown-freebsd CFLAGS='-O3 -m32' LDFLAGS=-m32
+On Un*x systems, prior to running CMake, you can set the `CC` environment
+variable to the command used to invoke the C compiler.
-to the `configure` command line. NASM 2.07 or later from FreeBSD ports must be
-installed.
+### 32-bit MinGW Build on Un*x (including Mac and Cygwin)
-### Oracle Solaris Studio
+Create a file called **toolchain.cmake** under *{build_directory}*, with the
+following contents:
-Add
+ set(CMAKE_SYSTEM_NAME Windows)
+ set(CMAKE_SYSTEM_PROCESSOR X86)
+ set(CMAKE_C_COMPILER {mingw_binary_path}/i686-w64-mingw32-gcc)
+ set(CMAKE_RC_COMPILER {mingw_binary_path}/i686-w64-mingw32-windres)
- CC=cc
+*{mingw\_binary\_path}* is the directory under which the MinGW binaries are
+located (usually **/usr/bin**.) Next, execute the following commands:
-to the `configure` command line. libjpeg-turbo will automatically be built
-with the maximum optimization level (-xO5) unless you override `CFLAGS`.
+ cd {build_directory}
+ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
+ [additional CMake flags] {source_directory}
+ make
-To build a 64-bit version of libjpeg-turbo using Oracle Solaris Studio, add
- --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
+### 64-bit MinGW Build on Un*x (including Mac and Cygwin)
-to the `configure` command line.
+Create a file called **toolchain.cmake** under *{build_directory}*, with the
+following contents:
+ set(CMAKE_SYSTEM_NAME Windows)
+ set(CMAKE_SYSTEM_PROCESSOR AMD64)
+ set(CMAKE_C_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-gcc)
+ set(CMAKE_RC_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-windres)
-### MinGW Build on Cygwin
+*{mingw\_binary\_path}* is the directory under which the MinGW binaries are
+located (usually **/usr/bin**.) Next, execute the following commands:
-Use CMake (see recipes below)
+ cd {build_directory}
+ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
+ [additional CMake flags] {source_directory}
+ make
Building libjpeg-turbo for iOS
IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform
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"
- export host_alias=arm-apple-darwin10
- export CC=${IOS_PLATFORMDIR}/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
- export CFLAGS="-mfloat-abi=softfp -isysroot ${IOS_SYSROOT[0]} -O3 -march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -miphoneos-version-min=3.0"
+ 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}
- sh {source_directory}/configure [additional configure flags]
+ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
+ -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
+ [additional CMake flags] {source_directory}
make
#### Xcode 4.3-4.6 (LLVM-GCC)
IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
+ export CFLAGS="--mfloat-abi=softfp -arch armv7 -miphoneos-version-min=3.0"
+ export ASMFLAGS="-no-integrated-as"
- export host_alias=arm-apple-darwin10
- export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
- export CFLAGS="-mfloat-abi=softfp -isysroot ${IOS_SYSROOT[0]} -O3 -arch armv7 -miphoneos-version-min=3.0"
- export CCASFLAGS="$CFLAGS -no-integrated-as"
+ 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}
- sh {source_directory}/configure [additional configure flags]
+ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
+ -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
+ [additional CMake flags] {source_directory}
make
IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
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"
- export host_alias=arm-apple-darwin10
- export CC=${IOS_PLATFORMDIR}/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
- export CFLAGS="-mfloat-abi=softfp -isysroot ${IOS_SYSROOT[0]} -O3 -march=armv7s -mcpu=swift -mtune=swift -mfpu=neon -miphoneos-version-min=6.0"
+ 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}
- sh {source_directory}/configure [additional configure flags]
+ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
+ -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
+ [additional CMake flags] {source_directory}
make
#### Xcode 5 and later (Clang)
Same as the ARMv7 build procedure for Xcode 5 and later, except replace the
compiler flags as follows:
- export CFLAGS="-mfloat-abi=softfp -isysroot ${IOS_SYSROOT[0]} -O3 -arch armv7s -miphoneos-version-min=6.0"
+ export CFLAGS="-Wall -mfloat-abi=softfp -arch armv7s -miphoneos-version-min=6.0"
### ARMv8 (64-bit)
IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
+ export CFLAGS="-Wall -arch arm64 -miphoneos-version-min=7.0 -funwind-tables"
- export host_alias=aarch64-apple-darwin
- export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
- export CFLAGS="-isysroot ${IOS_SYSROOT[0]} -O3 -arch arm64 -miphoneos-version-min=7.0 -funwind-tables"
+ 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}
- sh {source_directory}/configure [additional configure flags]
+ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
+ -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \
+ [additional CMake flags] {source_directory}
make
Once built, lipo can be used to combine the ARMv7, v7s, and/or v8 variants into
----------------------------------
Building libjpeg-turbo for Android platforms requires the
-[Android NDK](https://developer.android.com/tools/sdk/ndk) and autotools.
+[Android NDK](https://developer.android.com/tools/sdk/ndk).
### ARMv7 (32-bit)
# It should not be necessary to modify the rest
HOST=arm-linux-androideabi
SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
- ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
- --sysroot=${SYSROOT}"
-
+ export CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays --sysroot=${SYSROOT}"
+ export LDFLAGS=-pie
TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
- export CPP=${TOOLCHAIN}/bin/${HOST}-cpp
- export AR=${TOOLCHAIN}/bin/${HOST}-ar
- export NM=${TOOLCHAIN}/bin/${HOST}-nm
- export CC=${TOOLCHAIN}/bin/${HOST}-gcc
- export LD=${TOOLCHAIN}/bin/${HOST}-ld
- export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
- export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
- export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
+
+ cat <<EOF >android.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}
- sh {source_directory}/configure --host=${HOST} \
- CFLAGS="${ANDROID_CFLAGS} -O3 -fPIE" \
- CPPFLAGS="${ANDROID_CFLAGS}" \
- LDFLAGS="${ANDROID_CFLAGS} -pie" --with-simd ${1+"$@"}
+ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
+ -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
+ [additional CMake flags] {source_directory}
make
# It should not be necessary to modify the rest
HOST=aarch64-linux-android
SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64
- ANDROID_CFLAGS="--sysroot=${SYSROOT}"
-
+ export CFLAGS="--sysroot ${SYSROOT}"
+ export LDFLAGS=-pie
TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
- export CPP=${TOOLCHAIN}/bin/${HOST}-cpp
- export AR=${TOOLCHAIN}/bin/${HOST}-ar
- export NM=${TOOLCHAIN}/bin/${HOST}-nm
- export CC=${TOOLCHAIN}/bin/${HOST}-gcc
- export LD=${TOOLCHAIN}/bin/${HOST}-ld
- export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
- export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
- export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
- cd {build_directory}
- sh {source_directory}/configure --host=${HOST} \
- CFLAGS="${ANDROID_CFLAGS} -O3 -fPIE" \
- CPPFLAGS="${ANDROID_CFLAGS}" \
- LDFLAGS="${ANDROID_CFLAGS} -pie" --with-simd ${1+"$@"}
- make
-
-If building for Android 4.0.x (API level < 16) or earlier, remove `-fPIE` from
-`CFLAGS` and `-pie` from `LDFLAGS`.
-
-Installing libjpeg-turbo
-------------------------
-
-To install libjpeg-turbo after it is built, replace `make` in the build
-instructions with `make install`.
-
-The `--prefix` argument to configure (or the `prefix` configure variable) can
-be used to specify an installation directory of your choosing. If you don't
-specify an installation directory, then the default is to install libjpeg-turbo
-under **/opt/libjpeg-turbo** and to place the libraries in
-**/opt/libjpeg-turbo/lib32** (32-bit) or **/opt/libjpeg-turbo/lib64** (64-bit.)
-
-The `bindir`, `datadir`, `docdir`, `includedir`, `libdir`, and `mandir`
-configure variables allow a finer degree of control over where specific files in
-the libjpeg-turbo distribution should be installed. These variables can either
-be specified at configure time or passed as arguments to `make install`.
-
-
-Windows (Visual C++ or MinGW)
-=============================
-
-
-Build Requirements
-------------------
-
-- [CMake](http://www.cmake.org) v2.8.11 or later
-
-- [NASM](http://www.nasm.us) or [YASM](http://yasm.tortall.net)
- * If using NASM, 2.10 or later is required.
- * If using YASM, 1.2.0 or later is required.
- * **nasm.exe**/**yasm.exe** should be in your `PATH`.
-
-- Microsoft Visual C++ 2005 or later
-
- If you don't already have Visual C++, then the easiest way to get it is by
- installing the
- [Windows SDK](http://msdn.microsoft.com/en-us/windows/bb980924.aspx).
- The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
- everything necessary to build libjpeg-turbo.
-
- * You can also use Microsoft Visual Studio Express/Community Edition, which
- is a free download. (NOTE: versions prior to 2012 can only be used to
- build 32-bit code.)
- * If you intend to build libjpeg-turbo from the command line, then add the
- appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and
- `PATH` environment variables. This is generally accomplished by
- executing `vcvars32.bat` or `vcvars64.bat` and `SetEnv.cmd`.
- `vcvars32.bat` and `vcvars64.bat` are part of Visual C++ and are located in
- the same directory as the compiler. `SetEnv.cmd` is part of the Windows
- SDK. You can pass optional arguments to `SetEnv.cmd` to specify a 32-bit
- or 64-bit build environment.
-
- ... OR ...
-
-- MinGW
-
- [MSYS2](http://msys2.github.io/) or [tdm-gcc](http://tdm-gcc.tdragon.net/)
- recommended if building on a Windows machine. Both distributions install a
- Start Menu link that can be used to launch a command prompt with the
- 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>.
-
-
-Out-of-Tree Builds
-------------------
-
-Binary objects, libraries, and executables are generated in the directory from
-which CMake is executed (the "binary directory"), and this directory need not
-necessarily be the same as the libjpeg-turbo source directory. You can create
-multiple independent binary directories, in which different versions of
-libjpeg-turbo can be built from the same source tree using different compilers
-or settings. In the sections below, *{build_directory}* refers to the binary
-directory, whereas *{source_directory}* refers to the libjpeg-turbo source
-directory. For in-tree builds, these directories are the same.
-
-
-Build Procedure
----------------
-
-NOTE: The build procedures below assume that CMake is invoked from the command
-line, but all of these procedures can be adapted to the CMake GUI as
-well.
-
-
-### Visual C++ (Command Line)
-
- cd {build_directory}
- cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory}
- nmake
-
-This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
-on which version of **cl.exe** is in the `PATH`.
-
-The following files will be generated under *{build_directory}*:
-
-**jpeg-static.lib**<br>
-Static link library for the libjpeg API
-
-**sharedlib/jpeg{version}.dll**<br>
-DLL for the libjpeg API
-
-**sharedlib/jpeg.lib**<br>
-Import library for the libjpeg API
-
-**turbojpeg-static.lib**<br>
-Static link library for the TurboJPEG API
-
-**turbojpeg.dll**<br>
-DLL for the TurboJPEG API
-
-**turbojpeg.lib**<br>
-Import library for the TurboJPEG API
-
-*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
-v8 emulation is enabled.
-
-
-### Visual C++ (IDE)
-
-Choose the appropriate CMake generator option for your version of Visual Studio
-(run `cmake` with no arguments for a list of available generators.) For
-instance:
-
- cd {build_directory}
- cmake -G"Visual Studio 10" [additional CMake flags] {source_directory}
-
-NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10
-Win64") to build a 64-bit version of libjpeg-turbo. A separate build directory
-must be used for 32-bit and 64-bit builds.
-
-You can then open **ALL_BUILD.vcproj** in Visual Studio and build one of the
-configurations in that project ("Debug", "Release", etc.) to generate a full
-build of libjpeg-turbo.
-
-This will generate the following files under *{build_directory}*:
-
-**{configuration}/jpeg-static.lib**<br>
-Static link library for the libjpeg API
-
-**sharedlib/{configuration}/jpeg{version}.dll**<br>
-DLL for the libjpeg API
-
-**sharedlib/{configuration}/jpeg.lib**<br>
-Import library for the libjpeg API
-
-**{configuration}/turbojpeg-static.lib**<br>
-Static link library for the TurboJPEG API
-
-**{configuration}/turbojpeg.dll**<br>
-DLL for the TurboJPEG API
-
-**{configuration}/turbojpeg.lib**<br>
-Import library for the TurboJPEG API
-
-*{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending
-on the configuration you built in the IDE, and *{version}* is 62, 7, or 8,
-depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
-
-
-### MinGW
-
-NOTE: This assumes that you are building on a Windows machine using the MSYS
-environment. If you are cross-compiling on a Un*x platform (including Mac and
-Cygwin), then see "Build Recipes" below.
-
- cd {build_directory}
- cmake -G"MSYS Makefiles" [additional CMake flags] {source_directory}
- make
-
-This will generate the following files under *{build_directory}*:
-
-**libjpeg.a**<br>
-Static link library for the libjpeg API
-
-**sharedlib/libjpeg-{version}.dll**<br>
-DLL for the libjpeg API
-
-**sharedlib/libjpeg.dll.a**<br>
-Import library for the libjpeg API
-
-**libturbojpeg.a**<br>
-Static link library for the TurboJPEG API
-
-**libturbojpeg.dll**<br>
-DLL for the TurboJPEG API
-
-**libturbojpeg.dll.a**<br>
-Import library for the TurboJPEG API
-
-*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
-v8 emulation is enabled.
-
-
-### Debug Build
-
-Add `-DCMAKE_BUILD_TYPE=Debug` to the CMake command line. Or, if building
-with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default
-with NMake.)
-
-
-### libjpeg v7 or v8 API/ABI Emulation
-
-Add `-DWITH_JPEG7=1` to the CMake command line to build a version of
-libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1`
-to the CMake command line to build a version of libjpeg-turbo that is
-API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more
-information about libjpeg v7 and v8 emulation.
-
-
-### In-Memory Source/Destination Managers
-
-When using libjpeg v6b or v7 API/ABI emulation, add `-DWITH_MEM_SRCDST=0` to
-the CMake command line to build a version of libjpeg-turbo that lacks the
-`jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not
-part of the original libjpeg v6b and v7 APIs, so removing them ensures strict
-conformance with those APIs. See [README.md](README.md) for more information.
-
-
-### Arithmetic Coding Support
-
-Since the patent on arithmetic coding has expired, this functionality has been
-included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
-based on the implementation in libjpeg v8, but it works when emulating libjpeg
-v7 or v6b as well. The default is to enable both arithmetic encoding and
-decoding, but those who have philosophical objections to arithmetic coding can
-add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the CMake command line to
-disable encoding or decoding (respectively.)
-
-
-### TurboJPEG Java Wrapper
-
-Add `-DWITH_JAVA=1` to the CMake command line to incorporate an optional Java
-Native Interface (JNI) wrapper into the TurboJPEG shared library and build the
-Java front-end classes to support it. This allows the TurboJPEG shared library
-to be used directly from Java applications. See [java/README](java/README) for
-more details.
-
-If Java is not in your `PATH`, or if you wish to use an alternate JDK to
-build/test libjpeg-turbo, then (prior to running CMake) set the `JAVA_HOME`
-environment variable to the location of the JDK that you wish to use. The
-`Java_JAVAC_EXECUTABLE`, `Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE`
-CMake variables can also be used to specify alternate commands or locations for
-javac, jar, and java (respectively.) You can also set the `JAVACFLAGS` CMake
-variable to specify arguments that should be passed to the Java compiler when
-building the TurboJPEG classes.
-
-
-Build Recipes
--------------
-
-
-### 32-bit MinGW Build on Un*x (including Mac and Cygwin)
-
-Create a file called **toolchain.cmake** under *{build_directory}*, with the
-following contents:
-
- set(CMAKE_SYSTEM_NAME Windows)
- set(CMAKE_SYSTEM_PROCESSOR X86)
- set(CMAKE_C_COMPILER {mingw_binary_path}/i686-w64-mingw32-gcc)
- set(CMAKE_RC_COMPILER {mingw_binary_path}/i686-w64-mingw32-windres)
-
-*{mingw\_binary\_path}* is the directory under which the MinGW binaries are
-located (usually **/usr/bin**.) Next, execute the following commands:
+ 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 \
[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`.
-### 64-bit MinGW Build on Un*x (including Mac and Cygwin)
-Create a file called **toolchain.cmake** under *{build_directory}*, with the
-following contents:
+Advanced CMake Options
+----------------------
- set(CMAKE_SYSTEM_NAME Windows)
- set(CMAKE_SYSTEM_PROCESSOR AMD64)
- set(CMAKE_C_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-gcc)
- set(CMAKE_RC_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-windres)
+To list and configure other CMake options not specifically mentioned in this
+guide, run
-*{mingw\_binary\_path}* is the directory under which the MinGW binaries are
-located (usually **/usr/bin**.) Next, execute the following commands:
+ ccmake {source_directory}
- cd {build_directory}
- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
- [additional CMake flags] {source_directory}
- make
+or
+
+ cmake-gui {source_directory}
+
+from the build directory after initially configuring the build. CCMake is a
+text-based interactive version of CMake, and CMake-GUI is a GUI version. Both
+will display all variables that are relevant to the libjpeg-turbo build, their
+current values, and a help string describing what they do.
Installing libjpeg-turbo
-------------------------
+========================
You can use the build system to install libjpeg-turbo (as opposed to creating
an installer package.) To do this, run `make install` or `nmake install`
**c:\libjpeg-turbo-gcc64**<br>
MinGW 64-bit build
+**/opt/libjpeg-turbo**<br>
+Un*x
+
+The `BINDIR`, `DATADIR`, `DOCDIR`, `INCLUDEDIR`, `LIBDIR`, and `MANDIR`
+CMake variables allow a finer degree of control over where specific files in
+the libjpeg-turbo distribution should be installed.
+
+
Creating Distribution Packages
==============================
Packages built in this manner can be installed on OS X 10.5 and later, but they
must be built on OS X 10.6 or later.
- make udmg [BUILDDIR32={32-bit build directory}]
-
-On 64-bit OS X systems, this creates a Mac package/disk image that contains
-universal i386/x86-64 binaries. You should first configure a 32-bit
-out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree build,
-then run `make udmg` from the 64-bit build directory. The build system will
-look for the 32-bit build under *{source_directory}*/osxx86 by default, but you
-can override this by setting the `BUILDDIR32` variable on the make command line
-as shown above.
-
- make iosdmg [BUILDDIR32={32-bit build directory}] \
- [BUILDDIRARMV7={ARMv7 build directory}] \
- [BUILDDIRARMV7S={ARMv7s build directory}] \
- [BUILDDIRARMV8={ARMv8 build directory}]
-
-This creates a Mac package/disk image in which the libjpeg-turbo libraries
-contain ARM architectures necessary to build iOS applications. If building on
-an x86-64 system, the binaries will also contain the i386 architecture, as with
-`make udmg` above. You should first configure ARMv7, ARMv7s, and/or ARMv8
-out-of-tree builds of libjpeg-turbo (see "Building libjpeg-turbo for iOS"
-above.) If you are building an x86-64 version of libjpeg-turbo, you should
-configure a 32-bit out-of-tree build as well. Next, build libjpeg-turbo as you
-would normally, using an out-of-tree build. When it is built, run `make
-iosdmg` from the build directory. The build system will look for the ARMv7
-build under *{source_directory}*/iosarmv7 by default, the ARMv7s build under
-*{source_directory}*/iosarmv7s by default, the ARMv8 build under
-*{source_directory}*/iosarmv8 by default, and (if applicable) the 32-bit build
-under *{source_directory}*/osxx86 by default, but you can override this by
-setting the `BUILDDIR32`, `BUILDDIRARMV7`, `BUILDDIRARMV7S`, and/or
-`BUILDDIRARMV8` variables on the `make` command line as shown above.
-
-NOTE: If including an ARMv8 build in the package, then you may need to use
-Xcode's version of lipo instead of the operating system's. To do this, pass
-an argument of `LIPO="xcrun lipo"` on the make command line.
+ make udmg
+
+This creates a Mac package/disk image that contains universal x86-64/i386/ARM
+binaries. The following CMake variables control which architectures are
+included in the universal binaries. Setting any of these variables to an empty
+string excludes that architecture from the package.
+
+* `OSX_32BIT_BUILD`: Directory containing an i386 (32-bit) Mac build of
+ libjpeg-turbo (default: *{source_directory}*/osxx86)
+* `IOS_ARMV7_BUILD`: Directory containing an ARMv7 (32-bit) iOS build of
+ libjpeg-turbo (default: *{source_directory}*/iosarmv7)
+* `IOS_ARMV7S_BUILD`: Directory containing an ARMv7s (32-bit) iOS build of
+ libjpeg-turbo (default: *{source_directory}*/iosarmv7s)
+* `IOS_ARMV8_BUILD`: Directory containing an ARMv8 (64-bit) iOS build of
+ libjpeg-turbo (default: *{source_directory}*/iosarmv8)
+
+You should first use CMake to configure i386, ARMv7, ARMv7s, and/or ARMv8
+sub-builds of libjpeg-turbo (see "Build Recipes" and "Building libjpeg-turbo
+for iOS" above) in build directories that match those specified in the
+aforementioned CMake variables. Next, configure the primary build of
+libjpeg-turbo as an out-of-tree build, and build it. Once the primary build
+has been built, run `make udmg` from the build directory. The packaging system
+will build the sub-builds, use lipo to combine them into a single set of
+universal binaries, then package the universal binaries in the same manner as
+`make dmg`.
make cygwinpkg
-#
-# Setup
-#
-
-cmake_minimum_required(VERSION 2.8.11)
-# Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES
-if(POLICY CMP0022)
- cmake_policy(SET CMP0022 OLD)
-endif()
+cmake_minimum_required(VERSION 2.8.12)
project(libjpeg-turbo C)
set(VERSION 1.5.80)
pad_number(VERSION_REVISION 3)
set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION})
-if(NOT WIN32)
- message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
-endif()
-
-string(TIMESTAMP BUILD "%Y%m%d")
+string(TIMESTAMP DEFAULT_BUILD "%Y%m%d")
+set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})")
-# This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning
-# in Visual Studio, and it always defaults to Debug when using NMake.
+# NOTE: On Windows, this does nothing except when using MinGW or Cygwin.
+# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to
+# Debug when using NMake.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
-
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
-# This only works if building from the command line. There is currently no way
-# to set a variable's value based on the build type when using Visual Studio.
-if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- set(BUILD "${BUILD}d")
+message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
+
+# Detect CPU type and whether we're building 64-bit or 32-bit code
+math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8")
+string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC)
+if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR
+ CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR
+ CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR
+ CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR
+ CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32")
+ if(BITS EQUAL 64)
+ set(CPU_TYPE x86_64)
+ else()
+ set(CPU_TYPE i386)
+ endif()
+ if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE})
+ set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE})
+ endif()
+elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR
+ CMAKE_SYSTEM_PROCESSOR_LC MATCHES "arm*64*")
+ set(CPU_TYPE arm64)
+elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "arm*")
+ set(CPU_TYPE arm)
+elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ppc*" OR
+ CMAKE_SYSTEM_PROCESSOR_LC MATCHES "powerpc*")
+ set(CPU_TYPE powerpc)
+else()
+ set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC})
endif()
+message(STATUS "${BITS}-bit build (${CPU_TYPE})")
-message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
-option(WITH_SIMD "Include SIMD extensions" TRUE)
-option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
+###############################################################################
+# INSTALL DIRECTORIES
+###############################################################################
+
+if(WIN32)
+ if(MSVC)
+ set(DEFAULT_CMAKE_INSTALL_PREFIX "c:/${CMAKE_PROJECT_NAME}")
+ else()
+ set(DEFAULT_CMAKE_INSTALL_PREFIX "c:/${CMAKE_PROJECT_NAME}-gcc")
+ endif()
+ if(BITS EQUAL 64)
+ set(DEFAULT_CMAKE_INSTALL_PREFIX "${DEFAULT_CMAKE_INSTALL_PREFIX}64")
+ endif()
+else()
+ set(DEFAULT_CMAKE_INSTALL_PREFIX /opt/${CMAKE_PROJECT_NAME})
+endif()
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX "${DEFAULT_CMAKE_INSTALL_PREFIX}" CACHE PATH
+ "Directory into which to install ${CMAKE_PROJECT_NAME} (default: ${DEFAULT_CMAKE_INSTALL_PREFIX})"
+ FORCE)
+endif()
+
+set(DEFAULT_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
+set(BINDIR ${DEFAULT_BINDIR} CACHE PATH
+ "Directory into which executables and scripts should be installed (default: ${DEFAULT_BINDIR})")
+
+# When the prefix is /opt/${CMAKE_PROJECT_NAME}, we assume that an "official"
+# build is being created, and thus we install things into specific locations.
+if(CMAKE_INSTALL_PREFIX STREQUAL "${DEFAULT_CMAKE_INSTALL_PREFIX}" OR NOT UNIX)
+ set(DEFAULT_DATADIR ${CMAKE_INSTALL_PREFIX})
+else()
+ set(DEFAULT_DATADIR ${CMAKE_INSTALL_PREFIX}/share)
+endif()
+set(DATADIR ${DEFAULT_DATADIR} CACHE PATH
+ "Directory under which Java classes, docs, and man pages should be installed (default: ${DEFAULT_DATADIR})")
+
+if(CMAKE_INSTALL_PREFIX STREQUAL "${DEFAULT_CMAKE_INSTALL_PREFIX}" OR NOT UNIX)
+ set(DEFAULT_DOCDIR ${DATADIR}/doc)
+else()
+ set(DEFAULT_DOCDIR ${DATADIR}/doc/${CMAKE_PROJECT_NAME})
+endif()
+set(DOCDIR ${DEFAULT_DOCDIR} CACHE PATH
+ "Directory into which docs should be installed (default: ${DEFAULT_DOCDIR})")
+
+set(DEFAULT_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
+set(INCLUDEDIR ${DEFAULT_INCLUDEDIR} CACHE PATH
+ "Directory into which include files should be installed (default: ${DEFAULT_INCLUDEDIR})")
+
+if(CMAKE_INSTALL_PREFIX STREQUAL "${DEFAULT_CMAKE_INSTALL_PREFIX}" AND UNIX AND
+ NOT APPLE)
+ if(BITS EQUAL 64)
+ set(DEFAULT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib64)
+ else()
+ set(DEFAULT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib32)
+ endif()
+else()
+ set(DEFAULT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
+endif()
+set(LIBDIR ${DEFAULT_LIBDIR} CACHE PATH
+ "Directory into which libraries should be installed (default: ${DEFAULT_LIBDIR})")
+
+foreach(var CMAKE_INSTALL_PREFIX BINDIR DATADIR DOCDIR INCLUDEDIR LIBDIR)
+ message(STATUS "${var} = ${${var}}")
+endforeach()
+
+if(UNIX)
+ set(DEFAULT_MANDIR ${DATADIR}/man)
+ set(MANDIR ${DEFAULT_MANDIR} CACHE PATH
+ "Directory into which man pages should be installed (default: ${DEFAULT_MANDIR})")
+ message(STATUS "MANDIR = ${MANDIR}")
+endif()
+
+
+###############################################################################
+# CONFIGURATION OPTIONS
+###############################################################################
+
+macro(boolean_number var)
+ if(${var})
+ set(${var} 1)
+ else()
+ set(${var} 0)
+ endif()
+endmacro()
+
+option(ENABLE_SHARED "Build shared libraries" TRUE)
+boolean_number(ENABLE_SHARED)
+option(ENABLE_STATIC "Build static libraries" TRUE)
+boolean_number(ENABLE_STATIC)
+option(REQUIRE_SIMD "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" FALSE)
+boolean_number(REQUIRE_SIMD)
+option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_ARITH_DEC=0 WITH_ARITH_ENC=0 WITH_JAVA=0 WITH_SIMD=0 WITH_TURBOJPEG=0 )" FALSE)
+boolean_number(WITH_12BIT)
option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE)
-option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
-option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
+boolean_number(WITH_ARITH_DEC)
+option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
+boolean_number(WITH_ARITH_ENC)
+option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE)
+boolean_number(WITH_JAVA)
+option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
+boolean_number(WITH_JPEG7)
+option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
+boolean_number(WITH_JPEG8)
option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE)
-option(WITH_TURBOJPEG "Include the TurboJPEG wrapper library and associated test programs" TRUE)
-option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE)
-option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_SIMD=0 WITH_TURBOJPEG=0 WITH_ARITH_ENC=0 WITH_ARITH_DEC=0)" FALSE)
-option(ENABLE_STATIC "Build static libraries" TRUE)
-option(ENABLE_SHARED "Build shared libraries" TRUE)
+boolean_number(WITH_MEM_SRCDST)
+option(WITH_SIMD "Include SIMD extensions, if available for this platform" TRUE)
+boolean_number(WITH_SIMD)
+option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" TRUE)
+boolean_number(WITH_TURBOJPEG)
+
+macro(report_option var desc)
+ if(${var})
+ message(STATUS "${desc} enabled (${var} = ${${var}})")
+ else()
+ message(STATUS "${desc} disabled (${var} = ${${var}})")
+ endif()
+endmacro()
+
+if(WITH_JAVA)
+ set(ENABLE_SHARED 1)
+endif()
+
+# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all
+# targets, which will cause the shared library builds to fail. Thus, if shared
+# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set
+# to FALSE, we need to unset it, thus restoring the default behavior
+# (automatically using PIC for shared library targets.)
+if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND
+ NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED)
+ unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE)
+endif()
+
+report_option(ENABLE_SHARED "Shared libraries")
+report_option(ENABLE_STATIC "Static libraries")
if(WITH_12BIT)
- set(WITH_SIMD FALSE)
- set(WITH_TURBOJPEG FALSE)
- set(WITH_JAVA FALSE)
- set(WITH_ARITH_ENC FALSE)
- set(WITH_ARITH_DEC FALSE)
+ set(WITH_ARITH_DEC 0)
+ set(WITH_ARITH_ENC 0)
+ set(WITH_JAVA 0)
+ set(WITH_SIMD 0)
+ set(WITH_TURBOJPEG 0)
set(BITS_IN_JSAMPLE 12)
- message(STATUS "12-bit JPEG support enabled")
else()
set(BITS_IN_JSAMPLE 8)
endif()
+report_option(WITH_12BIT "12-bit JPEG support")
if(WITH_JPEG8 OR WITH_JPEG7)
set(WITH_ARITH_ENC 1)
set(WITH_ARITH_DEC 1)
endif()
if(WITH_JPEG8)
- set(WITH_MEM_SRCDST 1)
+ set(WITH_MEM_SRCDST 0)
+endif()
+
+if(WITH_ARITH_DEC)
+ set(D_ARITH_CODING_SUPPORTED 1)
+endif()
+if(NOT WITH_12BIT)
+ report_option(WITH_ARITH_DEC "Arithmetic decoding support")
endif()
if(WITH_ARITH_ENC)
set(C_ARITH_CODING_SUPPORTED 1)
- message(STATUS "Arithmetic encoding support enabled")
-else()
- message(STATUS "Arithmetic encoding support disabled")
endif()
-
-if(WITH_ARITH_DEC)
- set(D_ARITH_CODING_SUPPORTED 1)
- message(STATUS "Arithmetic decoding support enabled")
-else()
- message(STATUS "Arithmetic decoding support disabled")
+if(NOT WITH_12BIT)
+ report_option(WITH_ARITH_ENC "Arithmetic encoding support")
endif()
-if(WITH_TURBOJPEG)
- message(STATUS "TurboJPEG C wrapper enabled")
-else()
- message(STATUS "TurboJPEG C wrapper disabled")
+if(NOT WITH_12BIT)
+ report_option(WITH_TURBOJPEG "TurboJPEG API library")
+ report_option(WITH_JAVA "TurboJPEG Java wrapper")
endif()
-if(WITH_JAVA)
- message(STATUS "TurboJPEG Java wrapper enabled")
-else()
- message(STATUS "TurboJPEG Java wrapper disabled")
+if(WITH_MEM_SRCDST)
+ set(MEM_SRCDST_SUPPORTED 1)
+ set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;")
+endif()
+if(NOT WITH_JPEG8)
+ report_option(WITH_MEM_SRCDST "In-memory source/destination managers")
endif()
-set(SO_AGE 0)
+set(SO_AGE 1)
if(WITH_MEM_SRCDST)
- set(SO_AGE 1)
+ set(SO_AGE 2)
endif()
-set(JPEG_LIB_VERSION 62)
-set(DLL_VERSION ${JPEG_LIB_VERSION})
-set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0)
if(WITH_JPEG8)
set(JPEG_LIB_VERSION 80)
- set(DLL_VERSION 8)
- set(FULLVERSION ${DLL_VERSION}.0.2)
- message(STATUS "Emulating libjpeg v8 API/ABI")
elseif(WITH_JPEG7)
set(JPEG_LIB_VERSION 70)
- set(DLL_VERSION 7)
- set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0)
- message(STATUS "Emulating libjpeg v7 API/ABI")
-endif(WITH_JPEG8)
+else()
+ set(JPEG_LIB_VERSION 62)
+endif()
-if(WITH_MEM_SRCDST)
- set(MEM_SRCDST_SUPPORTED 1)
- message(STATUS "In-memory source/destination managers enabled")
+math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10")
+math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10")
+if(JPEG_LIB_VERSION STREQUAL "62")
+ set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION})
+else()
+ set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10})
+endif()
+if(JPEG_LIB_VERSION STREQUAL "80")
+ set(DEFAULT_SO_MINOR_VERSION 2)
else()
- message(STATUS "In-memory source/destination managers disabled")
+ set(DEFAULT_SO_MINOR_VERSION 0)
endif()
+# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if
+# WITH_JPEG7 or WITH_JPEG8 has changed.
+if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR
+ (DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT))
+ set(FORCE_SO_VERSION "FORCE")
+endif()
+set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "")
+set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "")
+
+set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING
+ "Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})"
+ ${FORCE_SO_VERSION})
+set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING
+ "Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})"
+ ${FORCE_SO_VERSION})
+
+set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}")
+message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})")
+message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}")
+
+# Because the TurboJPEG API library uses versioned symbols and changes the
+# names of functions whenever they are modified in a backward-incompatible
+# manner, it is always backward-ABI-compatible with itself, so the major and
+# minor SO versions don't change. However, we increase the middle number (the
+# SO "age") whenever functions are added to the API.
+set(TURBOJPEG_SO_MAJOR_VERSION 0)
+set(TURBOJPEG_SO_VERSION 0.1.0)
+
+
+###############################################################################
+# COMPILER SETTINGS
+###############################################################################
+
if(MSVC)
option(WITH_CRT_DLL
- "Link all libjpeg-turbo libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it."
+ "Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it."
FALSE)
if(NOT WITH_CRT_DLL)
# Use the static C library for all build types
endif()
endforeach()
endif()
- add_definitions(-W3 -wd4996)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /wd4996")
endif()
-# Detect whether compiler is 64-bit
-if(MSVC AND CMAKE_CL_64)
- set(SIMD_X86_64 1)
- set(64BIT 1)
-elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
- set(SIMD_X86_64 1)
- set(64BIT 1)
-endif()
-
-if(64BIT)
- message(STATUS "64-bit build")
-else()
- message(STATUS "32-bit build")
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ # Use the maximum optimization level for release builds
+ foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
+ if(${var} MATCHES "-O2")
+ string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}")
+ endif()
+ endforeach()
endif()
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- if(MSVC)
- set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME})
- else()
- set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}-gcc)
- endif()
- if(64BIT)
- set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64)
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ if(CMAKE_C_COMPILER_ID MATCHES "SunPro")
+ # Use the maximum optimization level for release builds
+ foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
+ if(${var} MATCHES "-xO3")
+ string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}")
+ endif()
+ if(${var} MATCHES "-xO2")
+ string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}")
+ endif()
+ endforeach()
endif()
- set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH
- "Directory into which to install libjpeg-turbo (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})"
- FORCE)
endif()
-message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}")
-
-configure_file(win/jconfig.h.in jconfig.h)
-configure_file(win/jconfigint.h.in jconfigint.h)
-
-include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
-
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}")
-if(WITH_JAVA)
- find_package(Java)
- find_package(JNI)
- if(DEFINED JAVACFLAGS)
- message(STATUS "Java compiler flags = ${JAVACFLAGS}")
+include(CheckCSourceCompiles)
+
+if(UNIX)
+ # Check for headers
+ include(CheckIncludeFiles)
+ check_include_files(locale.h HAVE_LOCALE_H)
+ check_include_files(stddef.h HAVE_STDDEF_H)
+ check_include_files(stdlib.h HAVE_STDLIB_H)
+ check_include_files(sys/types.h NEED_SYS_TYPES_H)
+
+ # Check for functions
+ include(CheckFunctionExists)
+ check_function_exists(memset HAVE_MEMSET)
+ check_function_exists(memcpy HAVE_MEMCPY)
+ if(NOT HAVE_MEMSET AND NOT HAVE_MEMCPY)
+ set(NEED_BSD_STRINGS 1)
+ endif()
+
+ # Check for types
+ include(CheckTypeSize)
+ check_type_size("unsigned char" UNSIGNED_CHAR)
+ check_type_size("unsigned short" UNSIGNED_SHORT)
+ check_type_size("size_t" SIZE_T)
+
+ # Check for compiler features
+ check_c_source_compiles("int main(void) { typedef struct undefined_structure *undef_struct_ptr; }"
+ INCOMPLETE_TYPES)
+ if(INCOMPLETE_TYPES)
+ message(STATUS "Compiler supports pointers to undefined structures.")
+ else()
+ set(INCOMPLETE_TYPES_BROKEN 1)
+ message(STATUS "Compiler does not support pointers to undefined structures.")
+ endif()
+
+ if(CMAKE_CROSSCOMPILING)
+ set(RIGHT_SHIFT_IS_UNSIGNED 0)
+ else()
+ include(CheckCSourceRuns)
+ check_c_source_runs("
+ #include <stdio.h>
+ #include <stdlib.h>
+ int is_shifting_signed (long arg) {
+ long res = arg >> 4;
+ if (res == -0x7F7E80CL)
+ return 1; /* right shift is signed */
+ /* see if unsigned-shift hack will fix it. */
+ /* we can't just test exact value since it depends on width of long... */
+ res |= (~0L) << (32-4);
+ if (res == -0x7F7E80CL)
+ return 0; /* right shift is unsigned */
+ printf(\"Right shift isn't acting as I expect it to.\\\\n\");
+ printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\");
+ return 0; /* try it with unsigned anyway */
+ }
+ int main (void) {
+ exit(is_shifting_signed(-0x7F7E80B1L));
+ }" RIGHT_SHIFT_IS_UNSIGNED)
+ endif()
+
+ if(CMAKE_CROSSCOMPILING)
+ set(__CHAR_UNSIGNED__ 0)
+ else()
+ check_c_source_runs("int main(void) { return ((char) -1 < 0); }"
+ __CHAR_UNSIGNED__)
endif()
endif()
+option(FORCE_INLINE "Force function inlining" TRUE)
+boolean_number(FORCE_INLINE)
+if(FORCE_INLINE)
+ if(MSVC)
+ set(INLINE "__forceinline")
+ check_c_source_compiles("__forceinline void foo(void) {} int main(void) { foo(); }"
+ FORCE_INLINE_WORKS)
+ else()
+ set(INLINE "inline __attribute__((always_inline))")
+ check_c_source_compiles("static inline __attribute__((always_inline)) void foo(void) {} int main(void) { foo(); }"
+ FORCE_INLINE_WORKS)
+ endif()
+endif()
+if(NOT FORCE_INLINE OR NOT FORCE_INLINE_WORKS)
+ if(MSVC)
+ set(INLINE "__inline")
+ check_c_source_compiles("__inline void foo(void) {} int main(void) { foo(); }"
+ INLINE_WORKS)
+ else()
+ set(INLINE "__inline__")
+ check_c_source_compiles("static __inline__ void foo(void) {} int main(void) { foo(); }"
+ INLINE_WORKS)
+ endif()
+ if(NOT INLINE_WORKS)
+ set(INLINE "inline")
+ check_c_source_compiles("static inline void foo(void) {} int main(void) { foo(); }"
+ C99_INLINE_WORKS)
+ if(NOT C99_INLINE_WORKS)
+ message(FATAL_ERROR "Could not determine how to inline functions.")
+ endif()
+ endif()
+endif()
+message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})")
+
+if(UNIX AND NOT APPLE)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };")
+ set(CMAKE_REQUIRED_FLAGS
+ "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
+ check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT)
+ set(CMAKE_REQUIRED_FLAGS)
+ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
+ if(HAVE_VERSION_SCRIPT)
+ message(STATUS "Linker supports GNU-style version scripts")
+ set(MAPFLAG "-Wl,--version-script,")
+ set(TJMAPFLAG "-Wl,--version-script,")
+ else()
+ message(STATUS "Linker does not support GNU-style version scripts")
+ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ # The Solaris linker doesn't like our version script for the libjpeg API
+ # library, but the version script for the TurboJPEG API library should
+ # still work.
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map
+ "VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;")
+ set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
+ check_c_source_compiles("void foo() {} void foo2() {} int main(void) { return 0; }"
+ HAVE_MAPFILE)
+ set(CMAKE_REQUIRED_FLAGS)
+ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
+ if(HAVE_MAPFILE)
+ message(STATUS "Linker supports mapfiles")
+ set(TJMAPFLAG "-Wl,-M,")
+ else()
+ message(STATUS "Linker does not support mapfiles")
+ endif()
+ endif()
+ endif()
+endif()
+
+# Generate files
+if(WIN32)
+ configure_file(win/jconfig.h.in jconfig.h)
+else()
+ configure_file(jconfig.h.in jconfig.h)
+endif()
+configure_file(jconfigint.h.in jconfigint.h)
+if(UNIX)
+ configure_file(libjpeg.map.in libjpeg.map)
+endif()
+
+# Include directories and compiler definitions
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
-#
-# Targets
-#
+
+###############################################################################
+# TARGETS
+###############################################################################
set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
endif()
if(WITH_SIMD)
- add_definitions(-DWITH_SIMD)
add_subdirectory(simd)
- if(SIMD_X86_64)
- set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c)
- else()
- set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c)
+elseif(NOT WITH_12BIT)
+ message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})")
+endif()
+if(WITH_SIMD)
+ message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})")
+ if(MSVC_IDE)
+ set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
endif()
- # This tells CMake that the "source" files haven't been generated yet
- set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
else()
- set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c)
- message(STATUS "Not using SIMD acceleration")
+ add_library(simd OBJECT jsimd_none.c)
endif()
if(WITH_JAVA)
add_subdirectory(java)
- set(ENABLE_SHARED TRUE)
endif()
if(ENABLE_SHARED)
add_subdirectory(sharedlib)
endif()
-if(ENABLE_STATIC OR WITH_TURBOJPEG)
- add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
+if(ENABLE_STATIC)
+ add_library(jpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd>
+ ${SIMD_OBJS})
if(NOT MSVC)
set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
endif()
- if(WITH_SIMD)
- add_dependencies(jpeg-static simd)
- endif()
endif()
if(WITH_TURBOJPEG)
- set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
- if(WITH_JAVA)
- set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
- include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
- endif()
-
if(ENABLE_SHARED)
+ set(TURBOJPEG_SOURCES ${JPEG_SOURCES} $<TARGET_OBJECTS:simd> ${SIMD_OBJS}
+ turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
+ set(TJMAPFILE ${CMAKE_SOURCE_DIR}/turbojpeg-mapfile)
+ if(WITH_JAVA)
+ set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
+ include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
+ set(TJMAPFILE ${CMAKE_SOURCE_DIR}/turbojpeg-mapfile.jni)
+ endif()
add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
- set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
+ if(WIN32)
+ set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
+ endif()
if(MINGW)
set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at)
endif()
- target_link_libraries(turbojpeg jpeg-static)
- set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "")
+ set_target_properties(turbojpeg PROPERTIES
+ SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION})
+ if(TJMAPFLAG)
+ set_target_properties(turbojpeg PROPERTIES
+ LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}")
+ endif()
add_executable(tjunittest tjunittest.c tjutil.c)
target_link_libraries(tjunittest turbojpeg)
add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
wrppm.c)
- target_link_libraries(tjbench turbojpeg jpeg-static)
+ target_link_libraries(tjbench turbojpeg jpeg)
+ if(UNIX)
+ target_link_libraries(tjbench m)
+ endif()
set_property(TARGET tjbench PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
endif()
if(ENABLE_STATIC)
- add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}
- turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
+ add_library(turbojpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd>
+ ${SIMD_OBJS} turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
if(NOT MSVC)
set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
endif()
- if(WITH_SIMD)
- add_dependencies(turbojpeg-static simd)
- endif()
add_executable(tjunittest-static tjunittest.c tjutil.c)
target_link_libraries(tjunittest-static turbojpeg-static)
add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c
wrbmp.c wrppm.c)
target_link_libraries(tjbench-static turbojpeg-static jpeg-static)
+ if(UNIX)
+ target_link_libraries(tjbench-static m)
+ endif()
set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
endif()
endif()
+if(WIN32)
+ set(USE_SETMODE "-DUSE_SETMODE")
+endif()
if(WITH_12BIT)
- set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE")
+ set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}")
else()
- set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
+ set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}")
set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c)
set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c)
endif()
add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
target_link_libraries(jpegtran-static jpeg-static)
- set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE")
+ set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "${USE_SETMODE}")
endif()
add_executable(rdjpgcom rdjpgcom.c)
add_executable(wrjpgcom wrjpgcom.c)
-#
-# Tests
-#
+###############################################################################
+# TESTS
+###############################################################################
add_subdirectory(md5)
set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca)
set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d)
set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e)
- if(64BIT)
- # Windows/x64 uses SSE for floating point
- set(MD5_JPEG_3x2_FLOAT_PROG a8c17daf77b457725ec929e215b603f8)
- set(MD5_PPM_3x2_FLOAT 42876ab9e5c2f76a87d08db5fbd57956)
- else()
- # Windows/x86 uses the 387 FPU for floating point
- if(MSVC)
- set(MD5_JPEG_3x2_FLOAT_PROG e27840755870fa849872e58aa0cd1400)
- set(MD5_PPM_3x2_FLOAT 6c2880b83bb1aa41dfe330e7a9768690)
- else()
- set(MD5_JPEG_3x2_FLOAT_PROG bc6dbbefac2872f6b9d6c4a0ae60c3c0)
- set(MD5_PPM_3x2_FLOAT f58119ee294198ac9b4a9f5645a34266)
- endif()
- endif()
+
+ set(MD5_JPEG_3x2_FLOAT_PROG_SSE a8c17daf77b457725ec929e215b603f8)
+ set(MD5_PPM_3x2_FLOAT_SSE 42876ab9e5c2f76a87d08db5fbd57956)
+ set(MD5_JPEG_3x2_FLOAT_PROG_32BIT a8c17daf77b457725ec929e215b603f8)
+ set(MD5_PPM_3x2_FLOAT_32BIT ${MD5_PPM_3x2_FLOAT_SSE})
+ set(MD5_JPEG_3x2_FLOAT_PROG_64BIT ${MD5_JPEG_3x2_FLOAT_PROG_32BIT})
+ set(MD5_PPM_3x2_FLOAT_64BIT ${MD5_PPM_3x2_FLOAT_SSE})
+ set(MD5_JPEG_3x2_FLOAT_PROG_387 bc6dbbefac2872f6b9d6c4a0ae60c3c0)
+ set(MD5_PPM_3x2_FLOAT_387 bcc5723c61560463ac60f772e742d092)
+ set(MD5_JPEG_3x2_FLOAT_PROG_MSVC e27840755870fa849872e58aa0cd1400)
+ set(MD5_PPM_3x2_FLOAT_MSVC 6c2880b83bb1aa41dfe330e7a9768690)
+
+ set(MD5_JPEG_3x2_IFAST_PROG 1396cc2b7185cfe943d408c9d305339e)
+ set(MD5_PPM_3x2_IFAST 3975985ef6eeb0a2cdc58daa651ccc00)
set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0)
set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb)
set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96)
set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc)
set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db)
set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8)
- if(WITH_SIMD)
- set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71)
- set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb)
- else()
- if(64BIT)
- set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5)
- set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc)
- else()
- if(MSVC)
- set(MD5_JPEG_3x2_FLOAT_PROG 7999ce9cd0ee9b6c7043b7351ab7639d)
- set(MD5_PPM_3x2_FLOAT 28cdc448a6b75e97892f0e0f8d4b21f3)
- else()
- set(MD5_JPEG_3x2_FLOAT_PROG 1657664a410e0822c924b54f6f65e6e9)
- set(MD5_PPM_3x2_FLOAT cb0a1f027f3d2917c902b5640214e025)
- endif()
- endif()
- endif()
+
+ set(MD5_JPEG_3x2_FLOAT_PROG_SSE 343e3f8caf8af5986ebaf0bdc13b5c71)
+ set(MD5_PPM_3x2_FLOAT_SSE 1a75f36e5904d6fc3a85a43da9ad89bb)
+ set(MD5_JPEG_3x2_FLOAT_PROG_32BIT 9bca803d2042bd1eb03819e2bf92b3e5)
+ set(MD5_PPM_3x2_FLOAT_32BIT f6bfab038438ed8f5522fbd33595dcdc)
+ set(MD5_JPEG_3x2_FLOAT_PROG_64BIT ${MD5_JPEG_3x2_FLOAT_PROG_32BIT})
+ set(MD5_PPM_3x2_FLOAT_64BIT 0e917a34193ef976b679a6b069b1be26)
+ set(MD5_JPEG_3x2_FLOAT_PROG_387 1657664a410e0822c924b54f6f65e6e9)
+ set(MD5_PPM_3x2_FLOAT_387 cb0a1f027f3d2917c902b5640214e025)
+ set(MD5_JPEG_3x2_FLOAT_PROG_MSVC 7999ce9cd0ee9b6c7043b7351ab7639d)
+ set(MD5_PPM_3x2_FLOAT_MSVC 28cdc448a6b75e97892f0e0f8d4b21f3)
+
+ set(MD5_JPEG_3x2_IFAST_PROG 1ee5d2c1a77f2da495f993c8c7cceca5)
+ set(MD5_PPM_3x2_IFAST fd283664b3b49127984af0a7f118fccd)
set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1)
set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617)
set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437)
if(WITH_JAVA)
add_test(TJUnitTest
- ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
+ ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest)
add_test(TJUnitTest-yuv
- ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
+ ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -yuv)
add_test(TJUnitTest-yuv-nopad
- ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
+ ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -yuv -noyuvpad)
add_test(TJUnitTest-bi
- ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
+ ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bi)
add_test(TJUnitTest-bi-yuv
- ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
+ ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bi -yuv)
add_test(TJUnitTest-bi-yuv-nopad
- ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
+ ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bi -yuv -noyuvpad)
endif()
file(RELATIVE_PATH MD5CMP ${CMAKE_CURRENT_BINARY_DIR} ${MD5CMP})
endif()
+# The output of the floating point DCT/IDCT algorithms differs depending on the
+# type of floating point math used, so the FLOATTEST CMake variable must be
+# set in order to tell the testing system which floating point results it
+# should expect:
+#
+# sse = validate against the expected results from the libjpeg-turbo SSE SIMD
+# extensions
+# 32bit = validate against the expected results from the C code when running on
+# a 32-bit FPU (or when SSE is being used for floating point math,
+# which is generally the default with x86-64 compilers)
+# 64bit = validate against the expected results from the C code when running
+# on a 64-bit FPU
+# 387 = validate against the expected results from the C code when the 387 FPU
+# is being used for floating point math (which is generally the default
+# with x86 compilers)
+# msvc = validate against the expected results from the C code when compiled
+# with a 32-bit version of Visual C++
+
+if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386")
+ if(WITH_SIMD)
+ set(DEFAULT_FLOATTEST sse)
+ elseif(CPU_TYPE STREQUAL "x86_64")
+ set(DEFAULT_FLOATTEST 32bit)
+ elseif(CPU_TYPE STREQUAL "i386" AND MSVC)
+ set(DEFAULT_FLOATTEST msvc)
+ endif()
+else()
+ if(BITS EQUAL 64)
+ set(DEFAULT_FLOATTEST 64bit)
+ elseif(BITS EQUAL 32)
+ set(DEFAULT_FLOATTEST 32bit)
+ endif()
+endif()
+
+# This causes FLOATTEST to reset to the default value if WITH_SIMD has
+# changed.
+if(DEFINED WITH_SIMD_INT AND NOT WITH_SIMD EQUAL WITH_SIMD_INT)
+ set(FORCE_FLOATTEST "FORCE")
+endif()
+set(WITH_SIMD_INT ${WITH_SIMD} CACHE INTERNAL "")
+set(FLOATTEST ${DEFAULT_FLOATTEST} CACHE STRING
+ "The type of floating point math used by the floating point DCT/IDCT algorithms. This tells the testing system which numerical results it should expect from those tests. [sse = libjpeg-turbo x86/x86-64 SIMD extensions, 32bit = generic 32-bit FPU or SSE, 64bit = generic 64-bit FPU, 387 = 387 FPU, msvc = 32-bit Visual Studio] (default = ${DEFAULT_FLOATTEST})"
+ ${FORCE_FLOATTEST})
+message(STATUS "FLOATTEST = ${FLOATTEST}")
+
+if(FLOATTEST)
+ string(TOUPPER ${FLOATTEST} FLOATTEST_UC)
+ string(TOLOWER ${FLOATTEST} FLOATTEST)
+ if(NOT FLOATTEST STREQUAL "sse" AND NOT FLOATTEST STREQUAL "32bit" AND
+ NOT FLOATTEST STREQUAL "64bit" AND NOT FLOATTEST STREQUAL "387" AND
+ NOT FLOATTEST STREQUAL "msvc")
+ message(FATAL_ERROR "\"${FLOATTEST}\" is not a valid value for FLOATTEST.")
+ endif()
+endif()
+
foreach(libtype ${TEST_LIBTYPES})
- if(libtype STREQUAL "shared")
- set(dir sharedlib/)
- else()
- set(dir "")
+ if(libtype STREQUAL "static")
set(suffix -static)
endif()
if(WITH_TURBOJPEG)
- add_test(tjunittest${suffix} tjunittest${suffix})
- add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc)
- add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv)
- add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc)
- add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad)
+ add_test(tjunittest-${libtype} tjunittest${suffix})
+ add_test(tjunittest-${libtype}-alloc tjunittest${suffix} -alloc)
+ add_test(tjunittest-${libtype}-yuv tjunittest${suffix} -yuv)
+ add_test(tjunittest-${libtype}-yuv-alloc tjunittest${suffix} -yuv -alloc)
+ add_test(tjunittest-${libtype}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad)
+
+ set(MD5_PPM_GRAY_TILE 89d3ca21213d9d864b50b4e4e7de4ca6)
+ set(MD5_PPM_420_8x8_TILE 847fceab15c5b7b911cb986cf0f71de3)
+ set(MD5_PPM_420_16x16_TILE ca45552a93687e078f7137cc4126a7b0)
+ set(MD5_PPM_420_32x32_TILE d8676f1d6b68df358353bba9844f4a00)
+ set(MD5_PPM_420_64x64_TILE 4e4c1a3d7ea4bace4f868bcbe83b7050)
+ set(MD5_PPM_420_128x128_TILE f24c3429c52265832beab9df72a0ceae)
+ set(MD5_PPM_420M_8x8_TILE bc25320e1f4c31ce2e610e43e9fd173c)
+ set(MD5_PPM_420M_TILE 75ffdf14602258c5c189522af57fa605)
+ set(MD5_PPM_422_8x8_TILE d83dacd9fc73b0a6f10c09acad64eb1e)
+ set(MD5_PPM_422_16x16_TILE 35077fb610d72dd743b1eb0cbcfe10fb)
+ set(MD5_PPM_422_32x32_TILE e6902ed8a449ecc0f0d6f2bf945f65f7)
+ set(MD5_PPM_422_64x64_TILE 2b4502a8f316cedbde1da7bce3d2231e)
+ set(MD5_PPM_422_128x128_TILE f0b5617d578f5e13c8eee215d64d4877)
+ set(MD5_PPM_422M_8x8_TILE 828941d7f41cd6283abd6beffb7fd51d)
+ set(MD5_PPM_422M_TILE e877ae1324c4a280b95376f7f018172f)
+ set(MD5_PPM_444_TILE 7964e41e67cfb8d0a587c0aa4798f9c3)
+
+ # Test compressing from/decompressing to an arbitrary subregion of a larger
+ # image buffer
+ add_test(tjbench-${libtype}-tile-cp
+ ${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES}/testorig.ppm
+ testout_tile.ppm)
+ add_test(tjbench-${libtype}-tile
+ tjbench${suffix} testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01)
+ set_tests_properties(tjbench-${libtype}-tile
+ PROPERTIES DEPENDS tjbench-${libtype}-tile-cp)
+
+ foreach(tile 8 16 32 64 128)
+ add_test(tjbench-${libtype}-tile-gray-${tile}x${tile}-cmp
+ ${MD5CMP} ${MD5_PPM_GRAY_TILE}
+ testout_tile_GRAY_Q95_${tile}x${tile}.ppm)
+ foreach(subsamp 420 422)
+ add_test(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp
+ ${MD5CMP} ${MD5_PPM_${subsamp}_${tile}x${tile}_TILE}
+ testout_tile_${subsamp}_Q95_${tile}x${tile}.ppm)
+ endforeach()
+ add_test(tjbench-${libtype}-tile-444-${tile}x${tile}-cmp
+ ${MD5CMP} ${MD5_PPM_444_TILE}
+ testout_tile_444_Q95_${tile}x${tile}.ppm)
+ foreach(subsamp gray 420 422 444)
+ set_tests_properties(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp
+ PROPERTIES DEPENDS tjbench-${libtype}-tile)
+ endforeach()
+ endforeach()
+
+ add_test(tjbench-${libtype}-tilem-cp
+ ${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES}/testorig.ppm
+ testout_tilem.ppm)
+ add_test(tjbench-${libtype}-tilem
+ tjbench${suffix} testout_tilem.ppm 95 -rgb -fastupsample -quiet -tile
+ -benchtime 0.01)
+ set_tests_properties(tjbench-${libtype}-tilem
+ PROPERTIES DEPENDS tjbench-${libtype}-tilem-cp)
+
+ add_test(tjbench-${libtype}-tile-420m-8x8-cmp
+ ${MD5CMP} ${MD5_PPM_420M_8x8_TILE} testout_tilem_420_Q95_8x8.ppm)
+ add_test(tjbench-${libtype}-tile-422m-8x8-cmp
+ ${MD5CMP} ${MD5_PPM_422M_8x8_TILE} testout_tilem_422_Q95_8x8.ppm)
+ foreach(tile 16 32 64 128)
+ foreach(subsamp 420 422)
+ add_test(tjbench-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp
+ ${MD5CMP} ${MD5_PPM_${subsamp}M_TILE}
+ testout_tilem_${subsamp}_Q95_${tile}x${tile}.ppm)
+ endforeach()
+ endforeach()
+ foreach(tile 8 16 32 64 128)
+ foreach(subsamp 420 422)
+ set_tests_properties(tjbench-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp
+ PROPERTIES DEPENDS tjbench-${libtype}-tilem)
+ endforeach()
+ endforeach()
endif()
- # These tests are carefully chosen to provide full coverage of as many of the
- # underlying algorithms as possible (including all of the SIMD-accelerated
- # ones.)
+ # These tests are carefully crafted to provide full coverage of as many of
+ # the underlying algorithms as possible (including all of the
+ # SIMD-accelerated ones.)
+
+ macro(add_bittest PROG NAME ARGS OUTFILE INFILE MD5SUM)
+ add_test(${PROG}-${libtype}-${NAME}
+ ${PROG}${suffix} ${ARGS} -outfile ${OUTFILE} ${INFILE})
+ add_test(${PROG}-${libtype}-${NAME}-cmp
+ ${MD5CMP} ${MD5SUM} ${OUTFILE})
+ set_tests_properties(${PROG}-${libtype}-${NAME}-cmp PROPERTIES
+ DEPENDS ${PROG}-${libtype}-${NAME})
+ if(${ARGC} GREATER 6)
+ set(DEPENDS ${ARGN})
+ set_tests_properties(${PROG}-${libtype}-${NAME} PROPERTIES
+ DEPENDS ${DEPENDS})
+ endif()
+ endmacro()
# CC: null SAMP: fullsize FDCT: islow ENT: huff
- add_test(cjpeg${suffix}-rgb-islow
- ${dir}cjpeg${suffix} -rgb -dct int
- -outfile testout_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-rgb-islow-cmp
- ${MD5CMP} ${MD5_JPEG_RGB_ISLOW} testout_rgb_islow.jpg)
+ add_bittest(cjpeg rgb-islow "-rgb;-dct;int"
+ testout_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_RGB_ISLOW})
# CC: null SAMP: fullsize IDCT: islow ENT: huff
- add_test(djpeg${suffix}-rgb-islow
- ${dir}djpeg${suffix} -dct int -ppm
- -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg)
- add_test(djpeg${suffix}-rgb-islow-cmp
- ${MD5CMP} ${MD5_PPM_RGB_ISLOW} testout_rgb_islow.ppm)
+ add_bittest(djpeg rgb-islow "-dct;int;-ppm"
+ testout_rgb_islow.ppm testout_rgb_islow.jpg
+ ${MD5_PPM_RGB_ISLOW} cjpeg-${libtype}-rgb-islow)
if(NOT WITH_12BIT)
# CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff
- add_test(djpeg${suffix}-rgb-islow-565
- ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
- -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg)
- add_test(djpeg${suffix}-rgb-islow-565-cmp
- ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565} testout_rgb_islow_565.bmp)
+ add_bittest(djpeg rgb-islow-565 "-dct;int;-rgb565;-dither;none;-bmp"
+ testout_rgb_islow_565.bmp testout_rgb_islow.jpg
+ ${MD5_BMP_RGB_ISLOW_565} cjpeg-${libtype}-rgb-islow)
# CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
- add_test(djpeg${suffix}-rgb-islow-565D
- ${dir}djpeg${suffix} -dct int -rgb565 -bmp
- -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg)
- add_test(djpeg${suffix}-rgb-islow-565D-cmp
- ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565D} testout_rgb_islow_565D.bmp)
+ add_bittest(djpeg rgb-islow-565D "-dct;int;-rgb565;-bmp"
+ testout_rgb_islow_565D.bmp testout_rgb_islow.jpg
+ ${MD5_BMP_RGB_ISLOW_565D} cjpeg-${libtype}-rgb-islow)
endif()
# CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff
- add_test(cjpeg${suffix}-422-ifast-opt
- ${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt
- -outfile testout_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-422-ifast-opt-cmp
- ${MD5CMP} ${MD5_JPEG_422_IFAST_OPT} testout_422_ifast_opt.jpg)
+ add_bittest(cjpeg 422-ifast-opt "-sample;2x1;-dct;fast;-opt"
+ testout_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_422_IFAST_OPT})
# CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff
- add_test(djpeg${suffix}-422-ifast
- ${dir}djpeg${suffix} -dct fast
- -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg)
- add_test(djpeg${suffix}-422-ifast-cmp
- ${MD5CMP} ${MD5_PPM_422_IFAST} testout_422_ifast.ppm)
+ add_bittest(djpeg 422-ifast "-dct;fast"
+ testout_422_ifast.ppm testout_422_ifast_opt.jpg
+ ${MD5_PPM_422_IFAST} cjpeg-${libtype}-422-ifast-opt)
# CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff
- add_test(djpeg${suffix}-422m-ifast
- ${dir}djpeg${suffix} -dct fast -nosmooth
- -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg)
- add_test(djpeg${suffix}-422m-ifast-cmp
- ${MD5CMP} ${MD5_PPM_422M_IFAST} testout_422m_ifast.ppm)
+ add_bittest(djpeg 422m-ifast "-dct;fast;-nosmooth"
+ testout_422m_ifast.ppm testout_422_ifast_opt.jpg
+ ${MD5_PPM_422M_IFAST} cjpeg-${libtype}-422-ifast-opt)
if(NOT WITH_12BIT)
# CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff
- add_test(djpeg${suffix}-422m-ifast-565
- ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp
- -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg)
- add_test(djpeg${suffix}-422m-ifast-565-cmp
- ${MD5CMP} ${MD5_BMP_422M_IFAST_565} testout_422m_ifast_565.bmp)
+ add_bittest(djpeg 422m-ifast-565
+ "-dct;int;-nosmooth;-rgb565;-dither;none;-bmp"
+ testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg
+ ${MD5_BMP_422M_IFAST_565} cjpeg-${libtype}-422-ifast-opt)
# CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff
- add_test(djpeg${suffix}-422m-ifast-565D
- ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp
- -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg)
- add_test(djpeg${suffix}-422m-ifast-565D-cmp
- ${MD5CMP} ${MD5_BMP_422M_IFAST_565D} testout_422m_ifast_565D.bmp)
+ add_bittest(djpeg 422m-ifast-565D "-dct;int;-nosmooth;-rgb565;-bmp"
+ testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg
+ ${MD5_BMP_422M_IFAST_565D} cjpeg-${libtype}-422-ifast-opt)
endif()
# CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff
- add_test(cjpeg${suffix}-420-q100-ifast-prog
- ${dir}cjpeg${suffix} -sample 2x2 -quality 100 -dct fast -prog
- -outfile testout_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp
- ${MD5CMP} ${MD5_JPEG_420_IFAST_Q100_PROG} testout_420_q100_ifast_prog.jpg)
+ add_bittest(cjpeg 420-q100-ifast-prog
+ "-sample;2x2;-quality;100;-dct;fast;-prog"
+ testout_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_420_IFAST_Q100_PROG})
# CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff
- add_test(djpeg${suffix}-420-q100-ifast-prog
- ${dir}djpeg${suffix} -dct fast
- -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg)
- add_test(djpeg${suffix}-420-q100-ifast-prog-cmp
- ${MD5CMP} ${MD5_PPM_420_Q100_IFAST} testout_420_q100_ifast.ppm)
+ add_bittest(djpeg 420-q100-ifast-prog "-dct;fast"
+ testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
+ ${MD5_PPM_420_Q100_IFAST} cjpeg-${libtype}-420-q100-ifast-prog)
# CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff
- add_test(djpeg${suffix}-420m-q100-ifast-prog
- ${dir}djpeg${suffix} -dct fast -nosmooth
- -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg)
- add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp
- ${MD5CMP} ${MD5_PPM_420M_Q100_IFAST} testout_420m_q100_ifast.ppm)
+ add_bittest(djpeg 420m-q100-ifast-prog "-dct;fast;-nosmooth"
+ testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
+ ${MD5_PPM_420M_Q100_IFAST} cjpeg-${libtype}-420-q100-ifast-prog)
# CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff
- add_test(cjpeg${suffix}-gray-islow
- ${dir}cjpeg${suffix} -gray -dct int
- -outfile testout_gray_islow.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-gray-islow-cmp
- ${MD5CMP} ${MD5_JPEG_GRAY_ISLOW} testout_gray_islow.jpg)
+ add_bittest(cjpeg gray-islow "-gray;-dct;int"
+ testout_gray_islow.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_GRAY_ISLOW})
# CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff
- add_test(djpeg${suffix}-gray-islow
- ${dir}djpeg${suffix} -dct int
- -outfile testout_gray_islow.ppm testout_gray_islow.jpg)
- add_test(djpeg${suffix}-gray-islow-cmp
- ${MD5CMP} ${MD5_PPM_GRAY_ISLOW} testout_gray_islow.ppm)
+ add_bittest(djpeg gray-islow "-dct;int"
+ testout_gray_islow.ppm testout_gray_islow.jpg
+ ${MD5_PPM_GRAY_ISLOW} cjpeg-${libtype}-gray-islow)
# CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff
- add_test(djpeg${suffix}-gray-islow-rgb
- ${dir}djpeg${suffix} -dct int -rgb
- -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg)
- add_test(djpeg${suffix}-gray-islow-rgb-cmp
- ${MD5CMP} ${MD5_PPM_GRAY_ISLOW_RGB} testout_gray_islow_rgb.ppm)
+ add_bittest(djpeg gray-islow-rgb "-dct;int;-rgb"
+ testout_gray_islow_rgb.ppm testout_gray_islow.jpg
+ ${MD5_PPM_GRAY_ISLOW_RGB} cjpeg-${libtype}-gray-islow)
if(NOT WITH_12BIT)
# CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff
- add_test(djpeg${suffix}-gray-islow-565
- ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
- -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg)
- add_test(djpeg${suffix}-gray-islow-565-cmp
- ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565} testout_gray_islow_565.bmp)
+ add_bittest(djpeg gray-islow-565 "-dct;int;-rgb565;-dither;none;-bmp"
+ testout_gray_islow_565.bmp testout_gray_islow.jpg
+ ${MD5_BMP_GRAY_ISLOW_565} cjpeg-${libtype}-gray-islow)
# CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
- add_test(djpeg${suffix}-gray-islow-565D
- ${dir}djpeg${suffix} -dct int -rgb565 -bmp
- -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg)
- add_test(djpeg${suffix}-gray-islow-565D-cmp
- ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565D} testout_gray_islow_565D.bmp)
+ add_bittest(djpeg gray-islow-565D "-dct;int;-rgb565;-bmp"
+ testout_gray_islow_565D.bmp testout_gray_islow.jpg
+ ${MD5_BMP_GRAY_ISLOW_565D} cjpeg-${libtype}-gray-islow)
endif()
# CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow
# ENT: 2-pass huff
- add_test(cjpeg${suffix}-420s-ifast-opt
- ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt
- -outfile testout_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-420s-ifast-opt-cmp
- ${MD5CMP} ${MD5_JPEG_420S_IFAST_OPT} testout_420s_ifast_opt.jpg)
-
- # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
- add_test(cjpeg${suffix}-3x2-float-prog
- ${dir}cjpeg${suffix} -sample 3x2 -dct float -prog
- -outfile testout_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-3x2-float-prog-cmp
- ${MD5CMP} ${MD5_JPEG_3x2_FLOAT_PROG} testout_3x2_float_prog.jpg)
-
- # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff
- add_test(djpeg${suffix}-3x2-float-prog
- ${dir}djpeg${suffix} -dct float
- -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg)
- add_test(djpeg${suffix}-3x2-float-prog-cmp
- ${MD5CMP} ${MD5_PPM_3x2_FLOAT} testout_3x2_float.ppm)
+ add_bittest(cjpeg 420s-ifast-opt "-sample;2x2;-smooth;1;-dct;int;-opt"
+ testout_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_420S_IFAST_OPT})
+
+ if(FLOATTEST)
+ # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
+ add_bittest(cjpeg 3x2-float-prog "-sample;3x2;-dct;float;-prog"
+ testout_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_3x2_FLOAT_PROG_${FLOATTEST_UC}})
+
+ # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff
+ add_bittest(djpeg 3x2-float-prog "-dct;float"
+ testout_3x2_float.ppm testout_3x2_float_prog.jpg
+ ${MD5_PPM_3x2_FLOAT_${FLOATTEST_UC}} cjpeg-${libtype}-3x2-float-prog)
+ endif()
+
+ # CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff
+ add_bittest(cjpeg 3x2-ifast-prog "-sample;3x2;-dct;fast;-prog"
+ testout_3x2_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_3x2_IFAST_PROG})
+
+ # CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff
+ add_bittest(djpeg 3x2-ifast-prog "-dct;fast"
+ testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg
+ ${MD5_PPM_3x2_IFAST} cjpeg-${libtype}-3x2-ifast-prog)
if(WITH_ARITH_ENC)
# CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith
- add_test(cjpeg${suffix}-420-islow-ari
- ${dir}cjpeg${suffix} -dct int -arithmetic
- -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-420-islow-ari-cmp
- ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg)
-
- add_test(jpegtran${suffix}-420-islow-ari
- ${dir}jpegtran${suffix} -arithmetic
- -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testimgint.jpg)
- add_test(jpegtran${suffix}-420-islow-ari-cmp
- ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg)
+ add_bittest(cjpeg 420-islow-ari "-dct;int;-arithmetic"
+ testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_420_ISLOW_ARI})
+
+ add_bittest(jpegtran 420-islow-ari "-arithmetic"
+ testout_420_islow_ari2.jpg ${TESTIMAGES}/testimgint.jpg
+ ${MD5_JPEG_420_ISLOW_ARI})
# CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith
- add_test(cjpeg${suffix}-444-islow-progari
- ${dir}cjpeg${suffix} -sample 1x1 -dct int -prog -arithmetic
- -outfile testout_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(cjpeg${suffix}-444-islow-progari-cmp
- ${MD5CMP} ${MD5_JPEG_444_ISLOW_PROGARI} testout_444_islow_progari.jpg)
+ add_bittest(cjpeg 444-islow-progari
+ "-sample;1x1;-dct;int;-prog;-arithmetic"
+ testout_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm
+ ${MD5_JPEG_444_ISLOW_PROGARI})
endif()
if(WITH_ARITH_DEC)
# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
- add_test(djpeg${suffix}-420m-ifast-ari
- ${dir}djpeg${suffix} -fast -ppm
- -outfile testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg)
- add_test(djpeg${suffix}-420m-ifast-ari-cmp
- ${MD5CMP} ${MD5_PPM_420M_IFAST_ARI} testout_420m_ifast_ari.ppm)
+ add_bittest(djpeg 420m-ifast-ari "-fast;-ppm"
+ testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg
+ ${MD5_PPM_420M_IFAST_ARI})
- add_test(jpegtran${suffix}-420-islow
- ${dir}jpegtran${suffix}
- -outfile testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg)
- add_test(jpegtran${suffix}-420-islow-cmp
- ${MD5CMP} ${MD5_JPEG_420_ISLOW} testout_420_islow.jpg)
+ add_bittest(jpegtran 420-islow ""
+ testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg
+ ${MD5_JPEG_420_ISLOW})
endif()
# 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff
# ENT: huff
foreach(scale 2_1 15_8 13_8 11_8 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8)
string(REGEX REPLACE "_" "/" scalearg ${scale})
- add_test(djpeg${suffix}-420m-islow-${scale}
- ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm
- -outfile testout_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG})
- add_test(djpeg${suffix}-420m-islow-${scale}-cmp
- ${MD5CMP} ${MD5_PPM_420M_ISLOW_${scale}} testout_420m_islow_${scale}.ppm)
+ add_bittest(djpeg 420m-islow-${scale}
+ "-dct;int;-scale;${scalearg};-nosmooth;-ppm"
+ testout_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG}
+ ${MD5_PPM_420M_ISLOW_${scale}})
endforeach()
if(NOT WITH_12BIT)
# CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
- add_test(djpeg${suffix}-420-islow-256
- ${dir}djpeg${suffix} -dct int -colors 256 -bmp
- -outfile testout_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG})
- add_test(djpeg${suffix}-420-islow-256-cmp
- ${MD5CMP} ${MD5_BMP_420_ISLOW_256} testout_420_islow_256.bmp)
+ add_bittest(djpeg 420-islow-256 "-dct;int;-colors;256;-bmp"
+ testout_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG}
+ ${MD5_BMP_420_ISLOW_256})
# CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff
- add_test(djpeg${suffix}-420-islow-565
- ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
- -outfile testout_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG})
- add_test(djpeg${suffix}-420-islow-565-cmp
- ${MD5CMP} ${MD5_BMP_420_ISLOW_565} testout_420_islow_565.bmp)
+ add_bittest(djpeg 420-islow-565 "-dct;int;-rgb565;-dither;none;-bmp"
+ testout_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG}
+ ${MD5_BMP_420_ISLOW_565})
# CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
- add_test(djpeg${suffix}-420-islow-565D
- ${dir}djpeg${suffix} -dct int -rgb565 -bmp
- -outfile testout_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG})
- add_test(djpeg${suffix}-420-islow-565D-cmp
- ${MD5CMP} ${MD5_BMP_420_ISLOW_565D} testout_420_islow_565D.bmp)
+ add_bittest(djpeg 420-islow-565D "-dct;int;-rgb565;-bmp"
+ testout_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG}
+ ${MD5_BMP_420_ISLOW_565D})
# CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff
- add_test(djpeg${suffix}-420m-islow-565
- ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp
- -outfile testout_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG})
- add_test(djpeg${suffix}-420m-islow-565-cmp
- ${MD5CMP} ${MD5_BMP_420M_ISLOW_565} testout_420m_islow_565.bmp)
+ add_bittest(djpeg 420m-islow-565
+ "-dct;int;-nosmooth;-rgb565;-dither;none;-bmp"
+ testout_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG}
+ ${MD5_BMP_420M_ISLOW_565})
# CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff
- add_test(djpeg${suffix}-420m-islow-565D
- ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp
- -outfile testout_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG})
- add_test(djpeg${suffix}-420m-islow-565D-cmp
- ${MD5CMP} ${MD5_BMP_420M_ISLOW_565D} testout_420m_islow_565D.bmp)
+ add_bittest(djpeg 420m-islow-565D "-dct;int;-nosmooth;-rgb565;-bmp"
+ testout_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG}
+ ${MD5_BMP_420M_ISLOW_565D})
endif()
# Partial decode tests. These tests are designed to cover all of the
# possible code paths in jpeg_skip_scanlines().
# Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff
- add_test(djpeg${suffix}-420-islow-skip15_31
- ${dir}djpeg${suffix} -dct int -skip 15,31 -ppm
- -outfile testout_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG})
- add_test(djpeg${suffix}-420-islow-skip15_31-cmp
- ${MD5CMP} ${MD5_PPM_420_ISLOW_SKIP15_31} testout_420_islow_skip15,31.ppm)
+ add_bittest(djpeg 420-islow-skip15_31 "-dct;int;-skip;15,31;-ppm"
+ testout_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG}
+ ${MD5_PPM_420_ISLOW_SKIP15_31})
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith
if(WITH_ARITH_DEC)
- add_test(djpeg${suffix}-420-islow-ari-skip16_139
- ${dir}djpeg${suffix} -dct int -skip 16,139 -ppm
- -outfile testout_420_islow_ari_skip16,139.ppm
- ${TESTIMAGES}/testimgari.jpg)
- add_test(djpeg${suffix}-420-islow-ari_skip16_139-cmp
- ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_SKIP16_139}
- testout_420_islow_ari_skip16,139.ppm)
+ add_bittest(djpeg 420-islow-ari-skip16_139 "-dct;int;-skip;16,139;-ppm"
+ testout_420_islow_ari_skip16,139.ppm ${TESTIMAGES}/testimgari.jpg
+ ${MD5_PPM_420_ISLOW_ARI_SKIP16_139})
endif()
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff
- add_test(cjpeg${suffix}-420-islow-prog
- ${dir}cjpeg${suffix} -dct int -prog
+ add_test(cjpeg-${libtype}-420-islow-prog
+ cjpeg${suffix} -dct int -prog
-outfile testout_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71
- ${dir}djpeg${suffix} -dct int -crop 62x62+71+71 -ppm
- -outfile testout_420_islow_prog_crop62x62,71,71.ppm
- testout_420_islow_prog.jpg)
- add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71-cmp
- ${MD5CMP} ${MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71}
- testout_420_islow_prog_crop62x62,71,71.ppm)
+ add_bittest(djpeg 420-islow-prog-crop62x62_71_71
+ "-dct;int;-crop;62x62+71+71;-ppm"
+ testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg
+ ${MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71} cjpeg-${libtype}-420-islow-prog)
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith
if(WITH_ARITH_DEC)
- add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4
- ${dir}djpeg${suffix} -dct int -crop 53x53+4+4 -ppm
- -outfile testout_420_islow_ari_crop53x53,4,4.ppm
- ${TESTIMAGES}/testimgari.jpg)
- add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4-cmp
- ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4}
- testout_420_islow_ari_crop53x53,4,4.ppm)
+ add_bittest(djpeg 420-islow-ari-crop53x53_4_4
+ "-dct;int;-crop;53x53+4+4;-ppm"
+ testout_420_islow_ari_crop53x53,4,4.ppm ${TESTIMAGES}/testimgari.jpg
+ ${MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4})
endif()
# Context rows: No Intra-iMCU row: Yes ENT: huff
- add_test(cjpeg${suffix}-444-islow
- ${dir}cjpeg${suffix} -dct int -sample 1x1
+ add_test(cjpeg-${libtype}-444-islow
+ cjpeg${suffix} -dct int -sample 1x1
-outfile testout_444_islow.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(djpeg${suffix}-444-islow-skip1_6
- ${dir}djpeg${suffix} -dct int -skip 1,6 -ppm
- -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg)
- add_test(djpeg${suffix}-444-islow-skip1_6-cmp
- ${MD5CMP} ${MD5_PPM_444_ISLOW_SKIP1_6} testout_444_islow_skip1,6.ppm)
+ add_bittest(djpeg 444-islow-skip1_6 "-dct;int;-skip;1,6;-ppm"
+ testout_444_islow_skip1,6.ppm testout_444_islow.jpg
+ ${MD5_PPM_444_ISLOW_SKIP1_6} cjpeg-${libtype}-444-islow)
# Context rows: No Intra-iMCU row: No ENT: prog huff
- add_test(cjpeg${suffix}-444-islow-prog
- ${dir}cjpeg${suffix} -dct int -prog -sample 1x1
+ add_test(cjpeg-${libtype}-444-islow-prog
+ cjpeg${suffix} -dct int -prog -sample 1x1
-outfile testout_444_islow_prog.jpg ${TESTIMAGES}/testorig.ppm)
- add_test(djpeg${suffix}-444-islow-prog-crop98x98_13_13
- ${dir}djpeg${suffix} -dct int -crop 98x98+13+13 -ppm
- -outfile testout_444_islow_prog_crop98x98,13,13.ppm
- testout_444_islow_prog.jpg)
- add_test(djpeg${suffix}-444-islow-prog_crop98x98_13_13-cmp
- ${MD5CMP} ${MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13}
- testout_444_islow_prog_crop98x98,13,13.ppm)
+ add_bittest(djpeg 444-islow-prog-crop98x98_13_13
+ "-dct;int;-crop;98x98+13+13;-ppm"
+ testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg
+ ${MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13} cjpeg-${libtype}-444-islow-prog)
# Context rows: No Intra-iMCU row: No ENT: arith
if(WITH_ARITH_ENC)
- add_test(cjpeg${suffix}-444-islow-ari
- ${dir}cjpeg${suffix} -dct int -arithmetic -sample 1x1
+ add_test(cjpeg-${libtype}-444-islow-ari
+ cjpeg${suffix} -dct int -arithmetic -sample 1x1
-outfile testout_444_islow_ari.jpg ${TESTIMAGES}/testorig.ppm)
if(WITH_ARITH_DEC)
- add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0
- ${dir}djpeg${suffix} -dct int -crop 37x37+0+0 -ppm
- -outfile testout_444_islow_ari_crop37x37,0,0.ppm
- testout_444_islow_ari.jpg)
- add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0-cmp
- ${MD5CMP} ${MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0}
- testout_444_islow_ari_crop37x37,0,0.ppm)
+ add_bittest(djpeg 444-islow-ari-crop37x37_0_0
+ "-dct;int;-crop;37x37+0+0;-ppm"
+ testout_444_islow_ari_crop37x37,0,0.ppm testout_444_islow_ari.jpg
+ ${MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0} cjpeg-${libtype}-444-islow-ari)
endif()
endif()
- add_test(jpegtran${suffix}-crop
- ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect
- -outfile testout_crop.jpg ${TESTIMAGES}/${TESTORIG})
- add_test(jpegtran${suffix}-crop-cmp
- ${MD5CMP} ${MD5_JPEG_CROP} testout_crop.jpg)
+ add_bittest(jpegtran crop "-crop;120x90+20+50;-transpose;-perfect"
+ testout_crop.jpg ${TESTIMAGES}/${TESTORIG}
+ ${MD5_JPEG_CROP})
endforeach()
add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P
${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake)
-
-#
-# Installer
-#
-
-if(MSVC)
- set(INST_PLATFORM "Visual C++")
- set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
- set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
-elseif(MINGW)
- set(INST_PLATFORM GCC)
- set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
- set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
- set(INST_DEFS -DGCC)
-endif()
-
-if(64BIT)
- set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
- set(INST_NAME ${INST_NAME}64)
- set(INST_REG_NAME ${INST_DIR}64)
- set(INST_DEFS ${INST_DEFS} -DWIN64)
-endif()
-
-if(WITH_JAVA)
- set(INST_DEFS ${INST_DEFS} -DJAVA)
-endif()
-
-if(MSVC_IDE)
- set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
-else()
- set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
+if(WITH_TURBOJPEG)
+ configure_file(tjbenchtest.in tjbenchtest @ONLY)
+ if(WITH_JAVA)
+ configure_file(tjbenchtest.java.in tjbenchtest.java @ONLY)
+ configure_file(tjexampletest.in tjexampletest @ONLY)
+ add_custom_target(tjtest
+ echo ./tjbenchtest COMMAND ./tjbenchtest
+ COMMAND echo ./tjbenchtest COMMAND ./tjbenchtest -alloc
+ COMMAND echo ./tjbenchtest -yuv COMMAND ./tjbenchtest -yuv
+ COMMAND echo ./tjbenchtest -yuv -alloc COMMAND ./tjbenchtest -yuv -alloc
+ COMMAND echo ./tjbenchtest.java COMMAND ./tjbenchtest.java
+ COMMAND echo ./tjbenchtest.java -yuv COMMAND ./tjbenchtest.java -yuv
+ COMMAND echo ./tjexampletest COMMAND ./tjexampletest
+ DEPENDS ${CMAKE_BINARY_DIR}/tjbenchtest
+ ${CMAKE_BINARY_DIR}/tjbenchtest.java
+ ${CMAKE_BINARY_DIR}/tjexampletest)
+ else()
+ add_custom_target(tjtest
+ echo ./tjbenchtest COMMAND ./tjbenchtest
+ COMMAND echo ./tjbenchtest -alloc COMMAND ./tjbenchtest -alloc
+ COMMAND echo ./tjbenchtest -yuv COMMAND ./tjbenchtest -yuv
+ COMMAND echo ./tjbenchtest -yuv -alloc COMMAND ./tjbenchtest -yuv -alloc
+ DEPENDS ${CMAKE_BINARY_DIR}/tjbenchtest)
+ endif()
endif()
-STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
-configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
+###############################################################################
+# INSTALLATION
+###############################################################################
-if(WITH_JAVA)
- set(JAVA_DEPEND java)
+if(WIN32)
+ set(EXE ".exe")
endif()
-add_custom_target(installer
- makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
- DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
- cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
- SOURCES libjpeg-turbo.nsi)
+SET(CMAKE_INSTALL_RPATH ${LIBDIR})
if(WITH_TURBOJPEG)
if(ENABLE_SHARED)
install(TARGETS turbojpeg tjbench
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
+ ARCHIVE DESTINATION ${LIBDIR}
+ LIBRARY DESTINATION ${LIBDIR}
+ RUNTIME DESTINATION ${BINDIR})
endif()
if(ENABLE_STATIC)
- install(TARGETS turbojpeg-static ARCHIVE DESTINATION lib)
+ install(TARGETS turbojpeg-static ARCHIVE DESTINATION ${LIBDIR})
if(NOT ENABLE_SHARED)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static.exe
- DESTINATION bin RENAME tjbench.exe)
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static${EXE}
+ DESTINATION ${BINDIR} RENAME tjbench${EXE})
endif()
endif()
- install(FILES ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include)
+ install(FILES ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION ${INCLUDEDIR})
endif()
if(ENABLE_STATIC)
- install(TARGETS jpeg-static ARCHIVE DESTINATION lib)
+ install(TARGETS jpeg-static ARCHIVE DESTINATION ${LIBDIR})
if(NOT ENABLE_SHARED)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static.exe
- DESTINATION bin RENAME cjpeg.exe)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static.exe
- DESTINATION bin RENAME djpeg.exe)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static.exe
- DESTINATION bin RENAME jpegtran.exe)
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static${EXE}
+ DESTINATION ${BINDIR} RENAME cjpeg${EXE})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static${EXE}
+ DESTINATION ${BINDIR} RENAME djpeg${EXE})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static${EXE}
+ DESTINATION ${BINDIR} RENAME jpegtran${EXE})
endif()
endif()
-install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION bin)
+install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION ${BINDIR})
install(FILES ${CMAKE_SOURCE_DIR}/README.ijg ${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt
${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt
- ${CMAKE_SOURCE_DIR}/wizard.txt
- DESTINATION doc)
+ ${CMAKE_SOURCE_DIR}/wizard.txt ${CMAKE_SOURCE_DIR}/LICENSE.md
+ DESTINATION ${DOCDIR})
+
+if(UNIX)
+ install(FILES ${CMAKE_SOURCE_DIR}/cjpeg.1 ${CMAKE_SOURCE_DIR}/djpeg.1
+ ${CMAKE_SOURCE_DIR}/jpegtran.1 ${CMAKE_SOURCE_DIR}/rdjpgcom.1
+ ${CMAKE_SOURCE_DIR}/wrjpgcom.1 DESTINATION ${MANDIR}/man1)
+ install(FILES ${CMAKE_BINARY_DIR}/pkgscripts/libjpeg.pc
+ ${CMAKE_BINARY_DIR}/pkgscripts/libturbojpeg.pc
+ DESTINATION ${LIBDIR}/pkgconfig)
+endif()
install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h
${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h
- DESTINATION include)
+ DESTINATION ${INCLUDEDIR})
+
+include(cmakescripts/BuildPackages.cmake)
configure_file("${CMAKE_SOURCE_DIR}/cmakescripts/cmake_uninstall.cmake.in"
"cmake_uninstall.cmake" IMMEDIATE @ONLY)
approximately 6-15% when using 64-bit code and 4-12% when using 32-bit code.
(As tested on a 3 GHz Intel Core i7. Actual mileage may vary.)
+2. Overhauled the build system to use CMake on all platforms, and removed the
+autotools-based build system. This decision resulted from extensive
+discussions within the libjpeg-turbo community. libjpeg-turbo traditionally
+used CMake only for Windows builds, but there was an increasing amount of
+demand to extend CMake support to other platforms. However, because of the
+unique nature of our code base (the need to support different assemblers on
+each platform, the need for Java support, etc.), providing dual build systems
+as other OSS imaging libraries do (including libpng and libtiff) would have
+created a maintenance burden. The use of CMake greatly simplifies some aspects
+of our build system, owing to CMake's built-in support for various assemblers,
+Java, and unit testing, as well as generally fewer quirks that have to be
+worked around in order to implement our packaging system. Eliminating
+autotools puts our project slightly at odds with the traditional practices of
+the OSS community, since most "system libraries" tend to be built with
+autotools, but it is believed that the benefits of this move outweigh the
+risks. In addition to providing a unified build environment, switching to
+CMake allows for the use of various build tools and IDEs that aren't supported
+under autotools, including XCode, Ninja, and Eclipse. It also eliminates the
+need to install autotools via MacPorts/Homebrew on OS X and allows
+libjpeg-turbo to be configured without the use of a terminal/command prompt.
+Extensive testing was conducted to ensure that all features provided by the
+autotools-based build system are provided by the new build system.
+
1.5.2
=====
- The Modified (3-clause) BSD License, which is listed in
[turbojpeg.c](turbojpeg.c)
- This license covers the TurboJPEG API library and associated programs.
+ This license covers the TurboJPEG API library and associated programs, as
+ well as the build system.
- The zlib License, which is listed in [simd/jsimdext.inc](simd/jsimdext.inc)
+++ /dev/null
-lib_LTLIBRARIES = libjpeg.la
-libjpeg_la_LDFLAGS = -version-info ${LIBTOOL_CURRENT}:${SO_MINOR_VERSION}:${SO_AGE} -no-undefined
-include_HEADERS = jerror.h jmorecfg.h jpeglib.h
-
-if WITH_TURBOJPEG
-lib_LTLIBRARIES += libturbojpeg.la
-libturbojpeg_la_LDFLAGS = -version-info 1:0:1 -no-undefined
-include_HEADERS += turbojpeg.h
-endif
-
-nodist_include_HEADERS = jconfig.h
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = pkgscripts/libjpeg.pc
-if WITH_TURBOJPEG
-pkgconfig_DATA += pkgscripts/libturbojpeg.pc
-endif
-
-HDRS = jchuff.h jdct.h jdhuff.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
- jpegint.h jpeglib.h jversion.h jsimd.h jsimddct.h jpegcomp.h \
- jpeg_nbits_table.h
-
-libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \
- jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \
- jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c \
- jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \
- jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \
- jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c \
- jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \
- jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c
-
-if WITH_ARITH
-libjpeg_la_SOURCES += jaricom.c
-endif
-
-if WITH_ARITH_ENC
-libjpeg_la_SOURCES += jcarith.c
-endif
-
-if WITH_ARITH_DEC
-libjpeg_la_SOURCES += jdarith.c
-endif
-
-
-SUBDIRS = java
-
-
-if WITH_TURBOJPEG
-
-libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpeg.c turbojpeg.h \
- transupp.c transupp.h jdatadst-tj.c jdatasrc-tj.c
-
-if WITH_JAVA
-
-libturbojpeg_la_SOURCES += turbojpeg-jni.c
-libturbojpeg_la_CFLAGS = ${JNI_CFLAGS}
-TJMAPFILE = turbojpeg-mapfile.jni
-
-else
-
-TJMAPFILE = turbojpeg-mapfile
-
-endif
-
-libturbojpeg_la_SOURCES += $(TJMAPFILE)
-
-if VERSION_SCRIPT
-libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/$(TJMAPFILE)
-endif
-
-endif
-
-
-if VERSION_SCRIPT
-libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
-endif
-
-
-if WITH_SIMD
-
-SUBDIRS += simd
-libjpeg_la_LIBADD = simd/libsimd.la
-libturbojpeg_la_LIBADD = simd/libsimd.la
-
-else
-
-libjpeg_la_SOURCES += jsimd_none.c
-
-endif
-
-
-bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
-noinst_PROGRAMS = jcstest
-
-
-if WITH_TURBOJPEG
-
-bin_PROGRAMS += tjbench
-
-noinst_PROGRAMS += tjunittest
-
-tjbench_SOURCES = tjbench.c bmp.h bmp.c tjutil.h tjutil.c rdbmp.c rdppm.c \
- wrbmp.c wrppm.c
-
-tjbench_LDADD = libturbojpeg.la libjpeg.la -lm
-
-tjbench_CFLAGS = -DBMP_SUPPORTED -DPPM_SUPPORTED
-
-tjunittest_SOURCES = tjunittest.c tjutil.h tjutil.c
-
-tjunittest_LDADD = libturbojpeg.la
-
-endif
-
-
-cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdgif.c rdppm.c rdswitch.c
-if WITH_12BIT
-else
-cjpeg_SOURCES += rdbmp.c rdtarga.c
-endif
-
-cjpeg_LDADD = libjpeg.la
-
-cjpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED
-if WITH_12BIT
-else
-cjpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED
-endif
-
-djpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c djpeg.c rdcolmap.c rdswitch.c \
- wrgif.c wrppm.c
-if WITH_12BIT
-else
-djpeg_SOURCES += wrbmp.c wrtarga.c
-endif
-
-djpeg_LDADD = libjpeg.la
-
-djpeg_CFLAGS = -DGIF_SUPPORTED -DPPM_SUPPORTED
-if WITH_12BIT
-else
-djpeg_CFLAGS += -DBMP_SUPPORTED -DTARGA_SUPPORTED
-endif
-
-jpegtran_SOURCES = jpegtran.c rdswitch.c cdjpeg.c transupp.c transupp.h
-
-jpegtran_LDADD = libjpeg.la
-
-rdjpgcom_SOURCES = rdjpgcom.c
-
-rdjpgcom_LDADD = libjpeg.la
-
-wrjpgcom_SOURCES = wrjpgcom.c
-
-wrjpgcom_LDADD = libjpeg.la
-
-jcstest_SOURCES = jcstest.c
-
-jcstest_LDADD = libjpeg.la
-
-dist_man1_MANS = cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1
-
-DOCS= coderules.txt jconfig.txt change.log rdrle.c wrrle.c BUILDING.md \
- ChangeLog.md
-
-dist_doc_DATA = README.ijg README.md libjpeg.txt structure.txt usage.txt \
- wizard.txt LICENSE.md
-
-exampledir = $(docdir)
-dist_example_DATA = example.c
-
-
-EXTRA_DIST = win release $(DOCS) testimages CMakeLists.txt \
- sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \
- doxygen-extra.css jccolext.c jdcolext.c jdcol565.c jdmrgext.c jdmrg565.c \
- jstdhuff.c jdcoefct.h jdmainct.h jdmaster.h jdsample.h wrppm.h \
- md5/CMakeLists.txt
-
-dist-hook:
- rm -rf `find $(distdir) -name .svn`
-
-
-SUBDIRS += md5
-
-if WITH_12BIT
-
-TESTORIG = testorig12.jpg
-MD5_JPEG_RGB_ISLOW = 9620f424569594bb9242b48498ad801f
-MD5_PPM_RGB_ISLOW = f3301d2219783b8b3d942b7239fa50c0
-MD5_JPEG_422_IFAST_OPT = 7322e3bd2f127f7de4b40d4480ce60e4
-MD5_PPM_422_IFAST = 79807fa552899e66a04708f533e16950
-MD5_PPM_422M_IFAST = 07737bfe8a7c1c87aaa393a0098d16b0
-MD5_JPEG_420_IFAST_Q100_PROG = a1da220b5604081863a504297ed59e55
-MD5_PPM_420_Q100_IFAST = 1b3730122709f53d007255e8dfd3305e
-MD5_PPM_420M_Q100_IFAST = 980a1a3c5bf9510022869d30b7d26566
-MD5_JPEG_GRAY_ISLOW = 235c90707b16e2e069f37c888b2636d9
-MD5_PPM_GRAY_ISLOW = 7213c10af507ad467da5578ca5ee1fca
-MD5_PPM_GRAY_ISLOW_RGB = e96ee81c30a6ed422d466338bd3de65d
-MD5_JPEG_420S_IFAST_OPT = 7af8e60be4d9c227ec63ac9b6630855e
-MD5_JPEG_3x2_FLOAT_PROG_SSE = a8c17daf77b457725ec929e215b603f8
-MD5_PPM_3x2_FLOAT_SSE = 42876ab9e5c2f76a87d08db5fbd57956
-MD5_JPEG_3x2_FLOAT_PROG_32BIT = a8c17daf77b457725ec929e215b603f8
-MD5_PPM_3x2_FLOAT_32BIT = 42876ab9e5c2f76a87d08db5fbd57956
-MD5_PPM_3x2_FLOAT_64BIT = d6fbc71153b3d8ded484dbc17c7b9cf4
-MD5_JPEG_3x2_FLOAT_PROG_387 = bc6dbbefac2872f6b9d6c4a0ae60c3c0
-MD5_PPM_3x2_FLOAT_387 = bcc5723c61560463ac60f772e742d092
-MD5_JPEG_3x2_IFAST_PROG = 1396cc2b7185cfe943d408c9d305339e
-MD5_PPM_3x2_IFAST = 3975985ef6eeb0a2cdc58daa651ccc00
-MD5_PPM_420M_ISLOW_2_1 = 4ca6be2a6f326ff9eaab63e70a8259c0
-MD5_PPM_420M_ISLOW_15_8 = 12aa9f9534c1b3d7ba047322226365eb
-MD5_PPM_420M_ISLOW_13_8 = f7e22817c7b25e1393e4ec101e9d4e96
-MD5_PPM_420M_ISLOW_11_8 = 800a16f9f4dc9b293197bfe11be10a82
-MD5_PPM_420M_ISLOW_9_8 = 06b7a92a9bc69f4dc36ec40f1937d55c
-MD5_PPM_420M_ISLOW_7_8 = 3ec444a14a4ab4eab88ffc49c48eca43
-MD5_PPM_420M_ISLOW_3_4 = 3e726b7ea872445b19437d1c1d4f0d93
-MD5_PPM_420M_ISLOW_5_8 = a8a771abdc94301d20ffac119b2caccd
-MD5_PPM_420M_ISLOW_1_2 = b419124dd5568b085787234866102866
-MD5_PPM_420M_ISLOW_3_8 = 343d19015531b7bbe746124127244fa8
-MD5_PPM_420M_ISLOW_1_4 = 35fd59d866e44659edfa3c18db2a3edb
-MD5_PPM_420M_ISLOW_1_8 = ccaed48ac0aedefda5d4abe4013f4ad7
-MD5_PPM_420_ISLOW_SKIP15_31 = 86664cd9dc956536409e44e244d20a97
-MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 452a21656115a163029cfba5c04fa76a
-MD5_PPM_444_ISLOW_SKIP1_6 = ef63901f71ef7a75cd78253fc0914f84
-MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = 15b173fb5872d9575572fbcc1b05956f
-MD5_JPEG_CROP = cdb35ff4b4519392690ea040c56ea99c
-
-else
-
-TESTORIG = testorig.jpg
-MD5_JPEG_RGB_ISLOW = 768e970dd57b340ff1b83c9d3d47c77b
-MD5_PPM_RGB_ISLOW = 00a257f5393fef8821f2b88ac7421291
-MD5_BMP_RGB_ISLOW_565 = f07d2e75073e4bb10f6c6f4d36e2e3be
-MD5_BMP_RGB_ISLOW_565D = 4cfa0928ef3e6bb626d7728c924cfda4
-MD5_JPEG_422_IFAST_OPT = 2540287b79d913f91665e660303ab2c8
-MD5_PPM_422_IFAST = 35bd6b3f833bad23de82acea847129fa
-MD5_PPM_422M_IFAST = 8dbc65323d62cca7c91ba02dd1cfa81d
-MD5_BMP_422M_IFAST_565 = 3294bd4d9a1f2b3d08ea6020d0db7065
-MD5_BMP_422M_IFAST_565D = da98c9c7b6039511be4a79a878a9abc1
-MD5_JPEG_420_IFAST_Q100_PROG = 990cbe0329c882420a2094da7e5adade
-MD5_PPM_420_Q100_IFAST = 5a732542015c278ff43635e473a8a294
-MD5_PPM_420M_Q100_IFAST = ff692ee9323a3b424894862557c092f1
-MD5_JPEG_GRAY_ISLOW = 72b51f894b8f4a10b3ee3066770aa38d
-MD5_PPM_GRAY_ISLOW = 8d3596c56eace32f205deccc229aa5ed
-MD5_PPM_GRAY_ISLOW_RGB = 116424ac07b79e5e801f00508eab48ec
-MD5_BMP_GRAY_ISLOW_565 = 12f78118e56a2f48b966f792fedf23cc
-MD5_BMP_GRAY_ISLOW_565D = bdbbd616441a24354c98553df5dc82db
-MD5_JPEG_420S_IFAST_OPT = 388708217ac46273ca33086b22827ed8
-# See README.md for more details on why this next bit is necessary.
-MD5_JPEG_3x2_FLOAT_PROG_SSE = 343e3f8caf8af5986ebaf0bdc13b5c71
-MD5_PPM_3x2_FLOAT_SSE = 1a75f36e5904d6fc3a85a43da9ad89bb
-MD5_JPEG_3x2_FLOAT_PROG_32BIT = 9bca803d2042bd1eb03819e2bf92b3e5
-MD5_PPM_3x2_FLOAT_32BIT = f6bfab038438ed8f5522fbd33595dcdc
-MD5_PPM_3x2_FLOAT_64BIT = 0e917a34193ef976b679a6b069b1be26
-MD5_JPEG_3x2_FLOAT_PROG_387 = 1657664a410e0822c924b54f6f65e6e9
-MD5_PPM_3x2_FLOAT_387 = cb0a1f027f3d2917c902b5640214e025
-MD5_JPEG_3x2_IFAST_PROG = 1ee5d2c1a77f2da495f993c8c7cceca5
-MD5_PPM_3x2_IFAST = fd283664b3b49127984af0a7f118fccd
-MD5_JPEG_420_ISLOW_ARI = e986fb0a637a8d833d96e8a6d6d84ea1
-MD5_JPEG_444_ISLOW_PROGARI = 0a8f1c8f66e113c3cf635df0a475a617
-MD5_PPM_420M_IFAST_ARI = 72b59a99bcf1de24c5b27d151bde2437
-MD5_JPEG_420_ISLOW = 9a68f56bc76e466aa7e52f415d0f4a5f
-MD5_PPM_420M_ISLOW_2_1 = 9f9de8c0612f8d06869b960b05abf9c9
-MD5_PPM_420M_ISLOW_15_8 = b6875bc070720b899566cc06459b63b7
-MD5_PPM_420M_ISLOW_13_8 = bc3452573c8152f6ae552939ee19f82f
-MD5_PPM_420M_ISLOW_11_8 = d8cc73c0aaacd4556569b59437ba00a5
-MD5_PPM_420M_ISLOW_9_8 = d25e61bc7eac0002f5b393aa223747b6
-MD5_PPM_420M_ISLOW_7_8 = ddb564b7c74a09494016d6cd7502a946
-MD5_PPM_420M_ISLOW_3_4 = 8ed8e68808c3fbc4ea764fc9d2968646
-MD5_PPM_420M_ISLOW_5_8 = a3363274999da2366a024efae6d16c9b
-MD5_PPM_420M_ISLOW_1_2 = e692a315cea26b988c8e8b29a5dbcd81
-MD5_PPM_420M_ISLOW_3_8 = 79eca9175652ced755155c90e785a996
-MD5_PPM_420M_ISLOW_1_4 = 79cd778f8bf1a117690052cacdd54eca
-MD5_PPM_420M_ISLOW_1_8 = 391b3d4aca640c8567d6f8745eb2142f
-MD5_BMP_420_ISLOW_256 = 4980185e3776e89bd931736e1cddeee6
-MD5_BMP_420_ISLOW_565 = bf9d13e16c4923b92e1faa604d7922cb
-MD5_BMP_420_ISLOW_565D = 6bde71526acc44bcff76f696df8638d2
-MD5_BMP_420M_ISLOW_565 = 8dc0185245353cfa32ad97027342216f
-MD5_BMP_420M_ISLOW_565D =d1be3a3339166255e76fa50a0d70d73e
-MD5_PPM_420_ISLOW_SKIP15_31 = c4c65c1e43d7275cd50328a61e6534f0
-MD5_PPM_420_ISLOW_ARI_SKIP16_139 = 087c6b123db16ac00cb88c5b590bb74a
-MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 = 26eb36ccc7d1f0cb80cdabb0ac8b5d99
-MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 = 886c6775af22370257122f8b16207e6d
-MD5_PPM_444_ISLOW_SKIP1_6 = 5606f86874cf26b8fcee1117a0a436a6
-MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 = db87dc7ce26bcdc7a6b56239ce2b9d6c
-MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 = cb57b32bd6d03e35432362f7bf184b6d
-MD5_JPEG_CROP = b4197f377e621c4e9b1d20471432610d
-
-endif
-
-.PHONY: test
-test: tjquicktest tjbittest bittest
-
-if CROSS_COMPILING
-tjquicktest: testclean
-else
-tjquicktest: testclean all
-endif
-
-if WITH_TURBOJPEG
-if WITH_JAVA
- $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest
- $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -bi
- $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv
- $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -noyuvpad
- $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi
- $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi -noyuvpad
-endif
- ./tjunittest
- ./tjunittest -alloc
- ./tjunittest -yuv
- ./tjunittest -yuv -alloc
- ./tjunittest -yuv -noyuvpad
-endif
- echo GREAT SUCCESS!
-
-if CROSS_COMPILING
-tjbittest: testclean
-else
-tjbittest: testclean all
-endif
-
-if WITH_TURBOJPEG
-
-MD5_PPM_GRAY_TILE = 89d3ca21213d9d864b50b4e4e7de4ca6
-MD5_PPM_420_8x8_TILE = 847fceab15c5b7b911cb986cf0f71de3
-MD5_PPM_420_16x16_TILE = ca45552a93687e078f7137cc4126a7b0
-MD5_PPM_420_32x32_TILE = d8676f1d6b68df358353bba9844f4a00
-MD5_PPM_420_64x64_TILE = 4e4c1a3d7ea4bace4f868bcbe83b7050
-MD5_PPM_420_128x128_TILE = f24c3429c52265832beab9df72a0ceae
-MD5_PPM_420M_8x8_TILE = bc25320e1f4c31ce2e610e43e9fd173c
-MD5_PPM_420M_TILE = 75ffdf14602258c5c189522af57fa605
-MD5_PPM_422_8x8_TILE = d83dacd9fc73b0a6f10c09acad64eb1e
-MD5_PPM_422_16x16_TILE = 35077fb610d72dd743b1eb0cbcfe10fb
-MD5_PPM_422_32x32_TILE = e6902ed8a449ecc0f0d6f2bf945f65f7
-MD5_PPM_422_64x64_TILE = 2b4502a8f316cedbde1da7bce3d2231e
-MD5_PPM_422_128x128_TILE = f0b5617d578f5e13c8eee215d64d4877
-MD5_PPM_422M_8x8_TILE = 828941d7f41cd6283abd6beffb7fd51d
-MD5_PPM_422M_TILE = e877ae1324c4a280b95376f7f018172f
-MD5_PPM_444_TILE = 7964e41e67cfb8d0a587c0aa4798f9c3
-
-# Test compressing from/decompressing to an arbitrary subregion of a larger
-# image buffer
- cp $(srcdir)/testimages/testorig.ppm testout_tile.ppm
- ./tjbench testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 >/dev/null 2>&1
- for i in 8 16 32 64 128; do \
- md5/md5cmp $(MD5_PPM_GRAY_TILE) testout_tile_GRAY_Q95_$$i\x$$i.ppm; \
- done
- md5/md5cmp $(MD5_PPM_420_8x8_TILE) testout_tile_420_Q95_8x8.ppm
- md5/md5cmp $(MD5_PPM_420_16x16_TILE) testout_tile_420_Q95_16x16.ppm
- md5/md5cmp $(MD5_PPM_420_32x32_TILE) testout_tile_420_Q95_32x32.ppm
- md5/md5cmp $(MD5_PPM_420_64x64_TILE) testout_tile_420_Q95_64x64.ppm
- md5/md5cmp $(MD5_PPM_420_128x128_TILE) testout_tile_420_Q95_128x128.ppm
- md5/md5cmp $(MD5_PPM_422_8x8_TILE) testout_tile_422_Q95_8x8.ppm
- md5/md5cmp $(MD5_PPM_422_16x16_TILE) testout_tile_422_Q95_16x16.ppm
- md5/md5cmp $(MD5_PPM_422_32x32_TILE) testout_tile_422_Q95_32x32.ppm
- md5/md5cmp $(MD5_PPM_422_64x64_TILE) testout_tile_422_Q95_64x64.ppm
- md5/md5cmp $(MD5_PPM_422_128x128_TILE) testout_tile_422_Q95_128x128.ppm
- for i in 8 16 32 64 128; do \
- md5/md5cmp $(MD5_PPM_444_TILE) testout_tile_444_Q95_$$i\x$$i.ppm; \
- done
- rm -f testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_*
-
- ./tjbench testout_tile.ppm 95 -rgb -fastupsample -quiet -tile -benchtime 0.01 >/dev/null 2>&1
- md5/md5cmp $(MD5_PPM_420M_8x8_TILE) testout_tile_420_Q95_8x8.ppm
- for i in 16 32 64 128; do \
- md5/md5cmp $(MD5_PPM_420M_TILE) testout_tile_420_Q95_$$i\x$$i.ppm; \
- done
- md5/md5cmp $(MD5_PPM_422M_8x8_TILE) testout_tile_422_Q95_8x8.ppm
- for i in 16 32 64 128; do \
- md5/md5cmp $(MD5_PPM_422M_TILE) testout_tile_422_Q95_$$i\x$$i.ppm; \
- done
- rm -f testout_tile_GRAY_* testout_tile_420_* testout_tile_422_* testout_tile_444_* testout_tile.ppm
- echo GREAT SUCCESS!
-
-endif
-
-if CROSS_COMPILING
-bittest: testclean
-else
-bittest: testclean all
-endif
-
-# These tests are carefully crafted to provide full coverage of as many of the
-# underlying algorithms as possible (including all of the SIMD-accelerated
-# ones.)
-
-# CC: null SAMP: fullsize FDCT: islow ENT: huff
- ./cjpeg -rgb -dct int -outfile testout_rgb_islow.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_RGB_ISLOW) testout_rgb_islow.jpg
-# CC: null SAMP: fullsize IDCT: islow ENT: huff
- ./djpeg -dct int -ppm -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg
- md5/md5cmp $(MD5_PPM_RGB_ISLOW) testout_rgb_islow.ppm
- rm -f testout_rgb_islow.ppm
-if WITH_12BIT
- rm -f testout_rgb_islow.jpg
-else
-# CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff
- ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg
- md5/md5cmp $(MD5_BMP_RGB_ISLOW_565) testout_rgb_islow_565.bmp
- rm -f testout_rgb_islow_565.bmp
-# CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
- ./djpeg -dct int -rgb565 -bmp -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg
- md5/md5cmp $(MD5_BMP_RGB_ISLOW_565D) testout_rgb_islow_565D.bmp
- rm -f testout_rgb_islow_565D.bmp testout_rgb_islow.jpg
-endif
-
-# CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff
- ./cjpeg -sample 2x1 -dct fast -opt -outfile testout_422_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_422_IFAST_OPT) testout_422_ifast_opt.jpg
-# CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff
- ./djpeg -dct fast -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg
- md5/md5cmp $(MD5_PPM_422_IFAST) testout_422_ifast.ppm
- rm -f testout_422_ifast.ppm
-# CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff
- ./djpeg -dct fast -nosmooth -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg
- md5/md5cmp $(MD5_PPM_422M_IFAST) testout_422m_ifast.ppm
- rm -f testout_422m_ifast.ppm
-if WITH_12BIT
- rm -f testout_422_ifast_opt.jpg
-else
-# CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff
- ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg
- md5/md5cmp $(MD5_BMP_422M_IFAST_565) testout_422m_ifast_565.bmp
- rm -f testout_422m_ifast_565.bmp
-# CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff
- ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg
- md5/md5cmp $(MD5_BMP_422M_IFAST_565D) testout_422m_ifast_565D.bmp
- rm -f testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg
-endif
-
-# CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff
- ./cjpeg -sample 2x2 -quality 100 -dct fast -prog -outfile testout_420_q100_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_420_IFAST_Q100_PROG) testout_420_q100_ifast_prog.jpg
-# CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff
- ./djpeg -dct fast -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
- md5/md5cmp $(MD5_PPM_420_Q100_IFAST) testout_420_q100_ifast.ppm
- rm -f testout_420_q100_ifast.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff
- ./djpeg -dct fast -nosmooth -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
- md5/md5cmp $(MD5_PPM_420M_Q100_IFAST) testout_420m_q100_ifast.ppm
- rm -f testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg
-
-# CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff
- ./cjpeg -gray -dct int -outfile testout_gray_islow.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_GRAY_ISLOW) testout_gray_islow.jpg
-# CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff
- ./djpeg -dct int -outfile testout_gray_islow.ppm testout_gray_islow.jpg
- md5/md5cmp $(MD5_PPM_GRAY_ISLOW) testout_gray_islow.ppm
- rm -f testout_gray_islow.ppm
-# CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff
- ./djpeg -dct int -rgb -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg
- md5/md5cmp $(MD5_PPM_GRAY_ISLOW_RGB) testout_gray_islow_rgb.ppm
- rm -f testout_gray_islow_rgb.ppm
-if WITH_12BIT
- rm -f testout_gray_islow.jpg
-else
-# CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff
- ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg
- md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565) testout_gray_islow_565.bmp
- rm -f testout_gray_islow_565.bmp
-# CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
- ./djpeg -dct int -rgb565 -bmp -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg
- md5/md5cmp $(MD5_BMP_GRAY_ISLOW_565D) testout_gray_islow_565D.bmp
- rm -f testout_gray_islow_565D.bmp testout_gray_islow.jpg
-endif
-
-# CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow
-# ENT: 2-pass huff
- ./cjpeg -sample 2x2 -smooth 1 -dct int -opt -outfile testout_420s_ifast_opt.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_420S_IFAST_OPT) testout_420s_ifast_opt.jpg
- rm -f testout_420s_ifast_opt.jpg
-
-# The output of the floating point tests is not validated by default, because
-# the output differs depending on the type of floating point math used, and
-# this is only deterministic if the DCT/IDCT are implemented using SIMD
-# instructions on a particular platform. Pass one of the following on the make
-# command line to validate the floating point tests against one of the expected
-# results:
-#
-# FLOATTEST=sse validate against the expected results from the libjpeg-turbo
-# SSE SIMD extensions
-# FLOATTEST=32bit validate against the expected results from the C code
-# when running on a 32-bit FPU (or when SSE is being used for
-# floating point math, which is generally the default with
-# x86-64 compilers)
-# FLOATTEST=64bit validate against the exepected results from the C code
-# when running on a 64-bit FPU
-# FLOATTEST=387 validate against the expected results from the C code when
-# the 387 FPU is being used for floating point math (which is
-# generally the default with x86 compilers)
-
-# CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
- ./cjpeg -sample 3x2 -dct float -prog -outfile testout_3x2_float_prog.jpg $(srcdir)/testimages/testorig.ppm
- if [ "${FLOATTEST}" = "sse" ]; then \
- md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_SSE) testout_3x2_float_prog.jpg; \
- elif [ "${FLOATTEST}" = "32bit" -o "${FLOATTEST}" = "64bit" ]; then \
- md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_32BIT) testout_3x2_float_prog.jpg; \
- elif [ "${FLOATTEST}" = "387" ]; then \
- md5/md5cmp $(MD5_JPEG_3x2_FLOAT_PROG_387) testout_3x2_float_prog.jpg; \
- fi
-# CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff
- ./djpeg -dct float -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg
- if [ "${FLOATTEST}" = "sse" ]; then \
- md5/md5cmp $(MD5_PPM_3x2_FLOAT_SSE) testout_3x2_float.ppm; \
- elif [ "${FLOATTEST}" = "32bit" ]; then \
- md5/md5cmp $(MD5_PPM_3x2_FLOAT_32BIT) testout_3x2_float.ppm; \
- elif [ "${FLOATTEST}" = "64bit" ]; then \
- md5/md5cmp $(MD5_PPM_3x2_FLOAT_64BIT) testout_3x2_float.ppm; \
- elif [ "${FLOATTEST}" = "387" ]; then \
- md5/md5cmp $(MD5_PPM_3x2_FLOAT_387) testout_3x2_float.ppm; \
- fi
- rm -f testout_3x2_float.ppm testout_3x2_float_prog.jpg
-
-# CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff
- ./cjpeg -sample 3x2 -dct fast -prog -outfile testout_3x2_ifast_prog.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_3x2_IFAST_PROG) testout_3x2_ifast_prog.jpg
-# CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff
- ./djpeg -dct fast -outfile testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg
- md5/md5cmp $(MD5_PPM_3x2_IFAST) testout_3x2_ifast.ppm
- rm -f testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg
-
-if WITH_ARITH_ENC
-# CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith
- ./cjpeg -dct int -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg
- rm -f testout_420_islow_ari.jpg
- ./jpegtran -arithmetic -outfile testout_420_islow_ari.jpg $(srcdir)/testimages/testimgint.jpg
- md5/md5cmp $(MD5_JPEG_420_ISLOW_ARI) testout_420_islow_ari.jpg
- rm -f testout_420_islow_ari.jpg
-# CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith
- ./cjpeg -sample 1x1 -dct int -prog -arithmetic -outfile testout_444_islow_progari.jpg $(srcdir)/testimages/testorig.ppm
- md5/md5cmp $(MD5_JPEG_444_ISLOW_PROGARI) testout_444_islow_progari.jpg
- rm -f testout_444_islow_progari.jpg
-endif
-if WITH_ARITH_DEC
-# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
- ./djpeg -fast -ppm -outfile testout_420m_ifast_ari.ppm $(srcdir)/testimages/testimgari.jpg
- md5/md5cmp $(MD5_PPM_420M_IFAST_ARI) testout_420m_ifast_ari.ppm
- rm -f testout_420m_ifast_ari.ppm
- ./jpegtran -outfile testout_420_islow.jpg $(srcdir)/testimages/testimgari.jpg
- md5/md5cmp $(MD5_JPEG_420_ISLOW) testout_420_islow.jpg
- rm -f testout_420_islow.jpg
-endif
-
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff
- ./djpeg -dct int -scale 2/1 -nosmooth -ppm -outfile testout_420m_islow_2_1.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_2_1) testout_420m_islow_2_1.ppm
- rm -f testout_420m_islow_2_1.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff
- ./djpeg -dct int -scale 15/8 -nosmooth -ppm -outfile testout_420m_islow_15_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_15_8) testout_420m_islow_15_8.ppm
- rm -f testout_420m_islow_15_8.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff
- ./djpeg -dct int -scale 13/8 -nosmooth -ppm -outfile testout_420m_islow_13_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_13_8) testout_420m_islow_13_8.ppm
- rm -f testout_420m_islow_13_8.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff
- ./djpeg -dct int -scale 11/8 -nosmooth -ppm -outfile testout_420m_islow_11_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_11_8) testout_420m_islow_11_8.ppm
- rm -f testout_420m_islow_11_8.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff
- ./djpeg -dct int -scale 9/8 -nosmooth -ppm -outfile testout_420m_islow_9_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_9_8) testout_420m_islow_9_8.ppm
- rm -f testout_420m_islow_9_8.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow ENT: huff
- ./djpeg -dct int -scale 7/8 -nosmooth -ppm -outfile testout_420m_islow_7_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_7_8) testout_420m_islow_7_8.ppm
- rm -f testout_420m_islow_7_8.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow ENT: huff
- ./djpeg -dct int -scale 3/4 -nosmooth -ppm -outfile testout_420m_islow_3_4.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_3_4) testout_420m_islow_3_4.ppm
- rm -f testout_420m_islow_3_4.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow ENT: huff
- ./djpeg -dct int -scale 5/8 -nosmooth -ppm -outfile testout_420m_islow_5_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_5_8) testout_420m_islow_5_8.ppm
- rm -f testout_420m_islow_5_8.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow ENT: huff
- ./djpeg -dct int -scale 1/2 -nosmooth -ppm -outfile testout_420m_islow_1_2.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_1_2) testout_420m_islow_1_2.ppm
- rm -f testout_420m_islow_1_2.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow ENT: huff
- ./djpeg -dct int -scale 3/8 -nosmooth -ppm -outfile testout_420m_islow_3_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_3_8) testout_420m_islow_3_8.ppm
- rm -f testout_420m_islow_3_8.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow ENT: huff
- ./djpeg -dct int -scale 1/4 -nosmooth -ppm -outfile testout_420m_islow_1_4.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_1_4) testout_420m_islow_1_4.ppm
- rm -f testout_420m_islow_1_4.ppm
-# CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow ENT: huff
- ./djpeg -dct int -scale 1/8 -nosmooth -ppm -outfile testout_420m_islow_1_8.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420M_ISLOW_1_8) testout_420m_islow_1_8.ppm
- rm -f testout_420m_islow_1_8.ppm
-if WITH_12BIT
-else
-# CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
- ./djpeg -dct int -colors 256 -bmp -outfile testout_420_islow_256.bmp $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_BMP_420_ISLOW_256) testout_420_islow_256.bmp
- rm -f testout_420_islow_256.bmp
-# CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff
- ./djpeg -dct int -rgb565 -dither none -bmp -outfile testout_420_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_BMP_420_ISLOW_565) testout_420_islow_565.bmp
- rm -f testout_420_islow_565.bmp
-# CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
- ./djpeg -dct int -rgb565 -bmp -outfile testout_420_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_BMP_420_ISLOW_565D) testout_420_islow_565D.bmp
- rm -f testout_420_islow_565D.bmp
-# CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff
- ./djpeg -dct int -nosmooth -rgb565 -dither none -bmp -outfile testout_420m_islow_565.bmp $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_BMP_420M_ISLOW_565) testout_420m_islow_565.bmp
- rm -f testout_420m_islow_565.bmp
-# CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff
- ./djpeg -dct int -nosmooth -rgb565 -bmp -outfile testout_420m_islow_565D.bmp $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_BMP_420M_ISLOW_565D) testout_420m_islow_565D.bmp
- rm -f testout_420m_islow_565D.bmp
-endif
-
-# Partial decode tests. These tests are designed to cover all of the possible
-# code paths in jpeg_skip_scanlines().
-
-# Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff
- ./djpeg -dct int -skip 15,31 -ppm -outfile testout_420_islow_skip15,31.ppm $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_PPM_420_ISLOW_SKIP15_31) testout_420_islow_skip15,31.ppm
- rm -f testout_420_islow_skip15,31.ppm
-# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith
-if WITH_ARITH_DEC
- ./djpeg -dct int -skip 16,139 -ppm -outfile testout_420_islow_ari_skip16,139.ppm $(srcdir)/testimages/testimgari.jpg
- md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_SKIP16_139) testout_420_islow_ari_skip16,139.ppm
- rm -f testout_420_islow_ari_skip16,139.ppm
-endif
-# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff
- ./cjpeg -dct int -prog -outfile testout_420_islow_prog.jpg $(srcdir)/testimages/testorig.ppm
- ./djpeg -dct int -crop 62x62+71+71 -ppm -outfile testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg
- md5/md5cmp $(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71) testout_420_islow_prog_crop62x62,71,71.ppm
- rm -f testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg
-# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith
-if WITH_ARITH_DEC
- ./djpeg -dct int -crop 53x53+4+4 -ppm -outfile testout_420_islow_ari_crop53x53,4,4.ppm $(srcdir)/testimages/testimgari.jpg
- md5/md5cmp $(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4) testout_420_islow_ari_crop53x53,4,4.ppm
- rm -f testout_420_islow_ari_crop53x53,4,4.ppm
-endif
-# Context rows: No Intra-iMCU row: Yes ENT: huff
- ./cjpeg -dct int -sample 1x1 -outfile testout_444_islow.jpg $(srcdir)/testimages/testorig.ppm
- ./djpeg -dct int -skip 1,6 -ppm -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg
- md5/md5cmp $(MD5_PPM_444_ISLOW_SKIP1_6) testout_444_islow_skip1,6.ppm
- rm -f testout_444_islow_skip1,6.ppm testout_444_islow.jpg
-# Context rows: No Intra-iMCU row: No ENT: prog huff
- ./cjpeg -dct int -prog -sample 1x1 -outfile testout_444_islow_prog.jpg $(srcdir)/testimages/testorig.ppm
- ./djpeg -dct int -crop 98x98+13+13 -ppm -outfile testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg
- md5/md5cmp $(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13) testout_444_islow_prog_crop98x98,13,13.ppm
- rm -f testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg
-# Context rows: No Intra-iMCU row: No ENT: arith
-if WITH_ARITH_ENC
- ./cjpeg -dct int -arithmetic -sample 1x1 -outfile testout_444_islow_ari.jpg $(srcdir)/testimages/testorig.ppm
-if WITH_ARITH_DEC
- ./djpeg -dct int -crop 37x37+0+0 -ppm -outfile testout_444_islow_ari_crop37x37,0,0.ppm testout_444_islow_ari.jpg
- md5/md5cmp $(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0) testout_444_islow_ari_crop37x37,0,0.ppm
- rm -f testout_444_islow_ari_crop37x37,0,0.ppm
-endif
- rm -f testout_444_islow_ari.jpg
-endif
-
- ./jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testout_crop.jpg $(srcdir)/testimages/$(TESTORIG)
- md5/md5cmp $(MD5_JPEG_CROP) testout_crop.jpg
- rm -f testout_crop.jpg
- echo GREAT SUCCESS!
-
-
-testclean:
- rm -f testout*
- rm -f *_GRAY_*.bmp
- rm -f *_GRAY_*.png
- rm -f *_GRAY_*.ppm
- rm -f *_GRAY_*.jpg
- rm -f *_GRAY.yuv
- rm -f *_420_*.bmp
- rm -f *_420_*.png
- rm -f *_420_*.ppm
- rm -f *_420_*.jpg
- rm -f *_420.yuv
- rm -f *_422_*.bmp
- rm -f *_422_*.png
- rm -f *_422_*.ppm
- rm -f *_422_*.jpg
- rm -f *_422.yuv
- rm -f *_444_*.bmp
- rm -f *_444_*.png
- rm -f *_444_*.ppm
- rm -f *_444_*.jpg
- rm -f *_444.yuv
- rm -f *_440_*.bmp
- rm -f *_440_*.png
- rm -f *_440_*.ppm
- rm -f *_440_*.jpg
- rm -f *_440.yuv
- rm -f *_411_*.bmp
- rm -f *_411_*.png
- rm -f *_411_*.ppm
- rm -f *_411_*.jpg
- rm -f *_411.yuv
-
-
-tjtest:
- sh ./tjbenchtest
- sh ./tjbenchtest -alloc
- sh ./tjbenchtest -yuv
- sh ./tjbenchtest -yuv -alloc
-if WITH_JAVA
- sh ./tjbenchtest.java
- sh ./tjbenchtest.java -yuv
-endif
-
-
-pkgscripts/libjpeg-turbo.spec: pkgscripts/libjpeg-turbo.spec.tmpl
- cat pkgscripts/libjpeg-turbo.spec.tmpl | sed s@%{__prefix}@$(prefix)@g | \
- sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \
- sed s@%{__docdir}@$(docdir)@g | sed s@%{__includedir}@$(includedir)@g | \
- sed s@%{__libdir}@$(libdir)@g | sed s@%{__mandir}@$(mandir)@g \
- > pkgscripts/libjpeg-turbo.spec
-
-rpm: all pkgscripts/libjpeg-turbo.spec
- TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
- mkdir -p $$TMPDIR/RPMS; \
- ln -fs `pwd` $$TMPDIR/BUILD; \
- rm -f ${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
- rpmbuild -bb --define "_blddir $$TMPDIR/buildroot" \
- --define "_topdir $$TMPDIR" \
- --target ${RPMARCH} pkgscripts/libjpeg-turbo.spec; \
- cp $$TMPDIR/RPMS/${RPMARCH}/${PKGNAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \
- ${PKGNAME}-${VERSION}.${RPMARCH}.rpm; \
- rm -rf $$TMPDIR
-
-srpm: dist-gzip pkgscripts/libjpeg-turbo.spec
- TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
- mkdir -p $$TMPDIR/RPMS; \
- mkdir -p $$TMPDIR/SRPMS; \
- mkdir -p $$TMPDIR/BUILD; \
- mkdir -p $$TMPDIR/SOURCES; \
- mkdir -p $$TMPDIR/SPECS; \
- rm -f ${PKGNAME}-${VERSION}.src.rpm; \
- cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
- cat pkgscripts/libjpeg-turbo.spec | sed s/%{_blddir}/%{_tmppath}/g \
- | sed s/#--\>//g \
- > $$TMPDIR/SPECS/libjpeg-turbo.spec; \
- rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/libjpeg-turbo.spec; \
- cp $$TMPDIR/SRPMS/${PKGNAME}-${VERSION}-${BUILD}.src.rpm \
- ${PKGNAME}-${VERSION}.src.rpm; \
- rm -rf $$TMPDIR
-
-pkgscripts/makedpkg: pkgscripts/makedpkg.tmpl
- cat pkgscripts/makedpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
- sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \
- > pkgscripts/makedpkg
-
-deb: all pkgscripts/makedpkg
- sh pkgscripts/makedpkg
-
-pkgscripts/uninstall: pkgscripts/uninstall.tmpl
- cat pkgscripts/uninstall.tmpl | sed s@%{__prefix}@$(prefix)@g | \
- sed s@%{__bindir}@$(bindir)@g | sed s@%{__datadir}@$(datadir)@g | \
- sed s@%{__includedir}@$(includedir)@g | sed s@%{__libdir}@$(libdir)@g | \
- sed s@%{__mandir}@$(mandir)@g > pkgscripts/uninstall
-
-pkgscripts/makemacpkg: pkgscripts/makemacpkg.tmpl
- cat pkgscripts/makemacpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
- sed s@%{__bindir}@$(bindir)@g | sed s@%{__docdir}@$(docdir)@g | \
- sed s@%{__libdir}@$(libdir)@g > pkgscripts/makemacpkg
-
-if X86_64
-
-udmg: all pkgscripts/makemacpkg pkgscripts/uninstall
- sh pkgscripts/makemacpkg -build32 ${BUILDDIR32}
-
-iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall
- sh pkgscripts/makemacpkg -build32 ${BUILDDIR32} -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} -buildarmv8 ${BUILDDIRARMV8} -lipo "${LIPO}"
-
-else
-
-iosdmg: all pkgscripts/makemacpkg pkgscripts/uninstall
- sh pkgscripts/makemacpkg -buildarmv7 ${BUILDDIRARMV7} -buildarmv7s ${BUILDDIRARMV7S} -buildarmv8 ${BUILDDIRARMV8} -lipo "${LIPO}"
-
-endif
-
-dmg: all pkgscripts/makemacpkg pkgscripts/uninstall
- sh pkgscripts/makemacpkg
-
-pkgscripts/makecygwinpkg: pkgscripts/makecygwinpkg.tmpl
- cat pkgscripts/makecygwinpkg.tmpl | sed s@%{__prefix}@$(prefix)@g | \
- sed s@%{__docdir}@$(docdir)@g | sed s@%{__libdir}@$(libdir)@g \
- > pkgscripts/makecygwinpkg
-
-cygwinpkg: all pkgscripts/makecygwinpkg
- sh pkgscripts/makecygwinpkg
+++ /dev/null
-# AC_PROG_NASM
-# --------------------------
-# Check that NASM exists and determine flags
-AC_DEFUN([AC_PROG_NASM],[
-
-AC_ARG_VAR(NASM, [NASM command (used to build the x86/x86-64 SIMD code)])
-if test "x$NASM" = "x"; then
- AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
- test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found])
-fi
-
-AC_MSG_CHECKING([for object file format of host system])
-case "$host_os" in
- cygwin* | mingw* | pw32* | interix*)
- case "$host_cpu" in
- x86_64)
- objfmt='Win64-COFF'
- ;;
- *)
- objfmt='Win32-COFF'
- ;;
- esac
- ;;
- msdosdjgpp* | go32*)
- objfmt='COFF'
- ;;
- os2-emx*) # not tested
- objfmt='MSOMF' # obj
- ;;
- linux*coff* | linux*oldld*)
- objfmt='COFF' # ???
- ;;
- linux*aout*)
- objfmt='a.out'
- ;;
- linux*)
- case "$host_cpu" in
- x86_64)
- objfmt='ELF64'
- ;;
- *)
- objfmt='ELF'
- ;;
- esac
- ;;
- kfreebsd* | freebsd* | netbsd* | openbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- objfmt='BSD-a.out'
- else
- case "$host_cpu" in
- x86_64 | amd64)
- objfmt='ELF64'
- ;;
- *)
- objfmt='ELF'
- ;;
- esac
- fi
- ;;
- solaris* | sunos* | sysv* | sco*)
- case "$host_cpu" in
- x86_64)
- objfmt='ELF64'
- ;;
- *)
- objfmt='ELF'
- ;;
- esac
- ;;
- darwin* | rhapsody* | nextstep* | openstep* | macos*)
- case "$host_cpu" in
- x86_64)
- objfmt='Mach-O64'
- ;;
- *)
- objfmt='Mach-O'
- ;;
- esac
- ;;
- *)
- objfmt='ELF ?'
- ;;
-esac
-
-AC_MSG_RESULT([$objfmt])
-if test "$objfmt" = 'ELF ?'; then
- objfmt='ELF'
- AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
-fi
-
-AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
-case "$objfmt" in
- MSOMF) NAFLAGS='-fobj -DOBJ32';;
- Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
- Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
- COFF) NAFLAGS='-fcoff -DCOFF';;
- a.out) NAFLAGS='-faout -DAOUT';;
- BSD-a.out) NAFLAGS='-faoutb -DAOUT';;
- ELF) NAFLAGS='-felf -DELF';;
- ELF64) NAFLAGS='-felf64 -DELF -D__x86_64__';;
- RDF) NAFLAGS='-frdf -DRDF';;
- Mach-O) NAFLAGS='-fmacho -DMACHO';;
- Mach-O64) NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
-esac
-AC_MSG_RESULT([$NAFLAGS])
-AC_SUBST([NAFLAGS])
-
-AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
-cat > conftest.asm <<EOF
-[%line __oline__ "configure"
- section .text
- global _main,main
-_main:
-main: xor eax,eax
- ret
-]EOF
-try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
-if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
- AC_MSG_RESULT(yes)
-else
- echo "configure: failed program was:" >&AC_FD_CC
- cat conftest.asm >&AC_FD_CC
- rm -rf conftest*
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([installation or configuration problem: assembler cannot create object files.])
-fi
-
-AC_MSG_CHECKING([whether the linker accepts assembler output])
-try_nasm='${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.o $LIBS 1>&AC_FD_CC'
-if AC_TRY_EVAL(try_nasm) && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- AC_MSG_RESULT(yes)
-else
- rm -rf conftest*
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([configuration problem: maybe object file format mismatch.])
-fi
-
-])
-
-# AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE
-# --------------------------
-# Test whether the assembler is suitable and supports NEON instructions
-AC_DEFUN([AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE],[
- ac_good_gnu_arm_assembler=no
- ac_save_CC="$CC"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS="$CCASFLAGS -x assembler-with-cpp"
- CC="$CCAS"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- .text
- .fpu neon
- .arch armv7a
- .object_arch armv4
- .arm
- pld [r0]
- vmovn.u16 d0, q0]])], ac_good_gnu_arm_assembler=yes)
-
- ac_use_gas_preprocessor=no
- if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
- CC="gas-preprocessor.pl $CCAS"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- .text
- .fpu neon
- .arch armv7a
- .object_arch armv4
- .arm
- pld [r0]
- vmovn.u16 d0, q0]])], ac_use_gas_preprocessor=yes)
- fi
- CFLAGS="$ac_save_CFLAGS"
- CC="$ac_save_CC"
-
- if test "x$ac_use_gas_preprocessor" = "xyes" ; then
- CCAS="gas-preprocessor.pl $CCAS"
- AC_SUBST([CCAS])
- ac_good_gnu_arm_assembler=yes
- fi
-
- if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
- $1
- else
- $2
- fi
-])
-
-# AC_CHECK_COMPATIBLE_MIPSEL_ASSEMBLER_IFELSE
-# --------------------------
-# Test whether the assembler is suitable and supports MIPS instructions
-AC_DEFUN([AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE],[
- have_mips_dspr2=no
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS="$CCASFLAGS -mdspr2"
-
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-
- int main ()
- {
- int c = 0, a = 0, b = 0;
- __asm__ __volatile__ (
- "precr.qb.ph %[c], %[a], %[b] \n\t"
- : [c] "=r" (c)
- : [a] "r" (a), [b] "r" (b)
- );
- return c;
- }
- ]])], have_mips_dspr2=yes)
- CFLAGS=$ac_save_CFLAGS
-
- if test "x$have_mips_dspr2" = "xyes" ; then
- $1
- else
- $2
- fi
-])
-
-AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[
- ac_good_gnu_arm_assembler=no
- ac_save_CC="$CC"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS="$CCASFLAGS -x assembler-with-cpp"
- CC="$CCAS"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- .text
- MYVAR .req x0
- movi v0.16b, #100
- mov MYVAR, #100
- .unreq MYVAR]])], ac_good_gnu_arm_assembler=yes)
-
- ac_use_gas_preprocessor=no
- if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
- CC="gas-preprocessor.pl $CCAS"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- .text
- MYVAR .req x0
- movi v0.16b, #100
- mov MYVAR, #100
- .unreq MYVAR]])], ac_use_gas_preprocessor=yes)
- fi
- CFLAGS="$ac_save_CFLAGS"
- CC="$ac_save_CC"
-
- if test "x$ac_use_gas_preprocessor" = "xyes" ; then
- CCAS="gas-preprocessor.pl $CCAS"
- AC_SUBST([CCAS])
- ac_good_gnu_arm_assembler=yes
- fi
-
- if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
- $1
- else
- $2
- fi
-])
set MSYSTEM=MINGW32
- bash -c "pacman --noconfirm -S autoconf automake libtool zip"
+ bash -c "pacman --noconfirm -S zip"
mklink /d "%ProgramData%\Oracle\Java32" "c:\Program Files (x86)\Java\jdk1.6.0"
- git clone --depth=1 https://github.com/libjpeg-turbo/buildscripts.git c:/buildscripts
+ git clone --depth=1 https://github.com/libjpeg-turbo/buildscripts.git -b %APPVEYOR_REPO_BRANCH% c:/buildscripts
build_script:
- cmd: >-
--- /dev/null
+# This file is included from the top-level CMakeLists.txt. We just store it
+# here to avoid cluttering up that file.
+
+set(PKGNAME ${CMAKE_PROJECT_NAME} CACHE STRING
+ "Distribution package name (default: ${CMAKE_PROJECT_NAME})")
+set(PKGVENDOR "The ${CMAKE_PROJECT_NAME} Project" CACHE STRING
+ "Vendor name to be included in distribution package descriptions (default: The ${CMAKE_PROJECT_NAME} Project)")
+set(PKGURL "http://www.${CMAKE_PROJECT_NAME}.org" CACHE STRING
+ "URL of project web site to be included in distribution package descriptions (default: http://www.${CMAKE_PROJECT_NAME}.org)")
+set(PKGEMAIL "information@${CMAKE_PROJECT_NAME}.org" CACHE STRING
+ "E-mail of project maintainer to be included in distribution package descriptions (default: information@${CMAKE_PROJECT_NAME}.org")
+set(PKGID "com.${CMAKE_PROJECT_NAME}.${PKGNAME}" CACHE STRING
+ "Globally unique package identifier (reverse DNS notation) (default: com.${CMAKE_PROJECT_NAME}.${PKGNAME})")
+
+
+###############################################################################
+# Linux RPM and DEB
+###############################################################################
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+
+set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR})
+if(CPU_TYPE STREQUAL "x86_64")
+ set(DEBARCH amd64)
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7*")
+ set(DEBARCH armhf)
+elseif(CPU_TYPE STREQUAL "arm64")
+ set(DEBARCH ${CPU_TYPE})
+elseif(CPU_TYPE STREQUAL "arm")
+ set(DEBARCH armel)
+else()
+ set(DEBARCH ${CMAKE_SYSTEM_PROCESSOR})
+endif()
+message(STATUS "RPM architecture = ${RPMARCH}, DEB architecture = ${DEBARCH}")
+
+# Re-set CMAKE_POSITION_INDEPENDENT_CODE so that the RPM spec file works
+# properly
+boolean_number(CMAKE_POSITION_INDEPENDENT_CODE)
+
+configure_file(release/makerpm.in pkgscripts/makerpm)
+configure_file(release/${CMAKE_PROJECT_NAME}.spec.in
+ pkgscripts/${CMAKE_PROJECT_NAME}.spec @ONLY)
+
+add_custom_target(rpm sh pkgscripts/makerpm
+ SOURCES pkgscripts/makerpm)
+
+configure_file(release/makesrpm.in pkgscripts/makesrpm)
+
+add_custom_target(srpm sh pkgscripts/makesrpm
+ SOURCES pkgscripts/makesrpm
+ DEPENDS dist)
+
+configure_file(release/makedpkg.in pkgscripts/makedpkg)
+configure_file(release/deb-control.in pkgscripts/deb-control)
+
+add_custom_target(deb sh pkgscripts/makedpkg
+ SOURCES pkgscripts/makedpkg)
+
+endif() # Linux
+
+
+###############################################################################
+# Windows installer (NullSoft Installer)
+###############################################################################
+
+if(WIN32)
+
+if(MSVC)
+ set(INST_PLATFORM "Visual C++")
+ set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
+ set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
+elseif(MINGW)
+ set(INST_PLATFORM GCC)
+ set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
+ set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
+ set(INST_DEFS -DGCC)
+endif()
+
+if(BITS EQUAL 64)
+ set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
+ set(INST_NAME ${INST_NAME}64)
+ set(INST_REG_NAME ${INST_DIR}64)
+ set(INST_DEFS ${INST_DEFS} -DWIN64)
+endif()
+
+if(WITH_JAVA)
+ set(INST_DEFS ${INST_DEFS} -DJAVA)
+endif()
+
+if(MSVC_IDE)
+ set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
+else()
+ set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
+endif()
+
+STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
+
+configure_file(release/${CMAKE_PROJECT_NAME}.nsi.in ${CMAKE_PROJECT_NAME}.nsi @ONLY)
+
+if(WITH_JAVA)
+ set(JAVA_DEPEND java)
+endif()
+add_custom_target(installer
+ makensis -nocd ${INST_DEFS} ${CMAKE_PROJECT_NAME}.nsi
+ DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
+ cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
+ SOURCES ${CMAKE_PROJECT_NAME}.nsi)
+
+endif() # WIN32
+
+
+###############################################################################
+# Cygwin Package
+###############################################################################
+
+if(CYGWIN)
+
+configure_file(release/makecygwinpkg.in pkgscripts/makecygwinpkg)
+
+add_custom_target(cygwinpkg sh pkgscripts/makecygwinpkg)
+
+endif() # CYGWIN
+
+
+###############################################################################
+# Mac DMG
+###############################################################################
+
+if(APPLE)
+
+set(DEFAULT_OSX_32BIT_BUILD ${CMAKE_SOURCE_DIR}/osxx86)
+set(OSX_32BIT_BUILD ${DEFAULT_OSX_32BIT_BUILD} CACHE PATH
+ "Directory containing 32-bit (i386) Mac build to include in universal binaries (default: ${DEFAULT_OSX_32BIT_BUILD})")
+set(DEFAULT_IOS_ARMV7_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7)
+set(IOS_ARMV7_BUILD ${DEFAULT_IOS_ARMV7_BUILD} CACHE PATH
+ "Directory containing ARMv7 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7_BUILD})")
+set(DEFAULT_IOS_ARMV7S_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7s)
+set(IOS_ARMV7S_BUILD ${DEFAULT_IOS_ARMV7S_BUILD} CACHE PATH
+ "Directory containing ARMv7s iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7S_BUILD})")
+set(DEFAULT_IOS_ARMV8_BUILD ${CMAKE_SOURCE_DIR}/iosarmv8)
+set(IOS_ARMV8_BUILD ${DEFAULT_IOS_ARMV8_BUILD} CACHE PATH
+ "Directory containing ARMv8 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV8_BUILD})")
+
+configure_file(release/makemacpkg.in pkgscripts/makemacpkg)
+configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
+configure_file(release/uninstall.in pkgscripts/uninstall)
+
+add_custom_target(dmg sh pkgscripts/makemacpkg
+ SOURCES pkgscripts/makemacpkg)
+
+add_custom_target(udmg sh pkgscripts/makemacpkg universal
+ SOURCES pkgscripts/makemacpkg)
+
+endif() # APPLE
+
+
+###############################################################################
+# Generic
+###############################################################################
+
+add_custom_target(dist
+ COMMAND git archive --prefix=${CMAKE_PROJECT_NAME}-${VERSION}/ HEAD |
+ gzip > ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}.tar.gz
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+
+configure_file(release/maketarball.in pkgscripts/maketarball)
+
+add_custom_target(tarball sh pkgscripts/maketarball
+ SOURCES pkgscripts/maketarball)
+
+configure_file(release/libjpeg.pc.in pkgscripts/libjpeg.pc @ONLY)
+
+configure_file(release/libturbojpeg.pc.in pkgscripts/libturbojpeg.pc @ONLY)
+++ /dev/null
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.56])
-AC_INIT([libjpeg-turbo], [1.5.80])
-
-AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
-AC_PREFIX_DEFAULT(/opt/libjpeg-turbo)
-
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-# Checks for programs.
-SAVED_CFLAGS=${CFLAGS}
-SAVED_CPPFLAGS=${CPPFLAGS}
-AC_PROG_CPP
-AC_PROG_CC
-m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
-AM_PROG_AS
-AM_PROG_CC_C_O
-AC_PROG_INSTALL
-AC_PROG_LIBTOOL
-AC_PROG_LN_S
-
-AC_ARG_WITH([build-date], [Use custom build string to enable reproducible builds (default: YYMMDD)],
- [BUILD="$with_build_date"],
- [BUILD=`date +%Y%m%d`])
-
-PKG_PROG_PKG_CONFIG
-
-# When the prefix is /opt/libjpeg-turbo, we assume that an "official" binary is
-# being created, and thus we install things into specific locations.
-
-old_prefix=${prefix}
-if test "x$prefix" = "xNONE" -a "x$ac_default_prefix" != "x"; then
- prefix=$ac_default_prefix
-fi
-DATADIR=`eval echo ${datadir}`
-DATADIR=`eval echo $DATADIR`
-if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
- datadir='${prefix}'
-fi
-DATADIR=`eval echo ${datarootdir}`
-DATADIR=`eval echo $DATADIR`
-if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
- datarootdir='${prefix}'
-fi
-DOCDIR=`eval echo ${docdir}`
-DOCDIR=`eval echo $DOCDIR`
-if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then
- docdir='${datadir}/doc'
-fi
-
-old_exec_prefix=${exec_prefix}
-if test "x$exec_prefix" = "xNONE"; then
- exec_prefix=${prefix}
-fi
-
-AC_CHECK_SIZEOF(size_t)
-
-if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
- LIBDIR=`eval echo ${libdir}`
- LIBDIR=`eval echo $LIBDIR`
- if test "$LIBDIR" = "/opt/libjpeg-turbo/lib"; then
- case $host_os in
- darwin*)
- ;;
- *)
- if test "${ac_cv_sizeof_size_t}" = "8"; then
- libdir='${exec_prefix}/lib64'
- elif test "${ac_cv_sizeof_size_t}" = "4"; then
- libdir='${exec_prefix}/lib32'
- fi
- ;;
- esac
- fi
-fi
-exec_prefix=${old_exec_prefix}
-prefix=${old_prefix}
-
-# Check whether compiler supports pointers to undefined structures
-AC_MSG_CHECKING(whether compiler supports pointers to undefined structures)
-AC_TRY_COMPILE([ typedef struct undefined_structure *undef_struct_ptr; ], ,
- AC_MSG_RESULT(yes),
- [AC_MSG_RESULT(no)
- AC_DEFINE([INCOMPLETE_TYPES_BROKEN], [1],
- [Compiler does not support pointers to undefined structures.])])
-
-if test "x${GCC}" = "xyes"; then
- if test "x${SAVED_CFLAGS}" = "x"; then
- CFLAGS=-O3
- fi
- if test "x${SAVED_CPPFLAGS}" = "x"; then
- CPPFLAGS=-Wall
- fi
-fi
-
-AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
-if test "x${SUNCC}" = "xyes"; then
- if test "x${SAVED_CFLAGS}" = "x"; then
- CFLAGS=-xO5
- fi
-fi
-
-# Checks for libraries.
-
-# Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h])
-AC_CHECK_HEADER([sys/types.h],
- AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include <sys/types.h> to get size_t.]))
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_CHAR_UNSIGNED
-AC_C_INLINE
-AC_TYPE_SIZE_T
-AC_CHECK_TYPES([unsigned char, unsigned short])
-
-AC_MSG_CHECKING([if right shift is signed])
-AC_TRY_RUN(
- [#include <stdio.h>
- int is_shifting_signed (long arg) {
- long res = arg >> 4;
-
- if (res == -0x7F7E80CL)
- return 1; /* right shift is signed */
-
- /* see if unsigned-shift hack will fix it. */
- /* we can't just test exact value since it depends on width of long... */
- res |= (~0L) << (32-4);
- if (res == -0x7F7E80CL)
- return 0; /* right shift is unsigned */
-
- printf("Right shift isn't acting as I expect it to.\n");
- printf("I fear the JPEG software will not work at all.\n\n");
- return 0; /* try it with unsigned anyway */
- }
- int main (void) {
- exit(is_shifting_signed(-0x7F7E80B1L));
- }],
- [AC_MSG_RESULT(no)
- AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1,
- [Define if your (broken) compiler shifts signed values as if they were unsigned.])],
- [AC_MSG_RESULT(yes)],
- [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
-
-# Checks for library functions.
-AC_CHECK_FUNCS([memset memcpy], [],
- [AC_DEFINE([NEED_BSD_STRINGS], 1,
- [Define if you have BSD-like bzero and bcopy in <strings.h> rather than memset/memcpy in <string.h>.])])
-
-AC_MSG_CHECKING([libjpeg API version])
-AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
-if test "x$JPEG_LIB_VERSION" = "x"; then
- AC_ARG_WITH([jpeg7],
- AC_HELP_STRING([--with-jpeg7],
- [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
- AC_ARG_WITH([jpeg8],
- AC_HELP_STRING([--with-jpeg8],
- [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
- if test "x${with_jpeg8}" = "xyes"; then
- JPEG_LIB_VERSION=80
- else
- if test "x${with_jpeg7}" = "xyes"; then
- JPEG_LIB_VERSION=70
- else
- JPEG_LIB_VERSION=62
- fi
- fi
-fi
-JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
-AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
-AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
-AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION],
- [libjpeg API version])
-
-AC_ARG_VAR(SO_MAJOR_VERSION,
- [Major version of the libjpeg-turbo shared library (default is determined by the API version)])
-AC_ARG_VAR(SO_MINOR_VERSION,
- [Minor version of the libjpeg-turbo shared library (default is determined by the API version)])
-if test "x$SO_MAJOR_VERSION" = "x"; then
- case "$JPEG_LIB_VERSION" in
- 62) SO_MAJOR_VERSION=$JPEG_LIB_VERSION ;;
- *) SO_MAJOR_VERSION=`expr $JPEG_LIB_VERSION / 10` ;;
- esac
-fi
-if test "x$SO_MINOR_VERSION" = "x"; then
- case "$JPEG_LIB_VERSION" in
- 80) SO_MINOR_VERSION=2 ;;
- *) SO_MINOR_VERSION=0 ;;
- esac
-fi
-
-RPM_CONFIG_ARGS=
-
-# Memory source/destination managers
-SO_AGE=1
-MEM_SRCDST_FUNCTIONS=
-if test "x${with_jpeg8}" != "xyes"; then
- AC_MSG_CHECKING([whether to include in-memory source/destination managers])
- AC_ARG_WITH([mem-srcdst],
- AC_HELP_STRING([--without-mem-srcdst],
- [Do not include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI]))
- if test "x$with_mem_srcdst" != "xno"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE([MEM_SRCDST_SUPPORTED], [1],
- [Support in-memory source/destination managers])
- SO_AGE=2
- MEM_SRCDST_FUNCTIONS="global: jpeg_mem_dest; jpeg_mem_src;";
- else
- AC_MSG_RESULT(no)
- RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-mem-srcdst"
- fi
-fi
-
-AC_MSG_CHECKING([libjpeg shared library version])
-AC_MSG_RESULT([$SO_MAJOR_VERSION.$SO_AGE.$SO_MINOR_VERSION])
-LIBTOOL_CURRENT=`expr $SO_MAJOR_VERSION + $SO_AGE`
-AC_SUBST(LIBTOOL_CURRENT)
-AC_SUBST(SO_MAJOR_VERSION)
-AC_SUBST(SO_MINOR_VERSION)
-AC_SUBST(SO_AGE)
-AC_SUBST(MEM_SRCDST_FUNCTIONS)
-
-AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION, [$VERSION], [libjpeg-turbo version])
-
-m4_define(version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
-m4_define(version_major,m4_argn(1,version_triplet))
-m4_define(version_minor,m4_argn(2,version_triplet))
-m4_define(version_revision,m4_argn(3,version_triplet))
-VERSION_MAJOR=version_major
-VERSION_MINOR=version_minor
-VERSION_REVISION=version_revision
-LIBJPEG_TURBO_VERSION_NUMBER=`printf "%d%03d%03d" $VERSION_MAJOR $VERSION_MINOR $VERSION_REVISION`
-AC_DEFINE_UNQUOTED(LIBJPEG_TURBO_VERSION_NUMBER, [$LIBJPEG_TURBO_VERSION_NUMBER], [libjpeg-turbo version in integer form])
-
-VERSION_SCRIPT=yes
-AC_ARG_ENABLE([ld-version-script],
- AS_HELP_STRING([--disable-ld-version-script],
- [Disable linker version script for libjpeg-turbo (default is to use linker version script if the linker supports it)]),
- [VERSION_SCRIPT=$enableval], [])
-
-AC_MSG_CHECKING([whether the linker supports version scripts])
-SAVED_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
-cat > conftest.map <<EOF
-VERS_1 {
- global: *;
-};
-EOF
-AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
- [VERSION_SCRIPT_FLAG=-Wl,--version-script,;
- AC_MSG_RESULT([yes (GNU style)])],
- [])
-if test "x$VERSION_SCRIPT_FLAG" = "x"; then
- LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
- [VERSION_SCRIPT_FLAG=-Wl,-M,;
- AC_MSG_RESULT([yes (Sun style)])],
- [])
-fi
-if test "x$VERSION_SCRIPT_FLAG" = "x"; then
- VERSION_SCRIPT=no
- AC_MSG_RESULT(no)
-fi
-LDFLAGS="$SAVED_LDFLAGS"
-
-AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
-AC_MSG_RESULT($VERSION_SCRIPT)
-
-AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
-AC_SUBST(VERSION_SCRIPT_FLAG)
-
-# Check for non-broken inline under various spellings
-AC_MSG_CHECKING(for inline)
-ljt_cv_inline=""
-AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; }
-int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))",
-AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
-int bar() { return foo();], ljt_cv_inline="__inline__",
-AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
-int bar() { return foo();], ljt_cv_inline="__inline",
-AC_TRY_COMPILE(, [} inline int foo() { return 0; }
-int bar() { return foo();], ljt_cv_inline="inline"))))
-AC_MSG_RESULT($ljt_cv_inline)
-AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
-
-# Arithmetic coding support
-AC_MSG_CHECKING([whether to include arithmetic encoding support])
-AC_ARG_WITH([arith-enc],
- AC_HELP_STRING([--without-arith-enc],
- [Do not include arithmetic encoding support when emulating the libjpeg v6b API/ABI]))
-if test "x$with_12bit" = "xyes"; then
- with_arith_enc=no
-fi
-if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then
- with_arith_enc=yes
-fi
-if test "x$with_arith_enc" = "xno"; then
- AC_MSG_RESULT(no)
- RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-enc"
-else
- AC_DEFINE([C_ARITH_CODING_SUPPORTED], [1], [Support arithmetic encoding])
- AC_MSG_RESULT(yes)
-fi
-AM_CONDITIONAL([WITH_ARITH_ENC], [test "x$with_arith_enc" != "xno"])
-
-AC_MSG_CHECKING([whether to include arithmetic decoding support])
-AC_ARG_WITH([arith-dec],
- AC_HELP_STRING([--without-arith-dec],
- [Do not include arithmetic decoding support when emulating the libjpeg v6b API/ABI]))
-if test "x$with_12bit" = "xyes"; then
- with_arith_dec=no
-fi
-if test "x${with_jpeg8}" = "xyes" -o "x${with_jpeg7}" = "xyes"; then
- with_arith_dec=yes
-fi
-if test "x$with_arith_dec" = "xno"; then
- AC_MSG_RESULT(no)
- RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-arith-dec"
-else
- AC_DEFINE([D_ARITH_CODING_SUPPORTED], [1], [Support arithmetic decoding])
- AC_MSG_RESULT(yes)
-fi
-AM_CONDITIONAL([WITH_ARITH_DEC], [test "x$with_arith_dec" != "xno"])
-
-AM_CONDITIONAL([WITH_ARITH],
- [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
-
-# 12-bit component support
-AC_MSG_CHECKING([whether to use 12-bit samples])
-AC_ARG_WITH([12bit],
- AC_HELP_STRING([--with-12bit], [Encode/decode JPEG images with 12-bit samples (implies --without-simd --without-turbojpeg --without-arith-dec --without-arith-enc)]))
-if test "x$with_12bit" = "xyes"; then
- AC_DEFINE([BITS_IN_JSAMPLE], [12], [use 8 or 12])
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-AM_CONDITIONAL([WITH_12BIT], [test "x$with_12bit" = "xyes"])
-
-# TurboJPEG support
-AC_MSG_CHECKING([whether to build TurboJPEG C wrapper])
-AC_ARG_WITH([turbojpeg],
- AC_HELP_STRING([--without-turbojpeg],
- [Do not include the TurboJPEG wrapper library and associated test programs]))
-if test "x$with_12bit" = "xyes"; then
- with_turbojpeg=no
-fi
-if test "x$with_turbojpeg" = "xno"; then
- AC_MSG_RESULT(no)
- RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-turbojpeg"
-else
- AC_MSG_RESULT(yes)
-fi
-
-# Java support
-AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
-if test "x$JAVAC" = "x"; then
- JAVAC=javac
-fi
-AC_SUBST(JAVAC)
-AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
-AC_SUBST(JAVACFLAGS)
-AC_ARG_VAR(JAR, [Java archive command (default: jar)])
-if test "x$JAR" = "x"; then
- JAR=jar
-fi
-AC_SUBST(JAR)
-AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
-if test "x$JAVA" = "x"; then
- JAVA=java
-fi
-AC_SUBST(JAVA)
-AC_ARG_VAR(JNI_CFLAGS,
- [C compiler flags needed to include jni.h (default: -I/System/Library/Frameworks/JavaVM.framework/Headers on OS X, '-I/usr/java/include -I/usr/java/include/solaris' on Solaris, and '-I/usr/java/default/include -I/usr/java/default/include/linux' on Linux)])
-
-AC_MSG_CHECKING([whether to build TurboJPEG Java wrapper])
-AC_ARG_WITH([java],
- AC_HELP_STRING([--with-java], [Build Java wrapper for the TurboJPEG library]))
-if test "x$with_12bit" = "xyes" -o "x$with_turbojpeg" = "xno"; then
- with_java=no
-fi
-
-WITH_JAVA=0
-if test "x$with_java" = "xyes"; then
- AC_MSG_RESULT(yes)
-
- case $host_os in
- darwin*)
- DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
- ;;
- solaris*)
- DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
- ;;
- linux*)
- DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
- ;;
- esac
- if test "x$JNI_CFLAGS" = "x"; then
- JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
- fi
-
- SAVE_CPPFLAGS=${CPPFLAGS}
- CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
- AC_CHECK_HEADERS([jni.h], [DUMMY=1],
- [AC_MSG_ERROR([Could not find JNI header file])])
- CPPFLAGS=${SAVE_CPPFLAGS}
- AC_SUBST(JNI_CFLAGS)
-
- RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --with-java"
- JAVA_RPM_CONTENTS_1='%dir %{_datadir}/classes'
- JAVA_RPM_CONTENTS_2=%{_datadir}/classes/turbojpeg.jar
- WITH_JAVA=1
-else
- AC_MSG_RESULT(no)
-fi
-AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
-AC_SUBST(WITH_JAVA)
-AC_SUBST(JAVA_RPM_CONTENTS_1)
-AC_SUBST(JAVA_RPM_CONTENTS_2)
-
-# optionally force using gas-preprocessor.pl for compatibility testing
-AC_ARG_WITH([gas-preprocessor],
- AC_HELP_STRING([--with-gas-preprocessor],
- [Force using gas-preprocessor.pl on ARM.]))
-if test "x${with_gas_preprocessor}" = "xyes"; then
- case $host_os in
- darwin*)
- CCAS="gas-preprocessor.pl -fix-unreq $CC"
- ;;
- *)
- CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
- ;;
- esac
- AC_SUBST([CCAS])
-fi
-
-# SIMD is optional
-AC_ARG_WITH([simd],
- AC_HELP_STRING([--without-simd], [Do not include SIMD extensions]))
-if test "x$with_12bit" = "xyes"; then
- with_simd=no
-fi
-if test "x${with_simd}" != "xno"; then
- require_simd=no
- if test "x${with_simd}" = "xyes"; then
- require_simd=yes
- fi
- # Check if we're on a supported CPU
- AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
- case "$host_cpu" in
- x86_64 | amd64)
- AC_MSG_RESULT([yes (x86_64)])
- AC_PROG_NASM
- simd_arch=x86_64
- ;;
- i*86 | x86 | ia32)
- AC_MSG_RESULT([yes (i386)])
- AC_PROG_NASM
- simd_arch=i386
- ;;
- arm*)
- AC_MSG_RESULT([yes (arm)])
- AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
- AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
- [if test "x$ac_use_gas_preprocessor" = "xyes"; then
- AC_MSG_RESULT([yes (with gas-preprocessor)])
- else
- AC_MSG_RESULT([yes])
- fi
- simd_arch=arm],
- [AC_MSG_RESULT([no])
- with_simd=no])
- if test "x${with_simd}" = "xno"; then
- if test "x${require_simd}" = "xyes"; then
- AC_MSG_ERROR([SIMD support can't be enabled.])
- else
- AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
- fi
- fi
- ;;
- aarch64*)
- AC_MSG_RESULT([yes (arm64)])
- AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
- AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE(
- [if test "x$ac_use_gas_preprocessor" = "xyes"; then
- AC_MSG_RESULT([yes (with gas-preprocessor)])
- else
- AC_MSG_RESULT([yes])
- fi
- simd_arch=aarch64],
- [AC_MSG_RESULT([no])
- with_simd=no])
- if test "x${with_simd}" = "xno"; then
- if test "x${require_simd}" = "xyes"; then
- AC_MSG_ERROR([SIMD support can't be enabled.])
- else
- AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
- fi
- fi
- ;;
- mips*)
- AC_MSG_RESULT([yes (mips)])
- AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
- AC_CHECK_COMPATIBLE_MIPS_ASSEMBLER_IFELSE(
- [AC_MSG_RESULT([yes])
- simd_arch=mips],
- [AC_MSG_RESULT([no])
- with_simd=no])
- if test "x${with_simd}" = "xno"; then
- if test "x${require_simd}" = "xyes"; then
- AC_MSG_ERROR([SIMD support can't be enabled.])
- else
- AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])
- fi
- fi
- ;;
- powerpc*)
- AC_MSG_RESULT([yes (powerpc)])
- simd_arch=powerpc
- ;;
- *)
- AC_MSG_RESULT([no ("$host_cpu")])
- with_simd=no;
- if test "x${require_simd}" = "xyes"; then
- AC_MSG_ERROR([SIMD support not available for this CPU.])
- else
- AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
- fi
- ;;
- esac
-
- if test "x${with_simd}" != "xno"; then
- AC_DEFINE([WITH_SIMD], [1], [Use accelerated SIMD routines.])
- fi
-else
- RPM_CONFIG_ARGS="$RPM_CONFIG_ARGS --without-simd"
-fi
-
-AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
-AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
-AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
-AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
-AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
-AM_CONDITIONAL([SIMD_ARM_64], [test "x$simd_arch" = "xaarch64"])
-AM_CONDITIONAL([SIMD_MIPS], [test "x$simd_arch" = "xmips"])
-AM_CONDITIONAL([SIMD_POWERPC], [test "x$simd_arch" = "xpowerpc"])
-AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
-AM_CONDITIONAL([WITH_TURBOJPEG], [test "x$with_turbojpeg" != "xno"])
-AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
-
-AC_ARG_VAR(PKGNAME, [distribution package name (default: libjpeg-turbo)])
-if test "x$PKGNAME" = "x"; then
- PKGNAME=$PACKAGE_NAME
-fi
-AC_SUBST(PKGNAME)
-
-case "$host_cpu" in
- x86_64)
- RPMARCH=x86_64
- DEBARCH=amd64
- ;;
- i*86 | x86 | ia32)
- RPMARCH=i386
- DEBARCH=i386
- ;;
- *)
- RPMARCH=`uname -m`
- DEBARCH=$RPMARCH
- ;;
-esac
-
-if test "${docdir}" = ""; then
- docdir=${datadir}/doc
- AC_SUBST(docdir)
-fi
-
-AC_SUBST(RPMARCH)
-AC_SUBST(RPM_CONFIG_ARGS)
-AC_SUBST(DEBARCH)
-AC_SUBST(BUILD)
-AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number])
-
-# NOTE: autoheader automatically modifies the input file of the first
-# invocation of AC_CONFIG_HEADERS, so we put config.h first to prevent
-# jconfig.h.in from being clobbered. config.h is used only internally, whereas
-# jconfig.h contains macros that are relevant to external programs (macros that
-# specify which features were built into the library.)
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_HEADERS([jconfig.h])
-AC_CONFIG_HEADERS([jconfigint.h])
-AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
-AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
-AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
-AC_CONFIG_FILES([pkgscripts/makemacpkg.tmpl:release/makemacpkg.in])
-AC_CONFIG_FILES([pkgscripts/uninstall.tmpl:release/uninstall.in])
-AC_CONFIG_FILES([pkgscripts/libjpeg.pc:release/libjpeg.pc.in])
-AC_CONFIG_FILES([pkgscripts/libturbojpeg.pc:release/libturbojpeg.pc.in])
-if test "x$with_turbojpeg" != "xno"; then
- AC_CONFIG_FILES([tjbenchtest])
-fi
-if test "x$with_java" = "xyes"; then
- AC_CONFIG_FILES([tjbenchtest.java])
- AC_CONFIG_FILES([tjexampletest])
-fi
-AC_CONFIG_FILES([libjpeg.map])
-AC_CONFIG_FILES([Makefile simd/Makefile])
-AC_CONFIG_FILES([java/Makefile])
-AC_CONFIG_FILES([md5/Makefile])
-AC_OUTPUT
-set(JAR_FILE turbojpeg.jar)
-set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.MF)
+find_package(Java REQUIRED)
+find_package(JNI REQUIRED)
-set(JAVA_CLASSNAMES org/libjpegturbo/turbojpeg/TJ
- org/libjpegturbo/turbojpeg/TJCompressor
- org/libjpegturbo/turbojpeg/TJCustomFilter
- org/libjpegturbo/turbojpeg/TJDecompressor
- org/libjpegturbo/turbojpeg/TJException
- org/libjpegturbo/turbojpeg/TJScalingFactor
- org/libjpegturbo/turbojpeg/TJTransform
- org/libjpegturbo/turbojpeg/TJTransformer
- org/libjpegturbo/turbojpeg/YUVImage
- TJUnitTest
- TJExample
- TJBench)
-
-if(MSVC_IDE)
- set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
-else()
- set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
+# Allow the Java compiler flags to be set using an environment variable
+if(NOT DEFINED CMAKE_JAVA_COMPILE_FLAGS AND DEFINED ENV{JAVAFLAGS})
+ set(CMAKE_JAVA_COMPILE_FLAGS $ENV{JAVAFLAGS})
endif()
+include(UseJava)
+
+set(CMAKE_JAVA_COMPILE_FLAGS "${CMAKE_JAVA_COMPILE_FLAGS} -J-Dfile.encoding=UTF8")
+message(STATUS "CMAKE_JAVA_COMPILE_FLAGS = ${CMAKE_JAVA_COMPILE_FLAGS}")
+string(REGEX REPLACE " " ";" CMAKE_JAVA_COMPILE_FLAGS "${CMAKE_JAVA_COMPILE_FLAGS}")
+
+set(JAVAARGS "" CACHE STRING "Additional arguments to pass to java when running unit tests (example: -d32)")
+message(STATUS "JAVAARGS = ${JAVAARGS}")
+
+set(JAVA_SOURCES org/libjpegturbo/turbojpeg/TJ.java
+ org/libjpegturbo/turbojpeg/TJCompressor.java
+ org/libjpegturbo/turbojpeg/TJCustomFilter.java
+ org/libjpegturbo/turbojpeg/TJDecompressor.java
+ org/libjpegturbo/turbojpeg/TJException.java
+ org/libjpegturbo/turbojpeg/TJScalingFactor.java
+ org/libjpegturbo/turbojpeg/TJTransform.java
+ org/libjpegturbo/turbojpeg/TJTransformer.java
+ org/libjpegturbo/turbojpeg/YUVImage.java
+ TJUnitTest.java
+ TJExample.java
+ TJBench.java)
+
set(TURBOJPEG_DLL_NAME "turbojpeg")
if(MINGW)
set(TURBOJPEG_DLL_NAME "libturbojpeg")
endif()
-configure_file(org/libjpegturbo/turbojpeg/TJLoader.java.in
- ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
-
-set(JAVA_SOURCES "")
-set(JAVA_CLASSES "")
-set(JAVA_CLASSES_FULL "")
-foreach(class ${JAVA_CLASSNAMES})
- set(JAVA_SOURCES ${JAVA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${class}.java)
- set(JAVA_CLASSES ${JAVA_CLASSES} ${class}.class)
- set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL} ${OBJDIR}/${class}.class)
-endforeach()
-
+if(WIN32)
+ configure_file(org/libjpegturbo/turbojpeg/TJLoader-win.java.in
+ ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
+else()
+ configure_file(org/libjpegturbo/turbojpeg/TJLoader-unix.java.in
+ ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
+endif()
set(JAVA_SOURCES ${JAVA_SOURCES}
${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
-set(JAVA_CLASSES ${JAVA_CLASSES}
- org/libjpegturbo/turbojpeg/TJLoader.class)
-set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL}
- ${OBJDIR}/org/libjpegturbo/turbojpeg/TJLoader.class)
-
-string(REGEX REPLACE " " ";" JAVACFLAGS "${JAVACFLAGS}")
-add_custom_command(OUTPUT ${JAVA_CLASSES_FULL} DEPENDS ${JAVA_SOURCES}
- COMMAND ${JAVA_COMPILE} ARGS ${JAVACFLAGS} -d ${OBJDIR} ${JAVA_SOURCES})
-add_custom_command(OUTPUT ${JAR_FILE} DEPENDS ${JAVA_CLASSES_FULL}
- ${MANIFEST_FILE}
- COMMAND ${JAVA_ARCHIVE} cfm ${JAR_FILE} ${MANIFEST_FILE} ${JAVA_CLASSES}
- WORKING_DIRECTORY ${OBJDIR})
-
-add_custom_target(java ALL DEPENDS ${JAR_FILE})
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${JAR_FILE} DESTINATION classes)
+if(MSYS)
+ # UGLY HACK ALERT: If we don't do this, then UseJava.cmake will separate
+ # class path members with a semicolon, which is interpreted as a command
+ # separator by the MSYS shell.
+ set(CMAKE_HOST_SYSTEM_NAME_BAK ${CMAKE_HOST_SYSTEM_NAME})
+ set(CMAKE_HOST_SYSTEM_NAME "MSYS")
+endif()
+add_jar(turbojpeg-java ${JAVA_SOURCES} OUTPUT_NAME turbojpeg
+ ENTRY_POINT TJExample)
+if(MSYS)
+ set(CMAKE_HOST_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME})
+endif()
+install_jar(turbojpeg-java ${DATADIR}/classes)
+++ /dev/null
-JAVAROOT = .
-
-org/libjpegturbo/turbojpeg/TJLoader.java: $(srcdir)/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl
- mkdir -p org/libjpegturbo/turbojpeg; \
- cat $(srcdir)/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl | \
- sed s@%{__libdir}@$(libdir)@g > org/libjpegturbo/turbojpeg/TJLoader.java
-
-
-JAVASOURCES = org/libjpegturbo/turbojpeg/TJ.java \
- org/libjpegturbo/turbojpeg/TJCompressor.java \
- org/libjpegturbo/turbojpeg/TJCustomFilter.java \
- org/libjpegturbo/turbojpeg/TJDecompressor.java \
- org/libjpegturbo/turbojpeg/TJException.java \
- org/libjpegturbo/turbojpeg/TJScalingFactor.java \
- org/libjpegturbo/turbojpeg/TJTransform.java \
- org/libjpegturbo/turbojpeg/TJTransformer.java \
- org/libjpegturbo/turbojpeg/YUVImage.java \
- TJExample.java \
- TJUnitTest.java \
- TJBench.java
-
-JNIHEADERS = org_libjpegturbo_turbojpeg_TJ.h \
- org_libjpegturbo_turbojpeg_TJCompressor.h \
- org_libjpegturbo_turbojpeg_TJDecompressor.h \
- org_libjpegturbo_turbojpeg_TJTransformer.h
-
-if WITH_JAVA
-
-nodist_noinst_JAVA = ${JAVASOURCES} org/libjpegturbo/turbojpeg/TJLoader.java
-
-JAVA_CLASSES = org/libjpegturbo/turbojpeg/TJ.class \
- org/libjpegturbo/turbojpeg/TJCompressor.class \
- org/libjpegturbo/turbojpeg/TJCustomFilter.class \
- org/libjpegturbo/turbojpeg/TJDecompressor.class \
- org/libjpegturbo/turbojpeg/TJException.class \
- org/libjpegturbo/turbojpeg/TJLoader.class \
- org/libjpegturbo/turbojpeg/TJScalingFactor.class \
- org/libjpegturbo/turbojpeg/TJTransform.class \
- org/libjpegturbo/turbojpeg/TJTransformer.class \
- org/libjpegturbo/turbojpeg/YUVImage.class \
- TJExample.class \
- TJUnitTest.class \
- TJBench.class
-
-all: all-am turbojpeg.jar
-
-turbojpeg.jar: classnoinst.stamp ${srcdir}/MANIFEST.MF
- $(JAR) cfm turbojpeg.jar ${srcdir}/MANIFEST.MF $(JAVA_CLASSES)
-
-clean-local:
- rm -f turbojpeg.jar
-
-install-exec-local: turbojpeg.jar
- mkdir -p $(DESTDIR)/$(datadir)/classes
- $(INSTALL) -m 644 turbojpeg.jar $(DESTDIR)/$(datadir)/classes/
-
-uninstall-local:
- rm -f $(DESTDIR)/$(datadir)/classes/turbojpeg.jar
- if [ -d $(DESTDIR)/$(datadir)/classes ]; then rmdir $(DESTDIR)/$(datadir)/classes; fi
-
-headers: all
- javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJ; \
- javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJCompressor; \
- javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJDecompressor; \
- javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJTransformer
-
-docs: all
- mkdir -p ${srcdir}/doc; \
- javadoc -notimestamp -d ${srcdir}/doc -sourcepath ${srcdir} org.libjpegturbo.turbojpeg
-
-endif
-
-EXTRA_DIST = MANIFEST.MF ${JAVASOURCES} ${JNIHEADERS} doc CMakeLists.txt \
- org/libjpegturbo/turbojpeg/TJLoader.java.tmpl \
- org/libjpegturbo/turbojpeg/TJLoader.java.in
/*
- * Copyright (C)2011-2013 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2011-2013, 2016 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
String os = System.getProperty("os.name").toLowerCase();
if (os.indexOf("mac") >= 0) {
try {
- System.load("%{__libdir}/libturbojpeg.jnilib");
+ System.load("@LIBDIR@/libturbojpeg.jnilib");
} catch (java.lang.UnsatisfiedLinkError e2) {
System.load("/usr/lib/libturbojpeg.jnilib");
}
} else {
try {
- System.load("%{__libdir}/libturbojpeg.so");
+ System.load("@LIBDIR@/libturbojpeg.so");
} catch (java.lang.UnsatisfiedLinkError e3) {
- String libdir = "%{__libdir}";
- if (libdir.equals("/opt/libjpeg-turbo/lib64")) {
- System.load("/opt/libjpeg-turbo/lib32/libturbojpeg.so");
- } else if (libdir.equals("/opt/libjpeg-turbo/lib32")) {
- System.load("/opt/libjpeg-turbo/lib64/libturbojpeg.so");
+ String libdir = "@LIBDIR@";
+ if (libdir.equals("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib64")) {
+ System.load("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib32/libturbojpeg.so");
+ } else if (libdir.equals("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib32")) {
+ System.load("@DEFAULT_CMAKE_INSTALL_PREFIX@/lib64/libturbojpeg.so");
} else {
throw e3;
}
/* Version ID for the JPEG library.
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
*/
-#define JPEG_LIB_VERSION 62 /* Version 6b */
+#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@
/* libjpeg-turbo version */
-#define LIBJPEG_TURBO_VERSION 0
+#define LIBJPEG_TURBO_VERSION @VERSION@
/* libjpeg-turbo version in integer form */
-#define LIBJPEG_TURBO_VERSION_NUMBER 0
+#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
/* Support arithmetic encoding */
-#undef C_ARITH_CODING_SUPPORTED
+#cmakedefine C_ARITH_CODING_SUPPORTED
/* Support arithmetic decoding */
-#undef D_ARITH_CODING_SUPPORTED
+#cmakedefine D_ARITH_CODING_SUPPORTED
+
+/* Support in-memory source/destination managers */
+#cmakedefine MEM_SRCDST_SUPPORTED
+
+/* Use accelerated SIMD routines. */
+#cmakedefine WITH_SIMD
/*
* Define BITS_IN_JSAMPLE as either
* We do not support run-time selection of data precision, sorry.
*/
-#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
+#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
+#cmakedefine HAVE_LOCALE_H
/* Define to 1 if you have the <stddef.h> header file. */
-#undef HAVE_STDDEF_H
+#cmakedefine HAVE_STDDEF_H
/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
+#cmakedefine HAVE_STDLIB_H
+
+/* Define if you need to include <sys/types.h> to get size_t. */
+#cmakedefine NEED_SYS_TYPES_H
+
+/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
+ memset/memcpy in <string.h>. */
+#cmakedefine NEED_BSD_STRINGS
/* Define to 1 if the system has the type `unsigned char'. */
-#undef HAVE_UNSIGNED_CHAR
+#cmakedefine HAVE_UNSIGNED_CHAR
/* Define to 1 if the system has the type `unsigned short'. */
-#undef HAVE_UNSIGNED_SHORT
+#cmakedefine HAVE_UNSIGNED_SHORT
/* Compiler does not support pointers to undefined structures. */
-#undef INCOMPLETE_TYPES_BROKEN
-
-/* Support in-memory source/destination managers */
-#undef MEM_SRCDST_SUPPORTED
-
-/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
- memset/memcpy in <string.h>. */
-#undef NEED_BSD_STRINGS
-
-/* Define if you need to include <sys/types.h> to get size_t. */
-#undef NEED_SYS_TYPES_H
+#cmakedefine INCOMPLETE_TYPES_BROKEN
/* Define if your (broken) compiler shifts signed values as if they were
unsigned. */
-#undef RIGHT_SHIFT_IS_UNSIGNED
-
-/* Use accelerated SIMD routines. */
-#undef WITH_SIMD
+#cmakedefine RIGHT_SHIFT_IS_UNSIGNED
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
-# undef __CHAR_UNSIGNED__
+ #cmakedefine __CHAR_UNSIGNED__
#endif
/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
+/* #undef const */
/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
+/* #undef size_t */
/* libjpeg-turbo build number */
-#undef BUILD
+#define BUILD "@BUILD@"
/* How to obtain function inlining. */
-#undef INLINE
+#define INLINE @INLINE@
/* Define to the full name of this package. */
-#undef PACKAGE_NAME
+#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
/* Version number of package */
-#undef VERSION
+#define VERSION "@VERSION@"
+
+#ifndef _WIN32
/* The size of `size_t', as computed by sizeof. */
-#undef SIZEOF_SIZE_T
+#define SIZEOF_SIZE_T @SIZE_T@
+
+#endif
+++ /dev/null
-noinst_PROGRAMS = md5cmp
-
-md5cmp_SOURCES = md5cmp.c md5.c md5hl.c md5.h
-md5cmp_CFLAGS = -I$(srcdir)
<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="1">
- <title>libjpeg-turbo</title>
+ <title>@CMAKE_PROJECT_NAME@</title>
<welcome file="Welcome.rtf" />
<readme file="ReadMe.txt" />
<license file="License.rtf" />
<options customize="never" />
<choices-outline>
<line choice="default">
- <line choice="com.libjpeg-turbo.libjpeg-turbo"/>
+ <line choice="@PKGID@"/>
</line>
</choices-outline>
<choice id="default"/>
- <choice id="com.libjpeg-turbo.libjpeg-turbo" visible="false">
- <pkg-ref id="com.libjpeg-turbo.libjpeg-turbo"/>
+ <choice id="@PKGID@" visible="false">
+ <pkg-ref id="@PKGID@"/>
</choice>
<pkg-ref auth="root"
- id="com.libjpeg-turbo.libjpeg-turbo">libjpeg-turbo.pkg</pkg-ref>
+ id="@PKGID@">@PKGNAME@.pkg</pkg-ref>
</installer-gui-script>
Package: {__PKGNAME}
-Version: {__VERSION}-{__BUILD}
+Version: @VERSION@-@BUILD@
Section: misc
Priority: optional
Architecture: {__ARCH}
Essential: no
-Maintainer: The libjpeg-turbo Project <information@libjpeg-turbo.org>
-Homepage: http://www.libjpeg-turbo.org
+Maintainer: @PKGVENDOR@ <@PKGEMAIL@>
+Homepage: @PKGURL@
Installed-Size: {__SIZE}
Description: A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg.dll"
!endif
!ifdef GCC
- File "/oname=libjpeg-@DLL_VERSION@.dll" "@CMAKE_BINARY_DIR@\sharedlib\libjpeg-*.dll"
+ File "@CMAKE_BINARY_DIR@\libjpeg-@SO_MAJOR_VERSION@.dll"
!else
- File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg@DLL_VERSION@.dll"
+ File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpeg@SO_MAJOR_VERSION@.dll"
!endif
- File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}cjpeg.exe"
- File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}djpeg.exe"
- File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpegtran.exe"
+ File "@CMAKE_BINARY_DIR@\${BUILDDIR}cjpeg.exe"
+ File "@CMAKE_BINARY_DIR@\${BUILDDIR}djpeg.exe"
+ File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpegtran.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}tjbench.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}rdjpgcom.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}wrjpgcom.exe"
!ifdef GCC
File "@CMAKE_BINARY_DIR@\libturbojpeg.dll.a"
File "@CMAKE_BINARY_DIR@\libturbojpeg.a"
- File "@CMAKE_BINARY_DIR@\sharedlib\libjpeg.dll.a"
+ File "@CMAKE_BINARY_DIR@\libjpeg.dll.a"
File "@CMAKE_BINARY_DIR@\libjpeg.a"
!else
File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg.lib"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg-static.lib"
- File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg.lib"
+ File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpeg.lib"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpeg-static.lib"
!endif
!ifdef JAVA
SetOutPath $INSTDIR\classes
- File "@CMAKE_BINARY_DIR@\java\${BUILDDIR}turbojpeg.jar"
+ File "@CMAKE_BINARY_DIR@\java\turbojpeg.jar"
!endif
SetOutPath $INSTDIR\include
File "@CMAKE_BINARY_DIR@\jconfig.h"
DeleteRegKey HKLM "SOFTWARE\@INST_REG_NAME@ @VERSION@"
!ifdef GCC
- Delete $INSTDIR\bin\libjpeg-@DLL_VERSION@.dll
+ Delete $INSTDIR\bin\libjpeg-@SO_MAJOR_VERSION@.dll
Delete $INSTDIR\bin\libturbojpeg.dll
Delete $SYSDIR\libturbojpeg.dll
Delete $INSTDIR\lib\libturbojpeg.dll.a"
Delete $INSTDIR\lib\libjpeg.dll.a"
Delete $INSTDIR\lib\libjpeg.a"
!else
- Delete $INSTDIR\bin\jpeg@DLL_VERSION@.dll
+ Delete $INSTDIR\bin\jpeg@SO_MAJOR_VERSION@.dll
Delete $INSTDIR\bin\turbojpeg.dll
Delete $SYSDIR\turbojpeg.dll
Delete $INSTDIR\lib\jpeg.lib
-# Path under which libjpeg-turbo should be installed
-%define _prefix %{__prefix}
-
-# Path under which executables should be installed
-%define _bindir %{__bindir}
-
-# Path under which Java classes and man pages should be installed
-%define _datadir %{__datadir}
-
-# Path under which docs should be installed
-%define _docdir /usr/share/doc/%{name}-%{version}
-
-# Path under which headers should be installed
-%define _includedir %{__includedir}
-
-# _libdir is set to %{_prefix}/%{_lib} by default
-%ifarch x86_64
-%define _lib lib64
-%else
-%if "%{_prefix}" == "/opt/libjpeg-turbo"
-%define _lib lib32
-%endif
-%endif
-
-# Path under which man pages should be installed
-%define _mandir %{__mandir}
+%define _prefix @CMAKE_INSTALL_PREFIX@
+%define _bindir @BINDIR@
+%define _datadir @DATADIR@
+%define _docdir %{_defaultdocdir}/%{name}-%{version}
+%define _includedir @INCLUDEDIR@
+%define _libdir @LIBDIR@
+%define _mandir @MANDIR@
+%define _enable_static @ENABLE_STATIC@
+%define _enable_shared @ENABLE_SHARED@
+%define _with_turbojpeg @WITH_TURBOJPEG@
+%define _with_java @WITH_JAVA@
Summary: A SIMD-accelerated JPEG codec that provides both the libjpeg and TurboJPEG APIs
Name: @PKGNAME@
Version: @VERSION@
-Vendor: The libjpeg-turbo Project
-URL: http://www.libjpeg-turbo.org
+Vendor: @PKGVENDOR@
+URL: @PKGURL@
Group: System Environment/Libraries
#-->Source0: http://prdownloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz
Release: @BUILD@
BuildRoot: %{_blddir}/%{name}-buildroot-%{version}-%{release}
Prereq: /sbin/ldconfig
%ifarch x86_64
-Provides: %{name} = %{version}-%{release}, @PACKAGE_NAME@ = %{version}-%{release}, libturbojpeg.so()(64bit)
+Provides: %{name} = %{version}-%{release}, @CMAKE_PROJECT_NAME@ = %{version}-%{release}, libturbojpeg.so()(64bit)
%else
-Provides: %{name} = %{version}-%{release}, @PACKAGE_NAME@ = %{version}-%{release}, libturbojpeg.so
+Provides: %{name} = %{version}-%{release}, @CMAKE_PROJECT_NAME@ = %{version}-%{release}, libturbojpeg.so
%endif
%description
broader range of users and developers.
#-->%prep
-#-->%setup -q -n libjpeg-turbo-%{version}
+#-->%setup -q -n @CMAKE_PROJECT_NAME@-%{version}
#-->%build
-#-->./configure prefix=%{_prefix} bindir=%{_bindir} datadir=%{_datadir} \
-#--> docdir=%{_docdir} includedir=%{_includedir} libdir=%{_libdir} \
-#--> mandir=%{_mandir} JPEG_LIB_VERSION=@JPEG_LIB_VERSION@ \
-#--> SO_MAJOR_VERSION=@SO_MAJOR_VERSION@ SO_MINOR_VERSION=@SO_MINOR_VERSION@ \
-#--> --with-pic @RPM_CONFIG_ARGS@
+#-->cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ \
+#--> -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+#--> -DCMAKE_POSITION_INDEPENDENT_CODE=@CMAKE_POSITION_INDEPENDENT_CODE@ \
+#--> -DBINDIR=%{_bindir} -DBUILD=%{release} -DDATADIR=%{_datadir} \
+#--> -DDOCDIR=%{_docdir} \
+#--> -DSO_MAJOR_VERSION=@SO_MAJOR_VERSION@ \
+#--> -DSO_MINOR_VERSION=@SO_MINOR_VERSION@ \
+#--> -DENABLE_SHARED=@ENABLE_SHARED@ -DENABLE_STATIC=@ENABLE_STATIC@ \
+#--> -DINCLUDEDIR=%{_includedir} -DJPEG_LIB_VERSION=@JPEG_LIB_VERSION@ \
+#--> -DLIBDIR=%{_libdir} -DMANDIR=%{_mandir} \
+#--> -DREQUIRE_SIMD=@REQUIRE_SIMD@ \
+#--> -DWITH_12BIT=@WITH_12BIT@ -DWITH_ARITH_DEC=@WITH_ARITH_DEC@ \
+#--> -DWITH_ARITH_ENC=@WITH_ARITH_ENC@ -DWITH_JAVA=@WITH_JAVA@ \
+#--> -DWITH_JPEG7=@WITH_JPEG7@ -DWITH_JPEG8=@WITH_JPEG8@ \
+#--> -DWITH_MEM_SRCDST=@WITH_MEM_SRCDST@ -DWITH_SIMD=@WITH_SIMD@ \
+#--> -DWITH_TURBOJPEG=@WITH_TURBOJPEG@ .
#-->make DESTDIR=$RPM_BUILD_ROOT
%install
rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT docdir=%{_docdir} exampledir=%{_docdir}
-rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+make install DESTDIR=$RPM_BUILD_ROOT
/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
#-->%if 0
-LJT_LIBDIR=%{__libdir}
-if [ ! "$LJT_LIBDIR" = "%{_libdir}" ]; then
- echo ERROR: libjpeg-turbo must be configured with libdir=%{_prefix}/%{_lib} when generating an in-tree RPM for this architecture.
- exit 1
+# This is only needed to support in-tree RPM generation via 'make rpm'. When
+# building from a SRPM, we control where things are installed via CMake
+# variables.
+
+safedirmove ()
+{
+ if [ "$1" = "$2" ]; then
+ return 0
+ fi
+ if [ "$1" = "" -o ! -d "$1" ]; then
+ echo safedirmove: source dir $1 is not valid
+ return 1
+ fi
+ if [ "$2" = "" -o -e "$2" ]; then
+ echo safedirmove: dest dir $2 is not valid
+ return 1
+ fi
+ if [ "$3" = "" -o -e "$3" ]; then
+ echo safedirmove: tmp dir $3 is not valid
+ return 1
+ fi
+ mkdir -p $3
+ mv $1/* $3/
+ rmdir $1
+ mkdir -p $2
+ mv $3/* $2/
+ rmdir $3
+ return 0
+}
+
+LJT_DOCDIR=@DOCDIR@
+if [ ! "$LJT_DOCDIR" = "%{_docdir}" ]; then
+ safedirmove $RPM_BUILD_ROOT/$LJT_DOCDIR $RPM_BUILD_ROOT/%{_docdir} $RPM_BUILD_ROOT/__tmpdoc
fi
#-->%endif
-LJT_DOCDIR=%{__docdir}
-if [ "%{_prefix}" = "/opt/libjpeg-turbo" -a "$LJT_DOCDIR" = "/opt/libjpeg-turbo/doc" ]; then
+LJT_DOCDIR=@DOCDIR@
+if [ "%{_prefix}" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$LJT_DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
ln -fs %{_docdir} $RPM_BUILD_ROOT/$LJT_DOCDIR
fi
%dir %{_docdir}
%doc %{_docdir}/*
%dir %{_prefix}
-%if "%{_prefix}" == "/opt/libjpeg-turbo" && "%{_docdir}" != "%{_prefix}/doc"
+%if "%{_prefix}" == "@DEFAULT_CMAKE_INSTALL_PREFIX@" && "%{_docdir}" != "%{_prefix}/doc"
%{_prefix}/doc
%endif
%dir %{_bindir}
%{_bindir}/cjpeg
%{_bindir}/djpeg
%{_bindir}/jpegtran
-%{_bindir}/tjbench
+%if "%{_with_turbojpeg}" == "1"
+ %{_bindir}/tjbench
+%endif
%{_bindir}/rdjpgcom
%{_bindir}/wrjpgcom
%dir %{_libdir}
-%{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@.@SO_AGE@.@SO_MINOR_VERSION@
-%{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@
-%{_libdir}/libjpeg.so
-%{_libdir}/libjpeg.a
+%if "%{_enable_shared}" == "1"
+ %{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@.@SO_AGE@.@SO_MINOR_VERSION@
+ %{_libdir}/libjpeg.so.@SO_MAJOR_VERSION@
+ %{_libdir}/libjpeg.so
+%endif
+%if "%{_enable_static}" == "1"
+ %{_libdir}/libjpeg.a
+%endif
%{_libdir}/pkgconfig
%{_libdir}/pkgconfig/libjpeg.pc
-%{_libdir}/libturbojpeg.so.0.1.0
-%{_libdir}/libturbojpeg.so.0
-%{_libdir}/libturbojpeg.so
-%{_libdir}/libturbojpeg.a
-%{_libdir}/pkgconfig/libturbojpeg.pc
+%if "%{_with_turbojpeg}" == "1"
+ %if "%{_enable_shared}" == "1" || "%{_with_java}" == "1"
+ %{_libdir}/libturbojpeg.so.@TURBOJPEG_SO_VERSION@
+ %{_libdir}/libturbojpeg.so.@TURBOJPEG_SO_MAJOR_VERSION@
+ %{_libdir}/libturbojpeg.so
+ %endif
+ %if "%{_enable_static}" == "1"
+ %{_libdir}/libturbojpeg.a
+ %endif
+ %{_libdir}/pkgconfig/libturbojpeg.pc
+%endif
%dir %{_includedir}
%{_includedir}/jconfig.h
%{_includedir}/jerror.h
%{_includedir}/jmorecfg.h
%{_includedir}/jpeglib.h
-%{_includedir}/turbojpeg.h
+%if "%{_with_turbojpeg}" == "1"
+ %{_includedir}/turbojpeg.h
+%endif
%dir %{_mandir}
%dir %{_mandir}/man1
%{_mandir}/man1/cjpeg.1*
%if "%{_prefix}" != "%{_datadir}"
%dir %{_datadir}
%endif
-@JAVA_RPM_CONTENTS_1@
-@JAVA_RPM_CONTENTS_2@
-
+%if "%{_with_java}" == "1"
+ %dir %{_datadir}/classes
+ %{_datadir}/classes/turbojpeg.jar
+%endif
%changelog
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
Name: libjpeg
Description: A SIMD-accelerated JPEG codec that provides the libjpeg API
-Version: @PACKAGE_VERSION@
+Version: @VERSION@
Libs: -L${libdir} -ljpeg
Cflags: -I${includedir}
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
Name: libturbojpeg
Description: A SIMD-accelerated JPEG codec that provides the TurboJPEG API
-Version: @PACKAGE_VERSION@
+Version: @VERSION@
Libs: -L${libdir} -lturbojpeg
Cflags: -I${includedir}
fi
}
+safedirmove ()
+{
+ if [ "$1" = "$2" ]; then
+ return 0
+ fi
+ if [ "$1" = "" -o ! -d "$1" ]; then
+ echo safedirmove: source dir $1 is not valid
+ return 1
+ fi
+ if [ "$2" = "" -o -e "$2" ]; then
+ echo safedirmove: dest dir $2 is not valid
+ return 1
+ fi
+ if [ "$3" = "" -o -e "$3" ]; then
+ echo safedirmove: tmp dir $3 is not valid
+ return 1
+ fi
+ mkdir -p $3
+ mv $1/* $3/
+ rmdir $1
+ mkdir -p $2
+ mv $3/* $2/
+ rmdir $3
+ return 0
+}
+
PACKAGE_NAME=@PKGNAME@
VERSION=@VERSION@
BUILD=@BUILD@
-SRCDIR=@abs_top_srcdir@
-PREFIX=%{__prefix}
-DOCDIR=%{__docdir}
-LIBDIR=%{__libdir}
+PREFIX=@CMAKE_INSTALL_PREFIX@
+DOCDIR=@DOCDIR@
+LIBDIR=@LIBDIR@
umask 022
rm -f $PACKAGE_NAME-$VERSION-$BUILD.tar.bz2
TMPDIR=`mktemp -d /tmp/ljtbuild.XXXXXX`
__PWD=`pwd`
-make install DESTDIR=$TMPDIR/pkg docdir=/usr/share/doc/$PACKAGE_NAME-$VERSION \
- exampledir=/usr/share/doc/$PACKAGE_NAME-$VERSION
-rm $TMPDIR/pkg$LIBDIR/*.la
-if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$DOCDIR" = "/opt/libjpeg-turbo/doc" ]; then
+make install DESTDIR=$TMPDIR/pkg
+if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
+ safedirmove $TMPDIR/pkg$DOCDIR $TMPDIR/pkg/usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/__tmpdoc
ln -fs /usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/pkg$DOCDIR
fi
cd $TMPDIR/pkg
id | cut -f2 -d = | cut -f1 -d \(;
}
+safedirmove ()
+{
+ if [ "$1" = "$2" ]; then
+ return 0
+ fi
+ if [ "$1" = "" -o ! -d "$1" ]; then
+ echo safedirmove: source dir $1 is not valid
+ return 1
+ fi
+ if [ "$2" = "" -o -e "$2" ]; then
+ echo safedirmove: dest dir $2 is not valid
+ return 1
+ fi
+ if [ "$3" = "" -o -e "$3" ]; then
+ echo safedirmove: tmp dir $3 is not valid
+ return 1
+ fi
+ mkdir -p $3
+ mv $1/* $3/
+ rmdir $1
+ mkdir -p $2
+ mv $3/* $2/
+ rmdir $3
+ return 0
+}
+
makedeb()
{
SUPPLEMENT=$1
mkdir $TMPDIR/DEBIAN
if [ $SUPPLEMENT = 1 ]; then
- make install DESTDIR=$TMPDIR bindir=/dummy/bin datadir=/dummy/data \
- docdir=/dummy/doc includedir=/dummy/include mandir=/dummy/man
- rm -f $TMPDIR$LIBDIR/*.la
- rm -rf $TMPDIR/dummy
+ make install DESTDIR=$TMPDIR
+ rm -rf $TMPDIR$BINDIR
+ if [ "$DATADIR" != "$PREFIX" ]; then
+ rm -rf $TMPDIR$DATADIR
+ else
+ rm -rf $TMPDIR$PREFIX/classes
+ fi
+ rm -rf $TMPDIR$DOCDIR
+ rm -rf $TMPDIR$INCLUDEDIR
+ rm -rf $TMPDIR$MANDIR
else
- make install DESTDIR=$TMPDIR docdir=/usr/share/doc/$DIRNAME-$VERSION \
- exampledir=/usr/share/doc/$DIRNAME-$VERSION
- rm -f $TMPDIR$LIBDIR/*.la
- if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$DOCDIR" = "/opt/libjpeg-turbo/doc" ]; then
+ make install DESTDIR=$TMPDIR
+ if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
+ safedirmove $TMPDIR/$DOCDIR $TMPDIR/usr/share/doc/$PACKAGE_NAME-$VERSION $TMPDIR/__tmpdoc
ln -fs /usr/share/doc/$DIRNAME-$VERSION $TMPDIR$DOCDIR
fi
fi
SIZE=`du -s $TMPDIR | cut -f1`
- (cat $SRCDIR/release/deb-control.tmpl | sed s/{__PKGNAME}/$PACKAGE_NAME/g \
- | sed s/{__VERSION}/$VERSION/g | sed s/{__BUILD}/$BUILD/g \
+ (cat pkgscripts/deb-control | sed s/{__PKGNAME}/$PACKAGE_NAME/g \
| sed s/{__ARCH}/$DEBARCH/g | sed s/{__SIZE}/$SIZE/g \
> $TMPDIR/DEBIAN/control)
-
/sbin/ldconfig -n $TMPDIR$LIBDIR
$SUDO chown -Rh root:root $TMPDIR/*
PACKAGE_NAME=@PKGNAME@
VERSION=@VERSION@
-BUILD=@BUILD@
DEBARCH=@DEBARCH@
-SRCDIR=@abs_top_srcdir@
-PREFIX=%{__prefix}
-DOCDIR=%{__docdir}
-LIBDIR=%{__libdir}
+PREFIX=@CMAKE_INSTALL_PREFIX@
+BINDIR=@BINDIR@
+DATADIR=@DATADIR@
+DOCDIR=@DOCDIR@
+INCLUDEDIR=@INCLUDEDIR@
+LIBDIR=@LIBDIR@
+MANDIR=@MANDIR@
if [ ! `uid` -eq 0 ]; then
SUDO=sudo
fi
}
+safedirmove ()
+{
+ if [ "$1" = "$2" ]; then
+ return 0
+ fi
+ if [ "$1" = "" -o ! -d "$1" ]; then
+ echo safedirmove: source dir $1 is not valid
+ return 1
+ fi
+ if [ "$2" = "" -o -e "$2" ]; then
+ echo safedirmove: dest dir $2 is not valid
+ return 1
+ fi
+ if [ "$3" = "" -o -e "$3" ]; then
+ echo safedirmove: tmp dir $3 is not valid
+ return 1
+ fi
+ mkdir -p $3
+ mv $1/* $3/
+ rmdir $1
+ mkdir -p $2
+ mv $3/* $2/
+ rmdir $3
+ return 0
+}
+
usage()
{
- echo "$0 [-build32 [32-bit build dir]] [-buildarmv6 [ARMv6 build dir]] [-buildarmv7 [ARMv7 build dir]] [-buildarmv7s [ARMv7s build dir] [-buildarmv8 [ARMv8 build dir]] [-lipo [path to lipo]]"
+ echo "$0 [universal] [-lipo [path to lipo]]"
exit 1
}
+UNIVERSAL=0
+
PACKAGE_NAME=@PKGNAME@
VERSION=@VERSION@
BUILD=@BUILD@
-SRCDIR=@abs_top_srcdir@
-BUILDDIR32=@abs_top_srcdir@/osxx86
-BUILD32=0
-BUILDDIRARMV6=@abs_top_srcdir@/iosarmv6
-BUILDARMV6=0
-BUILDDIRARMV7=@abs_top_srcdir@/iosarmv7
-BUILDARMV7=0
-BUILDDIRARMV7S=@abs_top_srcdir@/iosarmv7s
-BUILDARMV7S=0
-BUILDDIRARMV8=@abs_top_srcdir@/iosarmv8
-BUILDARMV8=0
+SRCDIR=@CMAKE_SOURCE_DIR@
+BUILDDIR32=@OSX_32BIT_BUILD@
+BUILDDIRARMV7=@IOS_ARMV7_BUILD@
+BUILDDIRARMV7S=@IOS_ARMV7S_BUILD@
+BUILDDIRARMV8=@IOS_ARMV8_BUILD@
WITH_JAVA=@WITH_JAVA@
LIPO=lipo
-PREFIX=%{__prefix}
-BINDIR=%{__bindir}
-DOCDIR=%{__docdir}
-LIBDIR=%{__libdir}
+PREFIX=@CMAKE_INSTALL_PREFIX@
+BINDIR=@BINDIR@
+DOCDIR=@DOCDIR@
+LIBDIR=@LIBDIR@
+
+LIBJPEG_DSO_NAME=libjpeg.@SO_MAJOR_VERSION@.@SO_AGE@.@SO_MINOR_VERSION@.dylib
+TURBOJPEG_DSO_NAME=libturbojpeg.@TURBOJPEG_SO_VERSION@.dylib
while [ $# -gt 0 ]; do
case $1 in
- -h*) usage 0 ;;
- -build32)
- BUILD32=1
- if [ $# -gt 1 ]; then
- if [[ ! "$2" =~ -.* ]]; then
- BUILDDIR32=$2; shift
- fi
- fi
- ;;
- -buildarmv6)
- BUILDARMV6=1
- if [ $# -gt 1 ]; then
- if [[ ! "$2" =~ -.* ]]; then
- BUILDDIRARMV6=$2; shift
- fi
- fi
- ;;
- -buildarmv7)
- BUILDARMV7=1
- if [ $# -gt 1 ]; then
- if [[ ! "$2" =~ -.* ]]; then
- BUILDDIRARMV7=$2; shift
- fi
- fi
- ;;
- -buildarmv7s)
- BUILDARMV7S=1
- if [ $# -gt 1 ]; then
- if [[ ! "$2" =~ -.* ]]; then
- BUILDDIRARMV7S=$2; shift
- fi
- fi
- ;;
- -buildarmv8)
- BUILDARMV8=1
- if [ $# -gt 1 ]; then
- if [[ ! "$2" =~ -.* ]]; then
- BUILDDIRARMV8=$2; shift
- fi
- fi
+ -h*)
+ usage 0
;;
-lipo)
if [ $# -gt 1 ]; then
fi
fi
;;
+ universal)
+ UNIVERSAL=1
+ ;;
esac
shift
done
TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
PKGROOT=$TMPDIR/pkg/Package_Root
mkdir -p $PKGROOT
-make install DESTDIR=$PKGROOT docdir=/Library/Documentation/$PACKAGE_NAME \
- exampledir=/Library/Documentation/$PACKAGE_NAME
-rm -f $PKGROOT$LIBDIR/*.la
-if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$DOCDIR" = "/opt/libjpeg-turbo/doc" ]; then
- ln -fs /Library/Documentation/$PACKAGE_NAME $PKGROOT$DOCDIR
+make install DESTDIR=$PKGROOT
+
+if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$DOCDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/doc" ]; then
+ mkdir -p $PKGROOT/Library/Documentation
+ safedirmove $PKGROOT$DOCDIR $PKGROOT/Library/Documentation/@CMAKE_PROJECT_NAME@ $TMPDIR/__tmpdoc
+ ln -fs /Library/Documentation/@CMAKE_PROJECT_NAME@ $PKGROOT$DOCDIR
fi
-if [ $BUILD32 = 1 ]; then
+if [ $UNIVERSAL = 1 -a "$BUILDDIR32" != "" ]; then
if [ ! -d $BUILDDIR32 ]; then
echo ERROR: 32-bit build directory $BUILDDIR32 does not exist
exit 1
pushd $BUILDDIR32
make install DESTDIR=$TMPDIR/dist.x86
popd
- if [ ! -h $TMPDIR/dist.x86/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib ]; then
- $LIPO -create \
- -arch i386 $TMPDIR/dist.x86/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -arch x86_64 $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib
- elif [ ! -h $TMPDIR/dist.x86/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib ]; then
- $LIPO -create \
- -arch i386 $TMPDIR/dist.x86/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -arch x86_64 $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib
- fi
+ $LIPO -create \
+ -arch i386 $TMPDIR/dist.x86/$LIBDIR/$LIBJPEG_DSO_NAME \
+ -arch x86_64 $PKGROOT/$LIBDIR/$LIBJPEG_DSO_NAME \
+ -output $PKGROOT/$LIBDIR/$LIBJPEG_DSO_NAME
$LIPO -create \
-arch i386 $TMPDIR/dist.x86/$LIBDIR/libjpeg.a \
-arch x86_64 $PKGROOT/$LIBDIR/libjpeg.a \
-output $PKGROOT/$LIBDIR/libjpeg.a
$LIPO -create \
- -arch i386 $TMPDIR/dist.x86/$LIBDIR/libturbojpeg.0.dylib \
- -arch x86_64 $PKGROOT/$LIBDIR/libturbojpeg.0.dylib \
- -output $PKGROOT/$LIBDIR/libturbojpeg.0.dylib
+ -arch i386 $TMPDIR/dist.x86/$LIBDIR/$TURBOJPEG_DSO_NAME \
+ -arch x86_64 $PKGROOT/$LIBDIR/$TURBOJPEG_DSO_NAME \
+ -output $PKGROOT/$LIBDIR/$TURBOJPEG_DSO_NAME
$LIPO -create \
-arch i386 $TMPDIR/dist.x86/$LIBDIR/libturbojpeg.a \
-arch x86_64 $PKGROOT/$LIBDIR/libturbojpeg.a \
-arch i386 $TMPDIR/dist.x86/$BINDIR/wrjpgcom \
-arch x86_64 $PKGROOT/$BINDIR/wrjpgcom \
-output $PKGROOT/$BINDIR/wrjpgcom
-
fi
-if [ $BUILDARMV6 = 1 ]; then
- if [ ! -d $BUILDDIRARMV6 ]; then
- echo ERROR: ARMv6 build directory $BUILDDIRARMV6 does not exist
- exit 1
- fi
- if [ ! -f $BUILDDIRARMV6/Makefile ]; then
- echo ERROR: ARMv6 build directory $BUILDDIRARMV6 is not configured
- exit 1
- fi
- mkdir -p $TMPDIR/dist.armv6
- pushd $BUILDDIRARMV6
- make install DESTDIR=$TMPDIR/dist.armv6
- popd
- if [ ! -h $TMPDIR/dist.armv6/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -arch arm $TMPDIR/dist.armv6/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib
- elif [ ! -h $TMPDIR/dist.armv6/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -arch arm $TMPDIR/dist.armv6/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib
- fi
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.a \
- -arch arm $TMPDIR/dist.armv6/$LIBDIR/libjpeg.a \
- -output $PKGROOT/$LIBDIR/libjpeg.a
- $LIPO -create \
- $PKGROOT/$LIBDIR/libturbojpeg.0.dylib \
- -arch arm $TMPDIR/dist.armv6/$LIBDIR/libturbojpeg.0.dylib \
- -output $PKGROOT/$LIBDIR/libturbojpeg.0.dylib
- $LIPO -create \
- $PKGROOT/$LIBDIR/libturbojpeg.a \
- -arch arm $TMPDIR/dist.armv6/$LIBDIR/libturbojpeg.a \
- -output $PKGROOT/$LIBDIR/libturbojpeg.a
- $LIPO -create \
- $PKGROOT/$BINDIR/cjpeg \
- -arch arm $TMPDIR/dist.armv6/$BINDIR/cjpeg \
- -output $PKGROOT/$BINDIR/cjpeg
- $LIPO -create \
- $PKGROOT/$BINDIR/djpeg \
- -arch arm $TMPDIR/dist.armv6/$BINDIR/djpeg \
- -output $PKGROOT/$BINDIR/djpeg
- $LIPO -create \
- $PKGROOT/$BINDIR/jpegtran \
- -arch arm $TMPDIR/dist.armv6/$BINDIR/jpegtran \
- -output $PKGROOT/$BINDIR/jpegtran
- $LIPO -create \
- $PKGROOT/$BINDIR/tjbench \
- -arch arm $TMPDIR/dist.armv6/$BINDIR/tjbench \
- -output $PKGROOT/$BINDIR/tjbench
- $LIPO -create \
- $PKGROOT/$BINDIR/rdjpgcom \
- -arch arm $TMPDIR/dist.armv6/$BINDIR/rdjpgcom \
- -output $PKGROOT/$BINDIR/rdjpgcom
- $LIPO -create \
- $PKGROOT/$BINDIR/wrjpgcom \
- -arch arm $TMPDIR/dist.armv6/$BINDIR/wrjpgcom \
- -output $PKGROOT/$BINDIR/wrjpgcom
-fi
+install_ios()
+{
+ BUILDDIR=$1
+ ARCHNAME=$2
+ DIRNAME=$3
+ LIPOARCH=$4
-if [ $BUILDARMV7 = 1 ]; then
- if [ ! -d $BUILDDIRARMV7 ]; then
- echo ERROR: ARMv7 build directory $BUILDDIRARMV7 does not exist
+ if [ ! -d $BUILDDIR ]; then
+ echo ERROR: $ARCHNAME build directory $BUILDDIR does not exist
exit 1
fi
- if [ ! -f $BUILDDIRARMV7/Makefile ]; then
- echo ERROR: ARMv7 build directory $BUILDDIRARMV7 is not configured
+ if [ ! -f $BUILDDIR/Makefile ]; then
+ echo ERROR: $ARCHNAME build directory $BUILDDIR is not configured
exit 1
fi
- mkdir -p $TMPDIR/dist.armv7
- pushd $BUILDDIRARMV7
- make install DESTDIR=$TMPDIR/dist.armv7
+ mkdir -p $TMPDIR/dist.$DIRNAME
+ pushd $BUILDDIR
+ make install DESTDIR=$TMPDIR/dist.$DIRNAME
popd
- if [ ! -h $TMPDIR/dist.armv7/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -arch arm $TMPDIR/dist.armv7/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib
- elif [ ! -h $TMPDIR/dist.armv7/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -arch arm $TMPDIR/dist.armv7/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib
- fi
+ $LIPO -create \
+ $PKGROOT/$LIBDIR/$LIBJPEG_DSO_NAME \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$LIBDIR/$LIBJPEG_DSO_NAME \
+ -output $PKGROOT/$LIBDIR/$LIBJPEG_DSO_NAME
$LIPO -create \
$PKGROOT/$LIBDIR/libjpeg.a \
- -arch arm $TMPDIR/dist.armv7/$LIBDIR/libjpeg.a \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$LIBDIR/libjpeg.a \
-output $PKGROOT/$LIBDIR/libjpeg.a
$LIPO -create \
- $PKGROOT/$LIBDIR/libturbojpeg.0.dylib \
- -arch arm $TMPDIR/dist.armv7/$LIBDIR/libturbojpeg.0.dylib \
- -output $PKGROOT/$LIBDIR/libturbojpeg.0.dylib
+ $PKGROOT/$LIBDIR/$TURBOJPEG_DSO_NAME \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$LIBDIR/$TURBOJPEG_DSO_NAME \
+ -output $PKGROOT/$LIBDIR/$TURBOJPEG_DSO_NAME
$LIPO -create \
$PKGROOT/$LIBDIR/libturbojpeg.a \
- -arch arm $TMPDIR/dist.armv7/$LIBDIR/libturbojpeg.a \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$LIBDIR/libturbojpeg.a \
-output $PKGROOT/$LIBDIR/libturbojpeg.a
$LIPO -create \
$PKGROOT/$BINDIR/cjpeg \
- -arch arm $TMPDIR/dist.armv7/$BINDIR/cjpeg \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$BINDIR/cjpeg \
-output $PKGROOT/$BINDIR/cjpeg
$LIPO -create \
$PKGROOT/$BINDIR/djpeg \
- -arch arm $TMPDIR/dist.armv7/$BINDIR/djpeg \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$BINDIR/djpeg \
-output $PKGROOT/$BINDIR/djpeg
$LIPO -create \
$PKGROOT/$BINDIR/jpegtran \
- -arch arm $TMPDIR/dist.armv7/$BINDIR/jpegtran \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$BINDIR/jpegtran \
-output $PKGROOT/$BINDIR/jpegtran
$LIPO -create \
$PKGROOT/$BINDIR/tjbench \
- -arch arm $TMPDIR/dist.armv7/$BINDIR/tjbench \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$BINDIR/tjbench \
-output $PKGROOT/$BINDIR/tjbench
$LIPO -create \
$PKGROOT/$BINDIR/rdjpgcom \
- -arch arm $TMPDIR/dist.armv7/$BINDIR/rdjpgcom \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$BINDIR/rdjpgcom \
-output $PKGROOT/$BINDIR/rdjpgcom
$LIPO -create \
$PKGROOT/$BINDIR/wrjpgcom \
- -arch arm $TMPDIR/dist.armv7/$BINDIR/wrjpgcom \
+ -arch $LIPOARCH $TMPDIR/dist.$DIRNAME/$BINDIR/wrjpgcom \
-output $PKGROOT/$BINDIR/wrjpgcom
+}
+
+if [ $UNIVERSAL = 1 -a "$BUILDDIRARMV7" != "" ]; then
+ install_ios $BUILDDIRARMV7 ARMv7 armv7 arm
fi
-if [ $BUILDARMV7S = 1 ]; then
- if [ ! -d $BUILDDIRARMV7S ]; then
- echo ERROR: ARMv7s build directory $BUILDDIRARMV7S does not exist
- exit 1
- fi
- if [ ! -f $BUILDDIRARMV7S/Makefile ]; then
- echo ERROR: ARMv7s build directory $BUILDDIRARMV7S is not configured
- exit 1
- fi
- mkdir -p $TMPDIR/dist.armv7s
- pushd $BUILDDIRARMV7S
- make install DESTDIR=$TMPDIR/dist.armv7s
- popd
- if [ ! -h $TMPDIR/dist.armv7s/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -arch arm $TMPDIR/dist.armv7s/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib
- elif [ ! -h $TMPDIR/dist.armv7s/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -arch arm $TMPDIR/dist.armv7s/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib
- fi
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.a \
- -arch arm $TMPDIR/dist.armv7s/$LIBDIR/libjpeg.a \
- -output $PKGROOT/$LIBDIR/libjpeg.a
- $LIPO -create \
- $PKGROOT/$LIBDIR/libturbojpeg.0.dylib \
- -arch arm $TMPDIR/dist.armv7s/$LIBDIR/libturbojpeg.0.dylib \
- -output $PKGROOT/$LIBDIR/libturbojpeg.0.dylib
- $LIPO -create \
- $PKGROOT/$LIBDIR/libturbojpeg.a \
- -arch arm $TMPDIR/dist.armv7s/$LIBDIR/libturbojpeg.a \
- -output $PKGROOT/$LIBDIR/libturbojpeg.a
- $LIPO -create \
- $PKGROOT/$BINDIR/cjpeg \
- -arch arm $TMPDIR/dist.armv7s/$BINDIR/cjpeg \
- -output $PKGROOT/$BINDIR/cjpeg
- $LIPO -create \
- $PKGROOT/$BINDIR/djpeg \
- -arch arm $TMPDIR/dist.armv7s/$BINDIR/djpeg \
- -output $PKGROOT/$BINDIR/djpeg
- $LIPO -create \
- $PKGROOT/$BINDIR/jpegtran \
- -arch arm $TMPDIR/dist.armv7s/$BINDIR/jpegtran \
- -output $PKGROOT/$BINDIR/jpegtran
- $LIPO -create \
- $PKGROOT/$BINDIR/tjbench \
- -arch arm $TMPDIR/dist.armv7s/$BINDIR/tjbench \
- -output $PKGROOT/$BINDIR/tjbench
- $LIPO -create \
- $PKGROOT/$BINDIR/rdjpgcom \
- -arch arm $TMPDIR/dist.armv7s/$BINDIR/rdjpgcom \
- -output $PKGROOT/$BINDIR/rdjpgcom
- $LIPO -create \
- $PKGROOT/$BINDIR/wrjpgcom \
- -arch arm $TMPDIR/dist.armv7s/$BINDIR/wrjpgcom \
- -output $PKGROOT/$BINDIR/wrjpgcom
+if [ $UNIVERSAL = 1 -a "$BUILDDIRARMV7S" != "" ]; then
+ install_ios $BUILDDIRARMV7S ARMv7s armv7s arm
fi
-if [ $BUILDARMV8 = 1 ]; then
- if [ ! -d $BUILDDIRARMV8 ]; then
- echo ERROR: ARMv8 build directory $BUILDDIRARMV8 does not exist
- exit 1
- fi
- if [ ! -f $BUILDDIRARMV8/Makefile ]; then
- echo ERROR: ARMv8 build directory $BUILDDIRARMV8 is not configured
- exit 1
- fi
- mkdir -p $TMPDIR/dist.armv8
- pushd $BUILDDIRARMV8
- make install DESTDIR=$TMPDIR/dist.armv8
- popd
- if [ ! -h $TMPDIR/dist.armv8/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -arch arm64 $TMPDIR/dist.armv8/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib
- elif [ ! -h $TMPDIR/dist.armv8/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib -a \
- ! -h $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib ]; then
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -arch arm64 $TMPDIR/dist.armv8/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
- -output $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib
- fi
- $LIPO -create \
- $PKGROOT/$LIBDIR/libjpeg.a \
- -arch arm64 $TMPDIR/dist.armv8/$LIBDIR/libjpeg.a \
- -output $PKGROOT/$LIBDIR/libjpeg.a
- $LIPO -create \
- $PKGROOT/$LIBDIR/libturbojpeg.0.dylib \
- -arch arm64 $TMPDIR/dist.armv8/$LIBDIR/libturbojpeg.0.dylib \
- -output $PKGROOT/$LIBDIR/libturbojpeg.0.dylib
- $LIPO -create \
- $PKGROOT/$LIBDIR/libturbojpeg.a \
- -arch arm64 $TMPDIR/dist.armv8/$LIBDIR/libturbojpeg.a \
- -output $PKGROOT/$LIBDIR/libturbojpeg.a
- $LIPO -create \
- $PKGROOT/$BINDIR/cjpeg \
- -arch arm64 $TMPDIR/dist.armv8/$BINDIR/cjpeg \
- -output $PKGROOT/$BINDIR/cjpeg
- $LIPO -create \
- $PKGROOT/$BINDIR/djpeg \
- -arch arm64 $TMPDIR/dist.armv8/$BINDIR/djpeg \
- -output $PKGROOT/$BINDIR/djpeg
- $LIPO -create \
- $PKGROOT/$BINDIR/jpegtran \
- -arch arm64 $TMPDIR/dist.armv8/$BINDIR/jpegtran \
- -output $PKGROOT/$BINDIR/jpegtran
- $LIPO -create \
- $PKGROOT/$BINDIR/tjbench \
- -arch arm64 $TMPDIR/dist.armv8/$BINDIR/tjbench \
- -output $PKGROOT/$BINDIR/tjbench
- $LIPO -create \
- $PKGROOT/$BINDIR/rdjpgcom \
- -arch arm64 $TMPDIR/dist.armv8/$BINDIR/rdjpgcom \
- -output $PKGROOT/$BINDIR/rdjpgcom
- $LIPO -create \
- $PKGROOT/$BINDIR/wrjpgcom \
- -arch arm64 $TMPDIR/dist.armv8/$BINDIR/wrjpgcom \
- -output $PKGROOT/$BINDIR/wrjpgcom
+if [ $UNIVERSAL = 1 -a "BUILDDIRARMV8" != "" ]; then
+ install_ios $BUILDDIRARMV8 ARMv8 armv8 arm64
fi
-install_name_tool -id $LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib $PKGROOT/$LIBDIR/libjpeg.@SO_MAJOR_VERSION@.dylib
-install_name_tool -id $LIBDIR/libturbojpeg.0.dylib $PKGROOT/$LIBDIR/libturbojpeg.0.dylib
+install_name_tool -id $LIBDIR/$LIBJPEG_DSO_NAME $PKGROOT/$LIBDIR/$LIBJPEG_DSO_NAME
+install_name_tool -id $LIBDIR/$TURBOJPEG_DSO_NAME $PKGROOT/$LIBDIR/$TURBOJPEG_DSO_NAME
if [ $WITH_JAVA = 1 ]; then
- ln -fs libturbojpeg.0.dylib $PKGROOT/$LIBDIR/libturbojpeg.jnilib
+ ln -fs $TURBOJPEG_DSO_NAME $PKGROOT/$LIBDIR/libturbojpeg.jnilib
fi
-if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$LIBDIR" = "/opt/libjpeg-turbo/lib" ]; then
+if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$LIBDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/lib" ]; then
if [ ! -h $PKGROOT/$PREFIX/lib32 ]; then
ln -fs lib $PKGROOT/$PREFIX/lib32
fi
cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.txt $TMPDIR/pkg/
mkdir $TMPDIR/dmg
-pkgbuild --root $PKGROOT --version $VERSION.$BUILD \
- --identifier com.libjpeg-turbo.libjpeg-turbo $TMPDIR/pkg/$PACKAGE_NAME.pkg
-productbuild --distribution $SRCDIR/release/Distribution.xml \
+pkgbuild --root $PKGROOT --version $VERSION.$BUILD --identifier @PKGID@ \
+ $TMPDIR/pkg/$PACKAGE_NAME.pkg
+productbuild --distribution pkgscripts/Distribution.xml \
--package-path $TMPDIR/pkg/ --resources $TMPDIR/pkg/ \
$TMPDIR/dmg/$PACKAGE_NAME.pkg
hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
--- /dev/null
+#!/bin/sh
+
+set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
+
+TMPDIR=
+
+onexit()
+{
+ if [ ! "$TMPDIR" = "" ]; then
+ rm -rf $TMPDIR
+ fi
+}
+
+if [ -f @PKGNAME@-@VERSION@.@RPMARCH@.rpm ]; then
+ rm -f @PKGNAME@-@VERSION@.@RPMARCH@.rpm
+fi
+
+umask 022
+TMPDIR=`mktemp -d /tmp/@CMAKE_PROJECT_NAME@-build.XXXXXX`
+
+mkdir -p $TMPDIR/RPMS
+ln -fs `pwd` $TMPDIR/BUILD
+rpmbuild -bb --define "_blddir $TMPDIR/buildroot" --define "_topdir $TMPDIR" \
+ --target @RPMARCH@ pkgscripts/@CMAKE_PROJECT_NAME@.spec; \
+cp $TMPDIR/RPMS/@RPMARCH@/@PKGNAME@-@VERSION@-@BUILD@.@RPMARCH@.rpm \
+ @PKGNAME@-@VERSION@.@RPMARCH@.rpm
--- /dev/null
+#!/bin/sh
+
+set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
+
+TMPDIR=
+
+onexit()
+{
+ if [ ! "$TMPDIR" = "" ]; then
+ rm -rf $TMPDIR
+ fi
+}
+
+PKGNAME=@PKGNAME@
+PROJECT=@CMAKE_PROJECT_NAME@
+VERSION=@VERSION@
+BUILD=@BUILD@
+
+if [ -f $PKGNAME-$VERSION.src.rpm ]; then
+ rm -f $PKGNAME-$VERSION.src.rpm
+fi
+
+umask 022
+TMPDIR=`mktemp -d /tmp/$PKGNAME-build.XXXXXX`
+
+mkdir -p $TMPDIR/RPMS
+mkdir -p $TMPDIR/SRPMS
+mkdir -p $TMPDIR/BUILD
+mkdir -p $TMPDIR/SOURCES
+mkdir -p $TMPDIR/SPECS
+
+if [ ! -f $PROJECT-$VERSION.tar.gz ]; then
+ echo "ERROR: $PROJECT-$VERSION.tar.gz does not exist."
+fi
+
+cp $PROJECT-$VERSION.tar.gz $TMPDIR/SOURCES/$PROJECT-$VERSION.tar.gz
+
+cat pkgscripts/$PROJECT.spec | sed s/%{_blddir}/%{_tmppath}/g \
+ | sed s/#--\>//g > $TMPDIR/SPECS/$PROJECT.spec
+
+rpmbuild -bs --define "_topdir $TMPDIR" $TMPDIR/SPECS/$PROJECT.spec
+mv $TMPDIR/SRPMS/$PKGNAME-$VERSION-$BUILD.src.rpm $PKGNAME-$VERSION.src.rpm
+
+exit
--- /dev/null
+#!/bin/sh
+
+set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
+
+TMPDIR=
+SUDO=
+
+onexit()
+{
+ if [ ! "$TMPDIR" = "" ]; then
+ $SUDO rm -rf $TMPDIR
+ fi
+}
+
+uid()
+{
+ id | cut -f2 -d = | cut -f1 -d \(;
+}
+
+PACKAGE_NAME=@PKGNAME@
+VERSION=@VERSION@
+ARCH=@CPU_TYPE@
+OS=@CMAKE_SYSTEM_NAME@
+PREFIX=@CMAKE_INSTALL_PREFIX@
+
+if [ ! `uid` -eq 0 ]; then
+ SUDO=sudo
+fi
+
+umask 022
+rm -f $PACKAGE_NAME-$VERSION-$OS-$ARCH.tar.bz2
+TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
+mkdir -p $TMPDIR/install
+
+make install DESTDIR=$TMPDIR/install
+$SUDO chown -Rh root:root $TMPDIR/install
+tar cf - -C $TMPDIR/install .$PREFIX | bzip2 -c >$PACKAGE_NAME-$VERSION-$OS-$ARCH.tar.bz2
+
+exit
fi
PACKAGE=@PKGNAME@
-MACPACKAGE=com.$PACKAGE.$PACKAGE
+MACPACKAGE=@PKGID@
RECEIPT=/Library/Receipts/$PACKAGE.pkg
LSBOM=
popd
echo Removing package directories ...
-PREFIX=%{__prefix}
-BINDIR=%{__bindir}
-DATADIR=%{__datadir}
-INCLUDEDIR=%{__includedir}
-LIBDIR=%{__libdir}
-MANDIR=%{__mandir}
+PREFIX=@CMAKE_INSTALL_PREFIX@
+BINDIR=@BINDIR@
+DATADIR=@DATADIR@
+INCLUDEDIR=@INCLUDEDIR@
+LIBDIR=@LIBDIR@
+MANDIR=@MANDIR@
if [ -d $BINDIR ]; then
rmdir $BINDIR 2>&1 || EXITSTATUS=-1
if [ -d $INCLUDEDIR ]; then
rmdir $INCLUDEDIR 2>&1 || EXITSTATUS=-1
fi
-if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$LIBDIR" = "/opt/libjpeg-turbo/lib" ]; then
+if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a "$LIBDIR" = "@DEFAULT_CMAKE_INSTALL_PREFIX@/lib" ]; then
if [ -h $LIBDIR\32 ]; then
rm $LIBDIR\32 2>&1 || EXITSTATUS=-1
fi
if [ -d $DATADIR -a "$DATADIR" != "$PREFIX" ]; then
rmdir $DATADIR 2>&1 || EXITSTATUS=-1
fi
-if [ "$PREFIX" = "/opt/libjpeg-turbo" -a -h "$PREFIX/doc" ]; then
+if [ "$PREFIX" = "@DEFAULT_CMAKE_INSTALL_PREFIX@" -a -h "$PREFIX/doc" ]; then
rm $PREFIX/doc 2>&1 || EXITSTATUS=-1
fi
rmdir $PREFIX 2>&1 || EXITSTATUS=-1
-rmdir /Library/Documentation/$PACKAGE 2>&1 || EXITSTATUS=-1
+rmdir /Library/Documentation/@CMAKE_PROJECT_NAME@ 2>&1 || EXITSTATUS=-1
if [ -d $RECEIPT ]; then
echo Removing package receipt ...
# better yet, provide a friendly way of configuring a Windows target to use the
# static C library.
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+
if(MSVC)
# Build all configurations against shared C library
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
set(JPEG_SRCS ${JPEG_SRCS} ${CMAKE_SOURCE_DIR}/${src})
endforeach()
-if(WITH_SIMD)
+if(WITH_SIMD AND MSVC_IDE)
# This tells CMake that the "source" files haven't been generated yet
set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
endif()
-if(WITH_MEM_SRCDST AND NOT WITH_JPEG8)
- add_library(jpeg SHARED ${JPEG_SRCS} ${SIMD_OBJS}
- ${CMAKE_SOURCE_DIR}/win/jpeg${DLL_VERSION}-memsrcdst.def)
-else()
- add_library(jpeg SHARED ${JPEG_SRCS} ${SIMD_OBJS}
- ${CMAKE_SOURCE_DIR}/win/jpeg${DLL_VERSION}.def)
+if(WIN32)
+ if(WITH_MEM_SRCDST)
+ set(DEFFILE ${CMAKE_SOURCE_DIR}/win/jpeg${SO_MAJOR_VERSION}-memsrcdst.def)
+ else()
+ set(DEFFILE ${CMAKE_SOURCE_DIR}/win/jpeg${SO_MAJOR_VERSION}.def)
+ endif()
+endif()
+add_library(jpeg SHARED ${JPEG_SRCS} ${DEFFILE} $<TARGET_OBJECTS:simd>
+ ${SIMD_OBJS})
+
+set_target_properties(jpeg PROPERTIES SOVERSION ${SO_MAJOR_VERSION}
+ VERSION ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION})
+if(MAPFLAG)
+ set_target_properties(jpeg PROPERTIES
+ LINK_FLAGS "${MAPFLAG}${CMAKE_BINARY_DIR}/libjpeg.map")
endif()
-set_target_properties(jpeg PROPERTIES SOVERSION ${DLL_VERSION}
- VERSION ${FULLVERSION})
if(MSVC)
- set_target_properties(jpeg PROPERTIES SUFFIX ${DLL_VERSION}.dll)
-elseif(MINGW OR CYGWIN)
- set_target_properties(jpeg PROPERTIES SUFFIX -${DLL_VERSION}.dll)
-endif(MSVC)
-if(WITH_SIMD)
- add_dependencies(jpeg simd)
+ set_target_properties(jpeg PROPERTIES SUFFIX ${SO_MAJOR_VERSION}.dll)
+ # The jsimd_*.c file is built using /MT, so this prevents a linker warning.
+ set_target_properties(jpeg PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT /NODEFAULTLIB:LIBCMTD")
+elseif(MINGW)
+ set_target_properties(jpeg PROPERTIES SUFFIX -${SO_MAJOR_VERSION}.dll)
endif()
+if(WIN32)
+ set(USE_SETMODE "-DUSE_SETMODE")
+endif()
if(WITH_12BIT)
- set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE")
+ set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}")
else()
- set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
+ set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}")
set(CJPEG_BMP_SOURCES ../rdbmp.c ../rdtarga.c)
set(DJPEG_BMP_SOURCES ../wrbmp.c ../wrtarga.c)
endif()
add_executable(jpegtran ../jpegtran.c ../cdjpeg.c ../rdswitch.c ../transupp.c)
target_link_libraries(jpegtran jpeg)
-set_property(TARGET jpegtran PROPERTY COMPILE_FLAGS "-DUSE_SETMODE")
+set_property(TARGET jpegtran PROPERTY COMPILE_FLAGS "${USE_SETMODE}")
add_executable(jcstest ../jcstest.c)
target_link_libraries(jcstest jpeg)
install(TARGETS jpeg cjpeg djpeg jpegtran
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin)
+ ARCHIVE DESTINATION ${LIBDIR}
+ LIBRARY DESTINATION ${LIBDIR}
+ RUNTIME DESTINATION ${BINDIR})
-if(NOT DEFINED NASM)
- find_program(NASM NAMES nasm yasm DOC "Path to NASM/YASM executable")
+macro(simd_fail message)
+ if(REQUIRE_SIMD)
+ message(FATAL_ERROR "${message}.")
+ else()
+ message(WARNING "${message}. Performance will suffer.")
+ set(WITH_SIMD 0 PARENT_SCOPE)
+ endif()
+endmacro()
+
+
+###############################################################################
+# x86[-64] (NASM)
+###############################################################################
+
+if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386")
+
+set(CMAKE_ASM_NASM_FLAGS_DEBUG_INIT "-g")
+set(CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO_INIT "-g")
+
+# Allow the location of the NASM executable to be specified using the ASM_NASM
+# environment variable. This should happen automatically, but unfortunately
+# enable_language(ASM_NASM) doesn't parse the ASM_NASM environment variable
+# until after CMAKE_ASM_NASM_COMPILER has been populated with the results of
+# searching for NASM or YASM in the PATH.
+if(NOT DEFINED CMAKE_ASM_NASM_COMPILER AND DEFINED ENV{ASM_NASM})
+ set(CMAKE_ASM_NASM_COMPILER $ENV{ASM_NASM})
endif()
-message(STATUS "NASM = ${NASM}")
-if(SIMD_X86_64)
- set(NAFLAGS -fwin64 -DWIN64 -D__x86_64__)
-else()
+if(CPU_TYPE STREQUAL "x86_64")
+ if(CYGWIN)
+ set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
+ endif()
+elseif(CPU_TYPE STREQUAL "i386")
if(BORLAND)
- set(NAFLAGS -fobj -DOBJ32)
- else()
- set(NAFLAGS -fwin32 -DWIN32)
+ set(CMAKE_ASM_NASM_OBJECT_FORMAT obj)
+ elseif(CYGWIN)
+ set(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
endif()
endif()
-set(NAFLAGS ${NAFLAGS} -I${CMAKE_SOURCE_DIR}/win/ -I${CMAKE_CURRENT_SOURCE_DIR}/)
-# This only works if building from the command line. There is currently no way
-# to set a variable's value based on the build type when using the MSVC IDE.
-if(CMAKE_BUILD_TYPE STREQUAL "Debug"
- OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
- set(NAFLAGS ${NAFLAGS} -g)
+enable_language(ASM_NASM)
+message(STATUS "CMAKE_ASM_NASM_COMPILER = ${CMAKE_ASM_NASM_COMPILER}")
+
+if(CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "macho*")
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DMACHO")
+elseif(CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "elf*")
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DELF")
+endif()
+if(CPU_TYPE STREQUAL "x86_64")
+ if(WIN32 OR CYGWIN)
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DWIN64")
+ endif()
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -D__x86_64__")
+elseif(CPU_TYPE STREQUAL "i386")
+ if(BORLAND)
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DOBJ32")
+ elseif(WIN32 OR CYGWIN)
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DWIN32")
+ endif()
endif()
-if(SIMD_X86_64)
- set(SIMD_BASENAMES jsimdcpu-64 jfdctflt-sse-64 jccolor-sse2-64 jcgray-sse2-64
- jchuff-sse2-64 jcsample-sse2-64 jdcolor-sse2-64 jdmerge-sse2-64
- jdsample-sse2-64 jfdctfst-sse2-64 jfdctint-sse2-64 jidctflt-sse2-64
- jidctfst-sse2-64 jidctint-sse2-64 jidctred-sse2-64 jquantf-sse2-64
- jquanti-sse2-64 jccolor-avx2-64 jcgray-avx2-64 jcsample-avx2-64
- jdcolor-avx2-64 jdmerge-avx2-64 jdsample-avx2-64 jquanti-avx2-64)
- message(STATUS "Building x86_64 SIMD extensions")
+message(STATUS "CMAKE_ASM_NASM_OBJECT_FORMAT = ${CMAKE_ASM_NASM_OBJECT_FORMAT}")
+
+if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
+ simd_fail("SIMD extensions disabled: could not determine NASM object format")
+ return()
+endif()
+
+if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED))
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DPIC")
+endif()
+
+string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
+set(EFFECTIVE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} ${CMAKE_ASM_NASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
+message(STATUS "CMAKE_ASM_NASM_FLAGS = ${EFFECTIVE_ASM_NASM_FLAGS}")
+
+set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I\"${CMAKE_CURRENT_SOURCE_DIR}/nasm/\" -I\"${CMAKE_CURRENT_SOURCE_DIR}/${CPU_TYPE}/\"")
+
+if(WIN32)
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I\"${CMAKE_SOURCE_DIR}/win/\"")
+ set(JSIMDCFG_INC ${CMAKE_SOURCE_DIR}/win/jsimdcfg.inc)
else()
- set(SIMD_BASENAMES jsimdcpu jfdctflt-3dn jidctflt-3dn jquant-3dn jccolor-mmx
- jcgray-mmx jcsample-mmx jdcolor-mmx jdmerge-mmx jdsample-mmx jfdctfst-mmx
- jfdctint-mmx jidctfst-mmx jidctint-mmx jidctred-mmx jquant-mmx jfdctflt-sse
- jidctflt-sse jquant-sse jccolor-sse2 jcgray-sse2 jchuff-sse2 jcsample-sse2
- jdcolor-sse2 jdmerge-sse2 jdsample-sse2 jfdctfst-sse2 jfdctint-sse2
- jidctflt-sse2 jidctfst-sse2 jidctint-sse2 jidctred-sse2 jquantf-sse2
- jquanti-sse2 jccolor-avx2 jcgray-avx2 jcsample-avx2 jdcolor-avx2
- jdmerge-avx2 jdsample-avx2 jquanti-avx2)
- message(STATUS "Building i386 SIMD extensions")
+ set(GREP grep)
+ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ set(GREP ggrep)
+ endif()
+ add_custom_command(OUTPUT jsimdcfg.inc
+ COMMAND ${CMAKE_C_COMPILER} -E -I${CMAKE_BINARY_DIR} -I${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/jsimdcfg.inc.h | ${GREP} -E '^[\;%]|^\ %' | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' >jsimdcfg.inc)
+ set(JSIMDCFG_INC ${CMAKE_CURRENT_BINARY_DIR}/jsimdcfg.inc)
+ set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -I\"${CMAKE_CURRENT_BINARY_DIR}/\"")
+endif()
+
+if(CPU_TYPE STREQUAL "x86_64")
+ set(SIMD_SOURCES x86_64/jsimdcpu.asm x86_64/jfdctflt-sse.asm
+ x86_64/jccolor-sse2.asm x86_64/jcgray-sse2.asm x86_64/jchuff-sse2.asm
+ x86_64/jcsample-sse2.asm x86_64/jdcolor-sse2.asm x86_64/jdmerge-sse2.asm
+ x86_64/jdsample-sse2.asm x86_64/jfdctfst-sse2.asm x86_64/jfdctint-sse2.asm
+ x86_64/jidctflt-sse2.asm x86_64/jidctfst-sse2.asm x86_64/jidctint-sse2.asm
+ x86_64/jidctred-sse2.asm x86_64/jquantf-sse2.asm x86_64/jquanti-sse2.asm
+ x86_64/jccolor-avx2.asm x86_64/jcgray-avx2.asm x86_64/jcsample-avx2.asm
+ x86_64/jdcolor-avx2.asm x86_64/jdmerge-avx2.asm x86_64/jdsample-avx2.asm
+ x86_64/jquanti-avx2.asm)
+else()
+ set(SIMD_SOURCES i386/jsimdcpu.asm i386/jfdctflt-3dn.asm
+ i386/jidctflt-3dn.asm i386/jquant-3dn.asm
+ i386/jccolor-mmx.asm i386/jcgray-mmx.asm i386/jcsample-mmx.asm
+ i386/jdcolor-mmx.asm i386/jdmerge-mmx.asm i386/jdsample-mmx.asm
+ i386/jfdctfst-mmx.asm i386/jfdctint-mmx.asm i386/jidctfst-mmx.asm
+ i386/jidctint-mmx.asm i386/jidctred-mmx.asm i386/jquant-mmx.asm
+ i386/jfdctflt-sse.asm i386/jidctflt-sse.asm i386/jquant-sse.asm
+ i386/jccolor-sse2.asm i386/jcgray-sse2.asm i386/jchuff-sse2.asm
+ i386/jcsample-sse2.asm i386/jdcolor-sse2.asm i386/jdmerge-sse2.asm
+ i386/jdsample-sse2.asm i386/jfdctfst-sse2.asm i386/jfdctint-sse2.asm
+ i386/jidctflt-sse2.asm i386/jidctfst-sse2.asm i386/jidctint-sse2.asm
+ i386/jidctred-sse2.asm i386/jquantf-sse2.asm i386/jquanti-sse2.asm
+ i386/jccolor-avx2.asm i386/jcgray-avx2.asm i386/jcsample-avx2.asm
+ i386/jdcolor-avx2.asm i386/jdmerge-avx2.asm i386/jdsample-avx2.asm
+ i386/jquanti-avx2.asm)
endif()
if(MSVC_IDE)
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
-else()
- set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
+ string(REGEX REPLACE " " ";" CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS}")
endif()
-file(GLOB INC_FILES *.inc)
+file(GLOB INC_FILES nasm/*.inc)
-foreach(file ${SIMD_BASENAMES})
- set(DEPFILE "")
- set(SIMD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${file}.asm)
+foreach(file ${SIMD_SOURCES})
+ set(OBJECT_DEPENDS "")
if(${file} MATCHES jccolor)
- set(DEPFILE ${file})
- string(REGEX REPLACE "jccolor" "jccolext" DEPFILE ${DEPFILE})
- set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
+ string(REGEX REPLACE "jccolor" "jccolext" DEPFILE ${file})
+ set(OBJECT_DEPENDS ${OBJECT_DEPENDS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE})
endif()
if(${file} MATCHES jcgray)
- set(DEPFILE ${file})
- string(REGEX REPLACE "jcgray" "jcgryext" DEPFILE ${DEPFILE})
- set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
+ string(REGEX REPLACE "jcgray" "jcgryext" DEPFILE ${file})
+ set(OBJECT_DEPENDS ${OBJECT_DEPENDS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE})
endif()
if(${file} MATCHES jdcolor)
- set(DEPFILE ${file})
- string(REGEX REPLACE "jdcolor" "jdcolext" DEPFILE ${DEPFILE})
- set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
+ string(REGEX REPLACE "jdcolor" "jdcolext" DEPFILE ${file})
+ set(OBJECT_DEPENDS ${OBJECT_DEPENDS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE})
endif()
if(${file} MATCHES jdmerge)
- set(DEPFILE ${file})
- string(REGEX REPLACE "jdmerge" "jdmrgext" DEPFILE ${DEPFILE})
- set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm)
+ string(REGEX REPLACE "jdmerge" "jdmrgext" DEPFILE ${file})
+ set(OBJECT_DEPENDS ${OBJECT_DEPENDS}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE})
+ endif()
+ set(OBJECT_DEPENDS ${OBJECT_DEPENDS} ${INC_FILES} ${JSIMDCFG_INC})
+ if(MSVC_IDE)
+ # The CMake Visual Studio generators do not work properly with the ASM_NASM
+ # language, so we have to go rogue here and use a custom command like we
+ # did in prior versions of libjpeg-turbo. (This is why we can't have nice
+ # things.)
+ string(REGEX REPLACE "${CPU_TYPE}/" "" filename ${file})
+ set(SIMD_OBJ ${OBJDIR}/${filename}.obj)
+ add_custom_command(OUTPUT ${SIMD_OBJ} DEPENDS ${file} ${OBJECT_DEPENDS}
+ COMMAND ${CMAKE_ASM_NASM_COMPILER} -f${CMAKE_ASM_NASM_OBJECT_FORMAT}
+ ${CMAKE_ASM_NASM_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${file}
+ -o${SIMD_OBJ})
+ set(SIMD_OBJS ${SIMD_OBJS} ${SIMD_OBJ})
+ else()
+ set_source_files_properties(${file} PROPERTIES OBJECT_DEPENDS
+ "${OBJECT_DEPENDS}")
endif()
- set(SIMD_OBJ ${OBJDIR}/${file}.obj)
- add_custom_command(OUTPUT ${SIMD_OBJ}
- DEPENDS ${SIMD_SRC} ${DEPFILE} ${INC_FILES}
- COMMAND ${NASM} ${NAFLAGS} ${SIMD_SRC} -o${SIMD_OBJ})
- set(SIMD_OBJS ${SIMD_OBJS} ${SIMD_OBJ})
endforeach()
-set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE)
-add_custom_target(simd DEPENDS ${SIMD_OBJS})
+if(MSVC_IDE)
+ set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE)
+ add_library(simd OBJECT ${CPU_TYPE}/jsimd.c)
+ add_custom_target(simd-objs DEPENDS ${SIMD_OBJS})
+ add_dependencies(simd simd-objs)
+else()
+ add_library(simd OBJECT ${SIMD_SOURCES} ${CPU_TYPE}/jsimd.c)
+endif()
+if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED))
+ set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1)
+endif()
+
+
+###############################################################################
+# ARM (GAS)
+###############################################################################
+
+elseif(CPU_TYPE STREQUAL "arm64" OR CPU_TYPE STREQUAL "arm")
+
+enable_language(ASM)
+
+set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS}${CMAKE_ASM_FLAGS})
+
+string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
+set(EFFECTIVE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
+message(STATUS "CMAKE_ASM_FLAGS = ${EFFECTIVE_ASM_FLAGS}")
+
+# Test whether we need gas-preprocessor.pl
+if(CPU_TYPE STREQUAL "arm")
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gastest.S "
+ .text
+ .fpu neon
+ .arch armv7a
+ .object_arch armv4
+ .arm
+ pld [r0]
+ vmovn.u16 d0, q0")
+else()
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gastest.S "
+ .text
+ MYVAR .req x0
+ movi v0.16b, #100
+ mov MYVAR, #100
+ .unreq MYVAR")
+endif()
+
+separate_arguments(CMAKE_ASM_FLAGS_SEP UNIX_COMMAND "${CMAKE_ASM_FLAGS}")
+
+execute_process(COMMAND ${CMAKE_ASM_COMPILER} ${CMAKE_ASM_FLAGS_SEP}
+ -x assembler-with-cpp -c ${CMAKE_CURRENT_BINARY_DIR}/gastest.S
+ RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE ERROR)
+if(NOT RESULT EQUAL 0)
+ message(STATUS "GAS appears to be broken. Trying gas-preprocessor.pl ...")
+ execute_process(COMMAND gas-preprocessor.pl ${CMAKE_ASM_COMPILER}
+ ${CMAKE_ASM_FLAGS_SEP} -x assembler-with-cpp -c
+ ${CMAKE_CURRENT_BINARY_DIR}/gastest.S
+ RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE ERROR)
+ if(NOT RESULT EQUAL 0)
+ simd_fail("SIMD extensions disabled: GAS is not working properly")
+ return()
+ else()
+ message(STATUS "Using gas-preprocessor.pl")
+ set(CMAKE_REAL_ASM_COMPILER ${CMAKE_ASM_COMPILER})
+ set(CMAKE_ASM_COMPILER gas-preprocessor.pl)
+ set(CMAKE_ASM_FLAGS "${CMAKE_REAL_ASM_COMPILER} ${CMAKE_ASM_FLAGS}")
+ endif()
+else()
+ message(STATUS "GAS is working properly")
+endif()
+
+file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/gastest.S)
+
+add_library(simd OBJECT ${CPU_TYPE}/jsimd_neon.S ${CPU_TYPE}/jsimd.c)
+
+if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)
+ set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1)
+endif()
+
+
+###############################################################################
+# MIPS (GAS)
+###############################################################################
+
+elseif(CPU_TYPE STREQUAL "mips")
+
+enable_language(ASM)
+
+string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
+set(EFFECTIVE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
+message(STATUS "CMAKE_ASM_FLAGS = ${EFFECTIVE_ASM_FLAGS}")
+
+add_library(simd OBJECT ${CPU_TYPE}/jsimd_dspr2.S ${CPU_TYPE}/jsimd.c)
+
+if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)
+ set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1)
+endif()
+
+
+###############################################################################
+# PowerPC (Intrinsics)
+###############################################################################
+
+elseif(CPU_TYPE STREQUAL "powerpc")
+
+set(SIMD_SOURCES powerpc/jccolor-altivec.c powerpc/jcgray-altivec.c
+ powerpc/jcsample-altivec.c powerpc/jdcolor-altivec.c
+ powerpc/jdmerge-altivec.c powerpc/jdsample-altivec.c
+ powerpc/jfdctfst-altivec.c powerpc/jfdctint-altivec.c
+ powerpc/jidctfst-altivec.c powerpc/jidctint-altivec.c
+ powerpc/jquanti-altivec.c powerpc/jsimd.c)
+
+add_definitions(-maltivec)
+
+add_library(simd OBJECT ${SIMD_SOURCES})
+
+if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)
+ set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1)
+endif()
+
+
+###############################################################################
+# None
+###############################################################################
+
+else()
+
+simd_fail("SIMD extensions not available for this CPU (${CMAKE_SYSTEM_PROCESSOR})")
+
+endif() # CPU_TYPE
+++ /dev/null
-noinst_LTLIBRARIES = libsimd.la
-
-BUILT_SOURCES = jsimdcfg.inc
-
-EXTRA_DIST = nasm_lt.sh CMakeLists.txt \
- jccolext-mmx.asm jcgryext-mmx.asm jdcolext-mmx.asm jdmrgext-mmx.asm \
- jccolext-sse2.asm jcgryext-sse2.asm jdcolext-sse2.asm jdmrgext-sse2.asm \
- jccolext-avx2.asm jcgryext-avx2.asm jdcolext-avx2.asm jdmrgext-avx2.asm \
- jccolext-sse2-64.asm jcgryext-sse2-64.asm jdcolext-sse2-64.asm \
- jdmrgext-sse2-64.asm \
- jccolext-avx2-64.asm jcgryext-avx2-64.asm jdcolext-avx2-64.asm \
- jdmrgext-avx2-64.asm \
- jccolext-altivec.c jcgryext-altivec.c jdcolext-altivec.c \
- jdmrgext-altivec.c
-
-if SIMD_X86_64
-
-libsimd_la_SOURCES = jsimd_x86_64.c jsimd.h jsimdcfg.inc.h jsimdext.inc \
- jcolsamp.inc jdct.inc jpeg_nbits_table.inc jsimdcpu-64.asm \
- jfdctflt-sse-64.asm \
- jccolor-sse2-64.asm jcgray-sse2-64.asm jchuff-sse2-64.asm \
- jcsample-sse2-64.asm jdcolor-sse2-64.asm jdmerge-sse2-64.asm \
- jdsample-sse2-64.asm jfdctfst-sse2-64.asm jfdctint-sse2-64.asm \
- jidctflt-sse2-64.asm jidctfst-sse2-64.asm jidctint-sse2-64.asm \
- jidctred-sse2-64.asm jquantf-sse2-64.asm jquanti-sse2-64.asm \
- jccolor-avx2-64.asm jcgray-avx2-64.asm jcsample-avx2-64.asm \
- jdcolor-avx2-64.asm jdmerge-avx2-64.asm jdsample-avx2-64.asm \
- jquanti-avx2-64.asm
-
-jccolor-sse2-64.lo: jccolext-sse2-64.asm
-jcgray-sse2-64.lo: jcgryext-sse2-64.asm
-jdcolor-sse2-64.lo: jdcolext-sse2-64.asm
-jdmerge-sse2-64.lo: jdmrgext-sse2-64.asm
-jccolor-avx2-64.lo: jccolext-avx2-64.asm
-jcgray-avx2-64.lo: jcgryext-avx2-64.asm
-jdcolor-avx2-64.lo: jdcolext-avx2-64.asm
-jdmerge-avx2-64.lo: jdmrgext-avx2-64.asm
-
-endif
-
-if SIMD_I386
-
-libsimd_la_SOURCES = jsimd_i386.c jsimd.h jsimdcfg.inc.h jsimdext.inc \
- jcolsamp.inc jdct.inc jpeg_nbits_table.inc jsimdcpu.asm \
- jfdctflt-3dn.asm jidctflt-3dn.asm jquant-3dn.asm \
- jccolor-mmx.asm jcgray-mmx.asm jcsample-mmx.asm \
- jdcolor-mmx.asm jdmerge-mmx.asm jdsample-mmx.asm \
- jfdctfst-mmx.asm jfdctint-mmx.asm jidctfst-mmx.asm \
- jidctint-mmx.asm jidctred-mmx.asm jquant-mmx.asm \
- jfdctflt-sse.asm jidctflt-sse.asm jquant-sse.asm \
- jccolor-sse2.asm jcgray-sse2.asm jchuff-sse2.asm \
- jcsample-sse2.asm jdcolor-sse2.asm jdmerge-sse2.asm \
- jdsample-sse2.asm jfdctfst-sse2.asm jfdctint-sse2.asm \
- jidctflt-sse2.asm jidctfst-sse2.asm jidctint-sse2.asm \
- jidctred-sse2.asm jquantf-sse2.asm jquanti-sse2.asm \
- jccolor-avx2.asm jcgray-avx2.asm jcsample-avx2.asm \
- jdcolor-avx2.asm jdmerge-avx2.asm jdsample-avx2.asm \
- jquanti-avx2.asm
-
-jccolor-mmx.lo: jccolext-mmx.asm
-jcgray.-mmx.lo: jcgryext-mmx.asm
-jdcolor-mmx.lo: jdcolext-mmx.asm
-jdmerge-mmx.lo: jdmrgext-mmx.asm
-jccolor-sse2.lo: jccolext-sse2.asm
-jcgray-sse2.lo: jcgryext-sse2.asm
-jdcolor-sse2.lo: jdcolext-sse2.asm
-jdmerge-sse2.lo: jdmrgext-sse2.asm
-jccolor-avx2.lo: jccolext-avx2.asm
-jcgray-avx2.lo: jcgryext-avx2.asm
-jdcolor-avx2.lo: jdcolext-avx2.asm
-jdmerge-avx2.lo: jdmrgext-avx2.asm
-
-endif
-
-if SIMD_ARM
-
-libsimd_la_SOURCES = jsimd_arm.c jsimd_arm_neon.S
-
-endif
-
-if SIMD_ARM_64
-
-libsimd_la_SOURCES = jsimd_arm64.c jsimd_arm64_neon.S
-
-endif
-
-if SIMD_MIPS
-
-libsimd_la_SOURCES = jsimd_mips.c jsimd_mips_dspr2_asm.h jsimd_mips_dspr2.S
-
-endif
-
-if SIMD_POWERPC
-
-noinst_LTLIBRARIES += libsimd_altivec.la
-
-libsimd_altivec_la_SOURCES = \
- jccolor-altivec.c jcgray-altivec.c jcsample-altivec.c \
- jdcolor-altivec.c jdmerge-altivec.c jdsample-altivec.c \
- jfdctfst-altivec.c jfdctint-altivec.c \
- jidctfst-altivec.c jidctint-altivec.c \
- jquanti-altivec.c
-libsimd_altivec_la_CFLAGS = -maltivec
-
-jccolor-altivec.lo: jccolext-altivec.c
-jcgray-altivec.lo: jcgryext-altivec.c
-jdcolor-altivec.lo: jdcolext-altivec.c
-jdmerge-altivec.lo: jdmrgext-altivec.c
-
-libsimd_la_SOURCES = jsimd_powerpc.c jsimd_altivec.h jcsample.h
-libsimd_la_LIBADD = libsimd_altivec.la
-
-endif
-
-AM_CPPFLAGS = -I$(top_srcdir)
-
-.asm.lo:
- $(AM_V_GEN) $(LIBTOOL) $(AM_V_lt) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(AM_V_lt) $(NASM) $(NAFLAGS) -I$(srcdir) -I. $< -o $@
-
-jsimdcfg.inc: $(srcdir)/jsimdcfg.inc.h ../jpeglib.h ../jconfig.h ../jmorecfg.h
- $(AM_V_GEN) $(CPP) -I$(top_builddir) -I$(top_builddir)/simd $(srcdir)/jsimdcfg.inc.h | $(EGREP) "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > $@
*/
#define JPEG_INTERNALS
-#include "../jinclude.h"
-#include "../jpeglib.h"
+#include "../../jinclude.h"
+#include "../../jpeglib.h"
+#include "../../jsimd.h"
+#include "../../jdct.h"
+#include "../../jsimddct.h"
#include "../jsimd.h"
-#include "../jdct.h"
-#include "../jsimddct.h"
-#include "jsimd.h"
#include <stdio.h>
#include <string.h>
*/
#define JPEG_INTERNALS
-#include "../jinclude.h"
-#include "../jpeglib.h"
+#include "../../jinclude.h"
+#include "../../jpeglib.h"
+#include "../../jsimd.h"
+#include "../../jdct.h"
+#include "../../jsimddct.h"
#include "../jsimd.h"
-#include "../jdct.h"
-#include "../jsimddct.h"
-#include "jsimd.h"
#include <stdio.h>
#include <string.h>
*/
#define JPEG_INTERNALS
-#include "../jinclude.h"
-#include "../jpeglib.h"
+#include "../../jinclude.h"
+#include "../../jpeglib.h"
+#include "../../jsimd.h"
+#include "../../jdct.h"
+#include "../../jsimddct.h"
#include "../jsimd.h"
-#include "../jdct.h"
-#include "../jsimddct.h"
-#include "jsimd.h"
/*
* In the PIC cases, we have no guarantee that constants will keep
*/
#define JPEG_INTERNALS
-#include "../jinclude.h"
-#include "../jpeglib.h"
+#include "../../jinclude.h"
+#include "../../jpeglib.h"
+#include "../../jsimd.h"
+#include "../../jdct.h"
+#include "../../jsimddct.h"
#include "../jsimd.h"
-#include "../jdct.h"
-#include "../jsimddct.h"
-#include "jsimd.h"
#include <stdio.h>
#include <string.h>
* 3. This notice may not be removed or altered from any source distribution.
*/
-#include "jsimd_mips_dspr2_asm.h"
+#include "jsimd_dspr2_asm.h"
/*****************************************************************************/
LEAF_MIPS_DSPR2(jsimd_c_null_convert_mips_dspr2)
END(jsimd_convsamp_float_mips_dspr2)
/*****************************************************************************/
-
addiu sp, sp, \stack_offset
.endif
.endm
-
-
+++ /dev/null
-#! /bin/sh
-command=""
-infile=""
-o_opt=no
-pic=no
-while [ $# -gt 0 ]; do
- case "$1" in
- --silent)
- exec > /dev/null
- ;;
- -DPIC|-fPIC|-fpic|-Kpic|-KPIC)
- if [ "$pic" != "yes" ] ; then
- command="$command -DPIC"
- pic=yes
- fi
- ;;
- -f|-fbin|-faout|-faoutb|-fcoff|-felf|-felf64|-fas86| \
- -fobj|-fwin32|-fwin64|-frdf|-fieee|-fmacho|-fmacho64)
- # it's a file format specifier for nasm.
- command="$command $1"
- ;;
- -f*)
- # maybe a code-generation flag for gcc.
- ;;
- -[Ii]*)
- incdir=`echo "$1" | sed 's/^-[Ii]//'`
- if [ "x$incdir" = x -a "x$2" != x ] ; then
- case "$2" in
- -*) ;;
- *) incdir="$2"; shift;;
- esac
- fi
- if [ "x$incdir" != x ] ; then
- # In the case of NASM, the trailing slash is necessary.
- incdir=`echo "$incdir" | sed 's%/*$%/%'`
- command="$command -I$incdir"
- fi
- ;;
- -o*)
- o_opt=yes
- command="$command $1"
- ;;
- *.asm)
- infile=$1
- command="$command $1"
- ;;
- *)
- command="$command $1"
- ;;
- esac
- shift
-done
-if [ "$o_opt" != yes ] ; then
- # By default, NASM creates an output file
- # in the same directory as the input file.
- outfile="-o `echo $infile | sed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.o"
- command="$command $outfile"
-fi
-echo $command
-exec $command
#endif
#define JPEG_INTERNALS
-#include "../jinclude.h"
-#include "../jpeglib.h"
+#include "../../jinclude.h"
+#include "../../jpeglib.h"
+#include "../../jsimd.h"
+#include "../../jdct.h"
+#include "../../jsimddct.h"
#include "../jsimd.h"
-#include "../jdct.h"
-#include "../jsimddct.h"
-#include "jsimd.h"
#include <stdio.h>
#include <string.h>
*/
#define JPEG_INTERNALS
-#include "../jinclude.h"
-#include "../jpeglib.h"
+#include "../../jinclude.h"
+#include "../../jpeglib.h"
+#include "../../jsimd.h"
+#include "../../jdct.h"
+#include "../../jsimddct.h"
#include "../jsimd.h"
-#include "../jdct.h"
-#include "../jsimddct.h"
-#include "jsimd.h"
#include <altivec.h>
SECTION SEG_TEXT
BITS 64
-%include "jccolext-avx2-64.asm"
+%include "jccolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGB_BLUE
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_avx2 jsimd_extrgb_ycc_convert_avx2
-%include "jccolext-avx2-64.asm"
+%include "jccolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGBX_BLUE
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_ycc_convert_avx2 jsimd_extrgbx_ycc_convert_avx2
-%include "jccolext-avx2-64.asm"
+%include "jccolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGR_BLUE
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_avx2 jsimd_extbgr_ycc_convert_avx2
-%include "jccolext-avx2-64.asm"
+%include "jccolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGRX_BLUE
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_ycc_convert_avx2 jsimd_extbgrx_ycc_convert_avx2
-%include "jccolext-avx2-64.asm"
+%include "jccolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XBGR_BLUE
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_avx2 jsimd_extxbgr_ycc_convert_avx2
-%include "jccolext-avx2-64.asm"
+%include "jccolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XRGB_BLUE
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_avx2 jsimd_extxrgb_ycc_convert_avx2
-%include "jccolext-avx2-64.asm"
+%include "jccolext-avx2.asm"
SECTION SEG_TEXT
BITS 64
-%include "jccolext-sse2-64.asm"
+%include "jccolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGB_BLUE
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2
-%include "jccolext-sse2-64.asm"
+%include "jccolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGBX_BLUE
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2
-%include "jccolext-sse2-64.asm"
+%include "jccolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGR_BLUE
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2
-%include "jccolext-sse2-64.asm"
+%include "jccolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGRX_BLUE
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2
-%include "jccolext-sse2-64.asm"
+%include "jccolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XBGR_BLUE
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2
-%include "jccolext-sse2-64.asm"
+%include "jccolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XRGB_BLUE
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2
-%include "jccolext-sse2-64.asm"
+%include "jccolext-sse2.asm"
SECTION SEG_TEXT
BITS 64
-%include "jcgryext-avx2-64.asm"
+%include "jcgryext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGB_BLUE
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_gray_convert_avx2 jsimd_extrgb_gray_convert_avx2
-%include "jcgryext-avx2-64.asm"
+%include "jcgryext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGBX_BLUE
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_gray_convert_avx2 jsimd_extrgbx_gray_convert_avx2
-%include "jcgryext-avx2-64.asm"
+%include "jcgryext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGR_BLUE
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_gray_convert_avx2 jsimd_extbgr_gray_convert_avx2
-%include "jcgryext-avx2-64.asm"
+%include "jcgryext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGRX_BLUE
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_gray_convert_avx2 jsimd_extbgrx_gray_convert_avx2
-%include "jcgryext-avx2-64.asm"
+%include "jcgryext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XBGR_BLUE
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_gray_convert_avx2 jsimd_extxbgr_gray_convert_avx2
-%include "jcgryext-avx2-64.asm"
+%include "jcgryext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XRGB_BLUE
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_gray_convert_avx2 jsimd_extxrgb_gray_convert_avx2
-%include "jcgryext-avx2-64.asm"
+%include "jcgryext-avx2.asm"
SECTION SEG_TEXT
BITS 64
-%include "jcgryext-sse2-64.asm"
+%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGB_BLUE
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2
-%include "jcgryext-sse2-64.asm"
+%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGBX_BLUE
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2
-%include "jcgryext-sse2-64.asm"
+%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGR_BLUE
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2
-%include "jcgryext-sse2-64.asm"
+%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGRX_BLUE
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2
-%include "jcgryext-sse2-64.asm"
+%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XBGR_BLUE
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2
-%include "jcgryext-sse2-64.asm"
+%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XRGB_BLUE
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2
-%include "jcgryext-sse2-64.asm"
+%include "jcgryext-sse2.asm"
;
-; jchuff-sse2-64.asm - Huffman entropy encoding (64-bit SSE2)
+; jchuff-sse2.asm - Huffman entropy encoding (64-bit SSE2)
;
; Copyright (C) 2009-2011, 2014-2016, D. R. Commander.
; Copyright (C) 2015, Matthieu Darbois.
SECTION SEG_TEXT
BITS 64
-%include "jdcolext-avx2-64.asm"
+%include "jdcolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGB_BLUE
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extrgb_convert_avx2
-%include "jdcolext-avx2-64.asm"
+%include "jdcolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGBX_BLUE
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extrgbx_convert_avx2
-%include "jdcolext-avx2-64.asm"
+%include "jdcolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGR_BLUE
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extbgr_convert_avx2
-%include "jdcolext-avx2-64.asm"
+%include "jdcolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGRX_BLUE
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extbgrx_convert_avx2
-%include "jdcolext-avx2-64.asm"
+%include "jdcolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XBGR_BLUE
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extxbgr_convert_avx2
-%include "jdcolext-avx2-64.asm"
+%include "jdcolext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XRGB_BLUE
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_avx2 jsimd_ycc_extxrgb_convert_avx2
-%include "jdcolext-avx2-64.asm"
+%include "jdcolext-avx2.asm"
SECTION SEG_TEXT
BITS 64
-%include "jdcolext-sse2-64.asm"
+%include "jdcolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGB_BLUE
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2
-%include "jdcolext-sse2-64.asm"
+%include "jdcolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_RGBX_BLUE
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2
-%include "jdcolext-sse2-64.asm"
+%include "jdcolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGR_BLUE
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2
-%include "jdcolext-sse2-64.asm"
+%include "jdcolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_BGRX_BLUE
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2
-%include "jdcolext-sse2-64.asm"
+%include "jdcolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XBGR_BLUE
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2
-%include "jdcolext-sse2-64.asm"
+%include "jdcolext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_BLUE EXT_XRGB_BLUE
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2
-%include "jdcolext-sse2-64.asm"
+%include "jdcolext-sse2.asm"
SECTION SEG_TEXT
BITS 64
-%include "jdmrgext-avx2-64.asm"
+%include "jdmrgext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_avx2 jsimd_h2v1_extrgb_merged_upsample_avx2
%define jsimd_h2v2_merged_upsample_avx2 jsimd_h2v2_extrgb_merged_upsample_avx2
-%include "jdmrgext-avx2-64.asm"
+%include "jdmrgext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_avx2 jsimd_h2v1_extrgbx_merged_upsample_avx2
%define jsimd_h2v2_merged_upsample_avx2 jsimd_h2v2_extrgbx_merged_upsample_avx2
-%include "jdmrgext-avx2-64.asm"
+%include "jdmrgext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_avx2 jsimd_h2v1_extbgr_merged_upsample_avx2
%define jsimd_h2v2_merged_upsample_avx2 jsimd_h2v2_extbgr_merged_upsample_avx2
-%include "jdmrgext-avx2-64.asm"
+%include "jdmrgext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_avx2 jsimd_h2v1_extbgrx_merged_upsample_avx2
%define jsimd_h2v2_merged_upsample_avx2 jsimd_h2v2_extbgrx_merged_upsample_avx2
-%include "jdmrgext-avx2-64.asm"
+%include "jdmrgext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_avx2 jsimd_h2v1_extxbgr_merged_upsample_avx2
%define jsimd_h2v2_merged_upsample_avx2 jsimd_h2v2_extxbgr_merged_upsample_avx2
-%include "jdmrgext-avx2-64.asm"
+%include "jdmrgext-avx2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_avx2 jsimd_h2v1_extxrgb_merged_upsample_avx2
%define jsimd_h2v2_merged_upsample_avx2 jsimd_h2v2_extxrgb_merged_upsample_avx2
-%include "jdmrgext-avx2-64.asm"
+%include "jdmrgext-avx2.asm"
SECTION SEG_TEXT
BITS 64
-%include "jdmrgext-sse2-64.asm"
+%include "jdmrgext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2
-%include "jdmrgext-sse2-64.asm"
+%include "jdmrgext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2
-%include "jdmrgext-sse2-64.asm"
+%include "jdmrgext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2
-%include "jdmrgext-sse2-64.asm"
+%include "jdmrgext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2
-%include "jdmrgext-sse2-64.asm"
+%include "jdmrgext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2
-%include "jdmrgext-sse2-64.asm"
+%include "jdmrgext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2
-%include "jdmrgext-sse2-64.asm"
+%include "jdmrgext-sse2.asm"
*/
#define JPEG_INTERNALS
-#include "../jinclude.h"
-#include "../jpeglib.h"
+#include "../../jinclude.h"
+#include "../../jpeglib.h"
+#include "../../jsimd.h"
+#include "../../jdct.h"
+#include "../../jsimddct.h"
#include "../jsimd.h"
-#include "../jdct.h"
-#include "../jsimddct.h"
-#include "jsimd.h"
/*
* In the PIC cases, we have no guarantee that constants will keep
;
-; jsimdcpu-64.asm - SIMD instruction support check
+; jsimdcpu.asm - SIMD instruction support check
;
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
; Copyright (C) 2016, D. R. Commander.
EXT=bmp
IMAGES="vgl_5674_0098.${EXT} vgl_6434_0018a.${EXT} vgl_6548_0026a.${EXT} nightshot_iso_100.${EXT}"
-IMGDIR=@srcdir@/testimages
+IMGDIR=@CMAKE_SOURCE_DIR@/testimages
OUTDIR=`mktemp -d /tmp/__tjbenchtest_output.XXXXXX`
EXEDIR=.
BMPARG=
# Scaled decompression
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
for samp in GRAY 420 422 444; do
runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG
for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
for samp in GRAY 444 422 420; do
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg
runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG
runme cmp $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.${EXT}
}
IMAGES="vgl_5674_0098.bmp vgl_6434_0018a.bmp vgl_6548_0026a.bmp nightshot_iso_100.bmp"
-IMGDIR=@srcdir@/testimages
+IMGDIR=@CMAKE_SOURCE_DIR@/testimages
OUTDIR=`mktemp -d /tmp/__tjbenchtest_java_output.XXXXXX`
EXEDIR=.
-JAVA="@JAVA@ -cp java/turbojpeg.jar -Djava.library.path=.libs"
+JAVA="@Java_JAVA_EXECUTABLE@ -cp java/turbojpeg.jar -Djava.library.path=."
BMPARG=
NSARG=
YUVARG=
# Scaled decompression
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
for samp in GRAY 420 422 444; do
runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG -bmp -outfile $OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG
for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
for samp in GRAY 444 422 420; do
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG -bmp -outfile $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg
runme $JAVA TJBench $OUTDIR/${basename}_${samp}_Q95.jpg -$xform -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_Q95_${scale}.bmp $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp
}
IMAGES="vgl_5674_0098.bmp vgl_6434_0018a.bmp vgl_6548_0026a.bmp nightshot_iso_100.bmp"
-IMGDIR=@srcdir@/testimages
+IMGDIR=@CMAKE_SOURCE_DIR@/testimages
OUTDIR=__tjexampletest_output
EXEDIR=.
-JAVA="@JAVA@ -cp java/turbojpeg.jar -Djava.library.path=.libs"
+JAVA="@Java_JAVA_EXECUTABLE@ -cp java/turbojpeg.jar -Djava.library.path=."
if [ -d $OUTDIR ]; then
rm -rf $OUTDIR
# Scaled decompression
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
for samp in GRAY 420 422 444; do
$EXEDIR/djpeg -rgb -bmp -scale ${scalearg} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${scale}.bmp -scale ${scalearg}
for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
for samp in GRAY 444 422 420; do
for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
$EXEDIR/djpeg -rgb -bmp -scale ${scalearg} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp -$xform -scale ${scalearg} -crop 16,16,70x60
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp
-/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
-/* see jconfig.txt for explanations */
-
#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@
#define LIBJPEG_TURBO_VERSION @VERSION@
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
+
#cmakedefine C_ARITH_CODING_SUPPORTED
#cmakedefine D_ARITH_CODING_SUPPORTED
#cmakedefine MEM_SRCDST_SUPPORTED
-
-/*
- * Define BITS_IN_JSAMPLE as either
- * 8 for 8-bit sample values (the usual setting)
- * 12 for 12-bit sample values
- * Only 8 and 12 are legal data precisions for lossy JPEG according to the
- * JPEG standard, and the IJG code does not support anything else!
- * We do not support run-time selection of data precision, sorry.
- */
+#cmakedefine WITH_SIMD
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
-#define HAVE_UNSIGNED_CHAR
-#define HAVE_UNSIGNED_SHORT
-/* #define void char */
-/* #define const */
-#undef __CHAR_UNSIGNED__
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
-#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
-#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
+#undef NEED_BSD_STRINGS
+
+#define HAVE_UNSIGNED_CHAR
+#define HAVE_UNSIGNED_SHORT
#undef INCOMPLETE_TYPES_BROKEN
+#undef RIGHT_SHIFT_IS_UNSIGNED
+#undef __CHAR_UNSIGNED__
/* Define "boolean" as unsigned char, not int, per Windows custom */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef signed int INT32;
#endif
#define XMD_H /* prevent jmorecfg.h from redefining it */
-
-#ifdef JPEG_INTERNALS
-
-#undef RIGHT_SHIFT_IS_UNSIGNED
-
-#endif /* JPEG_INTERNALS */
+++ /dev/null
-#define VERSION "@VERSION@"
-#define BUILD "@BUILD@"
-#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
-
-#ifndef INLINE
-#if defined(__GNUC__)
-#define INLINE inline __attribute__((always_inline))
-#elif defined(_MSC_VER)
-#define INLINE __forceinline
-#else
-#define INLINE
-#endif
-#endif
%define JSIMD_SSE 0x04
%define JSIMD_SSE2 0x08
%define JSIMD_AVX2 0x80
-; Short forms of external names for systems with brain-damaged linkers.
-;