clean up in dot net

This commit is contained in:
Bill Hoffman 2002-02-27 18:11:12 -05:00
parent 0b6f8be725
commit 6c1e38abb4
3 changed files with 98 additions and 46 deletions

View File

@ -24,18 +24,43 @@
#include "cmSourceGroup.h" #include "cmSourceGroup.h"
cmMSDotNETGenerator::cmMSDotNETGenerator() cmMSDotNETGenerator::cmMSDotNETGenerator()
{ {
m_Configurations.push_back("Debug");
m_Configurations.push_back("Release");
// m_Configurations.push_back("MinSizeRel");
// m_Configurations.push_back("RelWithDebInfo");
// default to building a sln project file // default to building a sln project file
BuildProjOn(); BuildProjOn();
} }
void cmMSDotNETGenerator::GenerateMakefile() void cmMSDotNETGenerator::GenerateMakefile()
{ {
std::string configTypes = m_Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES");
std::string::size_type start = 0;
std::string::size_type endpos = 0;
while(endpos != std::string::npos)
{
endpos = configTypes.find(' ', start);
if(endpos != std::string::npos)
{
std::string config = configTypes.substr(start, endpos - start);
if(config == "Debug" || config == "Release" ||
config == "MinSizeRel" || config == "RelWithDebInfo")
{
m_Configurations.push_back(config);
}
else
{
cmSystemTools::Error("Invalid configuration type in CMAKE_CONFIGURATION_TYPES: ",
config.c_str(),
" (Valid types are Debug,Release,MinSizeRel,RelWithDebInfo)");
}
}
start = endpos+1;
}
if(m_Configurations.size() == 0)
{
m_Configurations.push_back("Debug");
m_Configurations.push_back("Release");
}
if(m_BuildSLN) if(m_BuildSLN)
{ {
this->OutputSLNFile(); this->OutputSLNFile();
@ -675,7 +700,7 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout,
} }
fout << "\t\t<Configuration\n" fout << "\t\t<Configuration\n"
<< "\t\t\tName=\"" << configName << "|Win32\"\n" << "\t\t\tName=\"" << configName << "|Win32\"\n"
<< "\t\t\tOutputDirectory=\""; << "\t\t\tOutputDirectory=\"" << configName << "\"\n";
// This is an internal type to Visual Studio, it seems that: // This is an internal type to Visual Studio, it seems that:
// 4 == static library // 4 == static library
// 2 == dll // 2 == dll
@ -686,22 +711,18 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout,
{ {
case cmTarget::STATIC_LIBRARY: case cmTarget::STATIC_LIBRARY:
configType = "4"; configType = "4";
fout << m_LibraryOutputPath << configName << "\"\n";
break; break;
case cmTarget::SHARED_LIBRARY: case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY: case cmTarget::MODULE_LIBRARY:
fout << m_LibraryOutputPath << configName << "\"\n";
configType = "2"; configType = "2";
break; break;
case cmTarget::EXECUTABLE: case cmTarget::EXECUTABLE:
case cmTarget::WIN32_EXECUTABLE: case cmTarget::WIN32_EXECUTABLE:
fout << m_ExecutableOutputPath << configName << "\"\n";
configType = "1"; configType = "1";
break; break;
case cmTarget::UTILITY: case cmTarget::UTILITY:
configType = "10"; configType = "10";
default: default:
fout << configName << "\"\n";
break; break;
} }
@ -720,47 +741,66 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout,
std::vector<std::string>::iterator i = includes.begin(); std::vector<std::string>::iterator i = includes.begin();
if(i != includes.end()) if(i != includes.end())
{ {
fout << "&quot;" << *i << "&quot;"; fout << "&quot;" << cmSystemTools::ConvertToOutputPath(i->c_str()) << "&quot;";
} }
for(;i != includes.end(); ++i) for(;i != includes.end(); ++i)
{ {
fout << ";&quot;" << *i << "&quot;"; fout << ";&quot;" << cmSystemTools::ConvertToOutputPath(i->c_str()) << "&quot;";
} }
fout << "\"\n"; fout << "\"\n";
// Optimization = 0 None Debug /O0
// Optimization = 1 MinSize /O1
// Optimization = 2 MaxSpeed /O2
// Optimization = 3 Max Optimization /O3
// RuntimeLibrary = 0 /MT multithread
// RuntimeLibrary = 1 /MTd multithread debug
// RuntimeLibrary = 2 /MD multithread dll
// RuntimeLibrary = 3 /MDd multithread dll debug
// RuntimeLibrary = 4 /ML single thread
// RuntimeLibrary = 5 /MLd single thread debug
// InlineFunctionExpansion = 0 none
// InlineFunctionExpansion = 1 when inline keyword
// InlineFunctionExpansion = 2 any time you can
if(strcmp(configName, "Debug") == 0) if(strcmp(configName, "Debug") == 0)
{ {
fout << "\t\t\t\tOptimization=\"0\"\n" fout << "\t\t\t\tOptimization=\"0\"\n"
<< "\t\t\t\tRuntimeLibrary=\"3\"\n" << "\t\t\t\tRuntimeLibrary=\"3\"\n"
<< "\t\t\t\tInlineFunctionExpansion=\"0\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,_DEBUG,_WINDOWS"; << "\t\t\t\tPreprocessorDefinitions=\"WIN32,_DEBUG,_WINDOWS";
} }
else if(strcmp(configName, "Release") == 0) else if(strcmp(configName, "Release") == 0)
{ {
fout << "\t\t\t\tOptimization=\"2\"\n" fout << "\t\t\t\tOptimization=\"2\"\n"
<< "\t\t\t\tRuntimeLibrary=\"0\"\n" << "\t\t\t\tRuntimeLibrary=\"2\"\n"
<< "\t\t\t\tInlineFunctionExpansion=\"1\"\n" << "\t\t\t\tInlineFunctionExpansion=\"1\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS"; << "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS";
} }
else if(strcmp(configName, "MinSizeRel") == 0) else if(strcmp(configName, "MinSizeRel") == 0)
{ {
fout << "\t\t\t\tOptimization=\"1\"\n" fout << "\t\t\t\tOptimization=\"1\"\n"
<< "\t\t\t\tRuntimeLibrary=\"0\"\n" << "\t\t\t\tRuntimeLibrary=\"2\"\n"
<< "\t\t\t\tInlineFunctionExpansion=\"1\"\n" << "\t\t\t\tInlineFunctionExpansion=\"1\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS"; << "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS";
} }
else if(strcmp(configName, "RelWithDebInfo") == 0) else if(strcmp(configName, "RelWithDebInfo") == 0)
{ {
fout << "\t\t\t\tOptimization=\"2\"\n" fout << "\t\t\t\tOptimization=\"2\"\n"
<< "\t\t\t\tRuntimeLibrary=\"2\"\n"
<< "\t\t\t\tInlineFunctionExpansion=\"1\"\n" << "\t\t\t\tInlineFunctionExpansion=\"1\"\n"
<< "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS"; << "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS";
} }
this->OutputDefineFlags(fout); this->OutputDefineFlags(fout);
fout << "\"\n"; fout << "\"\n";
fout << "\t\t\t\tRuntimeTypeInfo=\"TRUE\"\n"; if(m_Makefile->IsOn("CMAKE_CXX_USE_RTTI"))
{
fout << "\t\t\t\tRuntimeTypeInfo=\"TRUE\"\n";
}
fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n"; fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
fout << "\t\t\t\tObjectFile=\"" << configName << "\\\"\n"; fout << "\t\t\t\tObjectFile=\"" << configName << "\\\"\n";
fout << "\t\t\t\tProgramDataBaseFileName=\"" << configName << "\"\n"; fout << "\t\t\t\tWarningLevel=\"" << m_Makefile->GetDefinition("CMAKE_CXX_WARNING_LEVEL") << "\"\n";
fout << "\t\t\t\tWarningLevel=\"3\"\n";
fout << "\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\n" fout << "\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\n"
<< "\t\t\t\tDebugInformationFormat=\"3\""; << "\t\t\t\tDebugInformationFormat=\"3\"";
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
@ -785,48 +825,48 @@ void cmMSDotNETGenerator::OutputBuildTool(std::ostream& fout,
case cmTarget::STATIC_LIBRARY: case cmTarget::STATIC_LIBRARY:
fout << "\t\t\t<Tool\n" fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCLibrarianTool\"\n" << "\t\t\t\tName=\"VCLibrarianTool\"\n"
<< "\t\t\t\t\tOutputFile=\"" << m_LibraryOutputPath << configName << "\t\t\t\t\tOutputFile=\"" << m_LibraryOutputPath << "$(OutDir)"
<< "/" << libName << ".lib\"/>\n"; << "/" << libName << ".lib\"/>\n";
break; break;
case cmTarget::SHARED_LIBRARY: case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY: case cmTarget::MODULE_LIBRARY:
break; break;
case cmTarget::EXECUTABLE: case cmTarget::EXECUTABLE:
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCLinkerTool\"\n"
<< "\t\t\t\tAdditionalOptions=\"/MACHINE:I386\"\n"
<< "\t\t\t\tAdditionalDependencies=\" odbc32.lib odbccp32.lib ";
this->OutputLibraries(fout, configName, libName, target);
fout << "\"\n";
fout << "\t\t\t\tOutputFile=\"" << m_ExecutableOutputPath <<
configName << "/" << libName << ".exe\"\n";
fout << "\t\t\t\tLinkIncremental=\"1\"\n";
fout << "\t\t\t\tSuppressStartupBanner=\"TRUE\"\n";
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, configName, libName, target);
fout << "\"\n";
fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath << libName << ".pdb\"\n";
fout << "\t\t\t\tSubSystem=\"1\"\n";
fout << "\t\t\t\tStackReserveSize=\"10000000\"/>\n";
break;
case cmTarget::WIN32_EXECUTABLE: case cmTarget::WIN32_EXECUTABLE:
fout << "\t\t\t<Tool\n" fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCLinkerTool\"\n" << "\t\t\t\tName=\"VCLinkerTool\"\n"
<< "\t\t\t\tAdditionalOptions=\"/MACHINE:I386\"\n" << "\t\t\t\tAdditionalOptions=\"/MACHINE:I386\"\n"
<< "\t\t\t\tAdditionalDependencies=\" odbc32.lib odbccp32.lib "; << "\t\t\t\tAdditionalDependencies=\" odbc32.lib odbccp32.lib ";
this->OutputLibraries(fout, configName, libName, target); this->OutputLibraries(fout, configName, libName, target);
fout << "\"\n"; fout << "\"\n";
fout << "\t\t\t\tOutputFile=\"" << m_ExecutableOutputPath << fout << "\t\t\t\tOutputFile=\""
configName << "/" << libName << ".exe\"\n"; << m_ExecutableOutputPath << configName << "/" << libName << ".exe\"\n";
fout << "\t\t\t\tLinkIncremental=\"1\"\n"; fout << "\t\t\t\tLinkIncremental=\"1\"\n";
fout << "\t\t\t\tSuppressStartupBanner=\"TRUE\"\n"; fout << "\t\t\t\tSuppressStartupBanner=\"TRUE\"\n";
fout << "\t\t\t\tAdditionalLibraryDirectories=\""; fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, configName, libName, target); this->OutputLibraryDirectories(fout, configName, libName, target);
fout << "\"\n"; fout << "\"\n";
fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath << libName << ".pdb\"\n"; fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath
fout << "\t\t\t\tSubSystem=\"2\"\n"; << "$(OutDir)\\" << libName << ".pdb\"\n";
fout << "\t\t\t\tStackReserveSize=\"10000000\"/>\n"; if(strcmp(configName, "Debug") == 0)
{
fout << "\t\t\t\tGenerateDebugInformation=\"TRUE\"\n";
}
if( target.GetType() == cmTarget::EXECUTABLE)
{
fout << "\t\t\t\tSubSystem=\"1\"\n";
}
else
{
fout << "\t\t\t\tSubSystem=\"2\"\n";
}
fout << "\t\t\t\tStackReserveSize=\""
<< m_Makefile->GetDefinition("CMAKE_CXX_STACK_SIZE") << "\"/>\n";
break; break;
fout << "\t\t\t\tSubSystem=\"2\"\n";
case cmTarget::UTILITY: case cmTarget::UTILITY:
break; break;
} }

View File

@ -636,7 +636,7 @@ void cmSystemTools::GetArguments(std::string& line,
while(!done) while(!done)
{ {
std::string arg; std::string arg;
long endpos; unsigned int endpos;
bool foundQuoted = quotedArgument.find(line.c_str()); bool foundQuoted = quotedArgument.find(line.c_str());
bool foundNormal = normalArgument.find(line.c_str()); bool foundNormal = normalArgument.find(line.c_str());
@ -1411,7 +1411,7 @@ void cmSystemTools::Glob(const char *directory, const char *regexp,
if (d.Load(directory)) if (d.Load(directory))
{ {
int i, numf; unsigned int i, numf;
numf = d.GetNumberOfFiles(); numf = d.GetNumberOfFiles();
for (i = 0; i < numf; i++) for (i = 0; i < numf; i++)
{ {
@ -1441,7 +1441,7 @@ void cmSystemTools::GlobDirs(const char *fullPath,
cmDirectory d; cmDirectory d;
if (d.Load(startPath.c_str())) if (d.Load(startPath.c_str()))
{ {
for (int i = 0; i < d.GetNumberOfFiles(); ++i) for (unsigned int i = 0; i < d.GetNumberOfFiles(); ++i)
{ {
if((std::string(d.GetFile(i)) != ".") if((std::string(d.GetFile(i)) != ".")
&& (std::string(d.GetFile(i)) != "..")) && (std::string(d.GetFile(i)) != ".."))

View File

@ -3,11 +3,17 @@
SET (CMAKE_CXX_COMPILER cl CACHE STRING SET (CMAKE_CXX_COMPILER cl CACHE STRING
"Name of C++ compiler used.") "Name of C++ compiler used.")
SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 " CACHE STRING SET (CMAKE_CXX_FLAGS "/Zm1000 " CACHE STRING
"Flags used by the compiler during all build types, /Zm1000 increases the compiler's memory allocation to support ANSI C++/stdlib") "Flags used by the compiler during all build types, /Zm1000 increases the compiler's memory allocation to support ANSI C++/stdlib, /W3 sets the warning level to 3")
SET (CMAKE_EXTRA_LINK_FLAGS "/STACK:10000000" CACHE STRING SET (CMAKE_CXX_STACK_SIZE "10000000" CACHE STRING
"Extra flags added to the link line for creation of exe and dlls.") "Size of stack for programs.")
SET (CMAKE_CXX_WARNING_LEVEL "3" CACHE STRING
"Size of stack for programs.")
SET (CMAKE_CXX_USE_RTTI 1 CACHE BOOL
"Compile CXX code with run time type information.")
SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL
"Use the win32 thread library") "Use the win32 thread library")
@ -15,6 +21,9 @@ SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL
SET (CMAKE_MAKE_PROGRAM "devenv" CACHE STRING SET (CMAKE_MAKE_PROGRAM "devenv" CACHE STRING
"Program used to build from dsp files.") "Program used to build from dsp files.")
SET (CMAKE_CONFIGURATION_TYPES "Debug Release MinSizeRel RelWithDebInfo" CACHE STRING
"Space separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
# We will hardcode them for now. Make sure to fix that in the future # We will hardcode them for now. Make sure to fix that in the future
SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type")
SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type")
@ -27,7 +36,10 @@ SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type")
# The following variables are advanced # The following variables are advanced
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
CMAKE_CXX_USE_RTTI
CMAKE_CXX_COMPILER CMAKE_CXX_COMPILER
CMAKE_CXX_STACK_SIZE
CMAKE_CXX_WARNING_LEVEL
CMAKE_USE_WIN32_THREADS CMAKE_USE_WIN32_THREADS
CMAKE_MAKE_PROGRAM CMAKE_MAKE_PROGRAM
CMAKE_EXTRA_LINK_FLAGS CMAKE_EXTRA_LINK_FLAGS