CREATE_PROJECT: Move project-specific information to configuration file

User-visible output and project-specific names are now defined in a config header.
This allows an easier usage of the create_project tools in other scummvm-derived projects (such as residual).
This commit is contained in:
Littleboy 2011-04-24 13:33:23 -04:00
parent 11b907ebf4
commit 878d72b387
13 changed files with 209 additions and 127 deletions

View file

@ -23,6 +23,7 @@
*
*/
#include "config.h"
#include "codeblocks.h"
#include <fstream>
@ -34,20 +35,20 @@ CodeBlocksProvider::CodeBlocksProvider(StringList &global_warnings, std::map<std
}
void CodeBlocksProvider::createWorkspace(const BuildSetup &setup) {
std::ofstream workspace((setup.outputDir + '/' + "scummvm.workspace").c_str());
std::ofstream workspace((setup.outputDir + '/' + PROJECT_NAME + ".workspace").c_str());
if (!workspace)
error("Could not open \"" + setup.outputDir + '/' + "scummvm.workspace\" for writing");
error("Could not open \"" + setup.outputDir + '/' + PROJECT_NAME + ".workspace\" for writing");
workspace << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n"
"<CodeBlocks_workspace_file>\n";
workspace << "\t<Workspace title=\"ScummVM\">\n";
workspace << "\t<Workspace title=\"" << PROJECT_DESCRIPTION << "\">\n";
writeReferences(workspace);
// Note we assume that the UUID map only includes UUIDs for enabled engines!
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
if (i->first == "scummvm")
if (i->first == PROJECT_NAME)
continue;
workspace << "\t\t<Project filename=\"" << i->first << ".cbp\" />\n";
@ -59,7 +60,7 @@ void CodeBlocksProvider::createWorkspace(const BuildSetup &setup) {
// HACK We need to pre-process library names
// since the MSVC and mingw precompiled
// librarie have different names :(
// libraries have different names :(
std::string processLibraryName(std::string name) {
// Remove "_static" in lib name
size_t pos = name.find("_static");
@ -90,16 +91,16 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
"\t\t<Option compiler=\"gcc\" />\n"
"\t\t<Build>\n";
if (name == "scummvm") {
if (name == PROJECT_NAME) {
std::string libraries;
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
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"
"\t\t\t\t<Option object_output=\"scummvm\" />\n"
"\t\t\t\t<Option external_deps=\"" << libraries /* + list of engines scummvm\engines\name\name.a */ << "\" />\n"
"\t\t\t\t<Option output=\"" << PROJECT_NAME << "\\" << PROJECT_NAME << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
"\t\t\t\t<Option object_output=\"" << PROJECT_NAME << "\" />\n"
"\t\t\t\t<Option external_deps=\"" << libraries /* + list of engines engines\name\name.a */ << "\" />\n"
"\t\t\t\t<Option type=\"1\" />\n"
"\t\t\t\t<Option compiler=\"gcc\" />\n"
"\t\t\t\t<Option parameters=\"-d 8 --debugflags=parser\" />\n"
@ -112,8 +113,8 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
writeWarnings(name, project);
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"
project << "\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")include\" />\n"
"\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")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"
@ -127,21 +128,21 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
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")
if (i->first == PROJECT_NAME)
continue;
project << "\t\t\t\t\t<Add library=\"scummvm\\engines\\" << i->first << "\\lib" << i->first << ".a\" />\n";
project << "\t\t\t\t\t<Add library=\"" << PROJECT_NAME << "\\engines\\" << i->first << "\\lib" << i->first << ".a\" />\n";
}
project << "\t\t\t\t\t<Add directory=\"$(SCUMMVM_LIBS)lib\\mingw\" />\n"
"\t\t\t\t\t<Add directory=\"$(SCUMMVM_LIBS)lib\" />\n"
project << "\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")lib\\mingw\" />\n"
"\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")lib\" />\n"
"\t\t\t\t</Linker>\n";
//////////////////////////////////////////////////////////////////////////
// Resource compiler
project << "\t\t\t\t<ResourceCompiler>\n"
"\t\t\t\t\t<Add directory=\"..\\..\\dists\" />\n"
"\t\t\t\t\t<Add directory=\"..\\..\\..\\scummvm\" />\n"
"\t\t\t\t\t<Add directory=\"..\\..\\..\\" << PROJECT_NAME << "\" />\n"
"\t\t\t\t</ResourceCompiler>\n"
"\t\t\t</Target>\n"
"\t\t</Build>\n";
@ -150,9 +151,9 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
} else {
project << "\t\t\t<Target title=\"default\">\n"
"\t\t\t\t<Option output=\"scummvm\\engines\\" << name << "\\lib" << name << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
"\t\t\t\t<Option output=\"" << PROJECT_NAME << "\\engines\\" << name << "\\lib" << name << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
"\t\t\t\t<Option working_dir=\"\" />\n"
"\t\t\t\t<Option object_output=\"scummvm\" />\n"
"\t\t\t\t<Option object_output=\"" << PROJECT_NAME << "\" />\n"
"\t\t\t\t<Option type=\"2\" />\n"
"\t\t\t\t<Option compiler=\"gcc\" />\n"
"\t\t\t\t<Option createDefFile=\"1\" />\n"
@ -163,11 +164,11 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
project << "\t\t\t\t\t<Add option=\"-g\" />\n"
"\t\t\t\t\t<Add directory=\"..\\..\\engines\" />\n"
"\t\t\t\t\t<Add directory=\"..\\..\\..\\scummvm\" />\n";
"\t\t\t\t\t<Add directory=\"..\\..\\..\\" << PROJECT_NAME << "\" />\n";
// Sword2.5 engine needs theora and vorbis includes
if (name == "sword25")
project << "\t\t\t\t\t<Add directory=\"$(SCUMMVM_LIBS)include\" />\n";
project << "\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")include\" />\n";
project << "\t\t\t\t</Compiler>\n"
"\t\t\t</Target>\n"
@ -233,7 +234,7 @@ void CodeBlocksProvider::writeFileListToProject(const FileNode &dir, std::ofstre
"\t\t</Unit>\n";
} else if (ext == "asm") {
projectFile << "\t\t<Unit filename=\"" << convertPathToWin(filePrefix + node->name) << "\">\n"
"\t\t\t<Option compiler=\"gcc\" use=\"1\" buildCommand=\"$(SCUMMVM_LIBS)bin/nasm.exe -f win32 -g $file -o $object\" />"
"\t\t\t<Option compiler=\"gcc\" use=\"1\" buildCommand=\"$(" << LIBS_DEFINE << ")bin/nasm.exe -f win32 -g $file -o $object\" />"
"\t\t</Unit>\n";
} else {
projectFile << "\t\t<Unit filename=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n";
@ -243,10 +244,10 @@ void CodeBlocksProvider::writeFileListToProject(const FileNode &dir, std::ofstre
}
void CodeBlocksProvider::writeReferences(std::ofstream &output) {
output << "\t\t<Project filename=\"scummvm.cbp\" active=\"1\">\n";
output << "\t\t<Project filename=\"" << PROJECT_NAME << ".cbp\" active=\"1\">\n";
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
if (i->first == "scummvm")
if (i->first == " << PROJECT_NAME << ")
continue;
output << "\t\t\t<Depends filename=\"" << i->first << ".cbp\" />\n";

View file

@ -36,6 +36,7 @@
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="..\config.h" />
<Unit filename="..\codeblocks.cpp" />
<Unit filename="..\codeblocks.h" />
<Unit filename="..\create_project.cpp" />

View file

@ -0,0 +1,38 @@
/* 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.
*
* $URL$
* $Id$
*
*/
#ifndef TOOLS_CREATE_PROJECT_CONFIG_H
#define TOOLS_CREATE_PROJECT_CONFIG_H
#define PROJECT_DESCRIPTION "ScummVM" // Used in console output and build configuration
#define PROJECT_NAME "scummvm" // Used for folders, icons, resources and project/solution name
#define LIBS_DEFINE "SCUMMVM_LIBS" // Name of the include environment variable
#define REVISION_DEFINE "SCUMMVM_INTERNAL_REVISION"
#define HAS_VIDEO_FOLDER 1
//#define ADDITIONAL_LIBRARY ""
#define NEEDS_RTTI 0
#endif // TOOLS_CREATE_PROJECT_CONFIG_H

View file

@ -29,6 +29,7 @@
#undef main
#endif // main
#include "config.h"
#include "create_project.h"
#include "codeblocks.h"
@ -150,7 +151,7 @@ int main(int argc, char *argv[]) {
using std::cout;
for (int i = 2; i < argc; ++i) {
if (!std::strcmp(argv[i], "--list-engines")) {
cout << " The following enables are available in the ScummVM source distribution\n"
cout << " The following enables are available in the " PROJECT_DESCRIPTION " source distribution\n"
" located at \"" << srcDir << "\":\n";
cout << " state | name | description\n\n";
@ -289,6 +290,11 @@ int main(int argc, char *argv[]) {
setup.libraries.push_back("sdl");
setup.libraries.push_back("winmm");
// Add additional project-specific library
#ifdef ADDITIONAL_LIBRARY
setup.libraries.push_back(ADDITIONAL_LIBRARY);
#endif
// Initialize global & project-specific warnings
#define SET_GLOBAL_WARNINGS(...) \
{ \
@ -456,7 +462,7 @@ void displayHelp(const char *exe) {
cout << "Usage:\n"
<< exe << " path\\to\\source [optional options]\n"
<< "\n"
<< " Creates project files for the ScummVM source located at \"path\\to\\source\".\n"
<< " Creates project files for the " PROJECT_DESCRIPTION " source located at \"path\\to\\source\".\n"
" The project files will be created in the directory where tool is run from and\n"
" will include \"path\\to\\source\" for relative file paths, thus be sure that you\n"
" pass a relative file path like \"..\\..\\trunk\".\n"
@ -482,14 +488,14 @@ void displayHelp(const char *exe) {
" --build-events Run custom build events as part of the build\n"
" (default: false)\n"
"\n"
"ScummVM engine settings:\n"
"Engines settings:\n"
" --list-engines list all available engines and their default state\n"
" --enable-engine enable building of the engine with the name \"engine\"\n"
" --disable-engine disable building of the engine with the name \"engine\"\n"
" --enable-all-engines enable building of all engines\n"
" --disable-all-engines disable building of all engines\n"
"\n"
"ScummVM optional feature settings:\n"
"Optional features settings:\n"
" --enable-name enable inclusion of the feature \"name\"\n"
" --disable-name disable inclusion of the feature \"name\"\n"
"\n"
@ -694,7 +700,7 @@ const Feature s_features[] = {
{ "theora", "USE_THEORADEC", "libtheora_static", true, "Theora decoding support" },
{ "mpeg2", "USE_MPEG2", "libmpeg2", false, "mpeg2 codec for cutscenes" },
// ScummVM feature flags
// Feature flags
{ "scalers", "USE_SCALERS", "", true, "Scalers" },
{ "hqscalers", "USE_HQ_SCALERS", "", true, "HQ scalers" },
{ "16bit", "USE_RGB_COLOR", "", true, "16bit color support" },
@ -977,7 +983,7 @@ void ProjectProvider::createProject(const BuildSetup &setup) {
_uuidMap = createUUIDMap(setup);
// We also need to add the UUID of the main project file.
const std::string svmUUID = _uuidMap["scummvm"] = createUUID();
const std::string svmUUID = _uuidMap[PROJECT_NAME] = createUUID();
// Create Solution/Workspace file
createWorkspace(setup);
@ -986,7 +992,7 @@ void ProjectProvider::createProject(const BuildSetup &setup) {
// Create engine project files
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
if (i->first == "scummvm")
if (i->first == PROJECT_NAME)
continue;
in.clear(); ex.clear();
@ -996,10 +1002,10 @@ void ProjectProvider::createProject(const BuildSetup &setup) {
createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
}
// Last but not least create the main ScummVM project file.
// Last but not least create the main project file.
in.clear(); ex.clear();
// File list for the ScummVM project file
// File list for the Project file
createModuleList(setup.srcDir + "/backends", setup.defines, in, ex);
createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, in, ex);
createModuleList(setup.srcDir + "/base", setup.defines, in, ex);
@ -1009,11 +1015,13 @@ void ProjectProvider::createProject(const BuildSetup &setup) {
createModuleList(setup.srcDir + "/gui", setup.defines, in, ex);
createModuleList(setup.srcDir + "/audio", setup.defines, in, ex);
createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, in, ex);
#if HAS_VIDEO_FOLDER
createModuleList(setup.srcDir + "/video", setup.defines, in, ex);
#endif
// Resource files
in.push_back(setup.srcDir + "/icons/scummvm.ico");
in.push_back(setup.srcDir + "/dists/scummvm.rc");
in.push_back(setup.srcDir + "/icons/" + PROJECT_NAME + ".ico");
in.push_back(setup.srcDir + "/dists/" + PROJECT_NAME + ".rc");
// Various text files
in.push_back(setup.srcDir + "/AUTHORS");
@ -1024,8 +1032,8 @@ void ProjectProvider::createProject(const BuildSetup &setup) {
in.push_back(setup.srcDir + "/README");
in.push_back(setup.srcDir + "/TODO");
// Create the scummvm project file.
createProjectFile("scummvm", svmUUID, setup, setup.srcDir, in, ex);
// Create the main project file.
createProjectFile(PROJECT_NAME, svmUUID, setup, setup.srcDir, in, ex);
// Create other misc. build files
createOtherBuildFiles(setup);

View file

@ -105,13 +105,13 @@ struct EngineDesc {
typedef std::list<EngineDesc> EngineDescList;
/**
* This function parses the ScummVM configure file and creates a list
* This function parses the project configure file and creates a list
* of available engines.
*
* It will also automatically setup the default build state (enabled
* or disabled) to the state specified in the "configure" file.
*
* @param srcDir Path to the root of the ScummVM source.
* @param srcDir Path to the root of the project source.
* @return List of available engines.
*/
EngineDescList parseConfigure(const std::string &srcDir);
@ -206,11 +206,11 @@ bool setFeatureBuildState(const std::string &name, FeatureList &features, bool e
* Structure to describe a build setup.
*
* This includes various information about which engines to
* enable, which features should be built into ScummVM.
* It also contains the path to the ScummVM souce root.
* enable, which features should be built into the main executable.
* It also contains the path to the project source root.
*/
struct BuildSetup {
std::string srcDir; ///< Path to the ScummVM sources.
std::string srcDir; ///< Path to the sources.
std::string filePrefix; ///< Prefix for the relative path arguments in the project files.
std::string outputDir; ///< Path where to put the MSVC project files.

View file

@ -23,10 +23,10 @@
*
*/
#include "config.h"
#include "msbuild.h"
#include <fstream>
#include <algorithm>
namespace CreateProjectTool {
@ -60,7 +60,7 @@ int MSBuildProvider::getVisualStudioVersion() {
#define OUTPUT_CONFIGURATION_TYPE_MSBUILD(config) \
(project << "\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"Configuration\">\n" \
"\t\t<ConfigurationType>" << (name == "scummvm" ? "Application" : "StaticLibrary") << "</ConfigurationType>\n" \
"\t\t<ConfigurationType>" << (name == PROJECT_NAME ? "Application" : "StaticLibrary") << "</ConfigurationType>\n" \
"\t</PropertyGroup>\n")
#define OUTPUT_PROPERTIES_MSBUILD(config, properties) \
@ -110,12 +110,12 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
"\t<ImportGroup Label=\"ExtensionSettings\">\n"
"\t</ImportGroup>\n";
OUTPUT_PROPERTIES_MSBUILD("Release|Win32", "ScummVM_Release.props");
OUTPUT_PROPERTIES_MSBUILD("Analysis|Win32", "ScummVM_Analysis.props");
OUTPUT_PROPERTIES_MSBUILD("Debug|Win32", "ScummVM_Debug.props");
OUTPUT_PROPERTIES_MSBUILD("Release|x64", "ScummVM_Release64.props");
OUTPUT_PROPERTIES_MSBUILD("Analysis|x64", "ScummVM_Analysis64.props");
OUTPUT_PROPERTIES_MSBUILD("Debug|x64", "ScummVM_Debug64.props");
OUTPUT_PROPERTIES_MSBUILD("Release|Win32", PROJECT_DESCRIPTION "_Release.props");
OUTPUT_PROPERTIES_MSBUILD("Analysis|Win32", PROJECT_DESCRIPTION "_Analysis.props");
OUTPUT_PROPERTIES_MSBUILD("Debug|Win32", PROJECT_DESCRIPTION "_Debug.props");
OUTPUT_PROPERTIES_MSBUILD("Release|x64", PROJECT_DESCRIPTION "_Release64.props");
OUTPUT_PROPERTIES_MSBUILD("Analysis|x64", PROJECT_DESCRIPTION "_Analysis64.props");
OUTPUT_PROPERTIES_MSBUILD("Debug|x64", PROJECT_DESCRIPTION "_Debug64.props");
project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
@ -140,8 +140,8 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
else
addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix);
// Output references for scummvm project
if (name == "scummvm")
// Output references for the main project
if (name == PROJECT_NAME)
writeReferences(project);
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n"
@ -212,7 +212,7 @@ void MSBuildProvider::writeReferences(std::ofstream &output) {
output << "\t<ItemGroup>\n";
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
if (i->first == "scummvm")
if (i->first == PROJECT_NAME)
continue;
output << "\t<ProjectReference Include=\"" << i->first << ".vcxproj\">\n"
@ -230,7 +230,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
// Nothing to add here, move along!
if (name != "scummvm" && name != "sword25" && name != "tinsel" && warningsIterator == _projectWarnings.end())
if (name != PROJECT_NAME && name != "sword25" && name != "tinsel" && name != "grim" && warningsIterator == _projectWarnings.end())
return;
std::string warnings = "";
@ -242,7 +242,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
"\t\t<ClCompile>\n";
// Compile configuration
if (name == "scummvm" || name == "sword25") {
if (name == PROJECT_NAME || name == "sword25" || name == "grim") {
project << "\t\t\t<DisableLanguageExtensions>false</DisableLanguageExtensions>\n";
} else {
if (name == "tinsel" && !isRelease)
@ -254,21 +254,21 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
project << "\t\t</ClCompile>\n";
// Link configuration for scummvm project
if (name == "scummvm") {
// Link configuration for main project
if (name == PROJECT_NAME) {
std::string libraries;
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
libraries += *i + ".lib;";
project << "\t\t<Link>\n"
"\t\t\t<OutputFile>$(OutDir)scummvm.exe</OutputFile>\n"
"\t\t\t<OutputFile>$(OutDir)" << PROJECT_NAME << ".exe</OutputFile>\n"
"\t\t\t<AdditionalDependencies>" << libraries << "%(AdditionalDependencies)</AdditionalDependencies>\n"
"\t\t</Link>\n";
if (setup.runBuildEvents) {
project << "\t\t<PreBuildEvent>\n"
"\t\t\t<Message>Generate internal_version_build.h</Message>\n"
"\t\t\t<Message>Generate revision</Message>\n"
"\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
"\t\t</PreBuildEvent>\n";
@ -295,16 +295,16 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits,
// Add define to include revision header
if (runBuildEvents)
definesList += "SCUMMVM_INTERNAL_REVISION;";
definesList += REVISION_DEFINE ";";
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
"\t<PropertyGroup>\n"
"\t\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n"
"\t\t<_PropertySheetDisplayName>ScummVM_Global</_PropertySheetDisplayName>\n"
"\t\t<ExecutablePath>$(SCUMMVM_LIBS)\\bin;$(ExecutablePath)</ExecutablePath>\n"
"\t\t<LibraryPath>$(SCUMMVM_LIBS)\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)</LibraryPath>\n"
"\t\t<IncludePath>$(SCUMMVM_LIBS)\\include;$(IncludePath)</IncludePath>\n"
"\t\t<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\n"
"\t\t<_PropertySheetDisplayName>" << PROJECT_DESCRIPTION << "_Global</_PropertySheetDisplayName>\n"
"\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(ExecutablePath)</ExecutablePath>\n"
"\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)</LibraryPath>\n"
"\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(IncludePath)</IncludePath>\n"
"\t\t<OutDir>$(Configuration)" << bits << "\\</OutDir>\n"
"\t\t<IntDir>$(Configuration)" << bits << "/$(ProjectName)\\</IntDir>\n"
"\t</PropertyGroup>\n"
@ -312,11 +312,17 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits,
"\t\t<ClCompile>\n"
"\t\t\t<DisableLanguageExtensions>true</DisableLanguageExtensions>\n"
"\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n"
"\t\t\t<AdditionalIncludeDirectories>$(SCUMMVM_LIBS)\\include;" << prefix << ";" << prefix << "\\engines;$(TargetDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<AdditionalIncludeDirectories>$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;$(TargetDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
"\t\t\t<ExceptionHandling></ExceptionHandling>\n"
"\t\t\t<RuntimeTypeInfo>false</RuntimeTypeInfo>\n"
"\t\t\t<WarningLevel>Level4</WarningLevel>\n"
"\t\t\t<ExceptionHandling></ExceptionHandling>\n";
#if NEEDS_RTTI
properties << "\t\t\t<RuntimeTypeInfo>true</RuntimeTypeInfo>\n";
#else
properties << "\t\t\t<RuntimeTypeInfo>false</RuntimeTypeInfo>\n";
#endif
properties << "\t\t\t<WarningLevel>Level4</WarningLevel>\n"
"\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n"
"\t\t\t<CompileAs>Default</CompileAs>\n"
"\t\t</ClCompile>\n"
@ -339,18 +345,18 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b
const std::string outputType = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug"));
const std::string outputBitness = (isWin32 ? "32" : "64");
std::ofstream properties((setup.outputDir + '/' + "ScummVM_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + "ScummVM_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
"\t<ImportGroup Label=\"PropertySheets\">\n"
"\t\t<Import Project=\"ScummVM_Global" << (isWin32 ? "" : "64") << ".props\" />\n"
"\t\t<Import Project=\"" << PROJECT_DESCRIPTION << "_Global" << (isWin32 ? "" : "64") << ".props\" />\n"
"\t</ImportGroup>\n"
"\t<PropertyGroup>\n"
"\t\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n"
"\t\t<_PropertySheetDisplayName>ScummVM_" << outputType << outputBitness << "</_PropertySheetDisplayName>\n"
"\t\t<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\n"
"\t\t<_PropertySheetDisplayName>" << PROJECT_DESCRIPTION << "_" << outputType << outputBitness << "</_PropertySheetDisplayName>\n"
"\t\t<LinkIncremental>" << (isRelease ? "false" : "true") << "</LinkIncremental>\n"
"\t</PropertyGroup>\n"
"\t<ItemDefinitionGroup>\n"

View file

@ -23,10 +23,10 @@
*
*/
#include "config.h"
#include "msvc.h"
#include <fstream>
#include <algorithm>
namespace CreateProjectTool {
@ -39,23 +39,23 @@ MSVCProvider::MSVCProvider(StringList &global_warnings, std::map<std::string, St
}
void MSVCProvider::createWorkspace(const BuildSetup &setup) {
UUIDMap::const_iterator svmUUID = _uuidMap.find("scummvm");
UUIDMap::const_iterator svmUUID = _uuidMap.find(PROJECT_NAME);
if (svmUUID == _uuidMap.end())
error("No UUID for \"scummvm\" project created");
error("No UUID for \"" PROJECT_NAME "\" project created");
const std::string svmProjectUUID = svmUUID->second;
assert(!svmProjectUUID.empty());
std::string solutionUUID = createUUID();
std::ofstream solution((setup.outputDir + '/' + "scummvm.sln").c_str());
std::ofstream solution((setup.outputDir + '/' + PROJECT_NAME ".sln").c_str());
if (!solution)
error("Could not open \"" + setup.outputDir + '/' + "scummvm.sln\" for writing");
error("Could not open \"" + setup.outputDir + '/' + PROJECT_NAME ".sln\" for writing");
solution << "Microsoft Visual Studio Solution File, Format Version " << _version + 1 << ".00\n";
solution << "# Visual Studio " << getVisualStudioVersion() << "\n";
solution << "Project(\"{" << solutionUUID << "}\") = \"scummvm\", \"scummvm" << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n";
solution << "Project(\"{" << solutionUUID << "}\") = \"" << PROJECT_NAME << "\", \"" << PROJECT_NAME << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n";
// Project dependencies are moved to vcxproj files in Visual Studio 2010
if (_version < 10)
@ -65,7 +65,7 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
// Note we assume that the UUID map only includes UUIDs for enabled engines!
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
if (i->first == "scummvm")
if (i->first == PROJECT_NAME)
continue;
solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << getProjectExtension() << "\", \"{" << i->second << "}\"\n"
@ -120,16 +120,16 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) {
}
void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
std::ofstream properties((setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension()).c_str());
std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global" + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global" + getPropertiesExtension() + "\" for writing");
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global" + getPropertiesExtension() + "\" for writing");
outputGlobalPropFile(properties, 32, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
properties.close();
properties.open((setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension()).c_str());
properties.open((setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global64" + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + "ScummVM_Global64" + getPropertiesExtension() + "\" for writing");
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global64" + getPropertiesExtension() + "\" for writing");
// HACK: We must disable the "nasm" feature for x64. To achieve that we must duplicate the feature list and
// recreate a define list.
@ -168,6 +168,8 @@ std::string MSVCProvider::getPostBuildEvent(bool isWin32) const {
cmdLine += (isWin32) ? "x86" : "x64";
cmdLine += " %SCUMMVM_LIBS%";
cmdLine += "\n"
"EXIT /B0";

View file

@ -101,6 +101,7 @@ xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\codeblocks\</Command>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\codeblocks.h" />
<ClInclude Include="..\config.h" />
<ClInclude Include="..\create_project.h" />
<ClInclude Include="..\msbuild.h" />
<ClInclude Include="..\msvc.h" />

View file

@ -27,6 +27,9 @@
<ClInclude Include="..\visualstudio.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\config.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\codeblocks.cpp">

View file

@ -198,6 +198,10 @@
RelativePath="..\codeblocks.h"
>
</File>
<File
RelativePath="..\config.h"
>
</File>
<File
RelativePath="..\msvc.h"
>

View file

@ -199,6 +199,10 @@
RelativePath="..\codeblocks.h"
>
</File>
<File
RelativePath="..\config.h"
>
</File>
<File
RelativePath="..\msvc.h"
>

View file

@ -11,10 +11,12 @@ REM Expected parameters
REM Root folder
REM Output folder
REM Architecture
REM Libs folder
if "%~1"=="" goto error_root
if "%~2"=="" goto error_output
if "%~3"=="" goto error_arch
if "%~4"=="" goto error_libs
echo Copying data files
echo.
@ -26,7 +28,7 @@ xcopy /F /Y "%~1/dists/engine-data/*.cpt" %~2 > NUL 2>&1
xcopy /F /Y "%~1/dists/engine-data/README" %~2 > NUL 2>&1
xcopy /F /Y "%~1/gui/themes/*.zip" %~2 > NUL 2>&1
xcopy /F /Y "%~1/gui/themes/translations.dat" %~2 > NUL 2>&1
xcopy /F /Y "%SCUMMVM_LIBS%/lib/%~3/SDL.dll" %~2 > NUL 2>&1
xcopy /F /Y "%~4/lib/%~3/SDL.dll" %~2 > NUL 2>&1
goto done
:error_root
@ -41,5 +43,9 @@ goto done
echo Invalid arch parameter (was: %~3, allowed: x86, x64)!
goto done
:error_libs
echo Invalid libs folder (%~4)!
goto done
:done
exit /B0

View file

@ -23,10 +23,10 @@
*
*/
#include "config.h"
#include "visualstudio.h"
#include <fstream>
#include <algorithm>
namespace CreateProjectTool {
@ -54,7 +54,7 @@ int VisualStudioProvider::getVisualStudioVersion() {
if (_version == 8)
return 2005;
error("Unsupported version passed to createScummVMSolution");
error("Unsupported version passed to getVisualStudioVersion");
}
#define OUTPUT_BUILD_EVENTS(isWin32) \
@ -67,20 +67,20 @@ int VisualStudioProvider::getVisualStudioVersion() {
"\t\t\t/>\n"; \
}
#define OUTPUT_CONFIGURATION_SCUMMVM(config, platform, props, isWin32) { \
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_" << config << props << ".vsprops\">\n" \
#define OUTPUT_CONFIGURATION_MAIN(config, platform, props, isWin32) { \
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << PROJECT_DESCRIPTION << "_" << config << props << ".vsprops\">\n" \
"\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n" \
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n" \
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << PROJECT_NAME << "\"\n" \
"\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n" \
"\t\t\t/>\n"; \
OUTPUT_BUILD_EVENTS(isWin32) \
project << "\t\t</Configuration>\n"; \
}
#define OUTPUT_CONFIGURATION_SCUMMVM_DEBUG(config, platform, props, isWin32) { \
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\ScummVM_" << config << props << ".vsprops\">\n" \
#define OUTPUT_CONFIGURATION_DEBUG(config, platform, props, isWin32) { \
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << PROJECT_DESCRIPTION << "_" << config << props << ".vsprops\">\n" \
"\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n" \
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/scummvm.exe\"\n" \
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << PROJECT_NAME << ".exe\"\n" \
"\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n" \
"\t\t\t/>\n"; \
OUTPUT_BUILD_EVENTS(isWin32) \
@ -88,7 +88,7 @@ int VisualStudioProvider::getVisualStudioVersion() {
}
#define OUTPUT_CONFIGURATION(config, platform, props) { \
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\ScummVM_" << config << props << ".vsprops\">\n" \
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\" << PROJECT_DESCRIPTION << "_" << config << props << ".vsprops\">\n" \
"\t\t\t<Tool Name=\"VCCLCompilerTool\" "<< toolConfig << "/>\n" \
"\t\t</Configuration>\n"; \
}
@ -122,24 +122,24 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
// Check for project-specific warnings:
std::map< std::string, std::list<std::string> >::iterator warningsIterator = _projectWarnings.find(name);
if (name == "scummvm") {
if (name == PROJECT_NAME) {
std::string libraries;
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
libraries += ' ' + *i + ".lib";
// Win32
OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Debug", "Win32", "", true);
OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Analysis", "Win32", "", true);
OUTPUT_CONFIGURATION_SCUMMVM("Release", "Win32", "", true);
OUTPUT_CONFIGURATION_DEBUG("Debug", "Win32", "", true);
OUTPUT_CONFIGURATION_DEBUG("Analysis", "Win32", "", true);
OUTPUT_CONFIGURATION_MAIN("Release", "Win32", "", true);
// x64
// For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and
// re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the
// libraries list created for IA-32. If that changes in the future, we need to adjust this part!
OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Debug", "x64", "64", false);
OUTPUT_CONFIGURATION_SCUMMVM_DEBUG("Analysis", "x64", "64", false);
OUTPUT_CONFIGURATION_SCUMMVM("Release", "x64", "64", false);
OUTPUT_CONFIGURATION_DEBUG("Debug", "x64", "64", false);
OUTPUT_CONFIGURATION_DEBUG("Analysis", "x64", "64", false);
OUTPUT_CONFIGURATION_MAIN("Release", "x64", "64", false);
} else {
std::string warnings = "";
@ -151,6 +151,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
toolConfig = (!warnings.empty() ? "DisableSpecificWarnings=\"" + warnings + "\"" : "");
toolConfig += (name == "tinsel" ? "DebugInformationFormat=\"3\" " : "");
toolConfig += (name == "sword25" ? "DisableLanguageExtensions=\"false\" " : "");
toolConfig += (name == "grim" ? "DisableLanguageExtensions=\"false\" " : "");
// Win32
OUTPUT_CONFIGURATION("Debug", "Win32", "");
@ -184,7 +185,7 @@ void VisualStudioProvider::writeReferences(std::ofstream &output) {
output << "\tProjectSection(ProjectDependencies) = postProject\n";
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
if (i->first == "scummvm")
if (i->first == PROJECT_NAME)
continue;
output << "\t\t{" << i->second << "} = {" << i->second << "}\n";
@ -207,13 +208,13 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b
// Add define to include revision header
if (runBuildEvents)
definesList += "SCUMMVM_INTERNAL_REVISION;";
definesList += REVISION_DEFINE ";";
properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
"<VisualStudioPropertySheet\n"
"\tProjectType=\"Visual C++\"\n"
"\tVersion=\"8.00\"\n"
"\tName=\"ScummVM_Global\"\n"
"\tName=\"" << PROJECT_DESCRIPTION << "_Global\"\n"
"\tOutputDirectory=\"$(ConfigurationName)" << bits << "\"\n"
"\tIntermediateDirectory=\"$(ConfigurationName)" << bits << "/$(ProjectName)\"\n"
"\t>\n"
@ -221,10 +222,17 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b
"\t\tName=\"VCCLCompilerTool\"\n"
"\t\tDisableLanguageExtensions=\"true\"\n"
"\t\tDisableSpecificWarnings=\"" << warnings << "\"\n"
"\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(SCUMMVM_LIBS)\\include;$(TargetDir)\"\n"
"\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(TargetDir)\"\n"
"\t\tPreprocessorDefinitions=\"" << definesList << "\"\n"
"\t\tExceptionHandling=\"0\"\n"
"\t\tRuntimeTypeInfo=\"false\"\n"
"\t\tExceptionHandling=\"0\"\n";
#if NEEDS_RTTI
properties << "\t\tRuntimeTypeInfo=\"true\"\n";
#else
properties << "\t\tRuntimeTypeInfo=\"false\"\n";
#endif
properties << "\t\tRuntimeTypeInfo=\"false\"\n"
"\t\tWarningLevel=\"4\"\n"
"\t\tWarnAsError=\"false\"\n"
"\t\tCompileAs=\"0\"\n"
@ -238,7 +246,7 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b
"\t\tIgnoreDefaultLibraryNames=\"\"\n"
"\t\tSubSystem=\"1\"\n"
"\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n"
"\t\tAdditionalLibraryDirectories=\"$(SCUMMVM_LIBS)\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n"
"\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n"
"\t/>\n"
"\t<Tool\n"
"\t\tName=\"VCResourceCompilerTool\"\n"
@ -254,16 +262,16 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea
const std::string outputType = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug"));
const std::string outputBitness = (isWin32 ? "32" : "64");
std::ofstream properties((setup.outputDir + '/' + "ScummVM_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + "ScummVM_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
"<VisualStudioPropertySheet\n"
"\tProjectType=\"Visual C++\"\n"
"\tVersion=\"8.00\"\n"
"\tName=\"ScummVM_" << outputType << outputBitness << "\"\n"
"\tInheritedPropertySheets=\".\\ScummVM_Global" << (isWin32 ? "" : "64") << ".vsprops\"\n"
"\tName=\"" << PROJECT_DESCRIPTION << "_" << outputType << outputBitness << "\"\n"
"\tInheritedPropertySheets=\".\\" << PROJECT_DESCRIPTION << "_Global" << (isWin32 ? "" : "64") << ".vsprops\"\n"
"\t>\n"
"\t<Tool\n"
"\t\tName=\"VCCLCompilerTool\"\n";