diff --git a/Tools/projectGenerator/classes/Generator.php b/Tools/projectGenerator/classes/Generator.php index 586936e3d..257b3933b 100644 --- a/Tools/projectGenerator/classes/Generator.php +++ b/Tools/projectGenerator/classes/Generator.php @@ -319,6 +319,17 @@ class Generator self::$project_cur->moduleDefinitionFile = $mdef; } + static function copyFileToProject( $sourcePath, $projectDestPath ) + { + // Create the array to hold the source and destination + $paths = array(); + array_push( $paths, $sourcePath ); + array_push( $paths, $projectDestPath ); + + // Add to the project + array_push( self::$project_cur->fileCopyPaths, $paths ); + } + static function beginModule( $name ) { if( !self::$module_cur ) diff --git a/Tools/projectGenerator/classes/Project.php b/Tools/projectGenerator/classes/Project.php index d94749a78..068174c70 100644 --- a/Tools/projectGenerator/classes/Project.php +++ b/Tools/projectGenerator/classes/Project.php @@ -48,6 +48,7 @@ class Project public $libsIgnore; // Ignore Specific Default Libraries public $lib_dirs; // Additional library search paths public $lib_includes; // libs to include (generated by modules) + public $fileCopyPaths; // Source and desitnation (relative to project) paths of files to copy into project public $additionalExePath; // Additional section to inject into executable path public $dependencies; // Projects this project depends on public $references; // for managed projects, references to required assemblies @@ -87,6 +88,7 @@ class Project $this->libsIgnore = array(); $this->lib_dirs = array(); $this->lib_includes = array(); + $this->fileCopyPaths = array(); $this->outputs = array(); $this->dependencies = array(); $this->disabledWarnings = array(); @@ -570,6 +572,42 @@ class Project $this->includes = $saved_includes; $this->lib_dirs = $saved_lib_dirs; } + + // Copy any files into the project + foreach( $this->fileCopyPaths as $paths ) + { + $source = $paths[0]; + $dest = $paths[1]; + + // We need forward slashes for paths. + $source = str_replace( "\\", "/", $source); + $dest = str_replace( "\\", "/", $dest); + + // Remove trailing slashes. + $source = rtrim($source, " /"); + $dest = rtrim($dest, " /"); + + // Remove any beginning slash from the destination + $dest = ltrim($dest, " /"); + + // Build full destination path + $fullDest = $base_dir . "/" . $dest; + + echo( " o Copying file " . $source . " to " . $fullDest . "\n" ); + if(!copy($source, $fullDest)) + { + trigger_error( + "\n*******************************************************************". + "\n". + "\n Unable to copy required file for project!". + "\n". + "Source file: " . $source . "\n" . + "Destination file: " . $fullDest . "\n" . + "\n". + "\n*******************************************************************". + "\n", E_USER_ERROR ); + } + } } } diff --git a/Tools/projectGenerator/modules/fmod.inc b/Tools/projectGenerator/modules/fmod.inc index f1ee77e31..377ec798f 100644 --- a/Tools/projectGenerator/modules/fmod.inc +++ b/Tools/projectGenerator/modules/fmod.inc @@ -64,6 +64,10 @@ beginModule( 'fmod' ); { addIncludePath( $FMOD_SDK_PATH . "/api/inc" ); addIncludePath( $FMOD_SDK_PATH . "/fmoddesignerapi/api/inc" ); + + // File Copy + copyFileToProject( $FMOD_SDK_PATH . "/api/fmodex.dll", "/game/fmodex.dll" ); + copyFileToProject( $FMOD_SDK_PATH . "/fmoddesignerapi/api/fmod_event.dll", "/game/fmod_event.dll" ); } else { diff --git a/Tools/projectGenerator/modules/leapMotion.inc b/Tools/projectGenerator/modules/leapMotion.inc index 06377c681..d25e8df4c 100644 --- a/Tools/projectGenerator/modules/leapMotion.inc +++ b/Tools/projectGenerator/modules/leapMotion.inc @@ -72,6 +72,12 @@ beginModule( 'leapMotion' ); // Libs addProjectLibDir( $LEAPMOTION_SDK_PATH . "/lib/x86" ); addProjectLibInput( "Leap.lib", "Leapd.lib" ); + + // File Copy for Release + copyFileToProject( $LEAPMOTION_SDK_PATH . "/lib/x86/Leap.dll", "/game/Leap.dll" ); + + // File Copy for Debug + copyFileToProject( $LEAPMOTION_SDK_PATH . "/lib/x86/Leapd.dll", "/game/Leapd.dll" ); } endModule(); diff --git a/Tools/projectGenerator/modules/physX.inc b/Tools/projectGenerator/modules/physX.inc index 548c2a2cf..077241161 100644 --- a/Tools/projectGenerator/modules/physX.inc +++ b/Tools/projectGenerator/modules/physX.inc @@ -89,6 +89,13 @@ beginModule( 'physX' ); addProjectLibDir( $PHYSX_SDK_PATH . "/SDKs/lib/Win32" ); addProjectLibInput( "PhysXCooking.lib" ); addProjectLibInput( "PhysXLoader.lib" ); + + // File Copy + copyFileToProject( $PHYSX_SDK_PATH . "/Bin/win32/cudart32_30_9.dll", "/game/cudart32_30_9.dll" ); + copyFileToProject( $PHYSX_SDK_PATH . "/Bin/win32/PhysXCooking.dll", "/game/PhysXCooking.dll" ); + copyFileToProject( $PHYSX_SDK_PATH . "/Bin/win32/PhysXCore.dll", "/game/PhysXCore.dll" ); + copyFileToProject( $PHYSX_SDK_PATH . "/Bin/win32/PhysXDevice.dll", "/game/PhysXDevice.dll" ); + copyFileToProject( $PHYSX_SDK_PATH . "/Bin/win32/PhysXLoader.dll", "/game/PhysXLoader.dll" ); // For PhysX support. includeLib( 'nxCharacter' ); diff --git a/Tools/projectGenerator/modules/razerHydra.inc b/Tools/projectGenerator/modules/razerHydra.inc index e24a220be..c381c976b 100644 --- a/Tools/projectGenerator/modules/razerHydra.inc +++ b/Tools/projectGenerator/modules/razerHydra.inc @@ -68,6 +68,13 @@ beginModule( 'razerHydra' ); // Includes addIncludePath( $RAZERHYDRA_SDK_PATH . "/include" ); + + // File Copy for Release + copyFileToProject( $RAZERHYDRA_SDK_PATH . "/bin/win32/release_dll/sixense.dll", "/game/sixense.dll" ); + + // File Copy for Debug + copyFileToProject( $RAZERHYDRA_SDK_PATH . "/bin/win32/debug_dll/sixensed.dll", "/game/sixensed.dll" ); + copyFileToProject( $RAZERHYDRA_SDK_PATH . "/samples/win32/sixense_simple3d/DeviceDLL.dll", "/game/DeviceDLL.dll" ); // Only needed by the debug sixense library } endModule(); diff --git a/Tools/projectGenerator/projectGenUtils.inc b/Tools/projectGenerator/projectGenUtils.inc index b82657827..f3e599ac9 100644 --- a/Tools/projectGenerator/projectGenUtils.inc +++ b/Tools/projectGenerator/projectGenUtils.inc @@ -315,6 +315,11 @@ function addProjectIgnoreDefaultLib( $lib ) Generator::addProjectIgnoreDefaultLib( $lib ); } +function copyFileToProject( $sourcePath, $projPath ) +{ + Generator::copyFileToProject( $sourcePath, $projPath ); +} + function addProjectDependency( $pd ) { Generator::addProjectDependency( $pd );