Skip to content

Commit

Permalink
CREATE_PROJECT: Add stubs for Xcode provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Templier committed Jun 1, 2011
1 parent 9db33ea commit 9717d5b
Show file tree
Hide file tree
Showing 12 changed files with 200 additions and 6 deletions.
2 changes: 1 addition & 1 deletion devtools/README
Expand Up @@ -65,7 +65,7 @@ create_lure (dreammaster)

create_project (LordHoto, Littleboy)
--------------
Creates project files for Visual Studio 2005, 2008, 2010 and
Creates project files for Visual Studio 2005, 2008, 2010, Xcode and
Code::Blocks out of the configure / Makefile based build system.
It also offers a way to enable or disable certain engines and the use
of external libraries similar to configure. Run the tool without
Expand Down
2 changes: 2 additions & 0 deletions devtools/create_project/codeblocks/create_project.cbp
Expand Up @@ -47,6 +47,8 @@
<Unit filename="..\msvc.h" />
<Unit filename="..\visualstudio.cpp" />
<Unit filename="..\visualstudio.h" />
<Unit filename="..\xcode.cpp" />
<Unit filename="..\xcode.h" />
<Extensions>
<code_completion />
<envvars />
Expand Down
41 changes: 39 additions & 2 deletions devtools/create_project/create_project.cpp
Expand Up @@ -28,11 +28,12 @@

#include "config.h"
#include "create_project.h"
#include "codeblocks.h"

#include "codeblocks.h"
#include "msvc.h"
#include "visualstudio.h"
#include "msbuild.h"
#include "xcode.h"

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -107,7 +108,8 @@ typedef std::list<FSNode> FileList;
enum ProjectType {
kProjectNone,
kProjectCodeBlocks,
kProjectMSVC
kProjectMSVC,
kProjectXcode
};

int main(int argc, char *argv[]) {
Expand Down Expand Up @@ -175,6 +177,14 @@ int main(int argc, char *argv[]) {

projectType = kProjectMSVC;

} else if (!std::strcmp(argv[i], "--xcode")) {
if (projectType != kProjectNone) {
std::cerr << "ERROR: You cannot pass more than one project type!\n";
return -1;
}

projectType = kProjectXcode;

} else if (!std::strcmp(argv[i], "--msvc-version")) {
if (i + 1 >= argc) {
std::cerr << "ERROR: Missing \"version\" parameter for \"--msvc-version\"!\n";
Expand Down Expand Up @@ -463,6 +473,32 @@ int main(int argc, char *argv[]) {
provider = new CreateProjectTool::MSBuildProvider(globalWarnings, projectWarnings, msvcVersion);

break;

case kProjectXcode:
////////////////////////////////////////////////////////////////////////////
// Xcode is also using GCC behind the scenes. See Code::Blocks comment
// for info on all warnings
////////////////////////////////////////////////////////////////////////////
globalWarnings.push_back("-Wall");
globalWarnings.push_back("-Wno-long-long");
globalWarnings.push_back("-Wno-multichar");
globalWarnings.push_back("-Wno-unknown-pragmas");
globalWarnings.push_back("-Wno-reorder");
globalWarnings.push_back("-Wpointer-arith");
globalWarnings.push_back("-Wcast-qual");
globalWarnings.push_back("-Wcast-align");
globalWarnings.push_back("-Wshadow");
globalWarnings.push_back("-Wimplicit");
globalWarnings.push_back("-Wnon-virtual-dtor");
globalWarnings.push_back("-Wwrite-strings");
// The following are not warnings at all... We should consider adding them to
// a different list of parameters.
globalWarnings.push_back("-fno-rtti");
globalWarnings.push_back("-fno-exceptions");
globalWarnings.push_back("-fcheck-new");

provider = new CreateProjectTool::XCodeProvider(globalWarnings, projectWarnings);
break;
}

provider->createProject(setup);
Expand Down Expand Up @@ -501,6 +537,7 @@ void displayHelp(const char *exe) {
"Project specific settings:\n"
" --codeblock build Code::Blocks project files\n"
" --msvc build Visual Studio project files\n"
" --xcode build XCode project files\n"
" --file-prefix prefix allow overwriting of relative file prefix in the\n"
" MSVC project files. By default the prefix is the\n"
" \"path\\to\\source\" argument\n"
Expand Down
3 changes: 2 additions & 1 deletion devtools/create_project/module.mk
Expand Up @@ -6,7 +6,8 @@ MODULE_OBJS := \
codeblocks.o \
msvc.o \
visualstudio.o \
msbuild.o
msbuild.o \
xcode.o

# Set the name of the executable
TOOL_EXECUTABLE := create_project
Expand Down
8 changes: 6 additions & 2 deletions devtools/create_project/msvc10/create_project.vcxproj
Expand Up @@ -58,10 +58,12 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\msvc10\
<Command>@echo off
xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\msvc10\
xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\msvc9\
xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\msvc8\
xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\codeblocks\</Command>
xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\codeblocks\
xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\iphone\</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -98,6 +100,7 @@ xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\codeblocks\</Command>
<ClCompile Include="..\msbuild.cpp" />
<ClCompile Include="..\msvc.cpp" />
<ClCompile Include="..\visualstudio.cpp" />
<ClCompile Include="..\xcode.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\codeblocks.h" />
Expand All @@ -106,6 +109,7 @@ xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\codeblocks\</Command>
<ClInclude Include="..\msbuild.h" />
<ClInclude Include="..\msvc.h" />
<ClInclude Include="..\visualstudio.h" />
<ClInclude Include="..\xcode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\scripts\installer.vbs" />
Expand Down
6 changes: 6 additions & 0 deletions devtools/create_project/msvc10/create_project.vcxproj.filters
Expand Up @@ -27,6 +27,9 @@
<ClInclude Include="..\visualstudio.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\xcode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\config.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -47,6 +50,9 @@
<ClCompile Include="..\visualstudio.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\xcode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\scripts\prebuild.cmd">
Expand Down
8 changes: 8 additions & 0 deletions devtools/create_project/msvc8/create_project.vcproj
Expand Up @@ -184,6 +184,10 @@
RelativePath="..\visualstudio.cpp"
>
</File>
<File
RelativePath="..\xcode.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Expand Down Expand Up @@ -214,6 +218,10 @@
RelativePath="..\visualstudio.h"
>
</File>
<File
RelativePath="..\xcode.h"
>
</File>
</Filter>
<Filter
Name="Scripts"
Expand Down
8 changes: 8 additions & 0 deletions devtools/create_project/msvc9/create_project.vcproj
Expand Up @@ -185,6 +185,10 @@
RelativePath="..\visualstudio.cpp"
>
</File>
<File
RelativePath="..\xcode.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Expand Down Expand Up @@ -215,6 +219,10 @@
RelativePath="..\visualstudio.h"
>
</File>
<File
RelativePath="..\xcode.h"
>
</File>
</Filter>
<Filter
Name="Scripts"
Expand Down
61 changes: 61 additions & 0 deletions devtools/create_project/xcode.cpp
@@ -0,0 +1,61 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "xcode.h"

#include <fstream>
#include <algorithm>

#if defined(_WIN32) || defined(WIN32)
#include <windows.h>
#else
#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#endif

namespace CreateProjectTool {

XCodeProvider::XCodeProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version)
: ProjectProvider(global_warnings, project_warnings, version) {
}

void XCodeProvider::createWorkspace(const BuildSetup &setup) {
// TODO
}

void XCodeProvider::createOtherBuildFiles(const BuildSetup &setup) {
// TODO
}

void XCodeProvider::createProjectFile(const std::string &, const std::string &, const BuildSetup &setup, const std::string &moduleDir,
const StringList &includeList, const StringList &excludeList) {
// TODO
}

void XCodeProvider::writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix) {
// TODO
}

} // End of CreateProjectTool namespace
54 changes: 54 additions & 0 deletions devtools/create_project/xcode.h
@@ -0,0 +1,54 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/


#ifndef TOOLS_CREATE_PROJECT_XCODE_H
#define TOOLS_CREATE_PROJECT_XCODE_H

#include "create_project.h"

#include <algorithm>
#include <vector>

namespace CreateProjectTool {

class XCodeProvider : public ProjectProvider {
public:
XCodeProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version = 0);

protected:

void createWorkspace(const BuildSetup &setup);

void createOtherBuildFiles(const BuildSetup &setup);

void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
const StringList &includeList, const StringList &excludeList);

void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);

};

} // End of CreateProjectTool namespace

