MS Windows - Fix compile errors when debug is enabled. 95/222695/6
authorVictor Cebollada <v.cebollada@samsung.com>
Fri, 17 Jan 2020 07:36:58 +0000 (07:36 +0000)
committerVictor Cebollada <v.cebollada@samsung.com>
Mon, 20 Jan 2020 13:40:30 +0000 (13:40 +0000)
* Builds with VCPKG

Change-Id: I209c6e4d4ec470595dc75d60965cd3ca76ecc394
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
15 files changed:
README.md
build/tizen/CMakeLists.txt
dali/integration-api/core-enumerations.h
dali/integration-api/debug.cpp
dali/integration-api/debug.h
dali/integration-api/file.list
dali/integration-api/trace.h
dali/internal/event/common/demangler-unix.cpp [moved from dali/internal/event/common/demangler.cpp with 60% similarity]
dali/internal/event/common/demangler-windows.cpp [new file with mode: 0644]
dali/internal/event/common/demangler.h
dali/internal/event/common/type-registry-impl.cpp
dali/internal/file-unix.list [new file with mode: 0644]
dali/internal/file-windows.list [new file with mode: 0644]
dali/internal/file.list
dali/public-api/common/dali-common.h

index 17972bc..b78598d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@
          * [NON-SMACK Targets](#non-smack-targets)
          * [SMACK enabled Targets](#smack-enabled-targets)
          * [DEBUG Builds](#debug-builds)
+      * [3. Building for MS Windows](#3-building-for-ms-windows)
 
 # Build Instructions
 
@@ -91,3 +92,13 @@ See the README.md in dali-core/automated-tests.
 
          $ gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
 
+## 3. Building for MS Windows
+
+Third party dependencies are built using vcpkg. Instructions on how to install vcpkg can be found in the
+vcpkg-script folder in the windows-dependencies repository.
+
+- Download the windows-dependencies repository from DaliHub
+
+         $ git clone https://github.com/dalihub/windows-dependencies.git
+
+- Read the README.md and vcpkg-script/Readme.md files for more instructions on how to install and build the third-party dependencies.
\ No newline at end of file
index b41d996..1fea1cc 100644 (file)
@@ -135,6 +135,11 @@ INCLUDE( ${ROOT_SRC_DIR}/dali/internal/file.list )
 INCLUDE( ${ROOT_SRC_DIR}/dali/integration-api/file.list )
 INCLUDE( ${ROOT_SRC_DIR}/dali/public-api/file.list )
 INCLUDE( ${ROOT_SRC_DIR}/dali/devel-api/file.list )
+IF( UNIX )
+  INCLUDE( ${ROOT_SRC_DIR}/dali/internal/file-unix.list )
+ELSEIF( WIN32 )
+  INCLUDE( ${ROOT_SRC_DIR}/dali/internal/file-windows.list )
+ENDIF()
 INCLUDE( ${ROOT_SRC_DIR}/doc/file.list )
 
 SET(LIBTYPE SHARED)
index 24299f4..e11dc63 100644 (file)
@@ -23,6 +23,9 @@
 #include <dali/integration-api/context-notifier.h>
 #include <dali/integration-api/resource-policies.h>
 
+#undef FALSE
+#undef TRUE
+
 namespace Dali
 {
 
index b9b5044..84c9cdf 100644 (file)
@@ -61,7 +61,7 @@ namespace Integration
 namespace Log
 {
 
-thread_local LogFunction gthreadLocalLogFunction = NULL;
+thread_local LogFunction gthreadLocalLogFunction = nullptr;
 
 /* Forward declarations */
 std::string FormatToString(const char *format, ...);
@@ -92,7 +92,7 @@ void InstallLogFunction(const LogFunction& logFunction)
 
 void UninstallLogFunction()
 {
-  gthreadLocalLogFunction = NULL;
+  gthreadLocalLogFunction = nullptr;
 }
 
 #ifdef DEBUG_ENABLED
@@ -101,11 +101,11 @@ void UninstallLogFunction()
 Filter* Filter::gRender     = Filter::New(Debug::Concise, false, "LOG_RENDER");
 Filter* Filter::gResource   = Filter::New(Debug::Concise, false, "LOG_RESOURCE");
 Filter* Filter::gGLResource = Filter::New(Debug::Concise, false, "LOG_GL_RESOURCE");
-Filter* Filter::gObject     = NULL;
+Filter* Filter::gObject     = nullptr;
 Filter* Filter::gImage      = Filter::New(Debug::Concise, false, "LOG_IMAGE");
 Filter* Filter::gModel      = Filter::New(Debug::Concise, false, "LOG_MODEL");
-Filter* Filter::gNode       = NULL;
-Filter* Filter::gElement    = NULL;
+Filter* Filter::gNode       = nullptr;
+Filter* Filter::gElement    = nullptr;
 Filter* Filter::gActor      = Filter::New(Debug::Concise, false, "LOG_ACTOR");
 Filter* Filter::gShader     = Filter::New(Debug::Concise, false, "LOG_SHADER");
 
@@ -179,7 +179,7 @@ void Filter::Log(LogLevel level, const char* format, ...)
 
     if( mTraceEnabled )
     {
-      char *buffer = NULL;
+      char *buffer = nullptr;
       int numChars = asprintf( &buffer, "    %-*c %s", mNesting, ':', format );
       if( numChars >= 0 ) // No error
       {
@@ -226,7 +226,6 @@ TraceObj::~TraceObj()
 
 #endif // DEBUG_ENABLED
 
-
 std::string ArgListToString(const char *format, va_list args)
 {
   std::string str; // empty string
index 807c0d0..d1313a8 100755 (executable)
@@ -142,7 +142,7 @@ DALI_CORE_API void UninstallLogFunction();
 /**
  * Provides unfiltered logging for global warning level messages
  */
-#define DALI_LOG_WARNING(format, ...)   Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, __PRETTY_FUNCTION__, ## __VA_ARGS__)
+#define DALI_LOG_WARNING(format, ...)   Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, ASSERT_LOCATION, ## __VA_ARGS__)
 
 
 #else // DEBUG_ENABLED
@@ -354,10 +354,10 @@ public:
 
 
 #define DALI_LOG_TRACE_METHOD_FMT(filter, format, ...)                 \
-  Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__)
+  Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, ASSERT_LOCATION, ## __VA_ARGS__)
 
 #define DALI_LOG_TRACE_METHOD(filter)                                      \
-  Dali::Integration::Log::TraceObj debugTraceObj(filter, __PRETTY_FUNCTION__)
+  Dali::Integration::Log::TraceObj debugTraceObj(filter, ASSERT_LOCATION)
 
 
 #else // DEBUG_ENABLED
index e03ced4..a6d44bf 100644 (file)
@@ -1,7 +1,7 @@
 # Set the source directory
 SET( platform_abstraction_src_dir ${ROOT_SRC_DIR}/dali/integration-api )
 
-# Add platform abstraction headers here
+# Add platform abstraction source files here
 SET( platform_abstraction_src_files
    ${platform_abstraction_src_dir}/bitmap.cpp
    ${platform_abstraction_src_dir}/core.cpp
index c884a71..fe9a3bd 100644 (file)
@@ -198,7 +198,7 @@ namespace
  * Used for function tracing. It logs tracing of the fuction from start to end.
  */
 #define DALI_TRACE_FUNCTION( filter ) \
-  Dali::Integration::Trace::Tracer logTraceFunction( filter, __PRETTY_FUNCTION__ );
+  Dali::Integration::Trace::Tracer logTraceFunction( filter, ASSERT_LOCATION );
 
 /**
  * Used for scope tracing. It logs tracing around a scope.
similarity index 60%
rename from dali/internal/event/common/demangler.cpp
rename to dali/internal/event/common/demangler-unix.cpp
index 5a2caed..07a63a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  */
 
-//
-// gcc and clang minimal demangling
-// Both follow Itanium C++ ABI
-//
-// We only decode namespaces and class typeid names for simplicity as its all we need.
-//
-// From http://mentorembedded.github.io/cxx-abi/abi.html#mangling-structure
-//
-// <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
-//     ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
-//
-// <prefix> ::= <prefix> <unqualified-name>
-//     ::= <template-prefix> <template-args>
-//          ::= <template-param>
-//          ::= <decltype>
-//     ::= # empty
-//     ::= <substitution>
-//          ::= <prefix> <data-member-prefix>
-//
-// <template-prefix> ::= <prefix> <template unqualified-name>
-//                   ::= <template-param>
-//                   ::= <substitution>
-// <unqualified-name> ::= <operator-name>
-//                    ::= <ctor-dtor-name>
-//                    ::= <source-name>
-//                    ::= <unnamed-type-name>
-//
-// <source-name> ::= <positive length number> <identifier>
-// <number> ::= [n] <non-negative decimal integer>
-// <identifier> ::= <unqualified source code identifier>
-//
-// So for example
-//
-// Dali::Internal::Actor would be
-//
-//   N4Dali8Internal5ActorE
-//
-
-// CLASS HEADER
+// FILE HEADER
 #include <dali/internal/event/common/demangler.h>
 
+// INTERNAL HEADERS
+#include <dali/public-api/common/vector-wrapper.h>
+
 namespace
 {
 
@@ -98,21 +63,17 @@ size_t GetNumberOfCharacters(const std::string& s, const size_t& start, int& res
   return i - start;
 }
 
-} // anon namespace
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-#if defined(__clang__) || defined(__GNUC__)
-
-// Demangle class name mangled according to the Itanium C++ ABI
-// Returns demangled names ie "N4Dali8Internal5ActorE" is ["Dali","Internal","Actor"]
+/**
+ * @brief Demangle a nested typeid name into its component parts.
+ * A nested type name is one containing namespaces and class names only.
+ *   eg DemangleNestedNames(typeid(Dali::Actor).name());
+ * @param[in] typeIdName The type id name string to demangle.
+ * @returns the demangled list of names ie ["Dali","Actor"] or an empty list
+ */
 std::vector<std::string> DemangleNestedNames(const char *typeIdName)
 {
+  // Demangle class name mangled according to the Itanium C++ ABI
+  // Returns demangled names ie "N4Dali8Internal5ActorE" is ["Dali","Internal","Actor"]
   std::vector<std::string> ret;
 
   const std::string mangledName(typeIdName);
@@ -143,10 +104,13 @@ std::vector<std::string> DemangleNestedNames(const char *typeIdName)
   return ret;
 }
 
-#else
-# error Unsupported Compiler
-#endif
+} // anon namespace
 
+namespace Dali
+{
+
+namespace Internal
+{
 
 const std::string DemangleClassName(const char *typeIdName)
 {
diff --git a/dali/internal/event/common/demangler-windows.cpp b/dali/internal/event/common/demangler-windows.cpp
new file mode 100644 (file)
index 0000000..9d6612a
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include <dali/internal/event/common/demangler.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+const std::string DemangleClassName(const char *typeIdName)
+{
+  std::string name = typeIdName;
+  int index = name.find_last_of(' ');
+
+  if( 0 <= index )
+  {
+    name = name.substr( index + 1, name.size() - index );
+  }
+
+  index = name.find_last_of(':');
+
+  if( 0 <= index )
+  {
+    name = name.substr(index + 1, name.size() - index);
+  }
+
+  return name;
+}
+
+} // namespace Internal
+
+} // namespace Dali
index 3e63ac8..4d9790b 100644 (file)
@@ -21,9 +21,6 @@
 // EXTERNAL INCLUDES
 #include <string>
 
-// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-
 namespace Dali
 {
 
@@ -31,16 +28,7 @@ namespace Internal
 {
 
 /**
- * Demangle a nested typeid name into its component parts.
- * A nested type name is one containing namespaces and class names only.
- *   eg DemangleNestedNames(typeid(Dali::Actor).name());
- * @param[in] typeIdName The type id name string to demangle.
- * @returns the demangled list of names ie ["Dali","Actor"] or an empty list
- */
-std::vector<std::string> DemangleNestedNames(const char *typeIdName);
-
-/**
- * Demangle a nested typeid name to its class name.
+ * @brief Demangle a nested typeid name to its class name.
  * @param[in] typeIdName The type id name string to demangle.
  * @returns the class name ie "Actor" or an empty string
  */
index 2495d5f..99c3337 100644 (file)
 #include <dali/internal/event/common/type-registry-impl.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/event/common/thread-local-storage.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/internal/event/actors/custom-actor-internal.h>
 #include <dali/internal/event/common/demangler.h>
+#include <dali/internal/event/common/thread-local-storage.h>
 
 #include <dali/integration-api/debug.h>
 
@@ -39,8 +39,6 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_TYP
 namespace Dali
 {
 
-extern std::string Demangle(const char* symbol);
-
 namespace Internal
 {
 
diff --git a/dali/internal/file-unix.list b/dali/internal/file-unix.list
new file mode 100644 (file)
index 0000000..23fe533
--- /dev/null
@@ -0,0 +1,11 @@
+# Set the source directory
+SET( internal_src_dir ${ROOT_SRC_DIR}/dali/internal )
+
+# Add internal unix source files here
+SET( internal_unix_src_files
+  ${internal_src_dir}/event/common/demangler-unix.cpp
+)
+
+SET( SOURCES ${SOURCES}
+  ${internal_unix_src_files}
+)
\ No newline at end of file
diff --git a/dali/internal/file-windows.list b/dali/internal/file-windows.list
new file mode 100644 (file)
index 0000000..c636840
--- /dev/null
@@ -0,0 +1,11 @@
+# Set the source directory
+SET( internal_src_dir ${ROOT_SRC_DIR}/dali/internal )
+
+# Add internal windows source files here
+SET( internal_windows_src_files
+  ${internal_src_dir}/event/common/demangler-windows.cpp
+)
+
+SET( SOURCES ${SOURCES}
+  ${internal_windows_src_files}
+)
\ No newline at end of file
index 9bb1751..969d49a 100644 (file)
@@ -26,7 +26,6 @@ SET( internal_src_files
   ${internal_src_dir}/event/animation/linear-constrainer-impl.cpp
   ${internal_src_dir}/event/animation/path-impl.cpp
   ${internal_src_dir}/event/animation/path-constrainer-impl.cpp
-  ${internal_src_dir}/event/common/demangler.cpp
   ${internal_src_dir}/event/common/event-thread-services.cpp
   ${internal_src_dir}/event/common/notification-manager.cpp
   ${internal_src_dir}/event/common/object-impl.cpp
@@ -160,7 +159,6 @@ SET( internal_src_files
   ${internal_src_dir}/update/rendering/scene-graph-renderer.cpp
 )
 
-
 SET( SOURCES ${SOURCES}
   ${internal_src_files}
 )
index c7e3215..d5424f8 100755 (executable)
@@ -169,7 +169,11 @@ public:
  * @SINCE_1_0.0
  */
 #if defined(DEBUG_ENABLED)
+#if defined(WIN32)
+#define ASSERT_LOCATION __FUNCSIG__
+#else
 #define ASSERT_LOCATION __PRETTY_FUNCTION__
+#endif
 #else
 #define ASSERT_LOCATION NULL
 #endif