You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OvInstallLaunchScript.cmake 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. INCLUDE(CMakeParseArguments)
  2. #
  3. # Creates launch script from a common OpenViBE template (in "cmake-modules/launchers/"), but dedicated to scenarios to be executed with the Designer
  4. #
  5. # The mandatory 1st argument SCRIPT_PREFIX specifies what the resulting script is called. A platform specific postfix will be added.
  6. # The mandatory 2nd argument EXECUTABLE_NAME specifies what the resulting script will called eventually.
  7. # The optional 3nd argument ARGV1 specifies some extra argument or switch that is given to the launched executable by the script
  8. #
  9. FUNCTION(OV_INSTALL_LAUNCH_SCRIPT)
  10. SET(options PAUSE NOPROJECT)
  11. SET(oneValueArgs SCRIPT_PREFIX EXECUTABLE_NAME ICON_PATH)
  12. SET(multiValueArgs PARAMETERS)
  13. CMAKE_PARSE_ARGUMENTS(OV_INSTALL_LAUNCH_SCRIPT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  14. #OV_CONFIGURE_RC(NAME ${OV_INSTALL_LAUNCH_SCRIPT_SCRIPT_PREFIX} ICON_PATH ${OV_INSTALL_LAUNCH_SCRIPT_ICON_PATH})
  15. # Install executable launcher if install_exe option is set to on, the os is WIN32, and no argument has been specified
  16. IF(WIN32 AND INSTALL_EXE AND NOT(OV_INSTALL_LAUNCH_SCRIPT_PAUSE) AND NOT(OV_INSTALL_LAUNCH_SCRIPT_PARAMETERS))
  17. # Add the dir to be parsed for documentation later. We need to do this before adding subdir, in case the subdir is the actual docs dir
  18. GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_EXE_PROJECTS_TO_INSTALL)
  19. SET(OV_TMP "${OV_TMP};${OV_INSTALL_LAUNCH_SCRIPT_SCRIPT_PREFIX}")
  20. SET_PROPERTY(GLOBAL PROPERTY OV_EXE_PROJECTS_TO_INSTALL ${OV_TMP})
  21. ELSE()
  22. IF(WIN32)
  23. SET(SCRIPT_POSTFIX ".cmd")
  24. ELSEIF(APPLE)
  25. SET(SCRIPT_POSTFIX "-macos.sh")
  26. ELSEIF(UNIX)
  27. # Debian recommends that extensions such as .sh are not used; On Linux, scripts with such extensions shouldn't be packaged
  28. SET(SCRIPT_POSTFIX ".sh")
  29. ENDIF()
  30. # Extract the filename of the project executable, the variable in the script base will be replaced with it by CONFIGURE_FILE()
  31. SET(OV_CMD_EXECUTABLE "TMP_PROJECT_TARGET_PATH-NOTFOUND")
  32. IF(NOT OV_INSTALL_LAUNCH_SCRIPT_NOPROJECT)
  33. GET_TARGET_PROPERTY(TMP_PROJECT_TARGET_PATH ${OV_INSTALL_LAUNCH_SCRIPT_EXECUTABLE_NAME} LOCATION)
  34. GET_FILENAME_COMPONENT(OV_CMD_EXECUTABLE ${TMP_PROJECT_TARGET_PATH} NAME)
  35. ENDIF()
  36. IF(${OV_CMD_EXECUTABLE} STREQUAL "TMP_PROJECT_TARGET_PATH-NOTFOUND")
  37. SET(OV_CMD_EXECUTABLE ${OV_INSTALL_LAUNCH_SCRIPT_EXECUTABLE_NAME})
  38. # ELSE()
  39. # IF(WIN32)
  40. # SET(OV_CMD_EXECUTABLE "%OV_PATH_ROOT%\\bin\\${OV_CMD_EXECUTABLE}")
  41. # ENDIF()
  42. ENDIF()
  43. SET(SCRIPT_NAME ${OV_INSTALL_LAUNCH_SCRIPT_SCRIPT_PREFIX}${SCRIPT_POSTFIX})
  44. SET(OV_CMD_ARGS ${OV_INSTALL_LAUNCH_SCRIPT_PARAMETERS})
  45. IF(OV_INSTALL_LAUNCH_SCRIPT_PAUSE)
  46. SET(OV_PAUSE "PAUSE")
  47. ELSE()
  48. SET(OV_PAUSE "")
  49. ENDIF()
  50. CONFIGURE_FILE(${OV_LAUNCHER_SOURCE_PATH}/openvibe-launcher${SCRIPT_POSTFIX}-base ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT_NAME} @ONLY)
  51. INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT_NAME} DESTINATION ${DIST_ROOT})
  52. ENDIF()
  53. ENDFUNCTION()
  54. #FUNCTION(OV_CONFIGURE_RC)
  55. # SET(options )
  56. # SET(oneValueArgs NAME ICON_PATH)
  57. # SET(multiValueArgs )
  58. # CMAKE_PARSE_ARGUMENTS(OV_CONFIGURE_RC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
  59. # SET(GENERATED_RC_FILE "${DIST_DATADIR}/resource-files/${OV_CONFIGURE_RC_NAME}.rc")
  60. # IF(OV_CONFIGURE_RC_ICON_PATH)
  61. # SET(CONFIGURE_ICON "ID_Icon ICON DISCARDABLE \"${OV_CONFIGURE_RC_ICON_PATH}\"")
  62. # ENDIF()
  63. # IF(NOT(PROJECT_PRODUCT_NAME))
  64. # SET(PROJECT_PRODUCT_NAME "${OV_CONFIGURE_RC_NAME}")
  65. # ENDIF()
  66. # SET(FILE_DESCRIPTION "${PROJECT_PRODUCT_NAME} for Win32")
  67. # CONFIGURE_FILE(
  68. # ${OV_LAUNCHER_SOURCE_PATH}/resource-file.rc-base
  69. # ${GENERATED_RC_FILE}
  70. # @ONLY)
  71. #ENDFUNCTION()