2020-10-15 11:24:39 +08:00
|
|
|
|
2021-01-23 20:20:31 +08:00
|
|
|
if(ENABLE_GITEE)
|
2020-10-15 11:24:39 +08:00
|
|
|
set(REQ_URL "https://gitee.com/mirrors/libjpeg-turbo/repository/archive/2.0.4.tar.gz")
|
|
|
|
set(MD5 "51aac2382ad1a68b2e4beb391dc1cf60")
|
|
|
|
else()
|
|
|
|
set(REQ_URL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.4.tar.gz")
|
|
|
|
set(MD5 "44c43e4a9fb352f47090804529317c88")
|
2021-01-23 20:20:31 +08:00
|
|
|
endif()
|
2020-10-15 11:24:39 +08:00
|
|
|
|
2021-01-23 20:20:31 +08:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2021-03-21 15:25:28 +08:00
|
|
|
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 \
|
|
|
|
-O2")
|
2020-04-13 19:42:12 +08:00
|
|
|
else()
|
2021-03-21 15:25:28 +08:00
|
|
|
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC \
|
|
|
|
-D_FORTIFY_SOURCE=2 -O2")
|
2020-04-13 19:42:12 +08:00
|
|
|
endif()
|
|
|
|
|
2020-12-10 15:02:44 +08:00
|
|
|
set(jpeg_turbo_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack,-s")
|
2020-12-05 16:42:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
set(jpeg_turbo_USE_STATIC_LIBS ON)
|
|
|
|
set(JPEG_TURBO_PATCHE ${CMAKE_SOURCE_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
|
|
|
|
set(CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=TRUE -DWITH_SIMD=ON)
|
2021-01-23 20:20:31 +08:00
|
|
|
if(BUILD_LITE)
|
2020-12-05 16:42:50 +08:00
|
|
|
set(jpeg_turbo_USE_STATIC_LIBS OFF)
|
|
|
|
set(JPEG_TURBO_PATCHE ${TOP_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
|
2021-01-23 20:20:31 +08:00
|
|
|
if(PLATFORM_ARM64)
|
2020-12-05 16:42:50 +08:00
|
|
|
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
|
|
|
-DANDROID_NATIVE_API_LEVEL=19
|
|
|
|
-DANDROID_NDK=$ENV{ANDROID_NDK}
|
|
|
|
-DANDROID_ABI=arm64-v8a
|
|
|
|
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
|
|
|
|
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
|
|
|
endif()
|
2021-01-23 20:20:31 +08:00
|
|
|
if(PLATFORM_ARM32)
|
2020-12-05 16:42:50 +08:00
|
|
|
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
|
|
|
-DANDROID_NATIVE_API_LEVEL=19
|
|
|
|
-DANDROID_NDK=$ENV{ANDROID_NDK}
|
|
|
|
-DANDROID_ABI=armeabi-v7a
|
|
|
|
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
|
|
|
|
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
|
|
|
endif()
|
|
|
|
|
2021-01-23 20:20:31 +08:00
|
|
|
endif()
|
2020-12-05 16:42:50 +08:00
|
|
|
|
2020-03-27 14:49:12 +08:00
|
|
|
mindspore_add_pkg(jpeg_turbo
|
|
|
|
VER 2.0.4
|
2020-07-16 16:11:17 +08:00
|
|
|
LIBS jpeg turbojpeg
|
2020-10-15 11:24:39 +08:00
|
|
|
URL ${REQ_URL}
|
|
|
|
MD5 ${MD5}
|
2020-12-05 16:42:50 +08:00
|
|
|
CMAKE_OPTION ${CMAKE_OPTION}
|
|
|
|
PATCHES ${JPEG_TURBO_PATCHE}
|
2020-03-27 14:49:12 +08:00
|
|
|
)
|
|
|
|
include_directories(${jpeg_turbo_INC})
|
|
|
|
add_library(mindspore::jpeg_turbo ALIAS jpeg_turbo::jpeg)
|
2020-07-16 16:11:17 +08:00
|
|
|
add_library(mindspore::turbojpeg ALIAS jpeg_turbo::turbojpeg)
|