CMakeLists.txt 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. add_subdirectory(razerd)
  65. add_subdirectory(ui)