Browse Source

Merge branch 'pkgconfig' of https://github.com/CendioOssman/tigervnc

tags/v1.12.90
Pierre Ossman 1 year ago
parent
commit
7f7dd69915

+ 7
- 12
CMakeLists.txt View File



include(CMakeMacroLibtoolFile) include(CMakeMacroLibtoolFile)


include(cmake/TargetLinkDirectories.cmake)

project(tigervnc) project(tigervnc)
set(VERSION 1.12.80) set(VERSION 1.12.80)


set(H264_LIBS "WIN") # may be LIBAV in the future set(H264_LIBS "WIN") # may be LIBAV in the future
set(H264_LIBRARIES ole32 mfplat mfuuid wmcodecdspuuid) set(H264_LIBRARIES ole32 mfplat mfuuid wmcodecdspuuid)
else() else()
check_include_files(libavcodec/avcodec.h HAVE_AVCODEC_H)
check_include_files(libavutil/avutil.h HAVE_AVUTIL_H)
check_include_files(libswscale/swscale.h HAVE_SWSCALE_H)
if (HAVE_AVCODEC_H AND HAVE_AVUTIL_H AND HAVE_SWSCALE_H)
find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h)
find_library(AVCODEC_LIBRARY avcodec)
find_path(AVUTIL_INCLUDE_DIR libavutil/avutil.h)
find_library(AVUTIL_LIBRARY avutil)
find_path(SWSCALE_INCLUDE_DIR libswscale/swscale.h)
find_library(SWSCALE_LIBRARY swscale)
include_directories(${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR} ${SWSCALE_INCLUDE_DIR})
set(H264_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${SWSCALE_LIBRARY})
find_package(Ffmpeg)
if (AVCODEC_FOUND AND AVUTIL_FOUND AND SWSCALE_FOUND)
set(H264_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIRS} ${AVUTIL_INCLUDE_DIRS} ${SWSCALE_INCLUDE_DIRS})
set(H264_LIBRARIES ${AVCODEC_LIBRARIES} ${AVUTIL_LIBRARIES} ${SWSCALE_LIBRARIES})
set(H264_LIBRARY_DIRS ${AVCODEC_LIBRARY_DIRS} ${AVUTIL_LIBRARY_DIRS} ${SWSCALE_LIBRARY_DIRS})
add_definitions("-D__STDC_CONSTANT_MACROS") add_definitions("-D__STDC_CONSTANT_MACROS")
add_definitions("-DHAVE_H264") add_definitions("-DHAVE_H264")
set(H264_LIBS "LIBAV") set(H264_LIBS "LIBAV")

+ 17
- 0
cmake/Modules/FindFfmpeg.cmake View File

find_package(PkgConfig)

if (PKG_CONFIG_FOUND)
pkg_check_modules(AVCODEC libavcodec)
pkg_check_modules(AVUTIL libavutil)
pkg_check_modules(SWSCALE libswscale)
else()
find_path(AVCODEC_INCLUDE_DIRS NAMES avcodec.h PATH_SUFFIXES libavcodec)
find_library(AVCODEC_LIBRARIES NAMES avcodec)
find_package_handle_standard_args(AVCODEC DEFAULT_MSG AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIRS)
find_path(AVUTIL_INCLUDE_DIRS NAMES avutil.h PATH_SUFFIXES libavutil)
find_library(AVUTIL_LIBRARIES NAMES avutil)
find_package_handle_standard_args(AVUTIL DEFAULT_MSG AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIRS)
find_path(SWSCALE_INCLUDE_DIRS NAMES swscale.h PATH_SUFFIXES libswscale)
find_library(SWSCALE_LIBRARIES NAMES swscale)
find_package_handle_standard_args(SWSCALE DEFAULT_MSG SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIRS)
endif()

+ 8
- 39
cmake/Modules/FindPixman.cmake View File

