Skip to content

Commit

Permalink
fix: Resolve compiler warnings on OS X and consolidate CGo settings. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
skidder authored Oct 12, 2024
1 parent 95a20d8 commit 37dccac
Show file tree
Hide file tree
Showing 29 changed files with 30 additions and 47 deletions.
5 changes: 4 additions & 1 deletion avcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static int avcodec_decoder_copy_frame(const avcodec_decoder d, opencv_mat mat, A
NULL, NULL, NULL);

// Configure colorspace
int colorspace = SWS_CS_ITU709;
int colorspace;
switch (frame->colorspace) {
case AVCOL_SPC_BT2020_NCL:
case AVCOL_SPC_BT2020_CL:
Expand All @@ -428,6 +428,9 @@ static int avcodec_decoder_copy_frame(const avcodec_decoder d, opencv_mat mat, A
case AVCOL_SPC_SMPTE240M:
colorspace = SWS_CS_SMPTE240M;
break;
default:
colorspace = SWS_CS_ITU709;
break;
}
const int* inv_table = sws_getCoefficients(colorspace);

Expand Down
9 changes: 0 additions & 9 deletions avcodec.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package lilliput

// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx
// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo CXXFLAGS: -std=c++11
// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo LDFLAGS: -lswscale -lavformat -lavcodec -lavfilter -lavutil -lbz2 -lz
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib
// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux/lib
// #include "avcodec.hpp"
import "C"

Expand Down
17 changes: 17 additions & 0 deletions cgo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package lilliput

/*
#cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include
#cgo linux CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -I${SRCDIR}/deps/linux/include
#cgo CXXFLAGS: -std=c++11
#cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include
#cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include
#cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -lavcodec -lavfilter -lavformat -lavutil -lbz2 -lgif -ljpeg -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lpng -lsharpyuv -lswscale -lwebp -lwebpmux -lz -framework CoreFoundation -framework CoreMedia -framework CoreVideo -framework VideoToolbox
#cgo linux LDFLAGS: -L${SRCDIR}/deps/linux/lib -L${SRCDIR}/deps/linux/share/OpenCV/3rdparty/lib -lswscale -lavformat -lavcodec -lavfilter -lavutil -lbz2 -lz -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz -lgif -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lsharpyuv -lz -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz -lopencv_core -lopencv_imgproc -lwebp -lwebpmux -lippicv
void dummy() {}
*/
import "C"

func init() {
C.dummy()
}
10 changes: 9 additions & 1 deletion deps/build-deps-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ tar -xzf $SRCDIR/libjpeg-turbo-2.1.4.tar.gz -C $BASEDIR/libjpeg-turbo --strip-co
cd $BASEDIR/libjpeg-turbo
mkdir -p $BUILDDIR/libjpeg-turbo
cd $BUILDDIR/libjpeg-turbo
cmake $BASEDIR/libjpeg-turbo -DENABLE_STATIC=1 -DENABLE_SHARED=0 -DWITH_JPEG8=1 -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_OSX_ARCHITECTURES=arm64
cmake $BASEDIR/libjpeg-turbo \
-DENABLE_STATIC=1 \
-DENABLE_SHARED=0 \
-DWITH_JPEG8=1 \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DCMAKE_C_FLAGS="-mmacosx-version-min=14.0" \
-DCMAKE_CXX_FLAGS="-mmacosx-version-min=14.0"
make
make install

Expand Down
Binary file modified deps/osx/lib/libavcodec.a
Binary file not shown.
Binary file modified deps/osx/lib/libavdevice.a
Binary file not shown.
Binary file modified deps/osx/lib/libavfilter.a
Binary file not shown.
Binary file modified deps/osx/lib/libavformat.a
Binary file not shown.
Binary file modified deps/osx/lib/libavutil.a
Binary file not shown.
Binary file modified deps/osx/lib/libbz2.a
Binary file not shown.
Binary file modified deps/osx/lib/libgif.a
Binary file not shown.
Binary file modified deps/osx/lib/libjpeg.a
Binary file not shown.
Binary file modified deps/osx/lib/libopencv_core.a
Binary file not shown.
Binary file modified deps/osx/lib/libopencv_imgcodecs.a
Binary file not shown.
Binary file modified deps/osx/lib/libopencv_imgproc.a
Binary file not shown.
Binary file modified deps/osx/lib/libpng.a
Binary file not shown.
Binary file modified deps/osx/lib/libpng16.a
Binary file not shown.
Binary file modified deps/osx/lib/libsharpyuv.a
Binary file not shown.
Binary file modified deps/osx/lib/libswresample.a
Binary file not shown.
Binary file modified deps/osx/lib/libswscale.a
Binary file not shown.
Binary file modified deps/osx/lib/libturbojpeg.a
Binary file not shown.
Binary file modified deps/osx/lib/libwebp.a
Binary file not shown.
Binary file modified deps/osx/lib/libwebpdemux.a
Binary file not shown.
Binary file modified deps/osx/lib/libwebpmux.a
Binary file not shown.
Binary file modified deps/osx/lib/libz.a
Binary file not shown.
9 changes: 0 additions & 9 deletions giflib.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package lilliput

// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx
// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo CXXFLAGS: -std=c++11
// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo LDFLAGS: -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz -lgif
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib
// #cgo linux LDFLAGS: -lippicv -L${SRCDIR}/deps/linux/lib
// #include "giflib.hpp"
import "C"

Expand Down
9 changes: 0 additions & 9 deletions opencv.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package lilliput

// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx
// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo CXXFLAGS: -std=c++11
// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo LDFLAGS: -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lsharpyuv -lz
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib -framework VideoToolbox -framework CoreVideo -framework CoreMedia -framework CoreFoundation
// #cgo linux LDFLAGS: -lippicv -L${SRCDIR}/deps/linux/lib
// #include "opencv.hpp"
import "C"

Expand Down
9 changes: 0 additions & 9 deletions thumbhash.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package lilliput

// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx
// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo CXXFLAGS: -std=c++11
// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo LDFLAGS: -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lz
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib
// #cgo linux LDFLAGS: -lippicv -L${SRCDIR}/deps/linux/lib
// #include "thumbhash.hpp"
import "C"

Expand Down
9 changes: 0 additions & 9 deletions webp.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package lilliput

// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx
// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo CXXFLAGS: -std=c++11
// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo LDFLAGS: -lopencv_core -lopencv_imgproc -lwebp -lwebpmux
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib
// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux/lib
// #include "webp.hpp"
import "C"

Expand Down

0 comments on commit 37dccac

Please sign in to comment.