# https://github.com/warmcat/libwebsockets/archive/v2.2.0.zip

### VERSION ###
DKSET(WEBSOCKETS_MAJOR 2)
DKSET(WEBSOCKETS_MINOR 2)
DKSET(WEBSOCKETS_BUILD 0)
DKSET(WEBSOCKETS_VERSION ${WEBSOCKETS_MAJOR}.${WEBSOCKETS_MINOR}.${WEBSOCKETS_BUILD})
DKSET(WEBSOCKETS_NAME libwebsockets-${WEBSOCKETS_VERSION})
DKSET(WEBSOCKETS_DL https://github.com/warmcat/libwebsockets/archive/v${WEBSOCKETS_MAJOR}.${WEBSOCKETS_MINOR}.${WEBSOCKETS_BUILD}.zip)
DKSET(WEBSOCKETS ${3RDPARTY}/${WEBSOCKETS_NAME})


### INSTALL ###
DKINSTALL(${WEBSOCKETS_DL} libwebsockets ${WEBSOCKETS})


### LINK ###
DKINCLUDE(${WEBSOCKETS}/lib)
DKINCLUDE(${WEBSOCKETS}/${OS})
WIN_DEBUG_LIB(${WEBSOCKETS}/${OS}/lib/${DEBUG_DIR}/websockets_static.lib)
WIN_RELEASE_LIB(${WEBSOCKETS}/${OS}/lib/${RELEASE_DIR}/websockets_static.lib)
## APPLE_DEBUG_LIB(${WEBSOCKETS}/${OS}/lib/${DEBUG_DIR}/libwebsockets.a)
## APPLE_RELEASE_LIB(${WEBSOCKETS}/${OS}/lib/${RELEASE_DIR}/libwebsockets.a)
LINUX_DEBUG_LIB(${WEBSOCKETS}/${OS}/${DEBUG_DIR}/lib/libwebsockets.a)
LINUX_RELEASE_LIB(${WEBSOCKETS}/${OS}/${RELEASE_DIR}/lib/libwebsockets.a)
## ANDROID_DEBUG_LIB(${WEBSOCKETS}/${OS}/${DEBUG_DIR}/obj/local/armeabi-v7a/libwebsockets.a)
## ANDROID_RELEASE_LIB(${WEBSOCKETS}/${OS}/${RELEASE_DIR}/obj/local/armeabi-v7a/libwebsockets.a)


### COMPILE ###
WIN_PATH(${WEBSOCKETS}/${OS})
WIN32_COMMAND(${DKCMAKE_WIN32} -LWS_WITH_SSL=OFF ${WEBSOCKETS})
WIN64_COMMAND(${DKCMAKE_WIN64} -LWS_WITH_SSL=OFF ${WEBSOCKETS})
WIN_VS(${WEBSOCKETS_NAME} libwebsockets.sln websockets)

DKSETPATH(${WEBSOCKETS}/${OS}/Debug)
LINUX_DEBUG_COMMAND(${DKCMAKE_LINUX_DEBUG} -DLWS_WITH_SSL=OFF ${WEBSOCKETS})
LINUX_DEBUG_COMMAND(make)

DKSETPATH(${WEBSOCKETS}/${OS}/${RELEASE_DIR})
LINUX_RELEASE_COMMAND(${DKCMAKE_LINUX_RELEASE} -DLWS_WITH_SSL=OFF ${WEBSOCKETS})
LINUX_RELEASE_COMMAND(make)