# https://github.com/LibVNC/libvncserver/archive/refs/heads/master.zip

### DEPENDS ###
DKDEPEND(zlib)
DKDEPEND(libpng)
IF(ANDROID)
	DKDEPEND(jpeg)
ELSE()
	DKDEPEND(libjpeg-turbo)
ENDIF()
DKDEPEND(openssl)
IF(LINUX)
	DKDEPEND(libsystemd-dev)
ENDIF()



### VERSION ###
DKSET(VNCSERVER_VERSION master)
DKSET(VNCSERVER_NAME libvncserver-${VNCSERVER_VERSION})
DKSET(VNCSERVER_DL https://github.com/LibVNC/libvncserver/archive/refs/heads/${VNCSERVER_VERSION}.zip)
DKSET(VNCSERVER ${3RDPARTY}/${VNCSERVER_NAME})



### INSTALL ###
DKINSTALL(${VNCSERVER_DL} libvncserver ${VNCSERVER})



### LINK ###
DKINCLUDE(${VNCSERVER})
DKINCLUDE(${VNCSERVER}/examples)
DKINCLUDE(${VNCSERVER}/${OS})
DKINCLUDE(${VNCSERVER}/${OS}/${RELEASE_DIR})
WIN_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/vncserver.lib)
WIN_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/vncserver.lib)
WIN_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/vncclient.lib)
WIN_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/vncclient.lib)
MAC_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/libvncserver.a)
MAC_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/libvncserver.a)
MAC_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/libvncclient.a)
MAC_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/libvncclient.a)
IOSSIM_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/lib/.libs/libvncserver.a)
IOSSIM_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/lib/.libs/libvncserver.a)
LINUX_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/libvncserver.a)
LINUX_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/libvncserver.a)
LINUX_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/libvncclient.a)
LINUX_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/libvncclient.a)
ANDROID_DEBUG_LIB(${VNCSERVER}/${OS}/${DEBUG_DIR}/obj/local/armeabi-v7a/libvncserver.a)
ANDROID_RELEASE_LIB(${VNCSERVER}/${OS}/${RELEASE_DIR}/obj/local/armeabi-v7a/libvncserver.a)



WIN_PATH(${VNCSERVER}/${OS})
WIN32_COMMAND(${DKCMAKE_WIN32} -DWITH_JPEG=ON ${OPENSSL_WIN} ${PNG_WIN} ${JPEG_WIN} ${ZLIB_WIN} ${VNCSERVER})
WIN64_COMMAND(${DKCMAKE_WIN64} -DWITH_JPEG=ON ${OPENSSL_WIN} ${PNG_WIN} ${JPEG_WIN} ${ZLIB_WIN} ${VNCSERVER})
WIN_VS(${VNCSERVER_NAME} LibVNCServer.sln vncserver)
WIN_VS(${VNCSERVER_NAME} LibVNCServer.sln vncclient)


MAC_PATH(${VNCSERVER}/${OS})
MAC64_COMMAND(${DKCMAKE_MAC64} -DWITH_JPEG=ON ${OPENSSL_APPLE} ${PNG_APPLE} ${JPEG_APPLE} ${ZLIB_APPLE} ${VNCSERVER})
MAC_XCODE(${VNCSERVER_NAME} vncserver)
MAC_XCODE(${VNCSERVER_NAME} vncclient)

IOS_PATH(${VNCSERVER}/${OS})
IOS64_COMMAND(${DKCMAKE_IOS64} -DWITH_JPEG=ON ${OPENSSL_APPLE} ${PNG_APPLE} ${JPEG_APPLE} ${ZLIB_APPLE} ${VNCSERVER})
IOS_XCODE(${VNCSERVER_NAME} vncserver)
IOS_XCODE(${VNCSERVER_NAME} vncclient)

IOSSIM_PATH(${VNCSERVER}/${OS})
IOSSIM64_COMMAND(${DKCMAKE_IOSSIM64} -DWITH_JPEG=ON ${OPENSSL_APPLE} ${PNG_APPLE} ${JPEG_APPLE} ${ZLIB_APPLE} ${VNCSERVER})
IOSSIM_XCODE(${VNCSERVER_NAME} vncserver)
IOSSIM_XCODE(${VNCSERVER_NAME} vncclient)

LINUX_DEBUG_PATH(${VNCSERVER}/${OS}/${DEBUG_DIR})
LINUX_DEBUG_COMMAND(${DKCMAKE_LINUX_DEBUG} -DWITH_JPEG=ON ${OPENSSL_LINUX} ${PNG_LINUX} ${JPEG_LINUX} ${ZLIB_LINUX} ${VNCSERVER})
LINUX_DEBUG_COMMAND(make vncserver)
LINUX_DEBUG_COMMAND(make vncclient)

LINUX_RELEASE_PATH(${VNCSERVER}/${OS}/${RELEASE_DIR})
LINUX_RELEASE_COMMAND(${DKCMAKE_LINUX_RELEASE} -DWITH_JPEG=ON ${OPENSSL_LINUX} ${PNG_LINUX} ${JPEG_LINUX} ${ZLIB_LINUX} ${VNCSERVER})
LINUX_RELEASE_COMMAND(make vncserver)
LINUX_RELEASE_COMMAND(make vncclient)


#ANDROID_NDK(${VNCSERVER_NAME})
ANDROID_PATH(${VNCSERVER}/${OS})
ANDROID32_COMMAND(${DKCMAKE_ANDROID32} -DWITH_JPEG=ON ${OPENSSL_ANDROID} ${PNG_ANDROID} ${JPEG_ANDROID} ${ZLIB_ANDROID} ${VNCSERVER})
ANDROID64_COMMAND(${DKCMAKE_ANDROID64} -DWITH_JPEG=ON ${OPENSSL_ANDROID} ${PNG_ANDROID} ${JPEG_ANDROID} ${ZLIB_ANDROID} ${VNCSERVER})
ANDROID_VS(${VNCSERVER_NAME} LibVNCServer.sln vncserver)
ANDROID_VS(${VNCSERVER_NAME} LibVNCServer.sln vncclient)