CMakeLists.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. set(CURA_APP_NAME "cura" CACHE STRING "Short name of Cura, used for configuration folder")
  14. set(CURA_APP_DISPLAY_NAME "Ultimaker Cura" CACHE STRING "Display name of Cura")
  15. set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
  16. set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
  17. set(CURA_CLOUD_API_ROOT "" CACHE STRING "Alternative Cura cloud API root")
  18. set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version")
  19. set(CURA_CLOUD_ACCOUNT_API_ROOT "" CACHE STRING "Alternative Cura cloud account API version")
  20. set(CURA_MARKETPLACE_ROOT "" CACHE STRING "Alternative Marketplace location")
  21. configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY)
  22. configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
  23. # FIXME: Remove the code for CMake <3.12 once we have switched over completely.
  24. # FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs. The FindPython3
  25. # module is copied from the CMake repository here so in CMake <3.12 we can still use it.
  26. if(${CMAKE_VERSION} VERSION_LESS 3.12)
  27. # Use FindPythonInterp and FindPythonLibs for CMake <3.12
  28. find_package(PythonInterp 3 REQUIRED)
  29. set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
  30. set(Python3_VERSION ${PYTHON_VERSION_STRING})
  31. set(Python3_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
  32. set(Python3_VERSION_MINOR ${PYTHON_VERSION_MINOR})
  33. set(Python3_VERSION_PATCH ${PYTHON_VERSION_PATCH})
  34. else()
  35. # Use FindPython3 for CMake >=3.12
  36. find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
  37. endif()
  38. if(NOT ${URANIUM_DIR} STREQUAL "")
  39. set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${URANIUM_DIR}/cmake")
  40. endif()
  41. if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
  42. list(APPEND CMAKE_MODULE_PATH ${URANIUM_DIR}/cmake)
  43. include(UraniumTranslationTools)
  44. # Extract Strings
  45. add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura)
  46. # Build Translations
  47. CREATE_TRANSLATION_TARGETS()
  48. endif()
  49. install(DIRECTORY resources
  50. DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
  51. include(CuraPluginInstall)
  52. if(NOT APPLE AND NOT WIN32)
  53. install(FILES cura_app.py
  54. DESTINATION ${CMAKE_INSTALL_BINDIR}
  55. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  56. RENAME cura)
  57. if(EXISTS /etc/debian_version)
  58. install(DIRECTORY cura
  59. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}/dist-packages
  60. FILES_MATCHING PATTERN *.py)
  61. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  62. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}/dist-packages/cura)
  63. else()
  64. install(DIRECTORY cura
  65. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages
  66. FILES_MATCHING PATTERN *.py)
  67. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  68. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/cura)
  69. endif()
  70. install(FILES ${CMAKE_BINARY_DIR}/cura.desktop
  71. DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
  72. install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
  73. DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
  74. install(FILES cura.appdata.xml
  75. DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
  76. install(FILES cura.sharedmimeinfo
  77. DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/
  78. RENAME cura.xml )
  79. else()
  80. install(FILES cura_app.py
  81. DESTINATION ${CMAKE_INSTALL_BINDIR}
  82. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  83. install(DIRECTORY cura
  84. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages
  85. FILES_MATCHING PATTERN *.py)
  86. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  87. DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/cura)
  88. endif()