add ENABLE_MAKE_UNIQUE flag for older gcc versions

-- fix #754
-- 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
pull/2/head
Michail Vourlakos 7 years ago
parent 1e09238bd4
commit 976bf2f684

@ -56,11 +56,11 @@ include(WriteBasicConfigVersionFile)
include(Definitions.cmake) include(Definitions.cmake)
add_subdirectory(liblattedock)
add_subdirectory(app) add_subdirectory(app)
add_subdirectory(applets) add_subdirectory(applets)
add_subdirectory(containment) add_subdirectory(containment)
add_subdirectory(icons) add_subdirectory(icons)
add_subdirectory(liblattedock)
add_subdirectory(plasmoid) add_subdirectory(plasmoid)
add_subdirectory(shell) add_subdirectory(shell)

@ -7,6 +7,12 @@ set -e
build_type=$1 build_type=$1
build_type=${build_type:="Release"} 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 if ! [ -a build ] ; then
mkdir build mkdir build
fi fi
@ -21,13 +27,13 @@ if [ -a locale ] ; then
fi fi
if [ "$1" == "--translations" ] ; then 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 make fetch-translations
elif [ "$1" == "--translations-stable" ] ; then 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 make fetch-translations
else 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 make
fi 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 set(lattedock_SRCS
lattedockplugin.cpp lattedockplugin.cpp
quickwindowsystem.cpp quickwindowsystem.cpp

@ -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 #ifndef EXTRAS_H
#define EXTRAS_H #define EXTRAS_H
#include "../liblattedock/config-latte-lib.h"
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QStringBuilder> #include <QStringBuilder>
@ -15,6 +17,19 @@
#include <memory> #include <memory>
#include <cmath> #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>` * @brief convert a QRect to a QString with format `(<x>, <y>) <width>x<height>`
*/ */

Loading…
Cancel
Save