Skip to content

Commit

Permalink
Merge pull request #1 from apanov/osx-dll
Browse files Browse the repository at this point in the history
webp-dll for mac os x
  • Loading branch information
Andrei Pangin authored Oct 11, 2018
2 parents 4d2d16f + bae4df7 commit 7b8b9ba
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# one-webp
JNI wrapper to convert JPEG and PNG to WebP

### Mac OS X
Before build native library it's needed to install libpng, libwebp and jpeg-turbo:

Using brew:
```
brew install libpng
brew install webp
brew install jpeg-turbo
```
For build libonewebp.dylib:
```
ant clean webp-dll -Djpeg-turbo.version=2.0.0 -Dlibpng.version=1.6.35 -Dlibwebp.version=1.0.0
```
35 changes: 34 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<property name="libpng.dir" value="/usr"/>
<property name="libwebp.dir" value="/usr"/>

<property name="jpeg-turbo.version" value="2.0.0"/>
<property name="libpng.version" value="1.6.35"/>
<property name="libwebp.version" value="1.0.0"/>

<property name="build.native.dir" value="${build.dir}/native"/>
<property name="src.native.dir" value="${src.dir}/one/webp/native"/>
<property name="gcc.extra.args" value=""/>
Expand Down Expand Up @@ -52,7 +56,7 @@
<arg path="${libpng.dir}/lib/libz.lib"/>
<arg path="${libwebp.dir}/lib/libwebp.lib"/>
</exec>

<property name="gcc" value="gcc"/>
<exec os="Linux" executable="${gcc}" dir="${build.native.dir}">
<arg value="-O3"/>
Expand All @@ -78,6 +82,35 @@
<arg line="-o libonewebp.so"/>
<arg value="-Wl,-soname,libonewebp.so"/>
</exec>

<property name="gcc" value="gcc"/>
<exec os="Mac OS X" executable="${gcc}" dir="${build.native.dir}">
<arg value="-DBUILD_JAVA=OFF"/>
<arg value="-O3"/>
<arg value="-shared"/>
<arg value="-fPIC"/>
<arg value="-I"/>
<arg path="${java.home}/../include"/>
<arg value="-I"/>
<arg path="${java.home}/../include/darwin"/>
<arg value="-I"/>
<arg path="${libjpeg-turbo.dir}/local/Cellar/jpeg-turbo/${jpeg-turbo.version}/include"/>
<arg value="-I"/>
<arg path="/usr/local/Cellar/libpng/${libpng.version}/include"/>
<arg value="-I"/>
<arg path="/usr/local/Cellar/webp/${libwebp.version}/include"/>
<arg line="${gcc.extra.args}"/>
<arg path="${src.native.dir}/onewebp.c"/>
<arg path="${src.native.dir}/jniwrapper.c"/>

<arg path="${libjpeg-turbo.dir}/local/Cellar/jpeg-turbo/${jpeg-turbo.version}/lib/libturbojpeg.a"/>
<arg path="${libpng.dir}/local/Cellar/libpng/${libpng.version}/lib/libpng.a"/>
<arg path="${libwebp.dir}/local/Cellar/webp/${libwebp.version}/lib/libwebp.a"/>

<arg value="-lz"/>
<arg line="-v -o libonewebp.dylib"/>
<arg value="-Wl,-install_name,libonewebp.dylib"/>
</exec>
</target>

<target name="webp-exe">
Expand Down

0 comments on commit 7b8b9ba

Please sign in to comment.