Skip to content

Commit

Permalink
* In addition to Leptonica and Tesseract, use only the officially su…
Browse files Browse the repository at this point in the history
…pported GCC compiler for FFmpeg, FFTW, and GSL under Windows as well, to prevent compatibility issues (issue bytedeco/javacv#137)
  • Loading branch information
saudet committed May 2, 2015
1 parent 7e05a85 commit 52df5ad
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 92 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* In addition to Leptonica and Tesseract, use only the officially supported GCC compiler for FFmpeg, FFTW, and GSL under Windows as well, to prevent compatibility issues ([issue bytedeco/javacv#137](https://github.com/bytedeco/javacv/issues/137))
* Make `flycapture/cppbuild.sh` fail if FlyCapture is not found installed on the system ([issue #46](https://github.com/bytedeco/javacpp-presets/issues/46))
* Patch libdc1394, libdcfreenect, FFTW, GSL, Leptonica and Tesseract with missing `@rpath` needed by Mac OS X ([issue #46](https://github.com/bytedeco/javacpp-presets/issues/46))

Expand Down
14 changes: 0 additions & 14 deletions ffmpeg/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ if [[ $PLATFORM == windows* ]]; then
[[ $PLATFORM == *64 ]] && BITS=64 || BITS=32
download http://ffmpeg.zeranoe.com/builds/win$BITS/dev/ffmpeg-$FFMPEG_VERSION-win$BITS-dev.7z ffmpeg-$FFMPEG_VERSION-win$BITS-dev.7z
download http://ffmpeg.zeranoe.com/builds/win$BITS/shared/ffmpeg-$FFMPEG_VERSION-win$BITS-shared.7z ffmpeg-$FFMPEG_VERSION-win$BITS-shared.7z
download http://msinttypes.googlecode.com/files/msinttypes-r26.zip msinttypes-r26.zip

mkdir -p $PLATFORM
cd $PLATFORM
7za x -y ../ffmpeg-$FFMPEG_VERSION-win$BITS-dev.7z
7za x -y ../ffmpeg-$FFMPEG_VERSION-win$BITS-shared.7z
patch -Np1 -d ffmpeg-$FFMPEG_VERSION-win$BITS-dev/ < ../../ffmpeg-$FFMPEG_VERSION-windows.patch
else
LAME=lame-3.99.5
SPEEX=speex-1.2rc1
Expand Down Expand Up @@ -212,28 +210,16 @@ case $PLATFORM in
make install
;;
windows-x86)
# http://ffmpeg.org/platform.html#Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b
LIBS=(avcodec-56 avdevice-56 avfilter-5 avformat-56 avutil-54 postproc-53 swresample-1 swscale-3)
for LIB in ${LIBS[@]}; do
lib /def:ffmpeg-$FFMPEG_VERSION-win32-dev/lib/$LIB.def /out:ffmpeg-$FFMPEG_VERSION-win32-dev/lib/$LIB.lib /machine:x86
done
cp -r ffmpeg-$FFMPEG_VERSION-win32-dev/include .
cp -r ffmpeg-$FFMPEG_VERSION-win32-dev/lib .
cp -r ffmpeg-$FFMPEG_VERSION-win32-shared/bin .
cd include
unzip -o ../../msinttypes-r26.zip
;;
windows-x86_64)
# http://ffmpeg.org/platform.html#Linking-to-FFmpeg-with-Microsoft-Visual-C_002b_002b
LIBS=(avcodec-56 avdevice-56 avfilter-5 avformat-56 avutil-54 postproc-53 swresample-1 swscale-3)
for LIB in ${LIBS[@]}; do
lib /def:ffmpeg-$FFMPEG_VERSION-win64-dev/lib/$LIB.def /out:ffmpeg-$FFMPEG_VERSION-win64-dev/lib/$LIB.lib /machine:x64
done
cp -r ffmpeg-$FFMPEG_VERSION-win64-dev/include .
cp -r ffmpeg-$FFMPEG_VERSION-win64-dev/lib .
cp -r ffmpeg-$FFMPEG_VERSION-win64-shared/bin .
cd include
unzip -o ../../msinttypes-r26.zip
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
Expand Down
27 changes: 0 additions & 27 deletions ffmpeg/ffmpeg-20150316-git-1e4d049-windows.patch

This file was deleted.

28 changes: 28 additions & 0 deletions ffmpeg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,32 @@
</plugins>
</build>

<profiles>
<profile>
<id>mingw</id>
<activation>
<os><family>windows</family></os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<configuration>
<properties>${platform.properties}-mingw</properties>
<compilerOptions>
<compilerOption>-static-libgcc</compilerOption>
<compilerOption>-static-libstdc++</compilerOption>
<compilerOption>-Wl,-Bstatic</compilerOption>
<compilerOption>-lstdc++</compilerOption>
<compilerOption>-lpthread</compilerOption>
<compilerOption>-Wl,-Bdynamic</compilerOption>
</compilerOptions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
@Properties(inherit=swresample.class, target="org.bytedeco.javacpp.avcodec", value={
@Platform(cinclude={"<libavcodec/avcodec.h>", "<libavcodec/avfft.h>"}, link="avcodec@.56"),
@Platform(value="windows", link="avcodec-56") })
@Platform(value="windows", preload="avcodec-56") })
public class avcodec implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("!FF_API_LOWRES", "!FF_API_DEBUG_MV").define(false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
@Properties(inherit=avfilter.class, target="org.bytedeco.javacpp.avdevice", value={
@Platform(cinclude="<libavdevice/avdevice.h>", link="avdevice@.56"),
@Platform(value="windows", link="avdevice-56") })
@Platform(value="windows", preload="avdevice-56") })
public class avdevice implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("av_device_capabilities").skip());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
@Properties(inherit={avformat.class, postproc.class, swresample.class, swscale.class}, target="org.bytedeco.javacpp.avfilter", value={
@Platform(cinclude={"<libavfilter/avfilter.h>", "<libavfilter/buffersink.h>", "<libavfilter/buffersrc.h>"}, link="avfilter@.5"),
@Platform(value="windows", link="avfilter-5") })
@Platform(value="windows", preload="avfilter-5") })
public class avfilter implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("AVFilterPool", "AVFilterCommand", "AVFilterChannelLayouts").cast().pointerTypes("Pointer"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
@Properties(inherit=avcodec.class, target="org.bytedeco.javacpp.avformat", value={
@Platform(cinclude={"<libavformat/avio.h>", "<libavformat/avformat.h>"}, link="avformat@.56"),
@Platform(value="windows", link="avformat-56") })
@Platform(value="windows", preload="avformat-56") })
public class avformat implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("AVPROBE_SCORE_RETRY", "AVPROBE_SCORE_STREAM_RETRY").translate(false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"<libavutil/downmix_info.h>", "<libavutil/stereo3d.h>"},
includepath={"/usr/local/include/ffmpeg/", "/opt/local/include/ffmpeg/", "/usr/include/ffmpeg/"},
link="avutil@.54", compiler={"default", "nodeprecated"}),
@Platform(value="windows", includepath={"C:/MinGW/local/include/ffmpeg/", "C:/MinGW/include/ffmpeg/"}, link="avutil-54") })
@Platform(value="windows", includepath={"C:/MinGW/local/include/ffmpeg/", "C:/MinGW/include/ffmpeg/"}, preload="avutil-54") })
public class avutil implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("AV_NOPTS_VALUE").cppTypes("int64_t").translate(false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
@Properties(inherit=avutil.class, target="org.bytedeco.javacpp.postproc", value={
@Platform(cinclude="<libpostproc/postprocess.h>", link="postproc@.53"),
@Platform(value="windows", link="postproc-53") })
@Platform(value="windows", preload="postproc-53") })
public class postproc implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("QP_STORE_T").cppTypes().valueTypes("byte").pointerTypes("BytePointer"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
@Properties(inherit=avutil.class, target="org.bytedeco.javacpp.swresample", value={
@Platform(cinclude="<libswresample/swresample.h>", link="swresample@.1"),
@Platform(value="windows", link="swresample-1") })
@Platform(value="windows", preload="swresample-1") })
public class swresample implements InfoMapper {
public void map(InfoMap infoMap) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
@Properties(inherit=avutil.class, target="org.bytedeco.javacpp.swscale", value={
@Platform(cinclude="<libswscale/swscale.h>", link="swscale@.3"),
@Platform(value="windows", link="swscale-3") })
@Platform(value="windows", preload="swscale-3") })
public class swscale implements InfoMapper {
public void map(InfoMap infoMap) {
}
Expand Down
18 changes: 3 additions & 15 deletions fftw/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [[ $PLATFORM == windows* ]]; then

mkdir -p $PLATFORM
cd $PLATFORM
mkdir -p include lib bin
mkdir -p include lib
unzip -o ../fftw-$FFTW_VERSION-dll$BITS.zip -d fftw-$FFTW_VERSION-dll$BITS
cd fftw-$FFTW_VERSION-dll$BITS
else
Expand Down Expand Up @@ -71,24 +71,12 @@ case $PLATFORM in
make install-strip
;;
windows-x86)
# http://www.fftw.org/install/windows.html
LIBS=(libfftw3-3 libfftw3f-3 libfftw3l-3)
for LIB in ${LIBS[@]}; do
lib /def:$LIB.def /out:$LIB.lib /machine:x86
done
cp *.h ../include
cp *.lib ../lib
cp *.dll ../bin
cp *.dll ../lib
;;
windows-x86_64)
# http://www.fftw.org/install/windows.html
LIBS=(libfftw3-3 libfftw3f-3 libfftw3l-3)
for LIB in ${LIBS[@]}; do
lib /def:$LIB.def /out:$LIB.lib /machine:x64
done
cp *.h ../include
cp *.lib ../lib
cp *.dll ../bin
cp *.dll ../lib
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
Expand Down
28 changes: 28 additions & 0 deletions fftw/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,32 @@
</plugins>
</build>