#endif // TOOLS_CREATE_PROJECT_XCODE_H
Expand Up @@ -12,6 +12,7 @@
F9A66C6B1396D4DF00CEE494 /* msbuild.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9A66C651396D4DF00CEE494 /* msbuild.cpp */; };
F9A66C6C1396D4DF00CEE494 /* msvc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9A66C671396D4DF00CEE494 /* msvc.cpp */; };
F9A66C6F1396D4E800CEE494 /* visualstudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9A66C6D1396D4E800CEE494 /* visualstudio.cpp */; };
F9A66C871396E2F500CEE494 /* xcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9A66C861396E2F500CEE494 /* xcode.cpp */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -44,6 +45,8 @@
F9A66C681396D4DF00CEE494 /* msvc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = msvc.h; path = ../msvc.h; sourceTree = "<group>"; };
F9A66C6D1396D4E800CEE494 /* visualstudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = visualstudio.cpp; path = ../visualstudio.cpp; sourceTree = "<group>"; };
F9A66C6E1396D4E800CEE494 /* visualstudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = visualstudio.h; path = ../visualstudio.h; sourceTree = "<group>"; };
F9A66C841396E2D800CEE494 /* xcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xcode.h; path = ../xcode.h; sourceTree = "<group>"; };
F9A66C861396E2F500CEE494 /* xcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xcode.cpp; path = ../xcode.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -60,6 +63,8 @@
F9A66C1C1396D36100CEE494 = {
isa = PBXGroup;
children = (
F9A66C861396E2F500CEE494 /* xcode.cpp */,
F9A66C841396E2D800CEE494 /* xcode.h */,
F9A66C6D1396D4E800CEE494 /* visualstudio.cpp */,
F9A66C6E1396D4E800CEE494 /* visualstudio.h */,
F9A66C5F1396D4DF00CEE494 /* codeblocks.cpp */,
Expand Down Expand Up @@ -148,6 +153,7 @@
F9A66C6B1396D4DF00CEE494 /* msbuild.cpp in Sources */,
F9A66C6C1396D4DF00CEE494 /* msvc.cpp in Sources */,
F9A66C6F1396D4E800CEE494 /* visualstudio.cpp in Sources */,
F9A66C871396E2F500CEE494 /* xcode.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
7 changes: 7 additions & 0 deletions dists/iphone/readme.txt
@@ -0,0 +1,7 @@
The Xcode project files can now be created automatically from the GCC
files using the create_project tool inside the /tools/create_project folder.

To create the default project files, build create_project.exe, copy it inside
this folder and run the create_xcode.bat file for a default build. You can
run create_project.exe with no parameters to check the possible command-line
options.

0 comments on commit 9717d5b

Please sign in to comment.