Add CMake support (thanks to Christian Ehrlicher)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
pull/1/head
dscho 17 years ago
parent c07091b390
commit 09d902c5b7

@ -30,7 +30,7 @@ Glenn Mabutt, Paul Kreiner, Erik Kunze, Mike Frysinger, Martin Waitz,
Mark McLoughlin, Paul Fox, Juan Jose Costello, Andre Leiadella,
Alberto Lusiani, Malvina Mazin, Dave Stuart, Rohit Kumar, Donald Dugger,
Steven Carr, Uwe Völker, Charles Coffing, Guillaume Rousse,
Alessandro Praduroux, Brad Hards, and Timo Ketola.
Alessandro Praduroux, Brad Hards, Timo Ketola, and Christian Ehrlicher.
Probably I forgot quite a few people sending a patch here and there, which
really made a difference. Without those, some obscure bugs still would

@ -0,0 +1,243 @@
project(LibVNCServer)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckTypeSize)
include(TestBigEndian)
set(PACKAGE_NAME "LibVNCServer")
set(FULL_PACKAGE_NAME "LibVNCServer")
set(PACKAGE_VERSION "0.9.2")
set(PROJECT_BUGREPORT_PATH "http://sourceforge.net/projects/libvncserver")
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/libvncserver)
find_package(ZLIB)
find_package(JPEG)
find_package(SDL)
if(SDL_FOUND) # == pthread.h available
option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON)
endif(SDL_FOUND)
if(ZLIB_FOUND)
set(LIBVNCSERVER_HAVE_LIBZ 1)
endif(ZLIB_FOUND)
if(JPEG_FOUND)
set(LIBVNCSERVER_HAVE_LIBJPEG 1)
endif(JPEG_FOUND)
option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON)
check_include_file("fcntl.h" LIBVNCSERVER_HAVE_FCNTL_H)
check_include_file("netinet/in.h" LIBVNCSERVER_HAVE_NETINET_IN_H)
check_include_file("pthread.h" LIBVNCSERVER_HAVE_LIBPTHREAD)
check_include_file("sys/socket.h" LIBVNCSERVER_HAVE_SYS_SOCKET_H)
check_include_file("sys/stat.h" LIBVNCSERVER_HAVE_SYS_STAT_H)
check_include_file("sys/time.h" LIBVNCSERVER_HAVE_SYS_TIME_H)
check_include_file("sys/types.h" LIBVNCSERVER_HAVE_SYS_TYPES_H)
check_include_file("sys/wait.h" LIBVNCSERVER_HAVE_SYS_WAIT_H)
check_include_file("unistd.h" LIBVNCSERVER_HAVE_UNISTD_H)
# headers needed for check_type_size()
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file("stdint.h" HAVE_STDINT_H)
check_include_file("stddef.h" HAVE_STDDEF_H)
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
check_function_exists(gettimeofday LIBVNCSERVER_HAVE_GETTIMEOFDAY)
if(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
# socklen_t
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
endif(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
if(HAVE_ARPA_INET_H)
# in_addr_t
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "arpa/inet.h")
endif(HAVE_ARPA_INET_H)
check_type_size(pid_t LIBVNCSERVER_PID_T)
check_type_size(size_t LIBVNCSERVER_SIZE_T)
check_type_size(socklen_t LIBVNCSERVER_SOCKLEN_T)
check_type_size(in_addr_t LIBVNCSERVER_IN_ADDR_T)
if(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
set(LIBVNCSERVER_NEED_INADDR_T 1)
endif(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
TEST_BIG_ENDIAN(LIBVNCSERVER_WORDS_BIGENDIAN)
# TODO:
# LIBVNCSERVER_ENOENT_WORKAROUND
# inline
configure_file(${CMAKE_SOURCE_DIR}/rfb/rfbconfig.h.cmake ${CMAKE_BINARY_DIR}/rfb/rfbconfig.h)
configure_file(${CMAKE_SOURCE_DIR}/rfb/rfbint.h.cmake ${CMAKE_BINARY_DIR}/rfb/rfbint.h)
set(LIBVNCSERVER_DIR ${CMAKE_SOURCE_DIR}/libvncserver)
set(LIBVNCCLIENT_DIR ${CMAKE_SOURCE_DIR}/libvncclient)
set(LIBVNCSRVTEST_DIR ${CMAKE_SOURCE_DIR}/examples)
set(LIBVNCCLITEST_DIR ${CMAKE_SOURCE_DIR}/client_examples)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_DIR}/main.c
${LIBVNCSERVER_DIR}/rfbserver.c
${LIBVNCSERVER_DIR}/rfbregion.c
${LIBVNCSERVER_DIR}/auth.c
${LIBVNCSERVER_DIR}/sockets.c
${LIBVNCSERVER_DIR}/stats.c
${LIBVNCSERVER_DIR}/corre.c
${LIBVNCSERVER_DIR}/hextile.c
${LIBVNCSERVER_DIR}/rre.c
${LIBVNCSERVER_DIR}/translate.c
${LIBVNCSERVER_DIR}/cutpaste.c
${LIBVNCSERVER_DIR}/httpd.c
${LIBVNCSERVER_DIR}/cursor.c
${LIBVNCSERVER_DIR}/font.c
${LIBVNCSERVER_DIR}/draw.c
${LIBVNCSERVER_DIR}/selbox.c
${LIBVNCSERVER_DIR}/d3des.c
${LIBVNCSERVER_DIR}/vncauth.c
${LIBVNCSERVER_DIR}/cargs.c
${LIBVNCSERVER_DIR}/minilzo.c
${LIBVNCSERVER_DIR}/ultra.c
${LIBVNCSERVER_DIR}/scale.c
)
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_DIR}/cursor.c
${LIBVNCCLIENT_DIR}/listen.c
${LIBVNCCLIENT_DIR}/rfbproto.c
${LIBVNCCLIENT_DIR}/sockets.c
${LIBVNCCLIENT_DIR}/vncviewer.c
${LIBVNCCLIENT_DIR}/minilzo.c
)
if(ZLIB_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBZ)
include_directories(${ZLIB_INCLUDE_DIR})
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/zlib.c
${LIBVNCSERVER_DIR}/zrle.c
${LIBVNCSERVER_DIR}/zrleoutstream.c
${LIBVNCSERVER_DIR}/zrlepalettehelper.c
)
endif(ZLIB_FOUND)
if(JPEG_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG)
include_directories(${JPEG_INCLUDE_DIR})
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/tight.c
)
endif(JPEG_FOUND)
if(TIGHTVNC_FILETRANSFER)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/rfbtightserver.c
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/handlefiletransferrequest.c
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filetransfermsg.c
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filelistinfo.c
)
endif(TIGHTVNC_FILETRANSFER)
add_library(vncclient SHARED ${LIBVNCCLIENT_SOURCES})
add_library(vncserver SHARED ${LIBVNCSERVER_SOURCES})
if(WIN32)
set(ADDITIONAL_LIBS ws2_32)
endif(WIN32)
target_link_libraries(vncclient
${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES}
${JPEG_LIBRARIES}
${SDL_LIBRARY}
)
target_link_libraries(vncserver
${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES}
${JPEG_LIBRARIES}
${SDL_LIBRARY}
)
# tests
set(LIBVNCSERVER_TESTS
backchannel
camera
colourmaptest
example
fontsel
pnmshow
pnmshow24
regiontest
rotate
simple
simple15
storepasswd
vncev
)
if(SDL_FOUND)
set(LIBVNCSERVER_TESTS
${LIBVNCSERVER_TESTS}
blooptest
)
endif(SDL_FOUND)
if(TIGHTVNC_FILETRANSFER)
set(LIBVNCSERVER_TESTS
${LIBVNCSERVER_TESTS}
filetransfer
)
endif(TIGHTVNC_FILETRANSFER)
if(MACOS)
set(LIBVNCSERVER_TESTS
${LIBVNCSERVER_TESTS}
mac
)
endif(MACOS)
set(LIBVNCCLIENT_TESTS
backchannel
ppmtest
)
if(SDL_FOUND)
include_directories(${SDL_INCLUDE_DIR})
set(LIBVNCCLIENT_TESTS
${LIBVNCCLIENT_TESTS}
SDLvncviewer
)
endif(SDL_FOUND)
if(HAVE_FFMPEG)
set(LIBVNCCLIENT_TESTS
${LIBVNCCLIENT_TESTS}
vnc2mpg
)
endif(HAVE_FFMPEG)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
foreach(test ${LIBVNCSERVER_TESTS})
add_executable(examples/${test} ${LIBVNCSRVTEST_DIR}/${test}.c)
target_link_libraries(examples/${test} vncserver)
endforeach(test ${LIBVNCSERVER_TESTS})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/client_examples)
foreach(test ${LIBVNCCLIENT_TESTS})
add_executable(client_examples/${test} ${LIBVNCCLITEST_DIR}/${test}.c)
target_link_libraries(client_examples/${test} vncclient ${SDL_LIBRARIES} ${FFMPEG_LIBRARIES})
endforeach(test ${LIBVNCCLIENT_TESTS})
install_targets(/lib vncserver)
install_targets(/lib vncclient)
install_files(/include/rfb FILES
rfb/keysym.h
rfb/rfb.h
rfb/rfbclient.h
rfb/rfbconfig.h
rfb/rfbint.h
rfb/rfbproto.h
rfb/rfbregion.h
)

