[2/2] kernel-shark: Install public interface headers
diff mbox series

Message ID 20190530131556.21832-3-ykaradzhov@vmware.com
State New
Headers show
Series
  • Modifications needed by the NumPy interface
Related show

Commit Message

Yordan Karadzhov May 30, 2019, 1:15 p.m. UTC
Installing the header files included in the public interfaces of
the KernelShark libraries will make possible the libraries to be used
for development.

A symbolic link that points to the latest versions of the libraries is
added to INSTALL_PREFIX/lib/kernelshark

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/README                     |  4 ++
 kernel-shark/src/CMakeLists.txt         | 56 ++++++++++++++++++++++---
 kernel-shark/src/plugins/CMakeLists.txt |  3 +-
 3 files changed, 56 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/kernel-shark/README b/kernel-shark/README
index 379c390..573e279 100644
--- a/kernel-shark/README
+++ b/kernel-shark/README
@@ -44,6 +44,10 @@  as a CMake Command-Line option.
 2.1.3 By default, installation prefix is "/usr/local". It can be changed using
 -D_INSTALL_PREFIX= as a CMake Command-Line option.
 
+2.1.4 In order to install a development version (including headers e.t.c) add
+-D_DEVEL=1 as a CMake Command-Line option.
+
+
 Example:
     cmake -D_DOXYGEN_DOC=1 -D_DEBUG=1 -D_INSTALL_PREFIX=/usr ../
 
diff --git a/kernel-shark/src/CMakeLists.txt b/kernel-shark/src/CMakeLists.txt
index 6cbc00f..36ce884 100644
--- a/kernel-shark/src/CMakeLists.txt
+++ b/kernel-shark/src/CMakeLists.txt
@@ -1,5 +1,13 @@ 
 message("\n src ...")
 
+macro(install_symlink filepath sympath)
+    install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${filepath} ${sympath})")
+    install(CODE "LIST(APPEND CMAKE_INSTALL_MANIFEST_FILES ${sympath})")
+    install(CODE "message(\"-- Created symlink: ${sympath} -> ${filepath}\")")
+endmacro(install_symlink)
+
+set(KS_INCLUDS_DESTINATION "${_INSTALL_PREFIX}/include/${KS_APP_NAME}")
+
 message(STATUS "libkshark")
 add_library(kshark SHARED libkshark.c
                           libkshark-model.c
@@ -14,6 +22,22 @@  target_link_libraries(kshark ${CMAKE_DL_LIBS}
 
 set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
 
+install(TARGETS kshark LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}
+                       COMPONENT core)
+
+if (_DEVEL)
+
+    install_symlink("libkshark.so.${KS_VERSION_STRING}"
+                    "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/libkshark.so")
+
+    install(FILES "${KS_DIR}/src/libkshark.h"
+                  "${KS_DIR}/src/libkshark-plugin.h"
+                  "${KS_DIR}/src/libkshark-model.h"
+            DESTINATION ${KS_INCLUDS_DESTINATION}
+            COMPONENT devel)
+
+endif (_DEVEL)
+
 if (OPENGL_FOUND AND GLUT_FOUND)
 
     message(STATUS "libkshark-plot")
@@ -26,6 +50,21 @@  if (OPENGL_FOUND AND GLUT_FOUND)
 
     set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
 
+    install(TARGETS kshark-plot LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}
+                                COMPONENT core)
+
+    if (_DEVEL)
+
+        install_symlink("libkshark-plot.so.${KS_VERSION_STRING}"
+                        "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/libkshark-plot.so")
+
+        install(FILES "${KS_DIR}/src/KsPlotTools.hpp"
+                      "${KS_DIR}/src/libkshark-plot.h"
+                DESTINATION ${KS_INCLUDS_DESTINATION}
+                COMPONENT devel)
+
+    endif (_DEVEL)
+
 endif (OPENGL_FOUND AND GLUT_FOUND)
 
 if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
@@ -77,21 +116,26 @@  if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
     add_executable(kshark-record        kshark-record.cpp)
     target_link_libraries(kshark-record kshark-gui)
 
-    install(TARGETS ${KS_APP_NAME} kshark-record kshark kshark-plot kshark-gui
+    install(TARGETS ${KS_APP_NAME} kshark-record kshark-gui
             RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/
-            LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/)
+            LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}
+            COMPONENT core)
 
     install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop"
-            DESTINATION ${_INSTALL_PREFIX}/share/applications/)
+            DESTINATION ${_INSTALL_PREFIX}/share/applications/
+            COMPONENT core)
 
     install(FILES "${KS_DIR}/icons/${KS_ICON}"
-            DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME})
+            DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME}
+            COMPONENT core)
 
     install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
-            DESTINATION ${_INSTALL_PREFIX}/share/polkit-1/actions/)
+            DESTINATION ${_INSTALL_PREFIX}/share/polkit-1/actions/
+            COMPONENT core)
 
     install(PROGRAMS "${KS_DIR}/bin/kshark-su-record"
-            DESTINATION ${_INSTALL_PREFIX}/bin/)
+            DESTINATION ${_INSTALL_PREFIX}/bin/
+            COMPONENT core)
 
 endif (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
diff --git a/kernel-shark/src/plugins/CMakeLists.txt b/kernel-shark/src/plugins/CMakeLists.txt
index 6c77179..51f6f65 100644
--- a/kernel-shark/src/plugins/CMakeLists.txt
+++ b/kernel-shark/src/plugins/CMakeLists.txt
@@ -28,6 +28,7 @@  BUILD_PLUGIN(NAME missed_events
 list(APPEND PLUGIN_LIST "missed_events default") # This plugin will be loaded by default
 
 install(TARGETS sched_events missed_events
-        LIBRARY DESTINATION ${KS_PLUGIN_INSTALL_PREFIX})
+        LIBRARY DESTINATION ${KS_PLUGIN_INSTALL_PREFIX}
+        COMPONENT core)
 
 set(PLUGINS ${PLUGIN_LIST} PARENT_SCOPE)