CMakeLists.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. include("${razer_SOURCE_DIR}/scripts/cmake.global")
  2. set(PYRAZER_DEPS "${CMAKE_CURRENT_SOURCE_DIR}/pyrazer/__init__.py"
  3. "${CMAKE_CURRENT_SOURCE_DIR}/pyrazer/main.py"
  4. "${CMAKE_CURRENT_SOURCE_DIR}/pyrazer/ui.py")
  5. set(PYRAZER_BUILD "${CMAKE_CURRENT_BINARY_DIR}/build")
  6. configure_file(setup.py.in setup.py)
  7. add_custom_command(OUTPUT ${PYRAZER_BUILD}/stamp
  8. COMMAND ${PYTHON} "${CMAKE_CURRENT_BINARY_DIR}/setup.py" build --build-base "${PYRAZER_BUILD}"
  9. COMMAND ${CMAKE_COMMAND} -E touch ${PYRAZER_BUILD}/stamp
  10. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  11. DEPENDS ${PYRAZER_DEPS})
  12. add_custom_target(pyrazer ALL
  13. DEPENDS ${PYRAZER_BUILD}/stamp)
  14. install(CODE
  15. "set(PYDESTDIR \"\$ENV{DESTDIR}\")
  16. if (\"\${PYDESTDIR}\" STREQUAL \"\")
  17. set(PYDESTDIR /)
  18. endif()
  19. execute_process(COMMAND ${PYTHON} \"${CMAKE_CURRENT_BINARY_DIR}/setup.py\"
  20. build --build-base \"${PYRAZER_BUILD}\" install --root \"\${PYDESTDIR}\" --prefix \"${CMAKE_INSTALL_PREFIX}\"
  21. WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\"
  22. RESULT_VARIABLE pyrazer_install_res)
  23. if (NOT \"\${pyrazer_install_res}\" STREQUAL \"0\")
  24. message(FATAL_ERROR \"Failed to install pyrazer\")
  25. endif()
  26. ")
  27. install(PROGRAMS razer-gamewrapper
  28. DESTINATION bin)
  29. configure_file(razercfg.desktop.template razercfg.desktop)
  30. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/razercfg.desktop
  31. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
  32. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/razercfg-icon.svg
  33. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps
  34. RENAME razercfg.svg)
  35. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/razercfg-alt.svg
  36. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)
  37. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/razercfg-snake.svg
  38. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)