Specified C++17 standard for the CMake projects. 45/240645/6
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 10 Aug 2020 08:12:08 +0000 (09:12 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Mon, 10 Aug 2020 10:50:14 +0000 (11:50 +0100)
Change-Id: I063ee68f3c5e5abeea01198141e7082c0e080867
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
README.md
build/tizen/CMakeLists.txt
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
examples/sparkle/sparkle-effect-example.cpp

index 140fd00..cff0224 100644 (file)
--- a/README.md
+++ b/README.md
 
  - Ubuntu 16.04 or later
  - Environment created using dali_env script in dali-core repository
- - GCC version 6
-
-DALi requires a compiler supporting C++11 features.
-Ubuntu 16.04 is the first version to offer this by default (GCC v5.4.0).
+ - GCC version 9
 
-GCC version 6 is recommended since it has fixes for issues in version 5
-e.g. it avoids spurious 'defined but not used' warnings in header files.
+DALi requires a compiler supporting C++17 features.
 
 ### Building the Repository
 
index 82c7ab4..4c79f6d 100644 (file)
@@ -1,4 +1,6 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(CMAKE_C_STANDARD 99)
 PROJECT(dali-demo C CXX)
 
 SET(dali-demo_VERSION_MAJOR 1)
@@ -304,8 +306,10 @@ ENDIF(INTERNATIONALIZATION)
 IF( WIN32 )
   ADD_COMPILE_OPTIONS( /FIdali-windows-dependencies.h ) # Adds missing definitions.
   ADD_COMPILE_OPTIONS( /vmg )                           # Avoids a 'reinterpret_cast' compile error while compiling signals and callbacks.
+  ADD_COMPILE_OPTIONS( /std:c++17 )                     # c++17 support
   ADD_COMPILE_OPTIONS( /wd4251 )                        # Ignores warning C4251: "'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'"
 ELSE()
+  ADD_COMPILE_OPTIONS( -std=c++17 )                     # c++17 support
   SET(DALI_DEMO_CFLAGS "${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE")
 
   IF( NOT ${ENABLE_EXPORTALL} )
index 1242d95..cd6c837 100644 (file)
@@ -48,6 +48,8 @@
 #include <iostream>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
+#include <random>       // std::default_random_engine
+#include <chrono>       // std::chrono::system_clock
 
 // INTERNAL INCLUDES
 #include "grid-flags.h"
@@ -417,8 +419,10 @@ public:
       }
     }
     // Stir-up the list to get some nice irregularity in the generated field:
-    std::random_shuffle( configurations.begin(), configurations.end() );
-    std::random_shuffle( configurations.begin(), configurations.end() );
+    unsigned int seed = std::chrono::system_clock::now().time_since_epoch().count();
+    std::shuffle( configurations.begin(), configurations.end(), std::default_random_engine(seed) );
+    seed = std::chrono::system_clock::now().time_since_epoch().count();
+    std::shuffle( configurations.begin(), configurations.end(), std::default_random_engine(seed) );
 
     // Place the images in the grid:
 
index 67af10f..a1444fa 100644 (file)
@@ -21,6 +21,8 @@
 #include <sstream>
 #include <algorithm>
 #include <map>
+#include <random>       // std::default_random_engine
+#include <chrono>       // std::chrono::system_clock
 
 #include "shared/utility.h"
 #include "sparkle-effect.h"
@@ -126,7 +128,8 @@ private:
     {
       shuffleArray[i] = i;
     }
-    std::random_shuffle(&shuffleArray[0],&shuffleArray[NUM_PARTICLE]);
+    const unsigned int seed = std::chrono::system_clock::now().time_since_epoch().count();
+    std::shuffle(&shuffleArray[0],&shuffleArray[NUM_PARTICLE], std::default_random_engine(seed));
 
     // Create vertices