Advertisement
Guest User

Build

a guest
Nov 6th, 2014
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.20 KB | None | 0 0
  1. // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
  2.  
  3. using System.IO;
  4. using UnrealBuildTool;
  5.  
  6.     public class Kinect2 : ModuleRules
  7.     {
  8.         public Kinect2(TargetInfo Target)
  9.         {
  10.             Type = ModuleType.External;
  11.             PublicIncludePaths.AddRange(
  12.                 new string[] {
  13.                     "Kinect2/Public",
  14.                     "Kinect2/Classes"
  15.                    
  16.                     // ... add public include paths required here ...
  17.                 }
  18.                 );
  19.  
  20.             PrivateIncludePaths.AddRange(
  21.                 new string[] {
  22.                     "Kinect2/Private",
  23.                     "Kinect2/Public"
  24.                    
  25.                     // ... add other private include paths required here ...
  26.                 }
  27.                 );
  28.  
  29.             PublicDependencyModuleNames.AddRange(
  30.                 new string[]
  31.                 {
  32.                     "Core",
  33.                     "CoreUObject",
  34.                     "Engine",
  35.                     "Slate",
  36.                     "InputDevice",
  37.                     "InputCore",
  38.                      "Kinect2"
  39.                    
  40.                     // ... add other public dependencies that you statically link with here ...
  41.                 }
  42.                 );
  43.  
  44.             PrivateDependencyModuleNames.AddRange(
  45.                 new string[]
  46.                 {
  47.                     "Core",
  48.                     "CoreUObject",
  49.                     "Engine"
  50.                     // ... add private dependencies that you statically link with here ...
  51.                 }
  52.                 );
  53.  
  54.             DynamicallyLoadedModuleNames.AddRange(
  55.                 new string[]
  56.                 {
  57.                     "Kinect2"
  58.                     // ... add any modules that your module loads dynamically here ...
  59.                 }
  60.                 );
  61.             LoadLibrary(Target);
  62.            
  63.         }
  64.         public bool LoadLibrary(TargetInfo Target)
  65.         {
  66.             Type = ModuleType.External;
  67.             bool isLibrarySupported = false;
  68.  
  69.             string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
  70.             string LibraryPath = Path.Combine(ModulePath, "ThirdParty", "KinectLib");
  71.            
  72.             string ArchitecturePath = "";
  73.  
  74.             if (Target.Platform == UnrealTargetPlatform.Win64 &&
  75.                 WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2013)
  76.             {
  77.                 ArchitecturePath = "amd64";
  78.  
  79.                 isLibrarySupported = true;
  80.             }
  81.             else if (Target.Platform == UnrealTargetPlatform.Win32 &&
  82.               WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2013)
  83.             {
  84.                
  85.                 ArchitecturePath = "x86";
  86.  
  87.                 isLibrarySupported = true;
  88.             }
  89.  
  90.             if (isLibrarySupported==true)
  91.             {
  92.                 // Add the architecture spacific path to the library files
  93.                 PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "lib", ArchitecturePath, "Kinect10.lib"));
  94.                 // Add a more generic path to the include header files
  95.                 PublicIncludePaths.Add(Path.Combine(LibraryPath, "inc"));
  96.                 PublicDelayLoadDLLs.AddRange(new string[] { LibraryPath + "lib" + ArchitecturePath  +"Microsoft.Kinect.dll" });
  97.             }
  98.            
  99.             Definitions.Add(string.Format("WITH_KINECT10_LIB_BINDING={0}", isLibrarySupported ? 1 : 0));
  100.            
  101.             return isLibrarySupported;
  102.  
  103.         }
  104.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement