Skip to content

Commit

Permalink
more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
skidder committed Dec 13, 2024
1 parent 848e925 commit 893fdd6
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 6 deletions.
2 changes: 1 addition & 1 deletion deps/build-deps-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ echo '\n--------------------'
echo 'Building libavif'
echo '--------------------\n'
mkdir -p $BASEDIR/libavif
tar -xzf $SRCDIR/libavif-1.1.1.tar.gz -C $BASEDIR/libavif
tar -xzf $SRCDIR/libavif-1.1.1.tar.gz -C $BASEDIR/libavif --strip-components 1
mkdir -p $BUILDDIR/libavif
cd $BUILDDIR/libavif
cmake $BASEDIR/libavif \
Expand Down
15 changes: 10 additions & 5 deletions deps/build-deps-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -360,19 +360,24 @@ echo '--------------------\n'
mkdir -p $BASEDIR/libyuv
tar -xzf $SRCDIR/libyuv-eb6e7bb63738e29efd82ea3cf2a115238a89fa51-2024-12-12.tar.gz -C $BASEDIR/libyuv
cd $BASEDIR/libyuv
patch -p0 < $BASEDIR/patches/0002-fix-libyuv-cmake-for-osx.patch
mkdir -p $BUILDDIR/libyuv
cd $BUILDDIR/libyuv

cmake $BASEDIR/libyuv \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DCMAKE_C_FLAGS="-arch arm64 -fPIC -O3 -march=armv8-a+crc+crypto -mtune=apple-m1" \
-DCMAKE_CXX_FLAGS="-arch arm64 -fPIC -O3 -march=armv8-a+crc+crypto -mtune=apple-m1" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DBUILD_STATIC_LIBS=ON \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DJPEG_LIBRARY=$PREFIX/lib/libjpeg.a \
-DJPEG_INCLUDE_DIR=$PREFIX/include \
-DCMAKE_EXE_LINKER_FLAGS="-L$PREFIX/lib" \
-DCMAKE_SHARED_LINKER_FLAGS="-L$PREFIX/lib" \
-DLIBYUV_BUILD_SHARED_LIBS=OFF \
-DLIBYUV_DISABLE_SHARED=ON \
-DLIBYUV_ENABLE_STATIC=ON
Expand All @@ -392,7 +397,7 @@ mkdir -p $BUILDDIR/aom
cd $BUILDDIR/aom
cmake $BASEDIR/aom \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DCMAKE_C_FLAGS="-O3 -march=armv8-a+crc+crypto -mtune=apple-m1" \
-DCMAKE_CXX_FLAGS="-O3 -march=armv8-a+crc+crypto -mtune=apple-m1" \
-DENABLE_SHARED=0 \
Expand All @@ -412,12 +417,12 @@ echo '\n--------------------'
echo 'Building libavif'
echo '--------------------\n'
mkdir -p $BASEDIR/libavif
tar -xzf $SRCDIR/libavif-1.1.1.tar.gz -C $BASEDIR/libavif
tar -xzf $SRCDIR/libavif-1.1.1.tar.gz -C $BASEDIR/libavif --strip-components 1
mkdir -p $BUILDDIR/libavif
cd $BUILDDIR/libavif
cmake $BASEDIR/libavif \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DCMAKE_C_FLAGS="-O3 -march=armv8-a+crc+crypto -mtune=apple-m1" \
-DCMAKE_CXX_FLAGS="-O3 -march=armv8-a+crc+crypto -mtune=apple-m1" \
-DAVIF_CODEC_AOM=SYSTEM \
Expand Down
81 changes: 81 additions & 0 deletions deps/patches/0002-fix-libyuv-cmake-for-osx.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
--- CMakeLists.txt.orig 2024-12-12 17:06:48
+++ CMakeLists.txt 2024-12-12 17:07:22
@@ -5,6 +5,7 @@
PROJECT ( YUV C CXX ) # "C" is required even for C++ projects
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
OPTION( TEST "Built unit tests" OFF )
+OPTION( BUILD_SHARED_LIBS "Build shared libraries" OFF )

SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
SET ( ly_src_dir ${ly_base_dir}/source )
@@ -12,7 +13,6 @@
SET ( ly_tst_dir ${ly_base_dir}/unit_test )
SET ( ly_lib_name yuv )
SET ( ly_lib_static ${ly_lib_name} )
-SET ( ly_lib_shared ${ly_lib_name}_shared )

FILE ( GLOB_RECURSE ly_source_files ${ly_src_dir}/*.cc )
LIST ( SORT ly_source_files )
@@ -22,26 +22,33 @@

INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )

+INCLUDE ( FindJPEG )
+if (JPEG_FOUND)
+ include_directories( ${JPEG_INCLUDE_DIR} )
+ add_definitions( -DHAVE_JPEG )
+endif()
+
# this creates the static library (.a)
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
+if (JPEG_FOUND)
+ target_link_libraries( ${ly_lib_static} ${JPEG_LIBRARY} )
+endif()

-# this creates the shared library (.so)
-ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
+if (BUILD_SHARED_LIBS)
+ # this creates the shared library (.so)
+ SET ( ly_lib_shared ${ly_lib_name}_shared )
+ ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
+ SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
+ SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
+ if (JPEG_FOUND)
+ target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} )
+ endif()
+endif()

# this creates the conversion tool
ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )

-
-INCLUDE ( FindJPEG )
-if (JPEG_FOUND)
- include_directories( ${JPEG_INCLUDE_DIR} )
- target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
- add_definitions( -DHAVE_JPEG )
-endif()
-
if(TEST)
find_library(GTEST_LIBRARY gtest)
if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND")
@@ -73,13 +80,13 @@
endif()
endif()

-
# install the conversion tool, .so, .a, and all the header files
INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
+if (BUILD_SHARED_LIBS)
+ INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
+endif()
INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )

# create the .deb and .rpm packages using cpack
INCLUDE ( CM_linux_packages.cmake )
-

0 comments on commit 893fdd6

Please sign in to comment.