@ -1,3 +1,7 @@
2008-01-27 Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
* CMakeLists, rfb/rfbconfig.h.cmake, rfb/rfbint.h.cmake:
support CMake
2007-09-04 Karl Runge <runge@karlrunge.com>
* classes/ssl: improve timeouts, port fallback, and connection
time of the SSL Java viewers.

@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(LibVNCServer, 0.9, http://sourceforge.net/projects/libvncserver)
AM_INIT_AUTOMAKE(LibVNCServer, 0.9)
AC_INIT(LibVNCServer, 0.9.2, http://sourceforge.net/projects/libvncserver)
AM_INIT_AUTOMAKE(LibVNCServer, 0.9.2)
AM_CONFIG_HEADER(rfbconfig.h)
AX_PREFIX_CONFIG_H([rfb/rfbconfig.h])

@ -0,0 +1,89 @@
#ifndef _RFB_RFBCONFIG_H
#cmakedefine _RFB_RFBCONFIG_H 1
/* rfb/rfbconfig.h. Generated automatically by cmake. */
/* Enable 24 bit per pixel in native framebuffer */
#cmakedefine LIBVNCSERVER_ALLOW24BPP 1
/* work around when write() returns ENOENT but does not mean it */
#cmakedefine LIBVNCSERVER_ENOENT_WORKAROUND 1
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_FCNTL_H 1
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine LIBVNCSERVER_HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the `jpeg' library (-ljpeg). */
#cmakedefine LIBVNCSERVER_HAVE_LIBJPEG 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#cmakedefine LIBVNCSERVER_HAVE_LIBPTHREAD 1
/* Define to 1 if you have the `z' library (-lz). */
#cmakedefine LIBVNCSERVER_HAVE_LIBZ 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_SYS_TYPES_H 1
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#cmakedefine LIBVNCSERVER_HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine LIBVNCSERVER_HAVE_UNISTD_H 1
/* Need a typedef for in_addr_t */
#cmakedefine LIBVNCSERVER_NEED_INADDR_T 1
/* Define to the full name and version of this package. */
#define LIBVNCSERVER_PACKAGE_STRING "@FULL_PACKAGE_NAME@ @PACKAGE_VERSION@"
/* Define to the version of this package. */
#define LIBVNCSERVER_PACKAGE_VERSION "@PACKAGE_VERSION@"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#cmakedefine LIBVNCSERVER_WORDS_BIGENDIAN 1
/* Define to empty if `const' does not conform to ANSI C. */
//#cmakedefine const @CMAKE_CONST@
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
//#ifndef __cplusplus
//#cmakedefine inline @CMAKE_INLINE@
//#endif
/* Define to `int' if <sys/types.h> does not define. */
#cmakedefine HAVE_LIBVNCSERVER_PID_T 1
#ifndef HAVE_LIBVNCSERVER_PID_T
typedef int pid_t;
#endif
/* The type for size_t */
#cmakedefine HAVE_LIBVNCSERVER_SIZE_T 1
#ifndef HAVE_LIBVNCSERVER_SIZE_T
typedef int size_t;
#endif
/* The type for socklen */
#cmakedefine HAVE_LIBVNCSERVER_SOCKLEN_T 1
#ifndef HAVE_LIBVNCSERVER_SOCKLEN_T
typedef int socklen_t;
#endif
/* once: _RFB_RFBCONFIG_H */
#endif

@ -0,0 +1,4 @@
#ifndef _RFB_RFBINT_H
#define _RFB_RFBINT_H 1
/* empty ... */
#endif
Loading…
Cancel
Save