# - Find Pixman
# Find the Pixman libraries
#
# This module defines the following variables:
# PIXMAN_FOUND - true if PIXMAN_INCLUDE_DIR & PIXMAN_LIBRARY are found
# PIXMAN_LIBRARIES - Set when PIXMAN_LIBRARY is found
# PIXMAN_INCLUDE_DIRS - Set when PIXMAN_INCLUDE_DIR is found
#
# PIXMAN_INCLUDE_DIR - where to find pixman.h, etc.
# PIXMAN_LIBRARY - the Pixman library
#

#=============================================================================
# Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

find_path(PIXMAN_INCLUDE_DIR NAMES pixman.h PATH_SUFFIXES pixman-1)

find_library(PIXMAN_LIBRARY NAMES pixman-1)

find_package_handle_standard_args(pixman-1 DEFAULT_MSG PIXMAN_LIBRARY PIXMAN_INCLUDE_DIR)

if(PIXMAN-1_FOUND)
set(PIXMAN_LIBRARIES ${PIXMAN_LIBRARY})
set(PIXMAN_INCLUDE_DIRS ${PIXMAN_INCLUDE_DIR})
find_package(PkgConfig)

if (PKG_CONFIG_FOUND)
pkg_check_modules(PIXMAN pixman-1)
else()
find_path(PIXMAN_INCLUDE_DIRS NAMES pixman.h PATH_SUFFIXES pixman-1)
find_library(PIXMAN_LIBRARIES NAMES pixman-1)
find_package_handle_standard_args(PIXMAN DEFAULT_MSG PIXMAN_LIBRARIES PIXMAN_INCLUDE_DIRS)
endif() endif()

mark_as_advanced(PIXMAN_INCLUDE_DIR PIXMAN_LIBRARY)

+ 1
- 1
cmake/StaticBuild.cmake View File



set(JPEG_LIBRARIES "-Wl,-Bstatic -ljpeg -Wl,-Bdynamic") set(JPEG_LIBRARIES "-Wl,-Bstatic -ljpeg -Wl,-Bdynamic")
set(ZLIB_LIBRARIES "-Wl,-Bstatic -lz -Wl,-Bdynamic") set(ZLIB_LIBRARIES "-Wl,-Bstatic -lz -Wl,-Bdynamic")
set(PIXMAN_LIBRARY "-Wl,-Bstatic -lpixman-1 -Wl,-Bdynamic")
set(PIXMAN_LIBRARIES "-Wl,-Bstatic -lpixman-1 -Wl,-Bdynamic")


# gettext is included in libc on many unix systems # gettext is included in libc on many unix systems
if(NOT LIBC_HAS_DGETTEXT) if(NOT LIBC_HAS_DGETTEXT)

+ 12
- 0
cmake/TargetLinkDirectories.cmake View File

# Compatibility replacement of target_link_directories() for older cmake

if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
function(target_link_directories TARGET SCOPE)
get_target_property(INTERFACE_LINK_LIBRARIES ${TARGET} INTERFACE_LINK_LIBRARIES)
foreach(DIRECTORY ${ARGN})
list(INSERT INTERFACE_LINK_LIBRARIES 0 "-L${DIRECTORY}")
endforeach()
set_target_properties(${TARGET} PROPERTIES
INTERFACE_LINK_LIBRARIES "${INTERFACE_LINK_LIBRARIES}")
endfunction()
endif()

+ 2
- 4
common/network/CMakeLists.txt View File

include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/common)


set(NETWORK_SOURCES
add_library(network STATIC
Socket.cxx Socket.cxx
TcpSocket.cxx) TcpSocket.cxx)


if(NOT WIN32) if(NOT WIN32)
set(NETWORK_SOURCES ${NETWORK_SOURCES} UnixSocket.cxx)
target_sources(network PRIVATE UnixSocket.cxx)
endif() endif()


add_library(network STATIC ${NETWORK_SOURCES})

