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.8KB

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