Commit 05fc8381 authored by Jonas Stienen's avatar Jonas Stienen

Improving deploy structure, now user can build itaVA if has been forgotten....

Improving deploy structure, now user can build itaVA if has been forgotten. And Matlab scripts are copied by CMake instead of Matlab build procedure
parent 79113360
......@@ -51,7 +51,7 @@ add_definitions( "-DVAMATLAB_VERSION_MINOR=\"${ITA_VAMATLAB_VERSION_MINOR}\"" )
if( ITA_VAMATLAB_SHOW_BANNER )
add_definitions( "-DVAMATLAB_SHOW_BANNER" )
endif( )
# Sources
set( VAMATLAB_SRC
......@@ -81,7 +81,14 @@ set_target_properties( VAMatlab PROPERTIES SUFFIX ".${MATLAB_MEX_EXTENSION}")
# VA matlab scripts file
set( VAMATLAB_DEPLOY_DIR "${CMAKE_INSTALL_PREFIX}/bin" )
set( VAMATLAB_SCRIPT_DIR "${CMAKE_INSTALL_PREFIX}/matlab" )
set( VAMATLAB_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" )
set( VAMATLAB_BASE_DIR "${CMAKE_INSTALL_PREFIX}" )
configure_file( "matlab/itaVA_build.m.proto" "${CMAKE_CURRENT_SOURCE_DIR}/matlab/itaVA_build_absolute.m" @ONLY )
set( VAMATLAB_BASE_DIR ".." ) # relative path from matlab folder
configure_file( "matlab/itaVA_build.m.proto" "${CMAKE_CURRENT_SOURCE_DIR}/matlab/itaVA_build.m" @ONLY )
# Install specialties
install( FILES "matlab/itaVA_build.m" DESTINATION "matlab" )
install( FILES "matlab/itaVA.m.proto" DESTINATION "matlab" )
install( FILES "matlab/itaVA_generateStubs.m" DESTINATION "matlab" )
install( FILES "matlab/itaVA_example_simple.m" DESTINATION "matlab" )
install( FILES "matlab/itaVA_example_tracked_listener.m" DESTINATION "matlab" )
......@@ -10,33 +10,34 @@
% mechanism ('enumerateFunctions')
%
script_dir = '@VAMATLAB_SCRIPT_DIR@'; % Matlab scripts target directory
deploy_dir = '@VAMATLAB_DEPLOY_DIR@'; % Deploy directory, i.e. 'C:/dev/VA/dist/win32-x64.vc12'
lib_dir = '@VAMATLAB_LIB_DIR@';
va_base_dir = '@VAMATLAB_BASE_DIR@'; % VA folder with bin, lib, matlab, data etc.
va_script_dir = fullfile( va_base_dir, 'matlab' ); % Matlab scripts target directory
va_bin_dir = fullfile( va_base_dir, 'bin' );
va_lib_dir = fullfile( va_base_dir, 'lib' );
if exist( deploy_dir, 'dir' ) ~= 7
error( 'Deploy dir ''%s'' does not exist. Please build and install VAMatlab first.', deploy_dir )
if exist( va_bin_dir, 'dir' ) ~= 7
error( 'Deploy dir ''%s'' does not exist. Please build and install VAMatlab first.', va_bin_dir )
end
if exist( script_dir, 'dir' ) ~= 7
mkdir( script_dir );
if exist( va_script_dir, 'dir' ) ~= 7
mkdir( va_script_dir );
end
if exist( [ 'VAMatlab' '.' mexext ], 'file' )
warning( 'VAMatlab already found at location "%s", are you sure to build itaVA against this executable? Will proceed now.', which( 'VAMatlab' ) )
else
% Add to PATH temporarily and attempt to move lib to bin dir
addpath( script_dir, deploy_dir )
addpath( va_script_dir, va_bin_dir )
[ s ] = movefile( fullfile( lib_dir, 'VAMatlab*' ), deploy_dir );
[ s ] = movefile( fullfile( va_lib_dir, 'VAMatlab*' ), va_bin_dir );
if ~s && ~exist( [ 'VAMatlab' '.' mexext ], 'file' )
error( 'Could locate VAMatlab executable. Please make sure that it can be found.' )
error( 'Could not locate VAMatlab executable. Please make sure that it can be found.' )
end
end
% Parameters
templateFile = 'itaVA.m.proto';
outputFile = fullfile( script_dir, 'itaVA.m' );
outputFile = fullfile( va_script_dir, 'itaVA.m' );
fprintf( 'Generating code for itaVA Matlab class ''%s'' ...\n', outputFile );
code = fileread( templateFile );
......@@ -51,9 +52,7 @@ fclose( fid );
fprintf( 'Matlab class ''%s'' successfully built\n', outputFile );
% Install examples
copyfile( 'itaVA_example*', script_dir );
% Remove from MATLABPATH (otherwise naming conflicts may occur with
% ITA-Toolbox/applications/VirtualAcoustics/VA/* scripts)
rmpath( script_dir, deploy_dir )
rmpath( va_script_dir, va_bin_dir )
......@@ -216,7 +216,8 @@ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
REGISTER_PRIVATE_FUNCTION( enumerateFunctions );
void enumerateFunctions( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
void enumerateFunctions( int nlhs, mxArray *plhs[], int nrhs, const mxArray** )
{
// Count public functions
mwSize nPublicFuncs = 0;
for( FunctionMapIterator it = g_mFunctionMap.begin(); it != g_mFunctionMap.end(); ++it )
......@@ -229,8 +230,10 @@ void enumerateFunctions( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
plhs[ 0 ] = pStruct;
mwIndex i = 0;
for( FunctionMapIterator it = g_mFunctionMap.begin(); it != g_mFunctionMap.end(); ++it ) {
if( !it->second.bPublic ) continue;
for( FunctionMapIterator it = g_mFunctionMap.begin(); it != g_mFunctionMap.end(); ++it )
{
if( !it->second.bPublic )
continue;
// Input arguments
mxSetField( pStruct, i, ppszFieldNames[ 0 ], mxCreateString( it->second.sName.c_str() ) );
......@@ -1209,8 +1212,8 @@ DECLARE_FUNCTION_REQUIRED_INARG( createAudiofileSignalSource, filename, "string"
DECLARE_FUNCTION_OPTIONAL_INARG( createAudiofileSignalSource, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( createAudiofileSignalSource, signalSourceID, "string", "Signal source ID" );
void createAudiofileSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
void createAudiofileSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
......@@ -1223,6 +1226,22 @@ void createAudiofileSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxA
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( createTextToSpeechSignalSource, "Creates a text to speech signal", "Note: depending on mode, either Speech WAV files are generated and then played back, or TTS sentence is directly played back." );
DECLARE_FUNCTION_OPTIONAL_INARG( createTextToSpeechSignalSource, name, "string", "Displayed name", "''" );
DECLARE_FUNCTION_OUTARG( createTextToSpeechSignalSource, signalSourceID, "string", "Signal source ID" );
void createTextToSpeechSignalSource( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sName = matlabGetString( prhs[ 2 ], "name" );
std::string sID = pConnection->pCoreInterface->CreateTextToSpeechSignalSource( sName );
plhs[ 0 ] = mxCreateString( sID.c_str() );
}
// ------------------------------------------------------------
REGISTER_PUBLIC_FUNCTION( createEngineSignalSource, "Creates an engine signal source", "" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment