From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org"
<linux-trace-devel@vger.kernel.org>,
"y.karadz@gmail.com" <y.karadz@gmail.com>,
"troyengel@gmail.com" <troyengel@gmail.com>,
Yordan Karadzhov <ykaradzhov@vmware.com>
Subject: [PATCH v2 3/3] kernel-shark: Define a CMAKE_BUILD_TYPE "Package"
Date: Fri, 14 Jun 2019 13:26:59 +0000 [thread overview]
Message-ID: <20190614132609.16465-4-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20190614132609.16465-1-ykaradzhov@vmware.com>
A special build type dedicated for package maintainers is added.
By default this build type adds the "-O2" compiler flag. Users
can chose their own compiler flags by providing the corresponding
CMAKE_XXXX_FLAGS_PACKAGE Command-Line options.
If no type is specified, the build type will be "Debug".
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
kernel-shark/CMakeLists.txt | 41 +++++++++++++++++++++++++------------
kernel-shark/README | 22 ++++++++++++++------
2 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt
index 87f33d6..4b58b9b 100644
--- a/kernel-shark/CMakeLists.txt
+++ b/kernel-shark/CMakeLists.txt
@@ -36,9 +36,34 @@ set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC")
-if(NOT _INSTALL_PREFIX)
- set(_INSTALL_PREFIX "/usr/local")
-endif()
+if (NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug)
+endif (NOT CMAKE_BUILD_TYPE)
+
+message("\n Build type: ${CMAKE_BUILD_TYPE}")
+
+if (NOT CMAKE_C_FLAGS_PACKAGE)
+ set(CMAKE_C_FLAGS_PACKAGE "-O3")
+endif (NOT CMAKE_C_FLAGS_PACKAGE)
+
+if (NOT CMAKE_CXX_FLAGS_PACKAGE)
+ set(CMAKE_CXX_FLAGS_PACKAGE "-O3")
+endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
+
+if (NOT _INSTALL_PREFIX)
+ set(_INSTALL_PREFIX "/usr/local")
+endif (NOT _INSTALL_PREFIX)
+
+if (CMAKE_BUILD_TYPE MATCHES Package)
+
+ set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+
+else (CMAKE_BUILD_TYPE MATCHES Package)
+
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+endif (CMAKE_BUILD_TYPE MATCHES Package)
set(KS_PLUGIN_INSTALL_PREFIX ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
@@ -47,16 +72,6 @@ set(KS_ICON_FIN KS_icon_fin.svg)
set(KS_LOGO KS_logo_symbol.svg)
set(KS_LOGO_LABEL KS_logo_horizontal.svg)
-if (NOT _DEBUG)
-
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
-
-endif (NOT _DEBUG)
-
-SET(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
-SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-
include_directories(${KS_DIR}/src/
${KS_DIR}/build/src/
${JSONC_INCLUDE_DIR}
diff --git a/kernel-shark/README b/kernel-shark/README
index 379c390..75a0dd0 100644
--- a/kernel-shark/README
+++ b/kernel-shark/README
@@ -38,14 +38,24 @@ the original trace-cmd end traceevent libraries.
2.1.1 In order to create a Doxygen documentation add -D_DOXYGEN_DOC=1
as a CMake Command-Line option.
-2.1.2 In order to generates complete debug information to be used by GDB add
--D_DEBUG=1 as a CMake Command-Line option.
-
-2.1.3 By default, installation prefix is "/usr/local". It can be changed using
+2.1.2 By default, installation prefix is "/usr/local". It can be changed using
-D_INSTALL_PREFIX= as a CMake Command-Line option.
-Example:
- cmake -D_DOXYGEN_DOC=1 -D_DEBUG=1 -D_INSTALL_PREFIX=/usr ../
+2.1.3 In addition to the standard CMake build types (Debug, Release,
+RelWithDebInfo, MinSizeRel) KernelShark supports a "Package" build type.
+By default this build type adds the "-O2" compiler flag. Package maintainers
+can chose their own compiler flags by providing the corresponding
+CMAKE_XXXX_FLAGS_PACKAGE Command-Line options (see the example below).
+
+Note that when built as a "Package" the RPATH-s of the executables are
+set directly to _INSTALL_PREFIX/lib/kernelshark/
+
+If no build types is specified, the type will be "Debug".
+
+Examples:
+ cmake -D_DOXYGEN_DOC=1 -D_INSTALL_PREFIX=/usr ../
+
+ cmake -DCMAKE_BUILD_TYPE=Package -DCMAKE_C_FLAGS_PACKAGE="-O3 -pedantic" ../
2.2.1 Use "make clean" if you want to delete all already compiled objects.
--
2.20.1
next prev parent reply other threads:[~2019-06-14 13:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 13:26 [PATCH v2 0/3] KernelShark build fixes for v1.0 Yordan Karadzhov
2019-06-14 13:26 ` [PATCH v2 1/3] kernel-shark: Remove the "-g" compiler flag Yordan Karadzhov
2019-06-14 13:26 ` [PATCH v2 2/3] kernel-shark: Avoid TRACECMD_BIN_DIR being set to the build path Yordan Karadzhov
2019-06-14 13:26 ` Yordan Karadzhov [this message]
2019-07-05 23:34 ` [PATCH v2 3/3] kernel-shark: Define a CMAKE_BUILD_TYPE "Package" Steven Rostedt
2019-07-08 9:16 ` Yordan Karadzhov (VMware)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190614132609.16465-4-ykaradzhov@vmware.com \
--to=ykaradzhov@vmware.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=troyengel@gmail.com \
--cc=y.karadz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).