if(WIN32) if(WIN32)
target_link_libraries(network ws2_32) target_link_libraries(network ws2_32)
endif() endif()

+ 4
- 5
common/rdr/CMakeLists.txt View File

ZlibInStream.cxx ZlibInStream.cxx
ZlibOutStream.cxx) ZlibOutStream.cxx)


set(RDR_LIBRARIES ${ZLIB_LIBRARIES} os)
target_link_libraries(rdr ${ZLIB_LIBRARIES} os)

if(GNUTLS_FOUND) if(GNUTLS_FOUND)
set(RDR_LIBRARIES ${RDR_LIBRARIES} ${GNUTLS_LIBRARIES})
target_link_libraries(rdr ${GNUTLS_LIBRARIES})
endif() endif()
if(WIN32) if(WIN32)
set(RDR_LIBRARIES ${RDR_LIBRARIES} ws2_32)
target_link_libraries(rdr ws2_32)
endif() endif()


target_link_libraries(rdr ${RDR_LIBRARIES})

if(UNIX) if(UNIX)
libtool_create_control_file(rdr) libtool_create_control_file(rdr)
endif() endif()

+ 17
- 25
common/rfb/CMakeLists.txt View File

include_directories(${CMAKE_SOURCE_DIR}/common ${JPEG_INCLUDE_DIR} ${PIXMAN_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/common ${JPEG_INCLUDE_DIR} ${PIXMAN_INCLUDE_DIRS} ${H264_INCLUDE_DIRS})


set(RFB_SOURCES
add_library(rfb STATIC
Blacklist.cxx Blacklist.cxx
Congestion.cxx Congestion.cxx
CConnection.cxx CConnection.cxx
encodings.cxx encodings.cxx
util.cxx) util.cxx)


target_link_libraries(rfb os rdr)
target_link_libraries(rfb ${JPEG_LIBRARIES} ${PIXMAN_LIBRARIES})
target_link_directories(rfb PUBLIC ${PIXMAN_LIBRARY_DIRS})

if(ENABLE_H264 AND NOT H264_LIBS STREQUAL "NONE") if(ENABLE_H264 AND NOT H264_LIBS STREQUAL "NONE")
set(RFB_SOURCES ${RFB_SOURCES} H264Decoder.cxx H264DecoderContext.cxx)
target_sources(rfb PRIVATE H264Decoder.cxx H264DecoderContext.cxx)
if(H264_LIBS STREQUAL "LIBAV") if(H264_LIBS STREQUAL "LIBAV")
set(RFB_SOURCES ${RFB_SOURCES} H264LibavDecoderContext.cxx)
target_sources(rfb PRIVATE H264LibavDecoderContext.cxx)
elseif(H264_LIBS STREQUAL "WIN") elseif(H264_LIBS STREQUAL "WIN")
set(RFB_SOURCES ${RFB_SOURCES} H264WinDecoderContext.cxx)
target_sources(rfb PRIVATE H264WinDecoderContext.cxx)
endif() endif()
target_link_libraries(rfb ${H264_LIBRARIES})
target_link_directories(rfb PUBLIC ${H264_LIBRARY_DIRS})
endif() endif()


if(UNIX) if(UNIX)
set(RFB_SOURCES ${RFB_SOURCES} Logger_syslog.cxx)
target_sources(rfb PRIVATE Logger_syslog.cxx)
endif() endif()


if(WIN32) if(WIN32)
include_directories(${CMAKE_SOURCE_DIR}/win) include_directories(${CMAKE_SOURCE_DIR}/win)
set(RFB_SOURCES ${RFB_SOURCES} WinPasswdValidator.cxx)
target_sources(rfb PRIVATE WinPasswdValidator.cxx)
endif(WIN32) endif(WIN32)


set(RFB_LIBRARIES ${JPEG_LIBRARIES} ${PIXMAN_LIBRARY} os rdr)

if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
set(RFB_SOURCES ${RFB_SOURCES} UnixPasswordValidator.cxx
UnixPasswordValidator.h pam.c pam.h)
set(RFB_LIBRARIES ${RFB_LIBRARIES} ${PAM_LIBS})
target_sources(rfb PRIVATE UnixPasswordValidator.cxx pam.c)
target_link_libraries(rfb ${PAM_LIBS})
endif() endif()


if(GNUTLS_FOUND) if(GNUTLS_FOUND)
set(RFB_SOURCES
${RFB_SOURCES}
CSecurityTLS.cxx
SSecurityTLS.cxx
)
set(RFB_LIBRARIES
${RFB_LIBRARIES}
${GNUTLS_LIBRARIES}
)
target_sources(rfb PRIVATE CSecurityTLS.cxx SSecurityTLS.cxx)
target_link_libraries(rfb ${GNUTLS_LIBRARIES})
endif() endif()


add_library(rfb STATIC ${RFB_SOURCES})

target_link_libraries(rfb ${RFB_LIBRARIES})

if(UNIX) if(UNIX)
libtool_create_control_file(rfb) libtool_create_control_file(rfb)
endif() endif()

+ 7
- 9
tests/perf/CMakeLists.txt View File

include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/common)


