# https://jerryscript.net
# https://github.com/jerryscript-project/jerryscript
#
# https://github.com/jerryscript-project/jerryscript/archive/refs/tags/v2.4.0.zip

### DEPENDS ###
#DKDEPEND(libname)


### VERSION ###
DKSET(JERRYSCRIPT_VERSION 2.4.0)
DKSET(JERRYSCRIPT_NAME jerryscript-${JERRYSCRIPT_VERSION})
DKSET(JERRYSCRIPT_DL https://github.com/jerryscript-project/jerryscript/archive/refs/tags/v${JERRYSCRIPT_VERSION}.zip)
DKSET(JERRYSCRIPT ${3RDPARTY}/${JERRYSCRIPT_NAME})


### INSTALL ###
DKINSTALL(${JERRYSCRIPT_DL} jerryscript ${JERRYSCRIPT})


### LINK ###
DKINCLUDE(${JERRYSCRIPT}/jerry-core/include)
DKINCLUDE(${JERRYSCRIPT}/${OS})
WIN_DEBUG_LIB(${JERRYSCRIPT}/${OS}/lib/${DEBUG_DIR}/jerry-core.lib)
WIN_RELEASE_LIB(${JERRYSCRIPT}/${OS}/lib/${RELEASE_DIR}/jerry-core.lib)
WIN_DEBUG_LIB(${JERRYSCRIPT}/${OS}/lib/${DEBUG_DIR}/jerry-ext.lib)
WIN_RELEASE_LIB(${JERRYSCRIPT}/${OS}/lib/${RELEASE_DIR}/jerry-ext.lib)
WIN_DEBUG_LIB(${JERRYSCRIPT}/${OS}/lib/${DEBUG_DIR}/jerry-port-default.lib)
WIN_RELEASE_LIB(${JERRYSCRIPT}/${OS}/lib/${RELEASE_DIR}/jerry-port-default.lib)
APPLE_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-core.a)
APPLE_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-core.a)
APPLE_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-ext.a)
APPLE_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-ext.a)
APPLE_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-port-default.a)
APPLE_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-port-default.a)
LINUX_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-core.a)
LINUX_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-core.a)
LINUX_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-ext.a)
LINUX_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-ext.a)
LINUX_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-port-default.a)
LINUX_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-port-default.a)
RASPBERRY_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-core.a)
RASPBERRY_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-core.a)
RASPBERRY_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-ext.a)
RASPBERRY_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-ext.a)
RASPBERRY_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-port-default.a)
RASPBERRY_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-port-default.a)
ANDROID_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-core.a)
ANDROID_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-core.a)
ANDROID_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-ext.a)
ANDROID_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-ext.a)
ANDROID_DEBUG_LIB(${JERRYSCRIPT}/${OS}/${DEBUG_DIR}/lib/libjerry-port-default.a)
ANDROID_RELEASE_LIB(${JERRYSCRIPT}/${OS}/${RELEASE_DIR}/lib/libjerry-port-default.a)


### COMPILE ###
WIN_PATH(${JERRYSCRIPT}/${OS})
WIN32_COMMAND(${DKCMAKE_WIN32} ${JERRYSCRIPT})
WIN64_COMMAND(${DKCMAKE_WIN64} ${JERRYSCRIPT})
WIN_VS(${JERRYSCRIPT_NAME} Jerry.sln jerry)


MAC_PATH(${JERRYSCRIPT}/${OS})
MAC32_COMMAND(${DKCMAKE_MAC32} ${JERRYSCRIPT})
MAC64_COMMAND(${DKCMAKE_MAC64} ${JERRYSCRIPT})
MAC_XCODE(${JERRYSCRIPT_NAME} jerry)


IOS_PATH(${JERRYSCRIPT}/${OS})
IOS32_COMMAND(${DKCMAKE_IOS32} ${JERRYSCRIPT})
IOS64_COMMAND(${DKCMAKE_IOS64} ${JERRYSCRIPT})
IOS_XCODE(${JERRYSCRIPT_NAME} jerry)


IOSSIM_PATH(${JERRYSCRIPT}/${OS})
IOSSIM32_COMMAND(${DKCMAKE_IOSSIM32} ${JERRYSCRIPT})
IOSSIM64_COMMAND(${DKCMAKE_IOSSIM64} ${JERRYSCRIPT})
IOSSIM_XCODE(${JERRYSCRIPT_NAME} jerry)


LINUX_DEBUG_PATH(${JERRYSCRIPT}/${OS}/${DEBUG_DIR})
LINUX_DEBUG_COMMAND(${DKCMAKE_LINUX_DEBUG} ${JERRYSCRIPT})
LINUX_DEBUG_COMMAND(make jerry)

LINUX_RELEASE_PATH(${JERRYSCRIPT}/${OS}/${RELEASE_DIR})
LINUX_RELEASE_COMMAND(${DKCMAKE_LINUX_RELEASE} ${JERRYSCRIPT})
LINUX_RELEASE_COMMAND(make jerry)


RASPBERRY_DEBUG_PATH(${JERRYSCRIPT}/${OS}/${DEBUG_DIR})
RASPBERRY_DEBUG_COMMAND(${DKCMAKE_RASPBERRY_DEBUG} ${JERRYSCRIPT})
RASPBERRY_DEBUG_COMMAND(make jerry)

RASPBERRY_RELEASE_PATH(${JERRYSCRIPT}/${OS}/${RELEASE_DIR})
RASPBERRY_RELEASE_COMMAND(${DKCMAKE_RASPBERRY_RELEASE} ${JERRYSCRIPT})
RASPBERRY_RELEASE_COMMAND(make jerry)


##ANDROID_NDK(${JERRYSCRIPT_NAME})
ANDROID_PATH(${JERRYSCRIPT}/${OS})
ANDROID32_COMMAND(${DKCMAKE_ANDROID32} ${JERRYSCRIPT})
ANDROID64_COMMAND(${DKCMAKE_ANDROID64} ${JERRYSCRIPT})
ANDROID_VS(${JERRYSCRIPT_NAME} jerryscript.sln jerryscript)
