Merge "Clean up the code to build successfully on macOS" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 18 Nov 2020 17:46:41 +0000 (17:46 +0000)
committerGerrit Code Review <gerrit@review>
Wed, 18 Nov 2020 17:46:41 +0000 (17:46 +0000)
12 files changed:
.gitignore
automated-tests/src/dali/utc-Dali-Mutex.cpp
build/tizen/CMakeLists.txt
dali/devel-api/threading/mutex.cpp
dali/devel-api/threading/mutex.h
dali/internal/event/common/property-input-impl.h
dali/internal/event/events/pan-gesture/pan-gesture-detector-impl.h
dali/internal/event/events/pan-gesture/pan-gesture-recognizer.cpp
dali/internal/event/events/ray-test.h
dali/internal/event/rendering/vertex-buffer-impl.cpp
dali/internal/update/manager/frame-callback-processor.h
dali/internal/update/manager/update-proxy-impl.h

index 2912c11..56258a1 100644 (file)
@@ -46,3 +46,5 @@ libdali2-core.so*
 /packaging/home*
 compile_commands.json
 file-list.cmake
+compile_commands.json
+.clangd
index edbd1cc..a15d26f 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <iostream>
 #include <type_traits>
+#include <utility>
 
 using Dali::Mutex;
 using Dali::Thread;
@@ -49,6 +50,20 @@ int UtcDaliMutexSingleThread(void)
   }
   DALI_TEST_EQUALS(false, mutex3.IsLocked(), TEST_LOCATION);
 
+  {
+    Mutex mutex4;
+    Mutex mutex5(std::move(mutex4)); // move constructor
+    Mutex::ScopedLock lock(mutex5);
+    DALI_TEST_EQUALS(true, mutex5.IsLocked(), TEST_LOCATION);
+  }
+
+  {
+    Mutex mutex4, mutex5;
+    mutex5 = std::move(mutex4); // move assignment
+    Mutex::ScopedLock lock(mutex5);
+    DALI_TEST_EQUALS(true, mutex5.IsLocked(), TEST_LOCATION);
+  }
+
   END_TEST;
 }
 
index f174d4c..eb890c2 100644 (file)
@@ -140,6 +140,8 @@ IF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
 
 ELSEIF( UNIX )
 
+  INCLUDE(CheckCXXCompilerFlag)
+
   # Set up compiler flags and warnings
   ADD_COMPILE_OPTIONS( -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast )
 
@@ -149,8 +151,21 @@ ELSEIF( UNIX )
     ADD_COMPILE_OPTIONS( -Werror )
   ENDIF()
 
-  ADD_COMPILE_OPTIONS( -Wall -Wextra -Wno-unused-parameter -Wfloat-equal -Wno-class-memaccess -Wno-cast-function-type )
+  ADD_COMPILE_OPTIONS( -Wall -Wextra -Wno-unused-parameter -Wfloat-equal )
+  CHECK_CXX_COMPILER_FLAG(-Wno-class-memaccess HAVE_NO_CLASS_MEMACCESS)
+  IF (HAVE_NO_CLASS_MEMACCESS)
+    ADD_COMPILE_OPTIONS( -Wno-class-memaccess )
+  ENDIF()
+
+  CHECK_CXX_COMPILER_FLAG(-Wno-cast-function-type HAVE_NO_CAST_FUNCTION_TYPE)
+  IF (HAVE_NO_CAST_FUNCTION_TYPE)
+    ADD_COMPILE_OPTIONS( -Wno-cast-function-type )
+  ENDIF()
 
+  CHECK_CXX_COMPILER_FLAG(-Wno-string-plus-int HAVE_NO_STRING_PLUS_INT)
+  IF (HAVE_NO_STRING_PLUS_INT)
+    ADD_COMPILE_OPTIONS( -Wno-string-plus-int )
+  ENDIF()
   IF( ENABLE_COVERAGE OR "$ENV{CXXFLAGS}" MATCHES --coverage )
     ADD_COMPILE_OPTIONS( --coverage )
     SET(ENABLE_COVERAGE ON)
@@ -245,7 +260,7 @@ IF( INSTALL_CMAKE_MODULES )
   INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake DESTINATION share/${name} )
 
   # Install the pdb file.
-  IF( ENABLE_DEBUG )
+  IF( ENABLE_DEBUG AND WIN32 )
     install( FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/${name}.pdb DESTINATION ${BIN_DIR} )
   ENDIF()
 ELSE()
index 31c29b3..f8580de 100644 (file)
@@ -46,6 +46,24 @@ Mutex::~Mutex()
   delete mImpl;
 }
 