add_library(test_util STATIC util.cxx) add_library(test_util STATIC util.cxx)
target_link_libraries(test_util ${H264_LIBRARIES})


add_executable(convperf convperf.cxx) add_executable(convperf convperf.cxx)
target_link_libraries(convperf test_util rfb) target_link_libraries(convperf test_util rfb)


if (BUILD_VIEWER) if (BUILD_VIEWER)
include_directories(${FLTK_INCLUDE_DIR}) include_directories(${FLTK_INCLUDE_DIR})
set(FBPERF_SOURCES
add_executable(fbperf
fbperf.cxx fbperf.cxx
${CMAKE_SOURCE_DIR}/vncviewer/PlatformPixelBuffer.cxx ${CMAKE_SOURCE_DIR}/vncviewer/PlatformPixelBuffer.cxx
${CMAKE_SOURCE_DIR}/vncviewer/Surface.cxx) ${CMAKE_SOURCE_DIR}/vncviewer/Surface.cxx)
if(WIN32) if(WIN32)
set(FBPERF_SOURCES ${FBPERF_SOURCES} ${CMAKE_SOURCE_DIR}/vncviewer/Surface_Win32.cxx)
target_sources(fbperf PRIVATE ${CMAKE_SOURCE_DIR}/vncviewer/Surface_Win32.cxx)
elseif(APPLE) elseif(APPLE)
set(FBPERF_SOURCES
${FBPERF_SOURCES} ${CMAKE_SOURCE_DIR}/vncviewer/Surface_OSX.cxx
${FBPERF_SOURCES} ${CMAKE_SOURCE_DIR}/vncviewer/keysym2ucs.c
${FBPERF_SOURCES} ${CMAKE_SOURCE_DIR}/vncviewer/cocoa.mm)
target_sources(fbperf PRIVATE
${CMAKE_SOURCE_DIR}/vncviewer/Surface_OSX.cxx
${CMAKE_SOURCE_DIR}/vncviewer/keysym2ucs.c
${CMAKE_SOURCE_DIR}/vncviewer/cocoa.mm)
else() else()
set(FBPERF_SOURCES ${FBPERF_SOURCES} ${CMAKE_SOURCE_DIR}/vncviewer/Surface_X11.cxx)
target_sources(fbperf PRIVATE ${CMAKE_SOURCE_DIR}/vncviewer/Surface_X11.cxx)
endif() endif()
add_executable(fbperf ${FBPERF_SOURCES})
target_link_libraries(fbperf test_util rfb ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES}) target_link_libraries(fbperf test_util rfb ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})
if(WIN32) if(WIN32)
target_link_libraries(fbperf msimg32) target_link_libraries(fbperf msimg32)

