CMakeLists.txt 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. set(CURA_SDK_VERSION "" CACHE STRING "SDK version of Cura")
  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. configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY)
  20. configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
  21. if(NOT ${URANIUM_DIR} STREQUAL "")
  22. set(CMAKE_MODULE_PATH "${URANIUM_DIR}/cmake")
  23. endif()
  24. if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
  25. list(APPEND CMAKE_MODULE_PATH ${URANIUM_DIR}/cmake)
  26. include(UraniumTranslationTools)
  27. # Extract Strings
  28. add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura)
  29. # Build Translations
  30. CREATE_TRANSLATION_TARGETS()
  31. endif()
  32. find_package(PythonInterp 3.5.0 REQUIRED)
  33. install(DIRECTORY resources
  34. DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
  35. install(DIRECTORY plugins
  36. DESTINATION lib${LIB_SUFFIX}/cura)
  37. if(NOT APPLE AND NOT WIN32)
  38. install(FILES cura_app.py
  39. DESTINATION ${CMAKE_INSTALL_BINDIR}
  40. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
  41. RENAME cura)
  42. if(EXISTS /etc/debian_version)
  43. install(DIRECTORY cura
  44. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}/dist-packages
  45. FILES_MATCHING PATTERN *.py)
  46. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  47. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}/dist-packages/cura)
  48. else()
  49. install(DIRECTORY cura
  50. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages
  51. FILES_MATCHING PATTERN *.py)
  52. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  53. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/cura)
  54. endif()
  55. install(FILES ${CMAKE_BINARY_DIR}/cura.desktop
  56. DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
  57. install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
  58. DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
  59. install(FILES cura.appdata.xml
  60. DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
  61. install(FILES cura.sharedmimeinfo
  62. DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/
  63. RENAME cura.xml )
  64. else()
  65. install(FILES cura_app.py
  66. DESTINATION ${CMAKE_INSTALL_BINDIR}
  67. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  68. install(DIRECTORY cura
  69. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages
  70. FILES_MATCHING PATTERN *.py)
  71. install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py
  72. DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/cura)
  73. endif()