<profiles>
<profile>
<id>mingw</id>
<activation>
<os><family>windows</family></os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<configuration>
<properties>${platform.properties}-mingw</properties>
<compilerOptions>
<compilerOption>-static-libgcc</compilerOption>
<compilerOption>-static-libstdc++</compilerOption>
<compilerOption>-Wl,-Bstatic</compilerOption>
<compilerOption>-lstdc++</compilerOption>
<compilerOption>-lpthread</compilerOption>
<compilerOption>-Wl,-Bdynamic</compilerOption>
</compilerOptions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
30 changes: 3 additions & 27 deletions gsl/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [[ $PLATFORM == windows* ]]; then

mkdir -p $PLATFORM
cd $PLATFORM
mkdir -p include lib bin
rm -Rf include lib bin
/C/Program\ Files/7-Zip/7z x -y ../mingw$BITS-gsl-$GSL_VERSION.rpm -o..
/C/Program\ Files/7-Zip/7z x -y ../mingw$BITS-gsl-$GSL_VERSION.cpio
else
Expand Down Expand Up @@ -56,34 +56,10 @@ case $PLATFORM in
make install-strip
;;
windows-x86)
cd usr/i686-w64-mingw32/sys-root/mingw
echo LIBRARY libgsl-0.dll > libgsl-0.def
echo EXPORTS >> libgsl-0.def
dumpbin //exports bin/libgsl-0.dll | tail -n +20 | head -n -13 | cut -c27- >> libgsl-0.def
lib /def:libgsl-0.def /out:libgsl-0.lib /machine:x86
echo LIBRARY libgslcblas-0.dll > libgslcblas-0.def
echo EXPORTS >> libgslcblas-0.def
dumpbin //exports bin/libgslcblas-0.dll | tail -n +20 | head -n -13 | cut -c27- >> libgslcblas-0.def
lib /def:libgslcblas-0.def /out:libgslcblas-0.lib /machine:x86
cp -r include/* ../../../../include
cp *.lib ../../../../lib
cp -r bin/* ../../../../bin
cd ../../../..
mv usr/i686-w64-mingw32/sys-root/mingw/* .
;;
windows-x86_64)
cd usr/x86_64-w64-mingw32/sys-root/mingw
echo LIBRARY libgsl-0.dll > libgsl-0.def
echo EXPORTS >> libgsl-0.def
dumpbin //exports bin/libgsl-0.dll | tail -n +20 | head -n -15 | cut -c27- >> libgsl-0.def
lib /def:libgsl-0.def /out:libgsl-0.lib /machine:x64
echo LIBRARY libgslcblas-0.dll > libgslcblas-0.def
echo EXPORTS >> libgslcblas-0.def
dumpbin //exports bin/libgslcblas-0.dll | tail -n +20 | head -n -15 | cut -c27- >> libgslcblas-0.def
lib /def:libgslcblas-0.def /out:libgslcblas-0.lib /machine:x64
cp -r include/* ../../../../include
cp *.lib ../../../../lib
cp -r bin/* ../../../../bin
cd ../../../..
mv usr/x86_64-w64-mingw32/sys-root/mingw/* .
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
Expand Down
28 changes: 28 additions & 0 deletions gsl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,32 @@
</plugins>
</build>

<profiles>
<profile>
<id>mingw</id>
<activation>
<os><family>windows</family></os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<configuration>
<properties>${platform.properties}-mingw</properties>
<compilerOptions>
<compilerOption>-static-libgcc</compilerOption>
<compilerOption>-static-libstdc++</compilerOption>
<compilerOption>-Wl,-Bstatic</compilerOption>
<compilerOption>-lstdc++</compilerOption>
<compilerOption>-lpthread</compilerOption>
<compilerOption>-Wl,-Bdynamic</compilerOption>
</compilerOptions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
2 changes: 1 addition & 1 deletion gsl/src/main/java/org/bytedeco/javacpp/presets/gsl.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"gsl/gsl_statistics_ushort.h", "gsl/gsl_statistics_short.h", "gsl/gsl_statistics_uchar.h", "gsl/gsl_statistics_char.h"},
link={"gslcblas@.0", "gsl@.0"}),
@Platform(value="android", link={"gslcblas", "gsl"}),
@Platform(value="windows", link={"libgslcblas-0", "libgsl-0"}) })
@Platform(value="windows", preload={"libgslcblas-0", "libgsl-0"}) })
public class gsl implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("__cplusplus").define())
Expand Down

0 comments on commit 52df5ad

Please sign in to comment.