[Scummvm-cvs-logs] SF.net SVN: scummvm:[55499] scummvm/trunk

littleboy at users.sourceforge.net littleboy at users.sourceforge.net
Mon Jan 24 13:41:03 CET 2011


Revision: 55499
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55499&view=rev
Author:   littleboy
Date:     2011-01-24 12:41:02 +0000 (Mon, 24 Jan 2011)

Log Message:
-----------
TOOLS: Add better Code::Blocks support to create_project

  - Update searchs path and library names to use the mingw precompiled libraries directly
  - Enhance batch file to handle the same arguments as the MSVC one

Modified Paths:
--------------
    scummvm/trunk/dists/codeblocks/create_codeblocks.bat
    scummvm/trunk/tools/create_project/codeblocks.cpp

Modified: scummvm/trunk/dists/codeblocks/create_codeblocks.bat
===================================================================
--- scummvm/trunk/dists/codeblocks/create_codeblocks.bat	2011-01-24 11:17:47 UTC (rev 55498)
+++ scummvm/trunk/dists/codeblocks/create_codeblocks.bat	2011-01-24 12:41:02 UTC (rev 55499)
@@ -1,13 +1,39 @@
 @echo off
+
 echo.
 echo Automatic creation of the Code::Blocks project files
 echo.
 
+if "%~1"=="/stable" goto stable
+if "%~1"=="/STABLE" goto stable
+if "%~1"=="/all"    goto all
+if "%~1"=="/ALL"    goto all
+if "%~1"=="/clean"  goto clean_check
+if "%~1"=="/CLEAN"  goto clean_check
+if "%~1"=="/help"   goto command_help
+if "%~1"=="/HELP"   goto command_help
+if "%~1"=="/?"      goto command_help
+
+if "%~1"==""        goto check_tool
+
+echo Invalid command parameter: %~1
+echo.
+
+:command_help
+echo Valid command parameters are:
+echo   stable   Generated stable engines project files
+echo   all      Generate all engines project files
+echo   clean    Clean generated project files
+echo   help     Show help message
+goto done
+
+:check_tool
 if not exist create_project.exe goto no_tool
 
 :question
 echo.
-set /p batchanswer="Enable (S)table engines only, or (A)ll engines? (S/A)"
+set batchanswer=S
+set /p batchanswer="Enable stable engines only, or all engines? (S/a)"
 if "%batchanswer%"=="s" goto stable
 if "%batchanswer%"=="S" goto stable
 if "%batchanswer%"=="a" goto all
@@ -21,14 +47,38 @@
 goto done
 
 :all
+echo.
 echo Creating project files with all engines enabled (stable and unstable)
+echo.
 create_project ..\.. --enable-all-engines --codeblocks
 goto done
 
 :stable
+echo.
 echo Creating normal project files, with only the stable engines enabled
+echo.
 create_project ..\.. --codeblocks
 goto done
 
+:clean_check
+echo.
+set cleananswer=N
+set /p cleananswer="This will remove all project files. Are you sure you want to continue? (N/y)"
+if "%cleananswer%"=="n" goto done
+if "%cleananswer%"=="N" goto done
+if "%cleananswer%"=="y" goto clean
+if "%cleananswer%"=="Y" goto clean
+goto clean_check
+
+:clean
+echo.
+echo Removing all project files
+del /Q *.cbp > NUL 2>&1
+del /Q *.workspace > NUL 2>&1
+del /Q *.depend > NUL 2>&1
+del /Q *.layout > NUL 2>&1
+goto done
+
 :done
-pause
\ No newline at end of file
+echo.
+pause

Modified: scummvm/trunk/tools/create_project/codeblocks.cpp
===================================================================
--- scummvm/trunk/tools/create_project/codeblocks.cpp	2011-01-24 11:17:47 UTC (rev 55498)
+++ scummvm/trunk/tools/create_project/codeblocks.cpp	2011-01-24 12:41:02 UTC (rev 55499)
@@ -57,6 +57,22 @@
 	             "</CodeBlocks_workspace_file>";
 }
 
+// HACK We need to pre-process library names
+//      since the MSVC and mingw precompiled
+//      librarie have different names :(
+std::string processLibraryName(std::string name) {
+	// Remove "_static" in lib name
+	size_t pos = name.find("_static");
+	if (pos != std::string::npos)
+		return name.replace(pos, 7, "");
+
+	// Replace "zlib" by "libz"
+	if (name == "zlib")
+		return "libz";
+
+	return name;
+}
+
 void CodeBlocksProvider::createProjectFile(const std::string &name, const std::string &, const BuildSetup &setup, const std::string &moduleDir,
                                            const StringList &includeList, const StringList &excludeList) {
 
@@ -78,7 +94,7 @@
 		std::string libraries;
 
 		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
-			libraries += *i + ".a;";
+			libraries += processLibraryName(*i) + ".a;";
 
 		project << "\t\t\t<Target title=\"default\">\n"
 		           "\t\t\t\t<Option output=\"scummvm\\scummvm\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
@@ -97,6 +113,7 @@
 		writeDefines(setup.defines, project);
 
 		project << "\t\t\t\t\t<Add directory=\"$(SCUMMVM_LIBS)include\" />\n"
+		           "\t\t\t\t\t<Add directory=\"$(SCUMMVM_LIBS)include\\SDL\" />\n"
 		           "\t\t\t\t\t<Add directory=\"..\\..\\engines\" />\n"
 		           "\t\t\t\t\t<Add directory=\"..\\..\\common\" />\n"
 		           "\t\t\t\t\t<Add directory=\"..\\..\" />\n"
@@ -107,7 +124,7 @@
 		project << "\t\t\t\t<Linker>\n";
 
 		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
-			project << "\t\t\t\t\t<Add library=\"" << *i << "\" />\n";
+			project << "\t\t\t\t\t<Add library=\"" << processLibraryName(*i) << "\" />\n";
 
 		for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
 			if (i->first == "scummvm")
@@ -117,6 +134,7 @@
 		}
 
 		project << "\t\t\t\t\t<Add directory=\"$(SCUMMVM_LIBS)lib\\mingw\" />\n"
+		           "\t\t\t\t\t<Add directory=\"$(SCUMMVM_LIBS)lib\" />\n"
 		           "\t\t\t\t</Linker>\n";
 
 		//////////////////////////////////////////////////////////////////////////


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list