You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
4.1KB

  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. set(DEB_PACKAGE_TARGET_PLATFORM "default" CACHE STRING "Target OS Platform")
  12. if (NOT MINIMUM_PYTHON_VERSION)
  13. set(MINIMUM_PYTHON_VERSION 3.5.0)
  14. endif()
  15. set(MINIMUM_PYTHON_VERSION ${MINIMUM_PYTHON_VERSION} CACHE STRING "Minimum Python Version")
  16. if(CURA_DEBUGMODE)
  17. set(_cura_debugmode "ON")
  18. endif()
  19. set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
  20. set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
  21. configure_file(${CMAKE_SOURCE_DIR}/cura-lulzbot.desktop.in ${CMAKE_BINARY_DIR}/cura-lulzbot.desktop @ONLY)
  22. configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
  23. if(NOT ${URANIUM_DIR} STREQUAL "")
  24. set(CMAKE_MODULE_PATH "${URANIUM_DIR}/cmake")
  25. endif()
  26. if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
  27. list(APPEND CMAKE_MODULE_PATH ${URANIUM_DIR}/cmake)
  28. include(UraniumTranslationTools)
  29. # Extract Strings
  30. add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura)
  31. # Build Translations
  32. CREATE_TRANSLATION_TARGETS()
  33. endif()
  34. if (NOT BUILD_PYTHON)
  35. find_package(PythonInterp ${MINIMUM_PYTHON_VERSION} REQUIRED)
  36. endif()
  37. if(NOT PYTHON_SITE_PACKAGES_DIR)
  38. if(APPLE OR WIN32)
  39. set(PYTHON_SITE_PACKAGES_DIR lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages
  40. CACHE STRING "Directory to install Python bindings to")
  41. else()
  42. set(PYTHON_SITE_PACKAGES_DIR lib/python${PYTHON_VERSION_MAJOR}/dist-packages
  43. CACHE STRING "Directory to install Python bindings to")
  44. endif()
  45. set(CURA_INSTALL_PLUGINS_PATH lib/cura)
  46. else()
  47. set(CURA_INSTALL_PLUGINS_PATH ${CMAKE_INSTALL_LIBDIR}/cura)
  48. endif()
  49. install(DIRECTORY resources
  50. DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
  51. install(DIRECTORY plugins
  52. DESTINATION ${CURA_INSTALL_PLUGINS_PATH})
  53. if(NOT APPLE AND NOT WIN32)
  54. if(DEB_PACKAGE_TARGET_PLATFORM STREQUAL "ubuntu-xenial")
  55. install(FILES cura_app.py
  56. DESTINATION ${CMAKE_INSTALL_BINDIR}
  57. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  58. install(FILES run_cura-lulzbot.sh
  59. DESTINATION ${CMAKE_INSTALL_BINDIR}
  60. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  61. RENAME cura-lulzbot)
  62. else()
  63. install(FILES cura_app.py
  64. DESTINATION ${CMAKE_INSTALL_BINDIR}
  65. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  66. RENAME cura-lulzbot)
  67. endif()
  68. install(DIRECTORY cura
  69. DESTINATION ${PYTHON_SITE_PACKAGES_DIR}
  70. FILES_MATCHING PATTERN *.py)
  71. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  72. DESTINATION ${PYTHON_SITE_PACKAGES_DIR}/cura)
  73. install(FILES ${CMAKE_BINARY_DIR}/cura-lulzbot.desktop
  74. DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
  75. install(FILES cura.appdata.xml
  76. DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata) # "appdata" is changed to "metainfo" in v3.1
  77. install(FILES cura.sharedmimeinfo
  78. DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/
  79. RENAME cura.xml)
  80. # install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
  81. # DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
  82. else()
  83. install(FILES cura_app.py
  84. DESTINATION ${CMAKE_INSTALL_BINDIR}
  85. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  86. install(DIRECTORY cura
  87. DESTINATION ${PYTHON_SITE_PACKAGES_DIR}
  88. FILES_MATCHING PATTERN *.py)
  89. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  90. DESTINATION ${PYTHON_SITE_PACKAGES_DIR}/cura)
  91. endif()
  92. include(CPackConfig.cmake)