mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-27 14:50:21 +03:00
add ENABLE_MAKE_UNIQUE flag for older gcc versions
--make_unique function is not available for gcc<=4.8.x by enabling this flag in through install script or through cmake such systems can build latte correctly
This commit is contained in:
parent
995ce7ba7a
commit
14cfa0d4bf
@ -56,11 +56,11 @@ include(WriteBasicConfigVersionFile)
|
||||
|
||||
include(Definitions.cmake)
|
||||
|
||||
add_subdirectory(liblattedock)
|
||||
add_subdirectory(app)
|
||||
add_subdirectory(applets)
|
||||
add_subdirectory(containment)
|
||||
add_subdirectory(icons)
|
||||
add_subdirectory(liblattedock)
|
||||
add_subdirectory(plasmoid)
|
||||
add_subdirectory(shell)
|
||||
|
||||
|
12
install.sh
12
install.sh
@ -7,6 +7,12 @@ set -e
|
||||
build_type=$1
|
||||
build_type=${build_type:="Release"}
|
||||
|
||||
enable_make_unique=OFF
|
||||
|
||||
if [ "$1" == "--enable-make-unique" ] || [ "$2" == "--enable-make-unique" ] ; then
|
||||
enable_make_unique=ON
|
||||
fi
|
||||
|
||||
if ! [ -a build ] ; then
|
||||
mkdir build
|
||||
fi
|
||||
@ -21,13 +27,13 @@ if [ -a locale ] ; then
|
||||
fi
|
||||
|
||||
if [ "$1" == "--translations" ] ; then
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDE_L10N_BRANCH=trunk -DKDE_L10N_AUTO_TRANSLATIONS=ON -DCMAKE_BUILD_TYPE=$build_type ..
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDE_L10N_BRANCH=trunk -DKDE_L10N_AUTO_TRANSLATIONS=ON -DENABLE_MAKE_UNIQUE=$enable_make_unique -DCMAKE_BUILD_TYPE=$build_type ..
|
||||
make fetch-translations
|
||||
elif [ "$1" == "--translations-stable" ] ; then
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDE_L10N_BRANCH=stable -DKDE_L10N_AUTO_TRANSLATIONS=ON -DCMAKE_BUILD_TYPE=$build_type ..
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDE_L10N_BRANCH=stable -DKDE_L10N_AUTO_TRANSLATIONS=ON -DENABLE_MAKE_UNIQUE=$enable_make_unique -DCMAKE_BUILD_TYPE=$build_type ..
|
||||
make fetch-translations
|
||||
else
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDE_L10N_AUTO_TRANSLATIONS=OFF -DCMAKE_BUILD_TYPE=$build_type ..
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DKDE_L10N_AUTO_TRANSLATIONS=OFF -DENABLE_MAKE_UNIQUE=$enable_make_unique -DCMAKE_BUILD_TYPE=$build_type ..
|
||||
make
|
||||
fi
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-latte-lib.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-latte-lib.h)
|
||||
|
||||
set(lattedock_SRCS
|
||||
lattedockplugin.cpp
|
||||
quickwindowsystem.cpp
|
||||
|
6
liblattedock/config-latte-lib.h.cmake
Normal file
6
liblattedock/config-latte-lib.h.cmake
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef CONFIG_LATTE_LIB_H
|
||||
#define CONFIG_LATTE_LIB_H
|
||||
|
||||
#cmakedefine01 ENABLE_MAKE_UNIQUE
|
||||
|
||||
#endif // CONFIG_LATTE_LIB_H
|
@ -1,6 +1,8 @@
|
||||
#ifndef EXTRAS_H
|
||||
#define EXTRAS_H
|
||||
|
||||
#include "../liblattedock/config-latte-lib.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
@ -15,6 +17,19 @@
|
||||
#include <memory>
|
||||
#include <cmath>
|
||||
|
||||
//! There are gcc versions that dont support yet that function even though they
|
||||
//! publish themselves as C++14 compatible. Such a case is gcc 4.8.x that openSUSE
|
||||
//! LEAP 42.2-3 is using. By enabling this flag such systems can be build correctly.
|
||||
#if ENABLE_MAKE_UNIQUE
|
||||
namespace std {
|
||||
template<class T, class... Args>
|
||||
unique_ptr<T> make_unique(Args &&... args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief convert a QRect to a QString with format `(<x>, <y>) <width>x<height>`
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user