diff mbox series

[v2,20/23] kernel-shark-qt: Add make install

Message ID 20181016155232.5257-21-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Headers show
Series Add Qt-based GUI for KernelShark | expand

Commit Message

Yordan Karadzhov Oct. 16, 2018, 3:53 p.m. UTC
From: Yordan Karadzhov (VMware) <y.karadz@gmail.com>

Define CMake installation rules for kernel-shark-qt project.
Add a script for uninstalling.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark-qt/CMakeLists.txt             |  3 +++
 kernel-shark-qt/build/cmake_uninstall.sh   | 17 +++++++++++++++++
 kernel-shark-qt/src/CMakeLists.txt         | 10 ++++++++++
 kernel-shark-qt/src/plugins/CMakeLists.txt |  3 +++
 4 files changed, 33 insertions(+)
 create mode 100755 kernel-shark-qt/build/cmake_uninstall.sh

Comments

Steven Rostedt Oct. 19, 2018, 3:52 p.m. UTC | #1
On Tue, 16 Oct 2018 15:53:21 +0000
Yordan Karadzhov <ykaradzhov@vmware.com> wrote:

> diff --git a/kernel-shark-qt/build/cmake_uninstall.sh b/kernel-shark-qt/build/cmake_uninstall.sh
> new file mode 100755
> index 0000000..50c163b
> --- /dev/null
> +++ b/kernel-shark-qt/build/cmake_uninstall.sh
> @@ -0,0 +1,17 @@
> +#!/bin/bash
> +
> +CYAN='\033[0;36m'
> +PURPLE='\033[0;35m'
> +NC='\033[0m' # No Color

BTW, this also works:

 CYAN='\e[36m'
 PURPLE='\e[35m'
 NC='\e[0m' # No Color

Which is a little cleaner.

If you agree, can you resend just this patch with the update (as v2)?

Thanks!

-- Steve

> +
> +if [[ $EUID -ne 0 ]]; then
> +   echo -e "${PURPLE}Permission denied${NC}" 1>&2
> +   exit 100
> +fi
> +
> +if [ -e install_manifest.txt ]
> +then
> +    echo -e "${CYAN}Uninstall the project...${NC}"
> +    xargs rm -v < install_manifest.txt
> +    rm -f install_manifest.txt
> +fi
> diff --git a/kernel-shark-qt/src/CMakeLists.txt b/kernel-shark-qt/src/CMakeLists.txt
> index 6819f86..2592094 100644
> --- a/kernel-shark-qt/src/CMakeLists.txt
> +++ b/kernel-shark-qt/src/CMakeLists.txt
> @@ -73,6 +73,16 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
>      add_executable(kshark-record        kshark-record.cpp)
>      target_link_libraries(kshark-record kshark-gui)
>  
> +    install(TARGETS kernelshark kshark-record kshark kshark-plot kshark-gui
> +            RUNTIME DESTINATION /usr/local/bin/
> +            LIBRARY DESTINATION /usr/local/lib/kshark/)
> +
> +    install(FILES "${KS_DIR}/kernelshark.desktop"
> +            DESTINATION /usr/share/applications/)
> +
> +    install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
> +            DESTINATION /usr/share/polkit-1/actions/)
> +
>  endif (Qt5Widgets_FOUND AND Qt5Network_FOUND)
>  
>  add_subdirectory(plugins)
> diff --git a/kernel-shark-qt/src/plugins/CMakeLists.txt b/kernel-shark-qt/src/plugins/CMakeLists.txt
> index 88fd93c..2d7251d 100644
> --- a/kernel-shark-qt/src/plugins/CMakeLists.txt
> +++ b/kernel-shark-qt/src/plugins/CMakeLists.txt
> @@ -24,4 +24,7 @@ BUILD_PLUGIN(NAME sched_events
>  list(APPEND PLUGIN_LIST "sched_events default") # This plugin will be loaded by default
>  # list(APPEND PLUGIN_LIST "sched_events") # This plugin isn't loaded by default
>  
> +install(TARGETS sched_events
> +        LIBRARY DESTINATION /usr/local/lib/kshark/)
> +
>  set(PLUGINS ${PLUGIN_LIST} PARENT_SCOPE)
diff mbox series

Patch

diff --git a/kernel-shark-qt/CMakeLists.txt b/kernel-shark-qt/CMakeLists.txt
index 278241b..767bec9 100644
--- a/kernel-shark-qt/CMakeLists.txt
+++ b/kernel-shark-qt/CMakeLists.txt
@@ -46,6 +46,9 @@  if (NOT _DEBUG)
 
 endif (NOT _DEBUG)
 
+SET(CMAKE_INSTALL_RPATH "/usr/local/lib/kshark/")
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
 include_directories(${KS_DIR}/src/
                     ${KS_DIR}/build/src/
                     ${JSONC_INCLUDE_DIR}
diff --git a/kernel-shark-qt/build/cmake_uninstall.sh b/kernel-shark-qt/build/cmake_uninstall.sh
new file mode 100755
index 0000000..50c163b
--- /dev/null
+++ b/kernel-shark-qt/build/cmake_uninstall.sh
@@ -0,0 +1,17 @@ 
+#!/bin/bash
+
+CYAN='\033[0;36m'
+PURPLE='\033[0;35m'
+NC='\033[0m' # No Color
+
+if [[ $EUID -ne 0 ]]; then
+   echo -e "${PURPLE}Permission denied${NC}" 1>&2
+   exit 100
+fi
+
+if [ -e install_manifest.txt ]
+then
+    echo -e "${CYAN}Uninstall the project...${NC}"
+    xargs rm -v < install_manifest.txt
+    rm -f install_manifest.txt
+fi
diff --git a/kernel-shark-qt/src/CMakeLists.txt b/kernel-shark-qt/src/CMakeLists.txt
index 6819f86..2592094 100644
--- a/kernel-shark-qt/src/CMakeLists.txt
+++ b/kernel-shark-qt/src/CMakeLists.txt
@@ -73,6 +73,16 @@  if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
     add_executable(kshark-record        kshark-record.cpp)
     target_link_libraries(kshark-record kshark-gui)
 
+    install(TARGETS kernelshark kshark-record kshark kshark-plot kshark-gui
+            RUNTIME DESTINATION /usr/local/bin/
+            LIBRARY DESTINATION /usr/local/lib/kshark/)
+
+    install(FILES "${KS_DIR}/kernelshark.desktop"
+            DESTINATION /usr/share/applications/)
+
+    install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
+            DESTINATION /usr/share/polkit-1/actions/)
+
 endif (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
 add_subdirectory(plugins)
diff --git a/kernel-shark-qt/src/plugins/CMakeLists.txt b/kernel-shark-qt/src/plugins/CMakeLists.txt
index 88fd93c..2d7251d 100644
--- a/kernel-shark-qt/src/plugins/CMakeLists.txt
+++ b/kernel-shark-qt/src/plugins/CMakeLists.txt
@@ -24,4 +24,7 @@  BUILD_PLUGIN(NAME sched_events
 list(APPEND PLUGIN_LIST "sched_events default") # This plugin will be loaded by default
 # list(APPEND PLUGIN_LIST "sched_events") # This plugin isn't loaded by default
 
+install(TARGETS sched_events
+        LIBRARY DESTINATION /usr/local/lib/kshark/)
+
 set(PLUGINS ${PLUGIN_LIST} PARENT_SCOPE)