You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. include_directories(${FLTK_INCLUDE_DIR})
  2. include_directories(${GETTEXT_INCLUDE_DIR})
  3. include_directories(${CMAKE_SOURCE_DIR}/common)
  4. set(VNCVIEWER_SOURCES
  5. menukey.cxx
  6. BaseTouchHandler.cxx
  7. CConn.cxx
  8. DesktopWindow.cxx
  9. EmulateMB.cxx
  10. UserDialog.cxx
  11. ServerDialog.cxx
  12. Surface.cxx
  13. OptionsDialog.cxx
  14. PlatformPixelBuffer.cxx
  15. Viewport.cxx
  16. parameters.cxx
  17. keysym2ucs.c
  18. touch.cxx
  19. MonitorArrangement.cxx
  20. MonitorIndicesParameter.cxx
  21. vncviewer.cxx)
  22. if(WIN32)
  23. # Since vncviewer.rc is generated, local includes will be looking
  24. # in the wrong directory. We need to help it out.
  25. include_directories(${CMAKE_CURRENT_SOURCE_DIR})
  26. configure_file(vncviewer.rc.in vncviewer.rc)
  27. set(VNCVIEWER_SOURCES
  28. ${VNCVIEWER_SOURCES}
  29. ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.rc)
  30. endif()
  31. if(WIN32)
  32. set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Win32TouchHandler.cxx win32.c)
  33. elseif(APPLE)
  34. set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} cocoa.mm osx_to_qnum.c)
  35. else()
  36. set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} GestureHandler.cxx XInputTouchHandler.cxx xkb_to_qnum.c)
  37. endif()
  38. if(WIN32)
  39. set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Surface_Win32.cxx)
  40. elseif(APPLE)
  41. set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Surface_OSX.cxx)
  42. else()
  43. set(VNCVIEWER_SOURCES ${VNCVIEWER_SOURCES} Surface_X11.cxx)
  44. endif()
  45. if(WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
  46. add_executable(vncviewer WIN32 ${VNCVIEWER_SOURCES})
  47. else()
  48. add_executable(vncviewer ${VNCVIEWER_SOURCES})
  49. endif()
  50. target_link_libraries(vncviewer rfb network rdr os ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES} ${H264_LIBRARIES})
  51. if(WIN32)
  52. target_link_libraries(vncviewer msimg32)
  53. elseif(APPLE)
  54. target_link_libraries(vncviewer "-framework Cocoa")
  55. target_link_libraries(vncviewer "-framework Carbon")
  56. target_link_libraries(vncviewer "-framework IOKit")
  57. else()
  58. target_link_libraries(vncviewer ${X11_Xi_LIB})
  59. if(X11_Xrandr_LIB)
  60. add_definitions(-DHAVE_XRANDR)
  61. target_link_libraries(vncviewer ${X11_Xrandr_LIB})
  62. endif()
  63. endif()
  64. install(TARGETS vncviewer DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
  65. if(UNIX)
  66. install(FILES vncviewer.man DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 RENAME vncviewer.1)
  67. configure_file(vncviewer.desktop.in.in vncviewer.desktop.in)
  68. find_program(INTLTOOL_MERGE_EXECUTABLE intltool-merge)
  69. if("${GETTEXT_VERSION_STRING}" VERSION_GREATER 0.18.99)
  70. add_custom_command(OUTPUT vncviewer.desktop
  71. COMMAND ${GETTEXT_MSGFMT_EXECUTABLE}
  72. --desktop --template vncviewer.desktop.in
  73. -d ${CMAKE_SOURCE_DIR}/po -o vncviewer.desktop
  74. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.desktop.in
  75. )
  76. elseif(INTLTOOL_MERGE_EXECUTABLE)
  77. add_custom_command(OUTPUT vncviewer.desktop
  78. COMMAND sed -e 's/^Name/_Name/'
  79. -e 's/^GenericName/_GenericName/'
  80. -e 's/^Comment/_Comment/'
  81. vncviewer.desktop.in > vncviewer.desktop.intl
  82. COMMAND ${INTLTOOL_MERGE_EXECUTABLE}
  83. -d ${CMAKE_SOURCE_DIR}/po
  84. vncviewer.desktop.intl vncviewer.desktop
  85. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.desktop.in
  86. )
  87. else()
  88. add_custom_command(OUTPUT vncviewer.desktop
  89. COMMAND cp vncviewer.desktop.in vncviewer.desktop
  90. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.desktop.in
  91. )
  92. endif()
  93. add_custom_target(desktop ALL DEPENDS vncviewer.desktop)
  94. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
  95. if("${GETTEXT_VERSION_STRING}" VERSION_GREATER 0.19.6)
  96. add_custom_command(OUTPUT org.tigervnc.vncviewer.metainfo.xml
  97. COMMAND ${GETTEXT_MSGFMT_EXECUTABLE}
  98. --xml --template ${CMAKE_CURRENT_SOURCE_DIR}/org.tigervnc.vncviewer.metainfo.xml.in
  99. -d ${CMAKE_SOURCE_DIR}/po -o org.tigervnc.vncviewer.metainfo.xml
  100. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/org.tigervnc.vncviewer.metainfo.xml.in
  101. )
  102. elseif(INTLTOOL_MERGE_EXECUTABLE)
  103. add_custom_command(OUTPUT org.tigervnc.vncviewer.metainfo.xml
  104. COMMAND sed -e 's@<name>@<_name>@\;s@</name>@</_name>@'
  105. -e 's@<summary>@<_summary>@\;s@</summary>@</_summary>@'
  106. -e 's@<caption>@<_caption>@\;s@</caption>@</_caption>@'
  107. -e 's@<p>@<_p>@g\;s@</p>@</_p>@g'
  108. ${CMAKE_CURRENT_SOURCE_DIR}/org.tigervnc.vncviewer.metainfo.xml.in > org.tigervnc.vncviewer.metainfo.xml.intl
  109. COMMAND ${INTLTOOL_MERGE_EXECUTABLE}
  110. -x ${CMAKE_SOURCE_DIR}/po
  111. org.tigervnc.vncviewer.metainfo.xml.intl org.tigervnc.vncviewer.metainfo.xml
  112. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/org.tigervnc.vncviewer.metainfo.xml.in
  113. )
  114. else()
  115. add_custom_command(OUTPUT org.tigervnc.vncviewer.metainfo.xml
  116. COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/org.tigervnc.vncviewer.metainfo.xml.in org.tigervnc.vncviewer.metainfo.xml
  117. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/org.tigervnc.vncviewer.metainfo.xml.in
  118. )
  119. endif()
  120. add_custom_target(appstream ALL DEPENDS org.tigervnc.vncviewer.metainfo.xml)
  121. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tigervnc.vncviewer.metainfo.xml DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/metainfo)
  122. foreach(res 16 22 24 32 48 64 128)
  123. install(FILES ../media/icons/tigervnc_${res}.png DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/${res}x${res}/apps RENAME tigervnc.png)
  124. endforeach()
  125. install(FILES ../media/icons/tigervnc.svg DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps)
  126. endif()