Merge pull request #35 from bofeng-song/v3

fix can`t debug vs project
This commit is contained in:
cocoscodeide 2014-06-19 17:27:20 +08:00
commit 8a1d170f0d
3 changed files with 78 additions and 20 deletions

View File

@ -807,6 +807,61 @@ tolua_lerror:
return 0; return 0;
} }
int lua_cocos2dx_runtime_setSearchPaths(lua_State* tolua_S)
{
int argc = 0;
cocos2d::FileUtils* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_runtime_setSearchPaths'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::vector<std::string> vecPaths;
ok &= luaval_to_std_vector_string(tolua_S, 2,&vecPaths);
if(!ok)
return 0;
for (int i = 0; i < vecPaths.size(); i++)
{
if (!FileUtils::getInstance()->isAbsolutePath(vecPaths[i]))
vecPaths[i] = g_resourcePath + vecPaths[i];
}
cobj->setSearchPaths(vecPaths);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSearchPaths",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_runtime_setSearchPaths'.",&tolua_err);
#endif
return 0;
}
static void register_runtime_override_function(lua_State* tolua_S) static void register_runtime_override_function(lua_State* tolua_S)
{ {
lua_pushstring(tolua_S, "cc.FileUtils"); lua_pushstring(tolua_S, "cc.FileUtils");
@ -814,6 +869,8 @@ static void register_runtime_override_function(lua_State* tolua_S)
if (lua_istable(tolua_S,-1)) if (lua_istable(tolua_S,-1))
{ {
tolua_function(tolua_S,"addSearchPath",lua_cocos2dx_runtime_addSearchPath); tolua_function(tolua_S,"addSearchPath",lua_cocos2dx_runtime_addSearchPath);
tolua_function(tolua_S,"setSearchPaths",lua_cocos2dx_runtime_setSearchPaths);
} }
lua_pop(tolua_S, 1); lua_pop(tolua_S, 1);
} }

View File

@ -78,6 +78,7 @@
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(ProjectDir)../../../runtime/win32/$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -85,6 +86,8 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>$(ProjectDir)../../../runtime/win32/$(TargetName).pdb</ProgramDatabaseFile>
<OutputFile>$(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt)</OutputFile>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
@ -105,21 +108,17 @@
</Midl> </Midl>
<PreBuildEvent> <PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)" <Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource" xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y
mkdir "$(OutDir)\Resource" xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y</Command>
mkdir "$(OutDir)\Resource\src"
mkdir "$(OutDir)\Resource\res"
xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y
xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y
xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y
copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y
xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y</Command>
<Message>copy files</Message> <Message>copy files</Message>
</PreBuildEvent> </PreBuildEvent>
<PreLinkEvent> <PreLinkEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)" <Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"</Command> xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"</Command>
</PreLinkEvent> </PreLinkEvent>
<PostBuildEvent>
<Command>xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32\"</Command>
</PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
@ -134,6 +133,7 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"</C
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(ProjectDir)../../../runtime/win32/$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -141,6 +141,8 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"</C
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt)</OutputFile>
<ProgramDatabaseFile>$(ProjectDir)../../../runtime/win32/$(TargetName).pdb</ProgramDatabaseFile>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
@ -161,15 +163,8 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"</C
</Midl> </Midl>
<PreBuildEvent> <PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)" <Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource" xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y
mkdir "$(OutDir)\Resource" xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y</Command>
mkdir "$(OutDir)\Resource\src"
mkdir "$(OutDir)\Resource\res"
xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y
xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y
xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y
copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y
xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y</Command>
<Message>copy files</Message> <Message>copy files</Message>
</PreBuildEvent> </PreBuildEvent>
<PreLinkEvent> <PreLinkEvent>

View File

@ -2,9 +2,15 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ShowAllFiles>false</ShowAllFiles> <ShowAllFiles>false</ShowAllFiles>
<LocalDebuggerWorkingDirectory Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)/Resource</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)../../../../runtime/win32/</LocalDebuggerWorkingDirectory>
<LocalDebuggerWorkingDirectory Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)/Resource</LocalDebuggerWorkingDirectory>
<DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WindowsLocalDebugger</DebuggerFlavor>
<DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)../../../../runtime/win32/</LocalDebuggerWorkingDirectory>
<LocalDebuggerCommand>$(OutDir)../../../../runtime/win32/$(TargetFileName)</LocalDebuggerCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommand>$(OutDir)../../../../runtime/win32/$(TargetFileName)</LocalDebuggerCommand>
</PropertyGroup>
</Project> </Project>