CMakeLists.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. project(cura)
  2. cmake_minimum_required(VERSION 3.6)
  3. include(GNUInstallDirs)
  4. list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
  5. set(URANIUM_DIR "${CMAKE_SOURCE_DIR}/../Uranium" CACHE PATH "The location of the Uranium repository")
  6. set(URANIUM_SCRIPTS_DIR "${URANIUM_DIR}/scripts" CACHE PATH "The location of the scripts directory of the Uranium repository")
  7. # Tests
  8. include(CuraTests)
  9. option(CURA_DEBUGMODE "Enable debug dialog and other debug features" OFF)
  10. if(CURA_DEBUGMODE)
  11. set(_cura_debugmode "ON")
  12. endif()
  13. option(GENERATE_TRANSLATIONS "Should the translations be generated?" ON)
  14. set(CURA_APP_NAME "cura" CACHE STRING "Short name of Cura, used for configuration folder")
  15. set(CURA_APP_DISPLAY_NAME "Ultimaker Cura" CACHE STRING "Display name of Cura")
  16. set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
  17. set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
  18. set(CURA_CLOUD_API_ROOT "" CACHE STRING "Alternative Cura cloud API root")
  19. set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version")
  20. set(CURA_CLOUD_ACCOUNT_API_ROOT "" CACHE STRING "Alternative Cura cloud account API version")
  21. set(CURA_MARKETPLACE_ROOT "" CACHE STRING "Alternative Marketplace location")
  22. set(CURA_DIGITAL_FACTORY_URL "" CACHE STRING "Alternative Digital Factory location")
  23. configure_file(${CMAKE_SOURCE_DIR}/com.ultimaker.cura.desktop.in ${CMAKE_BINARY_DIR}/com.ultimaker.cura.desktop @ONLY)
  24. configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
  25. # FIXME: The new FindPython3 finds the system's Python3.6 reather than the Python3.5 that we built for Cura's environment.
  26. # So we're using the old method here, with FindPythonInterp for now.
  27. find_package(PythonInterp 3 REQUIRED)
  28. set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
  29. set(Python3_VERSION ${PYTHON_VERSION_STRING})
  30. set(Python3_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
  31. set(Python3_VERSION_MINOR ${PYTHON_VERSION_MINOR})
  32. set(Python3_VERSION_PATCH ${PYTHON_VERSION_PATCH})
  33. if(NOT ${URANIUM_DIR} STREQUAL "")
  34. set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${URANIUM_DIR}/cmake")
  35. endif()
  36. if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
  37. list(APPEND CMAKE_MODULE_PATH ${URANIUM_DIR}/cmake)
  38. include(UraniumTranslationTools)
  39. # Extract Strings
  40. add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura)
  41. # Build Translations
  42. if(${GENERATE_TRANSLATIONS})
  43. CREATE_TRANSLATION_TARGETS()
  44. endif()
  45. endif()
  46. install(DIRECTORY resources
  47. DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
  48. include(CuraPluginInstall)
  49. if(NOT APPLE AND NOT WIN32)
  50. install(FILES cura_app.py
  51. DESTINATION ${CMAKE_INSTALL_BINDIR}
  52. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  53. RENAME cura)
  54. if(EXISTS /etc/debian_version)
  55. install(DIRECTORY cura
  56. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}/dist-packages
  57. FILES_MATCHING PATTERN *.py)
  58. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  59. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}/dist-packages/cura)
  60. else()
  61. install(DIRECTORY cura
  62. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages
  63. FILES_MATCHING PATTERN *.py)
  64. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  65. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/cura)
  66. endif()
  67. install(FILES ${CMAKE_BINARY_DIR}/com.ultimaker.cura.desktop
  68. DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
  69. install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
  70. DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
  71. install(FILES com.ultimaker.cura.appdata.xml
  72. DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
  73. install(FILES cura.sharedmimeinfo
  74. DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/
  75. RENAME cura.xml )
  76. else()
  77. install(FILES cura_app.py
  78. DESTINATION ${CMAKE_INSTALL_BINDIR}
  79. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  80. install(DIRECTORY cura
  81. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages
  82. FILES_MATCHING PATTERN *.py)
  83. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  84. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/cura)
  85. endif()