+ 14
- 17
vncviewer/CMakeLists.txt View File

include_directories(${GETTEXT_INCLUDE_DIR}) include_directories(${GETTEXT_INCLUDE_DIR})


include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/common)
set(VNCVIEWER_SOURCES

add_executable(vncviewer
menukey.cxx menukey.cxx
BaseTouchHandler.cxx BaseTouchHandler.cxx
CConn.cxx CConn.cxx
MonitorIndicesParameter.cxx MonitorIndicesParameter.cxx
vncviewer.cxx) vncviewer.cxx)


if(WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set_target_properties(vncviewer PROPERTIES WIN32_EXECUTABLE TRUE)
endif()

if(WIN32) if(WIN32)
# Since vncviewer.rc is generated, local includes will be looking # Since vncviewer.rc is generated, local includes will be looking
# in the wrong directory. We need to help it out. # in the wrong directory. We need to help it out.
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
configure_file(vncviewer.rc.in vncviewer.rc) configure_file(vncviewer.rc.in vncviewer.rc)
set(VNCVIEWER_SOURCES
${VNCVIEWER_SOURCES}
${CMAKE_CURRENT_BINARY_DIR}/vncviewer.rc)
target_sources(vncviewer PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.rc)
endif() endif()


if(WIN32) if(WIN32)
set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Win32TouchHandler.cxx win32.c)
target_sources(vncviewer PRIVATE Win32TouchHandler.cxx win32.c)
elseif(APPLE) elseif(APPLE)
set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} cocoa.mm osx_to_qnum.c)
target_sources(vncviewer PRIVATE cocoa.mm osx_to_qnum.c)
else() else()
set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} GestureHandler.cxx XInputTouchHandler.cxx xkb_to_qnum.c)
target_sources(vncviewer PRIVATE GestureHandler.cxx XInputTouchHandler.cxx xkb_to_qnum.c)
endif() endif()


if(WIN32) if(WIN32)
set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Surface_Win32.cxx)
target_sources(vncviewer PRIVATE Surface_Win32.cxx)
elseif(APPLE) elseif(APPLE)
set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Surface_OSX.cxx)
else()
set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Surface_X11.cxx)
endif()

if(WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_executable(vncviewer WIN32 ${VNCVIEWER_SOURCES})
target_sources(vncviewer PRIVATE Surface_OSX.cxx)
else() else()
add_executable(vncviewer ${VNCVIEWER_SOURCES})
target_sources(vncviewer PRIVATE Surface_X11.cxx)
endif() endif()


target_link_libraries(vncviewer rfb network rdr os ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES} ${H264_LIBRARIES})
target_link_libraries(vncviewer rfb network rdr os ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})


if(WIN32) if(WIN32)
target_link_libraries(vncviewer msimg32) target_link_libraries(vncviewer msimg32)

+ 2
- 4
win/rfb_win32/CMakeLists.txt View File

set(RFB_WIN32_SOURCES
add_library(rfb_win32 STATIC
AboutDialog.cxx AboutDialog.cxx
Clipboard.cxx Clipboard.cxx
CurrentUser.cxx CurrentUser.cxx
WMWindowCopyRect.cxx) WMWindowCopyRect.cxx)


if(BUILD_WINVNC) if(BUILD_WINVNC)
set(RFB_WIN32_SOURCES ${RFB_WIN32_SOURCES} CleanDesktop.cxx)
target_sources(rfb_win32 PRIVATE ${RFB_WIN32_SOURCES} CleanDesktop.cxx)
endif() endif()


add_library(rfb_win32 STATIC ${RFB_WIN32_SOURCES})

target_link_libraries(rfb_win32 user32.lib comctl32.lib wtsapi32.lib version.lib) target_link_libraries(rfb_win32 user32.lib comctl32.lib wtsapi32.lib version.lib)

Loading…
Cancel
Save