diff --git a/CMakeLists.txt b/CMakeLists.txt index 26b00f485..886d31f6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ project(Thunder DESCRIPTION "Thunder framework" HOMEPAGE_URL "https://rdkcentral.github.io/Thunder/") +include(GNUInstallDirs) + set(VERSION ${${PROJECT_NAME}_VERSION}) set(VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR}) set(VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR}) @@ -42,7 +44,6 @@ option(HUMAN_VERSIONED_BINARIES "Create binaries with a human readeable version suffix" ON) option(VERSIONED_LIBRARY_LOADING "Uses the major version (*.so.) to load libraries rather then *.so" OFF) - if (BUILD_REFERENCE) add_definitions (-DBUILD_REFERENCE=${BUILD_REFERENCE}) @@ -56,16 +57,15 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" - "${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/Modules") + "${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/Modules") if (TOOLS_SYSROOT) list(APPEND CMAKE_MODULE_PATH - "${TOOLS_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/Modules") + "${TOOLS_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/Modules") endif() include(platform) include(CmakeHelperFunctions) -include(GNUInstallDirs) set(PLATFORM "PC_UNIX" CACHE STRING "Defines on what platform the application will run") @@ -78,7 +78,7 @@ find_package(ConfigGenerator REQUIRED) if(NOT DEFINED BUILD_SHARED_LIBS) set(BUILD_SHARED_LIBS ON CACHE INTERNAL "Enable shared objects by default") - message(STATUS "BUILD_SHARED_LIBS was not set, assuming ${BUILD_SHARED_LIBS}") + message(VERBOSE "Building shared libs") endif() # @@ -89,7 +89,7 @@ if(NOT CMAKE_BUILD_TYPE) message(AUTHOR_WARNING "CMAKE_BUILD_TYPE not set, assuming '${CMAKE_BUILD_TYPE}'") endif() -message(STATUS "CMake build type: '${CMAKE_BUILD_TYPE}'") +message(VERBOSE "CMake build type: '${CMAKE_BUILD_TYPE}'") # Remove optimization flags added by the build system string(REGEX REPLACE "(-g[0123])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -110,18 +110,21 @@ configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/project.cmake.in" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}.cmake" RENAME "${NAMESPACE}Config.cmake" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE} + COMPONENT ${NAMESPACE}_Development) if(CMAKE_VERSION VERSION_LESS 3.20.0 AND LEGACY_CONFIG_GENERATOR) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/config" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE} + COMPONENT ${NAMESPACE}_Development) endif(CMAKE_VERSION VERSION_LESS 3.20.0 AND LEGACY_CONFIG_GENERATOR) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE} + COMPONENT ${NAMESPACE}_Development) if(APPLE) # Mac needed variables diff --git a/Source/Thunder/CMakeLists.txt b/Source/Thunder/CMakeLists.txt index e0be6eb13..fb3c0cdf8 100644 --- a/Source/Thunder/CMakeLists.txt +++ b/Source/Thunder/CMakeLists.txt @@ -107,7 +107,7 @@ install( ) install(DIRECTORY - DESTINATION ${PERSISTENT_PATH}/${NAMESPACE}} COMPONENT ${NAMESPACE}_Runtime + DESTINATION ${PERSISTENT_PATH} COMPONENT ${NAMESPACE}_Runtime DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE ) diff --git a/Source/Thunder/GenericConfig.cmake b/Source/Thunder/GenericConfig.cmake index 2cb0243c4..db6094bb3 100644 --- a/Source/Thunder/GenericConfig.cmake +++ b/Source/Thunder/GenericConfig.cmake @@ -23,19 +23,19 @@ set(BINDING "0.0.0.0" CACHE STRING "The binding interface") set(IDLE_TIME 180 CACHE STRING "Idle time") set(SOFT_KILL_CHECK_WAIT_TIME 10 CACHE STRING "Soft kill check waiting time") set(HARD_KILL_CHECK_WAIT_TIME 4 CACHE STRING "Hard kill check waiting time") -set(PERSISTENT_PATH "/root" CACHE STRING "Persistent path") -set(DATA_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${NAMESPACE}" CACHE STRING "Data path") -set(SYSTEM_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/${NAMESPACE_LIB}/plugins" CACHE STRING "System path") -set(WEBSERVER_PATH "/boot/www" CACHE STRING "Root path for the HTTP server") +set(PERSISTENT_PATH "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/${NAMESPACE}" CACHE PATH "Persistent path") +set(DATA_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${NAMESPACE}" CACHE PATH "Data path") +set(SYSTEM_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/${NAMESPACE_LIB}/plugins" CACHE PATH "System path") +set(WEBSERVER_PATH "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/www/html" CACHE PATH "Root path for the HTTP server") set(WEBSERVER_PORT 8080 CACHE STRING "Port for the HTTP server") -set(PROXYSTUB_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/${NAMESPACE_LIB}/proxystubs" CACHE STRING "Proxy stub path") -set(POSTMORTEM_PATH "/opt/minidumps" CACHE STRING "Core file path to do the postmortem of the crash") +set(PROXYSTUB_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/${NAMESPACE_LIB}/proxystubs" CACHE PATH "Proxy stub path") +set(POSTMORTEM_PATH "/opt/minidumps" CACHE PATH "Core file path to do the postmortem of the crash") set(MESSAGECONTROL_PATH "MessageDispatcher" CACHE STRING "MessageControl base path to create message files") set(MESSAGING_PORT 0 CACHE STRING "The port for the messaging") set(MESSAGING_STDOUT false CACHE STRING "Enable message rederict from stdout") set(MESSAGING_STDERR false CACHE STRING "Enable message rederict from stderr") set(MESSAGING_DATASIZE 20480 CACHE STRING "Size of the data buffer in bytes [max 63KB]") -set(CONFIG_INSTALL_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${NAMESPACE}" CACHE STRING "Install location of the configuration") +set(CONFIG_INSTALL_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${NAMESPACE}" CACHE PATH "Install location of the configuration") set(IPV6_SUPPORT false CACHE STRING "Controls if should application supports ipv6") set(LEGACY_INITIALZE false CACHE STRING "Enables legacy Plugin Initialize behaviour (Deinit not called on failed Init)") set(PRIORITY 0 CACHE STRING "Change the nice level [-20 - 20]") @@ -79,7 +79,7 @@ endif() map_set(${CONFIG} idletime ${IDLE_TIME}) map_set(${CONFIG} softkillcheckwaittime ${SOFT_KILL_CHECK_WAIT_TIME}) map_set(${CONFIG} hardkillcheckwaittime ${HARD_KILL_CHECK_WAIT_TIME}) -map_set(${CONFIG} persistentpath ${PERSISTENT_PATH}/${NAMESPACE}) +map_set(${CONFIG} persistentpath ${PERSISTENT_PATH}) map_set(${CONFIG} volatilepath ${VOLATILE_PATH}) map_set(${CONFIG} datapath ${DATA_PATH}) map_set(${CONFIG} systempath ${SYSTEM_PATH}) diff --git a/Source/Thunder/Thunder.conf.in b/Source/Thunder/Thunder.conf.in index 748082a40..48c939727 100644 --- a/Source/Thunder/Thunder.conf.in +++ b/Source/Thunder/Thunder.conf.in @@ -5,7 +5,7 @@ ipv6 = '@IPV6_SUPPORT@' idletime = '@IDLE_TIME@' softkillcheckwaittime = '@SOFT_KILL_CHECK_WAIT_TIME@' hardkillcheckwaittime = '@HARD_KILL_CHECK_WAIT_TIME@' -persistentpath = '@PERSISTENT_PATH@/@NAMESPACE@' +persistentpath = '@PERSISTENT_PATH@' volatilepath = '@VOLATILE_PATH@' datapath = '@DATA_PATH@' systempath = '@SYSTEM_PATH@' diff --git a/Source/core/CMakeLists.txt b/Source/core/CMakeLists.txt index f31b83c0d..c234636bd 100644 --- a/Source/core/CMakeLists.txt +++ b/Source/core/CMakeLists.txt @@ -23,7 +23,7 @@ find_package(ExecInfo) find_package(LIBRT) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/generated/core/Version.h" @ONLY) -message(STATUS "Generated ${CMAKE_CURRENT_BINARY_DIR}/generated/core/Version.h") +message(VERBOSE "Generated ${CMAKE_CURRENT_BINARY_DIR}/generated/core/Version.h") add_library(${TARGET} Module.cpp @@ -157,7 +157,7 @@ target_compile_options (${TARGET} PRIVATE -Wno-psabi) # All build flags that are applicable to the whole system should be set here in the # core since the core is included everywhere so if they are set here, they are # picked up everywhere! -if(DISABLE_TRACING) +if(DISABLE_TRACING OR NOT ENABLED_TRACING_LEVEL) target_compile_definitions(${TARGET} PUBLIC _TRACE_LEVEL=0) message(STATUS "Force trace level to 0") else() diff --git a/Source/extensions/localtracer/CMakeLists.txt b/Source/extensions/localtracer/CMakeLists.txt index 3a2a7c838..a978c7e84 100644 --- a/Source/extensions/localtracer/CMakeLists.txt +++ b/Source/extensions/localtracer/CMakeLists.txt @@ -1,4 +1,8 @@ -project(LocalTracer LANGUAGES CXX) +project(LocalTracer + VERSION 0.0.1 + DESCRIPTION "Library to get tracing locally from e.g. your test code on the stdout." + LANGUAGES CXX) + cmake_minimum_required(VERSION 3.15) set(MODULE_NAME ${NAMESPACE}LocalTracer) diff --git a/Source/extensions/privilegedrequest/CMakeLists.txt b/Source/extensions/privilegedrequest/CMakeLists.txt index 0bfbb22da..a64eb7e6d 100644 --- a/Source/extensions/privilegedrequest/CMakeLists.txt +++ b/Source/extensions/privilegedrequest/CMakeLists.txt @@ -15,7 +15,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -project(PrivilegedRequest LANGUAGES CXX) +project(PrivilegedRequest + VERSION 1.0.0 + DESCRIPTION "With PrivilegedRequest you can make a file descriptor available to other processes." + LANGUAGES CXX) cmake_minimum_required(VERSION 3.15) diff --git a/cmake/common/CmakeHelperFunctions.cmake b/cmake/common/CmakeHelperFunctions.cmake index 5490c8000..78fd3b245 100644 --- a/cmake/common/CmakeHelperFunctions.cmake +++ b/cmake/common/CmakeHelperFunctions.cmake @@ -376,7 +376,7 @@ function(InstallCMakeConfig) VERSION ${_version} COMPATIBILITY SameMajorVersion) - message(STATUS "${_target} added support for cmake consumers via '${_name}Config.cmake'") + message(VERBOSE "${_target} added support for cmake consumers via '${_name}Config.cmake'") if(NOT "${_type}" STREQUAL "INTERFACE_LIBRARY") # The alias is used by local targets project @@ -608,7 +608,7 @@ function(InstallPackageConfig) endif() endforeach() - message(STATUS "${_target} added support for generic consumers via ${_pc_filename}") + message(VERBOSE "${_target} added support for generic consumers via ${_pc_filename}") configure_file( "${_pc_template}" "${CMAKE_CURRENT_BINARY_DIR}/${_pc_filename}" diff --git a/cmake/common/CreateLink.cmake b/cmake/common/CreateLink.cmake index 0a7018cea..ae8d5be2f 100644 --- a/cmake/common/CreateLink.cmake +++ b/cmake/common/CreateLink.cmake @@ -13,7 +13,7 @@ function(CreateLink) cmake_parse_arguments(Argument "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - message(STATUS "Creating symlink ${Argument_LINK} -> ${Argument_TARGET}") + message(VERBOSE "Creating symlink ${Argument_LINK} -> ${Argument_TARGET}") get_filename_component(LINK_DIR ${Argument_LINK} DIRECTORY) file(MAKE_DIRECTORY "${LINK_DIR}") diff --git a/cmake/common/HeaderOnlyInstall.cmake b/cmake/common/HeaderOnlyInstall.cmake index 93ca517b6..e2f569682 100644 --- a/cmake/common/HeaderOnlyInstall.cmake +++ b/cmake/common/HeaderOnlyInstall.cmake @@ -82,7 +82,7 @@ function(HeaderOnlyInstallCMakeConfig) VERSION ${_version} COMPATIBILITY SameMajorVersion) - message(STATUS "${TARGET} added support for cmake consumers via '${_name}Config.cmake'") + message(VERBOSE "${TARGET} added support for cmake consumers via '${_name}Config.cmake'") if(NOT "${_type}" STREQUAL "INTERFACE_LIBRARY" OR Argument_TREAT_AS_NORMAL) # The alias is used by local targets project @@ -294,7 +294,7 @@ function(HeaderOnlyInstallPackageConfig) endif() endforeach() - message(STATUS "${TARGET} added support for generic consumers via ${_pc_filename}") + message(VERBOSE "${TARGET} added support for generic consumers via ${_pc_filename}") configure_file( "${_pc_template}" "${CMAKE_CURRENT_BINARY_DIR}/${_pc_filename}" diff --git a/docs/introduction/build_linux.md b/docs/introduction/build_linux.md index 15ebaa4fd..c8ccb5373 100644 --- a/docs/introduction/build_linux.md +++ b/docs/introduction/build_linux.md @@ -37,7 +37,7 @@ git clone https://github.com/rdkcentral/ThunderTools.git ``` Next, we need to run the following commands to build and then install the code generators inside ThunderTools: ```shell -cmake -G Ninja -S ThunderTools -B build/ThunderTools -DCMAKE_INSTALL_PREFIX="install/usr" +cmake -G Ninja -S ThunderTools -B build/ThunderTools -DCMAKE_INSTALL_PREFIX="install" cmake --build build/ThunderTools --target install ``` @@ -54,17 +54,12 @@ Run the following commands to build and then install Thunder. The available `-DC ```shell cmake -G Ninja -S Thunder -B build/Thunder \ --DBUILD_SHARED_LIBS=ON \ -DBINDING="127.0.0.1" \ -DCMAKE_BUILD_TYPE="Debug" \ --DCMAKE_INSTALL_PREFIX="install/usr" \ --DCMAKE_MODULE_PATH="${PWD}/install/usr/include/Thunder/Modules" \ --DDATA_PATH="${PWD}/install/usr/share/Thunder" \ --DPERSISTENT_PATH="${PWD}/install/var/thunder" \ +-DCMAKE_INSTALL_PREFIX="install" \ -DPORT="55555" \ --DPROXYSTUB_PATH="${PWD}/install/usr/lib/thunder/proxystubs" \ --DSYSTEM_PATH="${PWD}/install/usr/lib/thunder/plugins" \ --DVOLATILE_PATH="tmp" +-DTOOLS_SYSROOT="${PWD}" \ +-DINITV_SCRIPT=OFF cmake --build build/Thunder --target install ``` @@ -84,8 +79,7 @@ Run the following commands to build and then install ThunderInterfaces: ```shell cmake -G Ninja -S ThunderInterfaces -B build/ThunderInterfaces \ --DCMAKE_INSTALL_PREFIX="install/usr" \ --DCMAKE_MODULE_PATH="${PWD}/install/usr/include/Thunder/Modules" +-DCMAKE_INSTALL_PREFIX="install" cmake --build build/ThunderInterfaces --target install ``` @@ -107,24 +101,18 @@ In the command below, there is a complete list of plugins that do not require an ```shell cmake -G Ninja -S ThunderNanoServices -B build/ThunderNanoServices \ --DCMAKE_INSTALL_PREFIX="install/usr" \ --DCMAKE_MODULE_PATH="${PWD}/install/usr/include/Thunder/Modules" \ +-DCMAKE_INSTALL_PREFIX="install" \ -DPLUGIN_COMMANDER=ON \ --DPLUGIN_DHCPSERVER=ON \ -DPLUGIN_DIALSERVER=ON \ -DPLUGIN_DICTIONARY=ON \ -DPLUGIN_FILETRANSFER=ON \ --DPLUGIN_IOCONNECTOR=ON \ -DPLUGIN_INPUTSWITCH=ON \ --DPLUGIN_NETWORKCONTROL=ON \ -DPLUGIN_PROCESSMONITOR=ON \ -DPLUGIN_RESOURCEMONITOR=ON \ -DPLUGIN_SYSTEMCOMMANDS=ON \ -DPLUGIN_SWITCHBOARD=ON \ -DPLUGIN_WEBPROXY=ON \ --DPLUGIN_WEBSERVER=ON \ --DPLUGIN_WEBSHELL=ON \ --DPLUGIN_WIFICONTROL=ON +-DPLUGIN_WEBSHELL=ON cmake --build build/ThunderNanoServices --target install ``` @@ -143,11 +131,8 @@ In the command below, there is a complete list of plugins that do not require an ```shell cmake -G Ninja -S ThunderNanoServicesRDK -B build/ThunderNanoServicesRDK \ --DCMAKE_INSTALL_PREFIX="install/usr" \ --DCMAKE_MODULE_PATH="${PWD}/install/usr/include/Thunder/Modules" \ --DPLUGIN_DEVICEIDENTIFICATION=ON \ +-DCMAKE_INSTALL_PREFIX="install" \ -DPLUGIN_DEVICEINFO=ON \ --DPLUGIN_LOCATIONSYNC=ON \ -DPLUGIN_MESSAGECONTROL=ON \ -DPLUGIN_MESSENGER=ON \ -DPLUGIN_MONITOR=ON \ @@ -173,12 +158,10 @@ In the command below, there is a complete list of client libraries that do not r ```shell cmake -G Ninja -S ThunderClientLibraries -B build/ThunderClientLibraries \ --DCMAKE_INSTALL_PREFIX="install/usr" \ --DCMAKE_MODULE_PATH="${PWD}/install/usr/include/Thunder/Modules" \ +-DCMAKE_INSTALL_PREFIX="install" \ -DBLUETOOTHAUDIOSINK=ON \ -DDEVICEINFO=ON \ -DDISPLAYINFO=ON \ --DLOCALTRACER=ON \ -DSECURITYAGENT=ON \ -DPLAYERINFO=ON \ -DPROTOCOLS=ON \ @@ -205,8 +188,7 @@ Run the following commands to build and then install ThunderUI: ```shell cmake -G Ninja -S ThunderUI -B build/ThunderUI \ --DCMAKE_INSTALL_PREFIX="install/usr" \ --DCMAKE_MODULE_PATH="${PWD}/install/usr/include/Thunder/Modules" +-DCMAKE_INSTALL_PREFIX="install" cmake --build build/ThunderUI --target install ``` @@ -219,10 +201,10 @@ After everything has been built and installed correctly, we can run Thunder. Since we installed Thunder in a custom installation directory, we need to provide an `LD_LIBRARY_PATH` to that location and set `PATH` to include the `bin` directory. If the libraries are installed in system-wide locations (e.g. `/usr/lib` and `/usr/bin`) then those environment variables are not required ```shell -export LD_LIBRARY_PATH=${PWD}/install/usr/lib:${LD_LIBRARY_PATH} -export PATH=${PWD}/install/usr/bin:${PATH} +export LD_LIBRARY_PATH=${PWD}/install/lib:${LD_LIBRARY_PATH} +export PATH=${PWD}/install/bin:${PATH} -$ Thunder -f -c ${PWD}/install/etc/Thunder/config.json +Thunder -f -c ${PWD}/install/etc/Thunder/config.json ``` The following arguments should be specified to the Thunder binary: diff --git a/docs/introduction/intro.md b/docs/introduction/intro.md index 20e766218..3e2ed0d8e 100644 --- a/docs/introduction/intro.md +++ b/docs/introduction/intro.md @@ -4,7 +4,7 @@ ## Introduction -Thunder (aka Thunder) is developed by [Metrological](https://www.metrological.com/) (a Comcast company), and provides a way for STB operators to implement business-logic in a modular way using plugins, and a consistent way for applications to control and query those plugins. By using a plugin-based architecture, it is possible to build a device with only the specific features that are required for that particular device. +Thunder is developed by [Metrological](https://www.metrological.com/) (a Comcast company), and provides a way for STB operators to implement business-logic in a modular way using plugins, and a consistent way for applications to control and query those plugins. By using a plugin-based architecture, it is possible to build a device with only the specific features that are required for that particular device. !!! tip Do not confuse Thunder and [WPEWebKit](https://github.com/WebPlatformForEmbedded/WPEWebKit/). Whilst both are maintained by the Metrological/WPE team, they are not related. [WPEWebKit](https://github.com/WebPlatformForEmbedded/WPEWebKit/) is a fork of the WebKit browser for embedded devices, and shares no code with Thunder