RemoteVstPlugin32.cmake 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # INSTALL_EXTERNAL_PROJECT: install a project created with ExternalProject_Add in the
  2. # parent project's install time.
  3. #
  4. # Description:
  5. # In a regular scenario, cmake will install external projects
  6. # BEFORE actually building the parent project. Since the building
  7. # process may use installed components from the project.
  8. # We want to give the external project the ability to install
  9. # files directly to the parent's install. Therefore, we have to
  10. # manually trigger the install stage with the parent's INSTALL_PREFIX.
  11. MACRO(INSTALL_EXTERNAL_PROJECT name)
  12. ExternalProject_Get_Property(${name} BINARY_DIR)
  13. install(CODE "include(\"${BINARY_DIR}/cmake_install.cmake\")")
  14. ENDMACRO()
  15. IF(LMMS_BUILD_WIN32 AND NOT LMMS_BUILD_WIN64)
  16. ADD_SUBDIRECTORY(RemoteVstPlugin)
  17. ELSEIF(LMMS_BUILD_WIN64 AND MSVC)
  18. IF(NOT QT_32_PREFIX)
  19. SET(LMMS_MSVC_YEAR_FOR_QT ${LMMS_MSVC_YEAR})
  20. if(LMMS_MSVC_YEAR_FOR_QT EQUAL 2019 AND Qt5_VERSION VERSION_LESS "5.15")
  21. SET(LMMS_MSVC_YEAR_FOR_QT 2017) # Qt only provides binaries for MSVC 2017, but 2019 is binary compatible
  22. endif()
  23. GET_FILENAME_COMPONENT(QT_BIN_DIR ${QT_QMAKE_EXECUTABLE} DIRECTORY)
  24. SET(QT_32_PREFIX "${QT_BIN_DIR}/../../msvc${LMMS_MSVC_YEAR_FOR_QT}")
  25. ENDIF()
  26. #TODO: qt5 installed using vcpkg: I don't know how to detect if the user built the x86 version of qt5 from here. At least not cleanly.
  27. #So for the moment, we'll allow the built.
  28. IF(NOT (IS_DIRECTORY ${QT_32_PREFIX} AND EXISTS ${QT_32_PREFIX}/bin/qmake.exe))
  29. MESSAGE(WARNING "No Qt 32 bit installation found at ${QT_32_PREFIX}. If you're using VCPKG you can ignore this message if you've built x86-windows version of qt5")
  30. ENDIF()
  31. ExternalProject_Add(RemoteVstPlugin32
  32. "${EXTERNALPROJECT_ARGS}"
  33. CMAKE_GENERATOR "${LMMS_MSVC_GENERATOR}"
  34. CMAKE_GENERATOR_PLATFORM Win32
  35. #CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}"
  36. CMAKE_ARGS
  37. "${EXTERNALPROJECT_CMAKE_ARGS}"
  38. "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
  39. "-DCMAKE_PREFIX_PATH=${QT_32_PREFIX}"
  40. )
  41. INSTALL_EXTERNAL_PROJECT(RemoteVstPlugin32)
  42. ELSEIF(LMMS_BUILD_LINUX)
  43. # Use winegcc
  44. INCLUDE(CheckWineGcc)
  45. CheckWineGcc(32 "${WINEGCC}" WINEGCC_WORKING)
  46. IF(NOT WINEGCC_WORKING)
  47. MESSAGE(WARNING "winegcc fails to complie 32-bit binaries, please make sure you have 32-bit GCC libraries")
  48. RETURN()
  49. ENDIF()
  50. ExternalProject_Add(RemoteVstPlugin32
  51. "${EXTERNALPROJECT_ARGS}"
  52. CMAKE_ARGS
  53. "${EXTERNALPROJECT_CMAKE_ARGS}"
  54. "-DCMAKE_CXX_COMPILER=${WINEGCC}"
  55. "-DCMAKE_CXX_FLAGS=-m32"
  56. )
  57. INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../32/RemoteVstPlugin32" "${CMAKE_CURRENT_BINARY_DIR}/../32/RemoteVstPlugin32.exe.so" DESTINATION "${PLUGIN_DIR}/32")
  58. ELSEIF(CMAKE_TOOLCHAIN_FILE_32)
  59. ExternalProject_Add(RemoteVstPlugin32
  60. "${EXTERNALPROJECT_ARGS}"
  61. CMAKE_ARGS
  62. "${EXTERNALPROJECT_CMAKE_ARGS}"
  63. "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_32}"
  64. "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE_32}"
  65. )
  66. INSTALL_EXTERNAL_PROJECT(RemoteVstPlugin32)
  67. ELSE()
  68. MESSAGE(WARNING "Can't build RemoteVstPlugin32, unknown environment. Please supply CMAKE_TOOLCHAIN_FILE_32 and optionally CMAKE_PREFIX_PATH_32")
  69. RETURN()
  70. ENDIF()