+Mutex::Mutex(Mutex&& rhs) noexcept
+  : mImpl(rhs.mImpl)
+{
+  rhs.mImpl = nullptr;
+}
+
+Mutex &Mutex::operator=(Mutex&& rhs) noexcept
+{
+  if (mImpl != rhs.mImpl)
+  {
+    delete mImpl;
+    mImpl = rhs.mImpl;
+    rhs.mImpl = nullptr;
+  }
+
+  return *this;
+}
+
 bool Mutex::IsLocked()
 {
   return mImpl->locked;
index b829b8b..925f363 100644 (file)
@@ -43,6 +43,16 @@ public:
   ~Mutex();
 
   /**
+   * @brief Move constructor
+   */
+  Mutex(Mutex&& rhs) noexcept;
+
+  /**
+   * @brief Move assignment
+   */
+  Mutex &operator=(Mutex&& rhs) noexcept;
+
+  /**
    * @brief Check if the mutex is locked
    * @return true if the mutex is locked
    */
index 081a81c..996fde7 100644 (file)
@@ -31,7 +31,7 @@
 #include <dali/public-api/math/matrix.h>
 #include <dali/internal/common/buffer-index.h>
 
-#if defined (ANDROID) || defined(WIN32)
+#if defined (ANDROID) || defined(WIN32) || defined(__APPLE__)
 namespace std
 {
 
index 46ca899..aa20b73 100644 (file)
@@ -40,7 +40,6 @@ namespace
 const float MINIMUM_MOTION_DISTANCE_BEFORE_PAN( 15.0f );
 const float MINIMUM_MOTION_DISTANCE_BEFORE_PAN_SQUARED( MINIMUM_MOTION_DISTANCE_BEFORE_PAN * MINIMUM_MOTION_DISTANCE_BEFORE_PAN );
 const float MINIMUM_MOTION_DISTANCE_TO_THRESHOLD_ADJUSTMENTS_RATIO( 2.0f / 3.0f );
-const unsigned long MAXIMUM_TIME_DIFF_ALLOWED( 500 );
 const unsigned long MINIMUM_TIME_BEFORE_THRESHOLD_ADJUSTMENTS( 100 );
 const unsigned int MINIMUM_MOTION_EVENTS_BEFORE_PAN(2);
 } // unnamed namespace
index 660d4e0..7190989 100644 (file)
@@ -24,8 +24,8 @@
 namespace Dali
 {
 
-class Vector2;
-class Vector4;
+struct Vector2;
+struct Vector4;
 
 namespace Internal
 {
index 84f7f18..9d131c7 100644 (file)
@@ -22,7 +22,7 @@
 #include <dali/public-api/rendering/vertex-buffer.h>
 #include <dali/internal/update/manager/update-manager.h>
 
-#if defined (ANDROID) || defined(WIN32)
+#if defined (ANDROID) || defined(WIN32) || defined(__APPLE__)
 namespace std
 {
   uint64_t _Hash_bytes(const void* bytes, uint64_t size, uint64_t seed)
index 09f4acd..2c27d8b 100644 (file)
@@ -67,7 +67,7 @@ public:
   FrameCallbackProcessor( const FrameCallbackProcessor& )            = delete;  ///< Deleted copy constructor.
   FrameCallbackProcessor( FrameCallbackProcessor&& )                 = default; ///< Default move constructor.
   FrameCallbackProcessor& operator=( const FrameCallbackProcessor& ) = delete;  ///< Deleted copy assignment operator.
-  FrameCallbackProcessor& operator=( FrameCallbackProcessor&& )      = default; ///< Default move assignment operator.
+  FrameCallbackProcessor& operator=( FrameCallbackProcessor&& )      = delete;  ///< Deleted move assignment operator.
 
   /**
    * Adds an implementation of the FrameCallbackInterface.
index 88fefbb..ac9c4a9 100644 (file)
@@ -70,7 +70,7 @@ public:
   UpdateProxy( const UpdateProxy& )            = delete;  ///< Deleted copy constructor.
   UpdateProxy( UpdateProxy&& )                 = default; ///< Default move constructor.
   UpdateProxy& operator=( const UpdateProxy& ) = delete;  ///< Deleted copy assignment operator.
-  UpdateProxy& operator=( UpdateProxy&& )      = default; ///< Default move assignment operator.
+  UpdateProxy& operator=( UpdateProxy&& )      = delete;  ///< Deleted move assignment operator.
 
   /**
    * @copydoc Dali::UpdateProxy::GetPosition()