# http://www.ijg.org/
#
# https://www.ijg.org/files/jpegsr9d.zip


### VERSION ###
DKSET(JPEG_VERSION 9d)
DKSET(JPEG_NAME jpeg-${JPEG_VERSION})
DKSET(JPEG_DL http://www.ijg.org/files/jpegsr${JPEG_VERSION}.zip)
DKSET(JPEG ${3RDPARTY}/${JPEG_NAME})



### INSTALL ###
DKINSTALL(${JPEG_DL} jpeg ${JPEG})



### LINK ###
DKINCLUDE(${JPEG})
DKINCLUDE(${JPEG}/${OS})
DKINCLUDE(${JPEG}/${OS}/${RELEASE_DIR})
ANDROID_INCLUDE(${JPEG}/${OS}/$(BUILD_TYPE)/jni)
WIN_DEBUG_LIB(${JPEG}/${OS}/${DEBUG_DIR}/jpeg-static.lib)
WIN_RELEASE_LIB(${JPEG}/${OS}/${RELEASE_DIR}/jpeg-static.lib)
APPLE_DEBUG_LIB(${JPEG}/${OS}/${DEBUG_DIR}/libjpeg-static.a)
APPLE_RELEASE_LIB(${JPEG}/${OS}/${RELEASE_DIR}/libjpeg-static.a)
LINUX_DEBUG_LIB(${JPEG}/${OS}/${DEBUG_DIR}/libjpeg-static.a)
LINUX_RELEASE_LIB(${JPEG}/${OS}/${RELEASE_DIR}/libjpeg-static.a)
ANDROID_DEBUG_LIB(${JPEG}/${OS}/${DEBUG_DIR}/obj/local/armeabi-v7a/libjpeg.a)
ANDROID_RELEASE_LIB(${JPEG}/${OS}/${RELEASE_DIR}/obj/local/armeabi-v7a/libjpeg.a)



### 3RDPARTY LINK ###
DKSET(JPEG_WIN -DJPEG_INCLUDE_DIR=${JPEG} -DJPEG_INCLUDE_DIR2=${JPEG}/${OS} -DJPEG_LIBRARY_DEBUG=${JPEG}/${OS}/${DEBUG_DIR}/jpeg-static.lib -DJPEG_LIBRARY_RELEASE=${JPEG}/${OS}/${RELEASE_DIR}/jpeg-static.lib)
DKSET(JPEG_APPLE -DJPEG_INCLUDE_DIR=${JPEG} -DJPEG_INCLUDE_DIR2=${JPEG}/${OS} -DJPEG_LIBRARY=${JPEG}/${OS}/${RELEASE_DIR}/libjpeg-static.a)
DKSET(JPEG_LINUX -DJPEG_INCLUDE_DIR=${JPEG} -DJPEG_INCLUDE_DIR2=${JPEG}/${OS} -DJPEG_LIBRARY=${JPEG}/${OS}/${RELEASE_DIR}/libjpeg-static.a)
DKSET(JPEG_RASPBERRY -DJPEG_INCLUDE_DIR=${JPEG} -DJPEG_INCLUDE_DIR2=${JPEG}/${OS} -DJPEG_LIBRARY=${JPEG}/${OS}/${RELEASE_DIR}/libjpeg-static.a)



### COMPILE ###
WIN_PATH(${JPEG}/${OS})
WIN32_COMMAND(${DKCMAKE_WIN32} ${JPEG})
WIN64_COMMAND(${DKCMAKE_WIN64} ${JPEG})
WIN_VS(${JPEG_NAME} jpeg.sln jpeg-static)


MAC_PATH(${JPEG}/${OS})
MAC64_COMMAND(${DKCMAKE_MAC64} ${JPEG})
MAC_XCODE(${JPEG_NAME} jpeg-static)


IOS_PATH(${JPEG}/${OS})
IOS64_COMMAND(${DKCMAKE_IOS64} ${JPEG})
IOS_XCODE(${JPEG_NAME} jpeg-static)


IOSSIM_PATH(${JPEG}/${OS})
IOSSIM64_COMMAND(${DKCMAKE_IOSSIM64} ${JPEG})
IOSSIM_XCODE(${JPEG_NAME} jpeg-static)


LINUX_DEBUG_PATH(${JPEG}/${OS}/${DEBUG_DIR})
LINUX_DEBUG_COMMAND(${DKCMAKE_LINUX_DEBUG} ${JPEG})
LINUX_DEBUG_COMMAND(make jpeg-static)

LINUX_RELEASE_PATH(${JPEG}/${OS}/${RELEASE_DIR})
LINUX_RELEASE_COMMAND(${DKCMAKE_LINUX_RELEASE} ${JPEG})
LINUX_RELEASE_COMMAND(make jpeg-static)


ANDROID_NDK(${JPEG_NAME})