Build libjpeg-turbo as .dll

181 Views Asked by At

I am looking for parametr for build libjpeg-turbo as .dll using MSYS2.

cmake -G"Unix Makefiles" -DENABLE_STATIC=ON -DENABLE_SHARED=ON ...

I have tried all combinations of STATIC=ON/OFF and SHARED=ON/OFF but I always got .a or .dll.a files.

2

There are 2 best solutions below

0
Sergio On

The libjpeg-turbo library is already deployed as an msys2 package which contains both the source code and the binaries.
You can install libjpeg-turbo from the msys2 shell with the following command:
$ pacman -S mingw-w64-x86_64-libjpeg-turbo
After installation you can copy the binary files you need (*.dll, *.dll.a) to the location you prefer to link them to your project.

0
Sergio On

The CMake command you use is not appropriate on Windows.
You are asking CMake to generate a makefile for Unix, and as you know, Unix does not use DLLs.
You should (using the mingw64 shell) move to the build directory and use the following command:
$ cmake -G"MinGW Makefiles" -DENABLE_STATIC=ON -DENABLE_SHARED=ON .. (not "Unix Makefiles")
At this point (remaining in the build directory) you should type:
mingw32-make
Now the compilation will begin and you will find the dll and all files you need.