Commit 02656ebcfc3e0ccfe311dee0fa01d686709619d4

Authored by Victor Cebollada
1 parent 48b01135

Specified C++17 standard for the CMake projects.

Change-Id: I063ee68f3c5e5abeea01198141e7082c0e080867
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
README.md
@@ -25,13 +25,9 @@ @@ -25,13 +25,9 @@
25 25
26 - Ubuntu 16.04 or later 26 - Ubuntu 16.04 or later
27 - Environment created using dali_env script in dali-core repository 27 - Environment created using dali_env script in dali-core repository
28 - - GCC version 6  
29 -  
30 -DALi requires a compiler supporting C++11 features.  
31 -Ubuntu 16.04 is the first version to offer this by default (GCC v5.4.0). 28 + - GCC version 9
32 29
33 -GCC version 6 is recommended since it has fixes for issues in version 5  
34 -e.g. it avoids spurious 'defined but not used' warnings in header files. 30 +DALi requires a compiler supporting C++17 features.
35 31
36 ### Building the Repository 32 ### Building the Repository
37 33
build/tizen/CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  2 +
  3 +SET(CMAKE_C_STANDARD 99)
2 PROJECT(dali-demo C CXX) 4 PROJECT(dali-demo C CXX)
3 5
4 SET(dali-demo_VERSION_MAJOR 1) 6 SET(dali-demo_VERSION_MAJOR 1)
@@ -304,8 +306,10 @@ ENDIF(INTERNATIONALIZATION) @@ -304,8 +306,10 @@ ENDIF(INTERNATIONALIZATION)
304 IF( WIN32 ) 306 IF( WIN32 )
305 ADD_COMPILE_OPTIONS( /FIdali-windows-dependencies.h ) # Adds missing definitions. 307 ADD_COMPILE_OPTIONS( /FIdali-windows-dependencies.h ) # Adds missing definitions.
306 ADD_COMPILE_OPTIONS( /vmg ) # Avoids a 'reinterpret_cast' compile error while compiling signals and callbacks. 308 ADD_COMPILE_OPTIONS( /vmg ) # Avoids a 'reinterpret_cast' compile error while compiling signals and callbacks.
  309 + ADD_COMPILE_OPTIONS( /std:c++17 ) # c++17 support
307 ADD_COMPILE_OPTIONS( /wd4251 ) # Ignores warning C4251: "'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'" 310 ADD_COMPILE_OPTIONS( /wd4251 ) # Ignores warning C4251: "'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'"
308 ELSE() 311 ELSE()
  312 + ADD_COMPILE_OPTIONS( -std=c++17 ) # c++17 support
309 SET(DALI_DEMO_CFLAGS "${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE") 313 SET(DALI_DEMO_CFLAGS "${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE")
310 314
311 IF( NOT ${ENABLE_EXPORTALL} ) 315 IF( NOT ${ENABLE_EXPORTALL} )
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
@@ -48,6 +48,8 @@ @@ -48,6 +48,8 @@
48 #include <iostream> 48 #include <iostream>
49 #include <dali-toolkit/devel-api/controls/control-devel.h> 49 #include <dali-toolkit/devel-api/controls/control-devel.h>
50 #include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h> 50 #include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
  51 +#include <random> // std::default_random_engine
  52 +#include <chrono> // std::chrono::system_clock
51 53
52 // INTERNAL INCLUDES 54 // INTERNAL INCLUDES
53 #include "grid-flags.h" 55 #include "grid-flags.h"
@@ -417,8 +419,10 @@ public: @@ -417,8 +419,10 @@ public:
417 } 419 }
418 } 420 }
419 // Stir-up the list to get some nice irregularity in the generated field: 421 // Stir-up the list to get some nice irregularity in the generated field:
420 - std::random_shuffle( configurations.begin(), configurations.end() );  
421 - std::random_shuffle( configurations.begin(), configurations.end() ); 422 + unsigned int seed = std::chrono::system_clock::now().time_since_epoch().count();
  423 + std::shuffle( configurations.begin(), configurations.end(), std::default_random_engine(seed) );
  424 + seed = std::chrono::system_clock::now().time_since_epoch().count();
  425 + std::shuffle( configurations.begin(), configurations.end(), std::default_random_engine(seed) );
422 426
423 // Place the images in the grid: 427 // Place the images in the grid:
424 428
examples/sparkle/sparkle-effect-example.cpp
@@ -21,6 +21,8 @@ @@ -21,6 +21,8 @@
21 #include <sstream> 21 #include <sstream>
22 #include <algorithm> 22 #include <algorithm>
23 #include <map> 23 #include <map>
  24 +#include <random> // std::default_random_engine
  25 +#include <chrono> // std::chrono::system_clock
24 26
25 #include "shared/utility.h" 27 #include "shared/utility.h"
26 #include "sparkle-effect.h" 28 #include "sparkle-effect.h"
@@ -126,7 +128,8 @@ private: @@ -126,7 +128,8 @@ private:
126 { 128 {
127 shuffleArray[i] = i; 129 shuffleArray[i] = i;
128 } 130 }
129 - std::random_shuffle(&shuffleArray[0],&shuffleArray[NUM_PARTICLE]); 131 + const unsigned int seed = std::chrono::system_clock::now().time_since_epoch().count();
  132 + std::shuffle(&shuffleArray[0],&shuffleArray[NUM_PARTICLE], std::default_random_engine(seed));
130 133
131 // Create vertices 134 // Create vertices
132 135