CMakeLists.txt 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. project(cura NONE)
  2. cmake_minimum_required(VERSION 2.8.12)
  3. set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/
  4. ${CMAKE_MODULE_PATH})
  5. include(GNUInstallDirs)
  6. set(URANIUM_DIR "${CMAKE_SOURCE_DIR}/../Uranium" CACHE DIRECTORY "The location of the Uranium repository")
  7. set(URANIUM_SCRIPTS_DIR "${URANIUM_DIR}/scripts" CACHE DIRECTORY "The location of the scripts directory of the Uranium repository")
  8. # Tests
  9. include(CuraTests)
  10. option(CURA_DEBUGMODE "Enable debug dialog and other debug features" OFF)
  11. if(CURA_DEBUGMODE)
  12. set(_cura_debugmode "ON")
  13. endif()
  14. set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
  15. set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
  16. configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY)
  17. configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
  18. if(NOT ${URANIUM_DIR} STREQUAL "")
  19. set(CMAKE_MODULE_PATH "${URANIUM_DIR}/cmake")
  20. endif()
  21. if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
  22. list(APPEND CMAKE_MODULE_PATH ${URANIUM_DIR}/cmake)
  23. include(UraniumTranslationTools)
  24. # Extract Strings
  25. add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura)
  26. # Build Translations
  27. CREATE_TRANSLATION_TARGETS()
  28. endif()
  29. find_package(PythonInterp 3.5.0 REQUIRED)
  30. install(DIRECTORY resources
  31. DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
  32. install(DIRECTORY plugins
  33. DESTINATION lib${LIB_SUFFIX}/cura)
  34. if(NOT APPLE AND NOT WIN32)
  35. install(FILES cura_app.py
  36. DESTINATION ${CMAKE_INSTALL_BINDIR}
  37. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  38. RENAME cura)
  39. if(EXISTS /etc/debian_version)
  40. install(DIRECTORY cura
  41. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}/dist-packages
  42. FILES_MATCHING PATTERN *.py)
  43. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  44. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}/dist-packages/cura)
  45. else()
  46. install(DIRECTORY cura
  47. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages
  48. FILES_MATCHING PATTERN *.py)
  49. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  50. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/cura)
  51. endif()
  52. install(FILES ${CMAKE_BINARY_DIR}/cura.desktop
  53. DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
  54. install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
  55. DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
  56. install(FILES cura.appdata.xml
  57. DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
  58. install(FILES cura.sharedmimeinfo
  59. DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/
  60. RENAME cura.xml )
  61. else()
  62. install(FILES cura_app.py
  63. DESTINATION ${CMAKE_INSTALL_BINDIR}
  64. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  65. install(DIRECTORY cura
  66. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages
  67. FILES_MATCHING PATTERN *.py)
  68. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  69. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/cura)
  70. endif()