0027827: Samples - fix compilation errors in XAML (UWP) sample.
authorski <ski@opencascade.com>
Wed, 31 Aug 2016 09:35:03 +0000 (12:35 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 8 Sep 2016 08:41:35 +0000 (11:41 +0300)
Error about deployment target version was fixed.
Check of export to VRML format was added to sample XAML (UWP).

Add freetype.dll to the sample project for correct execution of sample from Visual Studio.

samples/xaml/CMakeLists.txt
samples/xaml/MainPage.xaml.cpp
samples/xaml/MainPage.xaml.h

index 26d988b..ee7ab9a 100644 (file)
@@ -51,10 +51,23 @@ source_group("Header Files" FILES ${HEADER_FILES})
 source_group("Resource Files" FILES ${RESOURCE_FILES})
 source_group("Xaml Files" FILES ${XAML_FILES})
 
-add_executable(uwp WIN32 ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES} ${XAML_FILES})
+if (USE_FREETYPE)
+  list (APPEND 3RDPARTY_DLLS "${3RDPARTY_FREETYPE_DLL}")
+  set_property(SOURCE ${3RDPARTY_DLLS} PROPERTY VS_DEPLOYMENT_CONTENT 1)
+endif()
+
+add_executable(uwp WIN32 ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES} ${XAML_FILES} ${3RDPARTY_DLLS})
 
 set_property(TARGET uwp PROPERTY VS_WINRT_COMPONENT TRUE)
 
+# Set Visual Studio Windows target platform minimum version equal to OS version
+string(REGEX MATCH "^([0-9]+\.[0-9]+\.[0-9]+)$" PLATFORM_WO_DEV_VER "${CMAKE_HOST_SYSTEM_VERSION}")
+if (PLATFORM_WO_DEV_VER)
+  # Add tailing zero to platfrom version 10.0.14393 -> 10.0.14393.0 to have correct version
+  set (CMAKE_HOST_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}.0")
+endif()
+set_property(TARGET uwp PROPERTY VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+
 set_property (TARGET uwp PROPERTY FOLDER Samples)
 
 if (SINGLE_GENERATOR)
@@ -93,7 +106,7 @@ set (uwp_USED_LIBS        TKernel
                           TKSTEP
                           TKXSBase
                           TKSTL
-#                         TKVRML
+                          TKVRML
                           )
 
-target_link_libraries (uwp ${uwp_USED_LIBS})
\ No newline at end of file
+target_link_libraries (uwp ${uwp_USED_LIBS})
index cee94f5..5466e3b 100644 (file)
@@ -256,14 +256,12 @@ void MainPage::OnClickDataExchange(Platform::Object^  theSender,
   if (SaveSTL(filePath, theBox))
     Output_TextBlock->Text += L"OK: export to .stl\n";
 
-/*
   // Export box to .vrml
   StringCchCopyW(filePath, _countof(filePath), tmpPath);
   StringCchCatW(filePath, _countof(filePath), L"/box.vrml");
 
   if (SaveVRML(filePath, theBox))
     Output_TextBlock->Text += L"OK: export to .vrml\n";
-*/
 }
 
 //=======================================================================
@@ -371,7 +369,6 @@ Standard_Boolean MainPage::SaveSTL(const wchar_t* theFilePath, const TopoDS_Shap
 //function : SaveVRML
 //purpose  : Export shape to .vrml
 //=======================================================================
-/*
 Standard_Boolean MainPage::SaveVRML(const wchar_t* theFilePath, const TopoDS_Shape& theShape)
 {
   VrmlAPI_Writer aWriter;
@@ -383,7 +380,6 @@ Standard_Boolean MainPage::SaveVRML(const wchar_t* theFilePath, const TopoDS_Sha
 
   return Standard_True;
 }
-*/
 
 //=======================================================================
 //function : ReadBREP
@@ -454,4 +450,4 @@ Standard_Boolean MainPage::ReadSTEP(const wchar_t* theFilePath, TopoDS_Shape& th
     return Standard_True;
   }
   return Standard_False;
-}
\ No newline at end of file
+}
index d59c600..93f08c9 100644 (file)
@@ -41,7 +41,7 @@ namespace uwp
     Standard_Boolean SaveIGES(const wchar_t* theFilePath, const TopoDS_Shape& theShape);
     Standard_Boolean SaveSTEP(const wchar_t* theFilePath, const TopoDS_Shape& theShape, const STEPControl_StepModelType theValue);
     Standard_Boolean SaveSTL (const wchar_t* theFilePath, const TopoDS_Shape& theShape);
-    // Standard_Boolean SaveVRML(const wchar_t* theFilePath, const TopoDS_Shape& theShape);
+    Standard_Boolean SaveVRML(const wchar_t* theFilePath, const TopoDS_Shape& theShape);
 
     // test data exchange import functionality
     Standard_Boolean ReadBREP(const wchar_t* theFilePath, TopoDS_Shape& theShape);