CMakeLists.txt 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. SET(WIN_PLATFORM mingw)
  2. if(LMMS_MSVC_YEAR)
  3. SET(WIN_PLATFORM "msvc${LMMS_MSVC_YEAR}")
  4. endif()
  5. SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/nsis_branding.bmp")
  6. IF(MSVC)
  7. STRING(REPLACE "/" "\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON})
  8. ENDIF(MSVC)
  9. SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/icon.ico")
  10. SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_PROJECT_NAME}.exe" PARENT_SCOPE)
  11. SET(CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME_UCASE} ${VERSION}" PARENT_SCOPE)
  12. SET(CPACK_NSIS_HELP_LINK "${PROJECT_URL}" PARENT_SCOPE)
  13. SET(CPACK_NSIS_URL_INFO_ABOUT "${PROJECT_URL}" PARENT_SCOPE)
  14. SET(CPACK_NSIS_CONTACT "${PROJECT_EMAIL}" PARENT_SCOPE)
  15. SET(CPACK_PACKAGE_EXECUTABLES "${CMAKE_PROJECT_NAME}.exe;${PROJECT_NAME_UCASE}" PARENT_SCOPE)
  16. SET(CPACK_NSIS_MENU_LINKS "${CMAKE_PROJECT_NAME}.exe;${PROJECT_NAME_UCASE}" PARENT_SCOPE)
  17. SET(CPACK_NSIS_DEFINES "
  18. !addincludedir ${CMAKE_SOURCE_DIR}/cmake/nsis
  19. !include FileAssociation.nsh
  20. !include LogicLib.nsh
  21. !include WinVer.nsh")
  22. SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}-${WIN_PLATFORM}-win32")
  23. SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
  24. \\\${registerExtension} \\\"$INSTDIR\\\\${CMAKE_PROJECT_NAME}.exe\\\" \\\".mmp\\\" \\\"${PROJECT_NAME_UCASE} Project\\\"
  25. \\\${registerExtension} \\\"$INSTDIR\\\\${CMAKE_PROJECT_NAME}.exe\\\" \\\".mmpz\\\" \\\"${PROJECT_NAME_UCASE} Project (compressed)\\\"
  26. \\\${IfNot} \\\${AtMostWin7}
  27. WriteRegDWORD HKLM \\\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\SideBySide\\\" \\\"PreferExternalManifest\\\" \\\"1\\\"
  28. \\\${EndIf}
  29. " PARENT_SCOPE)
  30. SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
  31. \\\${unregisterExtension} \\\".mmp\\\" \\\"${PROJECT_NAME_UCASE} Project\\\"
  32. \\\${unregisterExtension} \\\".mmpz\\\" \\\"${PROJECT_NAME_UCASE} Project (compressed)\\\"
  33. DeleteRegKey HKCR \\\"${PROJECT_NAME_UCASE} Project\\\"
  34. DeleteRegKey HKCR \\\"${PROJECT_NAME_UCASE} Project (compressed)\\\"
  35. " PARENT_SCOPE)
  36. IF(WIN64)
  37. SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}-${WIN_PLATFORM}-win64")
  38. SET(CPACK_INSTALL_FIX "$PROGRAMFILES64\\\\${CPACK_PACKAGE_INSTALL_DIRECTORY}\\\\")
  39. SET(CPACK_NSIS_DEFINES "
  40. ${CPACK_NSIS_DEFINES}
  41. InstallDir ${CPACK_INSTALL_FIX}
  42. ")
  43. ENDIF()
  44. # Fix windows paths for msys
  45. IF(LMMS_BUILD_MSYS)
  46. STRING(REPLACE "/" "\\\\" CPACK_PACKAGE_ICON "${CPACK_PACKAGE_ICON}")
  47. STRING(REPLACE "/" "\\\\" CPACK_NSIS_MUI_ICON "${CPACK_NSIS_MUI_ICON}")
  48. STRING(REPLACE "/" "\\\\" CPACK_NSIS_DEFINES "${CPACK_NSIS_DEFINES}")
  49. STRING(REPLACE "/" "\\\\" CMAKE_BINARY_DIR_FIX "${CMAKE_BINARY_DIR}")
  50. # FIXME: there's no easy way to fix $INST_DIR, so we'll redefine it manually
  51. IF(WIN64)
  52. SET(NSIS_ARCH "win64")
  53. ELSE()
  54. SET(NSIS_ARCH "win32")
  55. ENDIF()
  56. SET(CPACK_NSIS_DEFINES "
  57. ${CPACK_NSIS_DEFINES}
  58. !define /redef INST_DIR ${CMAKE_BINARY_DIR_FIX}\\\\_CPack_Packages\\\\${NSIS_ARCH}\\\\NSIS\\\\${CPACK_PACKAGE_FILE_NAME}
  59. ")
  60. ENDIF()
  61. # Setup missing parent scopes
  62. SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}" PARENT_SCOPE)
  63. SET(CPACK_NSIS_DEFINES "${CPACK_NSIS_DEFINES}" PARENT_SCOPE)
  64. SET(CPACK_PACKAGE_ICON "${CPACK_PACKAGE_ICON}" PARENT_SCOPE)
  65. SET(CPACK_NSIS_MUI_ICON "${CPACK_NSIS_MUI_ICON}" PARENT_SCOPE)
  66. # Windows resource compilers
  67. CONFIGURE_FILE("lmms.rc.in" "${CMAKE_BINARY_DIR}/lmms.rc")
  68. CONFIGURE_FILE("zynaddsubfx.rc.in" "${CMAKE_BINARY_DIR}/plugins/zynaddsubfx/zynaddsubfx.rc")
  69. IF(LMMS_HAVE_STK)
  70. FILE(GLOB RAWWAVES "${MINGW_PREFIX}/share/stk/rawwaves/*.raw")
  71. LIST(SORT RAWWAVES)
  72. INSTALL(FILES ${RAWWAVES} DESTINATION "${DATA_DIR}/stk/rawwaves")
  73. ENDIF()
  74. INSTALL(FILES "lmms.exe.manifest" DESTINATION .)
  75. INSTALL(FILES "lmms.VisualElementsManifest.xml" DESTINATION .)
  76. INSTALL(DIRECTORY "assets" DESTINATION .)