CMakeLists.txt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. set(PYRAZER_BUILD "${CMAKE_CURRENT_SOURCE_DIR}/build")
  5. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in"
  6. "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")
  7. add_custom_command(OUTPUT ${PYRAZER_BUILD}/stamp
  8. COMMAND ${PYTHON} "${CMAKE_CURRENT_SOURCE_DIR}/setup.py" build -b "${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_SOURCE_DIR}/setup.py\"
  20. 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)