# https://github.com/libuv/libuv
#
# https://dist.libuv.org/dist/1.37.0/libuv-1.37.0.tar.gz
# https://github.com/libuv/libuv/archive/refs/tags/v1.42.0.zip

### VERSION ###
DKSET(UV_MAJOR 1)
DKSET(UV_MINOR 42)
DKSET(UV_BUILD 0)
DKSET(UV_VERSION ${UV_MAJOR}.${UV_MINOR}.${UV_BUILD})
DKSET(UV_NAME libuv-${UV_VERSION})
#DKSET(UV_DL https://dist.libuv.org/dist/${UV_VERSION}/${UV_NAME}.tar.gz)
DKSET(UV_DL https://github.com/libuv/libuv/archive/refs/tags/v${UV_VERSION}.zip)
DKSET(UV ${3RDPARTY}/${UV_NAME})


### INSTALL ###
DKINSTALL(${UV_DL} libuv ${UV})



### DKPLUGINS LINK ###
WIN_LIB(Iphlpapi.lib)
WIN_LIB(Userenv.lib)
DKINCLUDE(${UV}/include)
DKINCLUDE(${UV}/${OS})
WIN_DEBUG_LIB(${UV}/${OS}/${DEBUG_DIR}/uv_a.lib)
WIN_RELEASE_LIB(${UV}/${OS}/${RELEASE_DIR}/uv_a.lib)
MAC_DEBUG_LIB(${UV}/${OS}/lib/${DEBUG_DIR}/libuv_a.a)
MAC_RELEASE_LIB(${UV}/${OS}/lib/${RELEASE_DIR}/libuv_a.a)
IOSSIM_DEBUG_LIB(${UV}/${OS}/${DEBUG_DIR}/lib/.libs/libuv_a.a)
IOSSIM_RELEASE_LIB(${UV}/${OS}/${RELEASE_DIR}/lib/.libs/libuv_a.a)
LINUX_DEBUG_LIB(${UV}/${OS}/${DEBUG_DIR}/libuv_a.a)
LINUX_RELEASE_LIB(${UV}/${OS}/${RELEASE_DIR}/libuv_a.a)
RASPBERRY_DEBUG_LIB(${UV}/${OS}/${DEBUG_DIR}/libuv_a.a)
RASPBERRY_RELEASE_LIB(${UV}/${OS}/${RELEASE_DIR}/libuv_a.a)
## ANDROID_DEBUG_LIB(${UV}/${OS}/${DEBUG_DIR}/obj/local/armeabi-v7a/libuv_a.a)
## ANDROID_RELEASE_LIB(${UV}/${OS}/${RELEASE_DIR}/obj/local/armeabi-v7a/libuv_a.a)
ANDROID_DEBUG_LIB(${UV}/${OS}/${DEBUG_DIR}/libuv_a.a)
ANDROID_RELEASE_LIB(${UV}/${OS}/${RELEASE_DIR}/libuv_a.a)



### 3RDPARTY LINK ###
DKSET(LIBUV_WIN -DLIBUV_INCLUDE_DIR=${UV} -DLIBUV_LIBRARY=${UV}/${OS}/${RELEASE_DIR}/uv_a.lib)
DKSET(LIBUV_APPLE -DLIBUV_INCLUDE_DIR=${UV} -DLIBUV_LIBRARY=${UV}/${OS}/${RELEASE_DIR}/uv_a.a)
DKSET(LIBUV_LINUX -DLIBUV_INCLUDE_DIR=${UV} -DLIBUV_LIBRARY=${UV}/${OS}/${RELEASE_DIR}/uv_a.a)
DKSET(LIBUV_RASPBERRY -DLIBUV_INCLUDE_DIR=${UV} -DLIBUV_LIBRARY=${UV}/${OS}/${RELEASE_DIR}/uv_a.a)
DKSET(LIBUV_ANDROID -DLIBUV_INCLUDE_DIR=${UV} -DLIBUV_LIBRARY=${UV}/${OS}/${RELEASE_DIR}/uv_a.a)



### COMPILE ###
WIN_PATH(${UV}/${OS})
WIN32_COMMAND(${DKCMAKE_WIN32} ${UV})
WIN64_COMMAND(${DKCMAKE_WIN64} ${UV})
WIN_VS(${UV_NAME} libuv.sln uv_a)


MAC_PATH(${UV}/${OS})
MAC64_COMMAND(${DKCMAKE_MAC64} ${UV})
MAC_XCODE(${UV_NAME} uv_a)


IOS_PATH(${UV}/${OS})
IOS64_COMMAND(${DKCMAKE_IOS64} ${UV})
IOS_XCODE(${UV_NAME} uv_a)


IOSSIM_PATH(${UV}/${OS})
IOSSIM64_COMMAND(${DKCMAKE_IOSSIM64} ${UV})
IOSSIM_XCODE(${UV_NAME} uv_a)


LINUX_DEBUG_PATH(${UV}/${OS}/${DEBUG_DIR})
LINUX_DEBUG_COMMAND(${DKCMAKE_LINUX_DEBUG} ${UV})
LINUX_DEBUG_COMMAND(make uv_a)

LINUX_RELEASE_PATH(${UV}/${OS}/${RELEASE_DIR})
LINUX_RELEASE_COMMAND(${DKCMAKE_LINUX_RELEASE} ${UV})
LINUX_RELEASE_COMMAND(make uv_a)


RASPBERRY_DEBUG_PATH(${UV}/${OS}/${DEBUG_DIR})
RASPBERRY_DEBUG_COMMAND(${DKCMAKE_RASPBERRY_DEBUG} ${UV})
RASPBERRY_DEBUG_COMMAND(make uv_a)

RASPBERRY_RELEASE_PATH(${UV}/${OS}/${RELEASE_DIR})
RASPBERRY_RELEASE_COMMAND(${DKCMAKE_RASPBERRY_RELEASE} ${UV})
RASPBERRY_RELEASE_COMMAND(make uv_a)


## ANDROID_NDK(${UV_NAME})
ANDROID_PATH(${UV}/${OS})
ANDROID32_COMMAND(${DKCMAKE_ANDROID32} ${UV})
ANDROID64_COMMAND(${DKCMAKE_ANDROID64} ${UV})
ANDROID_VS(${UV_NAME} libuv.sln uv_a)