Merge pull request #352 from DavidWyand-GG/ProjGenFileCopy

Project Generator File Copy
This commit is contained in:
David Wyand 2013-04-21 14:13:22 -07:00
commit 88a319179b
7 changed files with 78 additions and 0 deletions

View file

@ -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 )

View file

@ -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 );
}
}
}
}

View file

@ -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
{

View file

@ -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();

View file

@ -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' );

View file

@ -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();

View file

@ -315,6 +315,11 @@ function addProjectIgnoreDefaultLib( $lib )
Generator::addProjectIgnoreDefaultLib( $lib );
}
function copyFileToProject( $sourcePath, $projPath )
{
Generator::copyFileToProject( $sourcePath, $projPath );
}
function addProjectDependency( $pd )
{
Generator::addProjectDependency( $pd );