CMakeLists.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. project(razer C)
  2. cmake_minimum_required(VERSION 2.4)
  3. if (COMMAND cmake_policy)
  4. # Libraries linked via full path no longer produce linker search paths.
  5. cmake_policy(SET CMP0003 NEW)
  6. # Preprocessor definition values are not escaped automatically.
  7. cmake_policy(SET CMP0005 OLD)
  8. endif (COMMAND cmake_policy)
  9. include("${razer_SOURCE_DIR}/scripts/cmake.global")
  10. include(CheckIncludeFile)
  11. macro(CHECK_LIB _LIB _HEADER)
  12. check_include_file(${_HEADER} ${_HEADER}_ERR)
  13. if (NOT ${_HEADER}_ERR)
  14. message(FATAL_ERROR "Could not find library \"lib${_LIB}\" "
  15. "with header ${_HEADER}")
  16. endif (NOT ${_HEADER}_ERR)
  17. endmacro(CHECK_LIB)
  18. check_lib(usb-1.0 libusb.h)
  19. add_subdirectory(librazer)
  20. configure_file("udev.rules.template" "udev.rules")
  21. execute_process(COMMAND pkg-config --variable=udevdir udev
  22. OUTPUT_VARIABLE UDEV_DIR
  23. ERROR_QUIET
  24. OUTPUT_STRIP_TRAILING_WHITESPACE)
  25. if(UDEV_DIR)
  26. install(FILES ${CMAKE_BINARY_DIR}/udev.rules
  27. DESTINATION ${UDEV_DIR}/rules.d
  28. RENAME 80-razer.rules
  29. PERMISSIONS OWNER_READ OWNER_WRITE
  30. GROUP_READ
  31. WORLD_READ)
  32. install_exec_cmd("udevadm control --reload-rules"
  33. "Please reload udev manually or reboot the system")
  34. endif(UDEV_DIR)
  35. configure_file("pm-hook.sh.template" "pm-hook.sh" @ONLY)
  36. install(FILES ${CMAKE_BINARY_DIR}/pm-hook.sh
  37. DESTINATION /etc/pm/sleep.d/
  38. RENAME 50-razer
  39. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
  40. GROUP_READ GROUP_EXECUTE
  41. WORLD_READ WORLD_EXECUTE)
  42. configure_file("razerd.service.template" "razerd.service")
  43. execute_process(COMMAND pkg-config --variable=systemdsystemunitdir systemd
  44. OUTPUT_VARIABLE SYSTEMD_UNIT_DIR
  45. ERROR_QUIET
  46. OUTPUT_STRIP_TRAILING_WHITESPACE)
  47. if(SYSTEMD_UNIT_DIR)
  48. install(FILES ${CMAKE_BINARY_DIR}/razerd.service
  49. DESTINATION ${SYSTEMD_UNIT_DIR}
  50. PERMISSIONS OWNER_READ OWNER_WRITE
  51. GROUP_READ
  52. WORLD_READ)
  53. install_exec_cmd("systemctl --system daemon-reload"
  54. "If you use systemd, please reload systemd manually or reboot the system")
  55. install_exec_cmd("systemctl --system --force enable razerd.service"
  56. "If you use systemd, enable razerd.service manually")
  57. endif(SYSTEMD_UNIT_DIR)
  58. configure_file("razercfg.desktop.template" "razercfg.desktop")
  59. install(FILES ${CMAKE_BINARY_DIR}/razercfg.desktop
  60. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/
  61. PERMISSIONS OWNER_READ OWNER_WRITE
  62. GROUP_READ
  63. WORLD_READ)
  64. install(FILES ${CMAKE_SOURCE_DIR}/icons/razercfg-icon.svg
  65. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
  66. RENAME razercfg.svg
  67. PERMISSIONS OWNER_READ OWNER_WRITE
  68. GROUP_READ
  69. WORLD_READ)
  70. install(FILES ${CMAKE_SOURCE_DIR}/icons/razercfg-alt.svg
  71. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
  72. PERMISSIONS OWNER_READ OWNER_WRITE
  73. GROUP_READ
  74. WORLD_READ)
  75. install(FILES ${CMAKE_SOURCE_DIR}/icons/razercfg-snake.svg
  76. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
  77. PERMISSIONS OWNER_READ OWNER_WRITE
  78. GROUP_READ
  79. WORLD_READ)
  80. add_subdirectory(razerd)
  81. add_subdirectory(ui)