From cfdc43e637a64512de891538940c4254c6409c7b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 2 Feb 2017 09:38:58 +0100 Subject: [PATCH] Create shortcut to run linphone from OUTPUT directory when building on Windows. --- cmake_builder/additional_steps.cmake | 31 +++++++++++++++++++ .../linphone_package/winshortcut.vbs.in | 6 ++++ cmake_builder/linphoneqt.cmake | 2 ++ 3 files changed, 39 insertions(+) create mode 100644 cmake_builder/additional_steps.cmake create mode 100644 cmake_builder/linphone_package/winshortcut.vbs.in diff --git a/cmake_builder/additional_steps.cmake b/cmake_builder/additional_steps.cmake new file mode 100644 index 000000000..f11170c21 --- /dev/null +++ b/cmake_builder/additional_steps.cmake @@ -0,0 +1,31 @@ +############################################################################ +# additional_steps.cmake +# Copyright (C) 2017 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ + +# Create a shortcut to linphone.exe in install prefix +if(LINPHONE_BUILDER_TARGET STREQUAL linphoneqt AND WIN32) + set(SHORTCUT_PATH "${CMAKE_INSTALL_PREFIX}/linphone.lnk") + set(SHORTCUT_TARGET_PATH "${CMAKE_INSTALL_PREFIX}/bin/linphone.exe") + set(SHORTCUT_WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/linphone_package/winshortcut.vbs.in" "${CMAKE_CURRENT_BINARY_DIR}/winshortcut.vbs" @ONLY) + add_custom_command(OUTPUT "${SHORTCUT_PATH}" COMMAND "cscript" "${CMAKE_CURRENT_BINARY_DIR}/winshortcut.vbs") + add_custom_target(linphoneqt_winshortcut ALL DEPENDS "${SHORTCUT_PATH}" TARGET_linphone_builder) +endif() diff --git a/cmake_builder/linphone_package/winshortcut.vbs.in b/cmake_builder/linphone_package/winshortcut.vbs.in new file mode 100644 index 000000000..58750a7b1 --- /dev/null +++ b/cmake_builder/linphone_package/winshortcut.vbs.in @@ -0,0 +1,6 @@ +Set oWS = WScript.CreateObject("WScript.Shell") +sLinkFile = "@SHORTCUT_PATH@" +Set oLink = oWS.CreateShortcut(sLinkFile) +oLink.TargetPath = "@SHORTCUT_TARGET_PATH@" +oLink.WorkingDirectory = "@SHORTCUT_WORKING_DIRECTORY@" +oLink.Save diff --git a/cmake_builder/linphoneqt.cmake b/cmake_builder/linphoneqt.cmake index 583873b95..4af41d48a 100644 --- a/cmake_builder/linphoneqt.cmake +++ b/cmake_builder/linphoneqt.cmake @@ -24,3 +24,5 @@ lcb_external_source_paths("../linphone-desktop") lcb_dependencies("linphone") +# Add config step for packaging +set(LINPHONE_BUILDER_ADDITIONAL_CONFIG_STEPS "${CMAKE_CURRENT_LIST_DIR}/additional_steps.cmake")