X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Ftools%2Frbuild%2Fbackend%2Fmsvc%2Fvcprojmaker.cpp;h=e89efb277cdcc4e50e9fb8632c31980030e868cb;hp=d95a6c2e1e63bddb7ca523202c1deceb47f7f830;hb=e7ac44d731ea21ae1105b8b805399863f2b9e117;hpb=bb4c8ed5eef2571b42077a48ad0b1dc58eb3ab13 diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp index d95a6c2e1e6..e89efb277cd 100644 --- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp @@ -47,16 +47,28 @@ MSVCBackend::_generate_vcproj ( const Module& module ) FILE* OUT = fopen ( vcproj_file.c_str(), "wb" ); vector imports; - for ( i = 0; i < module.non_if_data.libraries.size(); i++ ) - { - imports.push_back ( module.non_if_data.libraries[i]->name ); - } - string module_type = GetExtension(module.GetTargetName()); bool lib = (module.type == ObjectLibrary) || (module_type == ".lib") || (module_type == ".a"); bool dll = (module_type == ".dll") || (module_type == ".cpl"); bool exe = (module_type == ".exe"); bool sys = (module_type == ".sys"); + + string path_basedir = module.GetPathToBaseDir (); + string intenv = Environment::GetIntermediatePath (); + string outenv = Environment::GetOutputPath (); + string outdir; + string intdir; + + if ( intenv == "obj-i386" ) + intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */ + else + intdir = intenv; + + if ( outenv == "output-i386" ) + outdir = path_basedir + "output-i386"; + else + outdir = outenv; + // TODO FIXME - need more checks here for 'sys' and possibly 'drv'? bool console = exe && (module.type == Win32CUI); @@ -78,16 +90,16 @@ MSVCBackend::_generate_vcproj ( const Module& module ) //$progress_current++; //$output->progress("$dsp_file (file $progress_current of $progress_max)"); - // TODO FIXME - what's diff. betw. 'c_srcs' and 'source_files'? string vcproj_path = module.GetBasePath(); - vector c_srcs, source_files, resource_files, includes, libraries, defines; + vector source_files, resource_files, includes, libraries, defines; vector ifs_list; ifs_list.push_back ( &module.project.non_if_data ); ifs_list.push_back ( &module.non_if_data ); - // this is a define in MinGW w32api, but not Microsoft's headers + // MinGW doesn't have a safe-string library yet defines.push_back ( "_CRT_SECURE_NO_DEPRECATE" ); defines.push_back ( "_CRT_NON_CONFORMING_SWPRINTFS" ); + // this is a define in MinGW w32api, but not Microsoft's headers defines.push_back ( "STDCALL=__stdcall" ); string baseaddr; @@ -105,11 +117,10 @@ MSVCBackend::_generate_vcproj ( const Module& module ) // TODO FIXME - do we want the full path of the file here? string file = string(".") + &files[i]->name[vcproj_path.size()]; - source_files.push_back ( file ); - if ( !stricmp ( Right(file,2).c_str(), ".c" ) ) - c_srcs.push_back ( file ); if ( !stricmp ( Right(file,3).c_str(), ".rc" ) ) resource_files.push_back ( file ); + else + source_files.push_back ( file ); } const vector& incs = data.includes; for ( i = 0; i < incs.size(); i++ ) @@ -130,7 +141,19 @@ MSVCBackend::_generate_vcproj ( const Module& module ) const vector& libs = data.libraries; for ( i = 0; i < libs.size(); i++ ) { - libraries.push_back ( libs[i]->name + ".lib" ); +#if 0 + // this code is deactivated untill the tree builds fine with msvc + // --- is appended to each library path which is later + // replaced by the configuration + // i.e. ../output-i386/lib/rtl/---/rtl.lib becomes + // ../output-i386/lib/rtl/Debug/rtl.lib + // etc + libs[i]->importedModule-> + string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\---\\" + libs[i]->name + ".lib"; + libraries.push_back ( libpath ); +#else + libraries.push_back ( libs[i]->name + ".lib" ); +#endif } const vector& defs = data.defines; for ( i = 0; i < defs.size(); i++ ) @@ -221,16 +244,16 @@ MSVCBackend::_generate_vcproj ( const Module& module ) { std::string& cfg = cfgs[icfg]; - bool debug = strstr ( cfg.c_str(), "Debug" ); - bool speed = strstr ( cfg.c_str(), "Speed" ); + bool debug = strstr ( cfg.c_str(), "Debug" ) != NULL; + bool speed = strstr ( cfg.c_str(), "Speed" ) != NULL; bool release = (!debug && !speed ); //bool msvc_headers = ( 0 != strstr ( cfg.c_str(), "MSVC Headers" ) ); fprintf ( OUT, "\t\t\r\n" ); @@ -287,9 +310,9 @@ MSVCBackend::_generate_vcproj ( const Module& module ) fprintf ( OUT, "\"\r\n" ); fprintf ( OUT, "\t\t\t\tMinimalRebuild=\"%s\"\r\n", speed ? "FALSE" : "TRUE" ); - fprintf ( OUT, "\t\t\t\tBasicRuntimeChecks=\"%s\"\r\n", debug ? "3" : "0" ); + fprintf ( OUT, "\t\t\t\tBasicRuntimeChecks=\"%s\"\r\n", sys ? 0 : (debug ? "3" : "0") ); fprintf ( OUT, "\t\t\t\tRuntimeLibrary=\"5\"\r\n" ); - fprintf ( OUT, "\t\t\t\tBufferSecurityCheck=\"%s\"\r\n", debug ? "TRUE" : "FALSE" ); + fprintf ( OUT, "\t\t\t\tBufferSecurityCheck=\"%s\"\r\n", sys ? "FALSE" : (debug ? "TRUE" : "FALSE" )); fprintf ( OUT, "\t\t\t\tEnableFunctionLevelLinking=\"%s\"\r\n", debug ? "TRUE" : "FALSE" ); if ( module.pch != NULL ) @@ -313,9 +336,12 @@ MSVCBackend::_generate_vcproj ( const Module& module ) } fprintf ( OUT, "\t\t\t\tEnablePREfast=\"%s\"\r\n", debug ? "TRUE" : "FALSE"); - fprintf ( OUT, "\t\t\t\tDisableSpecificWarnings=\"4201;4127\"\r\n" ); - fprintf ( OUT, "\t\t\t\tWarningLevel=\"%s\"\r\n", release ? "0" : "4" ); - fprintf ( OUT, "\t\t\t\tDetect64BitPortabilityProblems=\"%s\"\r\n", release ? "FALSE" : "TRUE"); + fprintf ( OUT, "\t\t\t\tDisableSpecificWarnings=\"4201;4127;4214\"\r\n" ); + fprintf ( OUT, "\t\t\t\tWarningLevel=\"%s\"\r\n", speed ? "0" : "4" ); + fprintf ( OUT, "\t\t\t\tDetect64BitPortabilityProblems=\"%s\"\r\n", speed ? "FALSE" : "TRUE"); + if ( !module.cplusplus ) + fprintf ( OUT, "\t\t\t\tCompileAs=\"1\"\r\n" ); + fprintf ( OUT, "\t\t\t\tCallingConvention=\"%d\"\r\n", (sys || (exe && module.type == Kernel)) ? 2: 1); fprintf ( OUT, "\t\t\t\tDebugInformationFormat=\"%s\"/>\r\n", speed ? "0" : "4"); fprintf ( OUT, "\t\t\t 0 ) fprintf ( OUT, " " ); +#if 0 + // this code is deactivated untill + // msvc can build the whole tree + string libpath = libraries[i].c_str(); + libpath.replace (libpath.find("---"), //See HACK + 3, + cfg); + fprintf ( OUT, "%s", libpath.c_str() ); +#else fprintf ( OUT, "%s", libraries[i].c_str() ); +#endif } fprintf ( OUT, "\"\r\n" ); @@ -350,31 +386,39 @@ MSVCBackend::_generate_vcproj ( const Module& module ) if ( sys ) { - fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /DRIVER /ALIGN:0x20 /SUBSYSTEM:NATIVE /SECTION:INIT,D /NODEFAULTLIB /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" ); + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" ); fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 ); + fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 ); fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DriverEntry" : module.entrypoint.c_str ()); fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ()); } else if ( exe ) { if ( module.type == Kernel ) - { - fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SUBSYSTEM:NATIVE /NODEFAULTLIB /SECTION:INIT,D /ALIGN:0x80\"\r\n" ); - fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + { + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SECTION:INIT,D /ALIGN:0x80\"\r\n" ); + fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 ); + fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 ); fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"KiSystemStartup\"\r\n" ); fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ()); - } + } else if ( module.type == NativeCUI ) { - fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SUBSYSTEM:NATIVE /NODEFAULTLIB /ALIGN:0x20\"\r\n" ); - fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20\"\r\n" ); + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 1 ); + fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"NtProcessStartup\"\r\n" ); fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ()); } else if ( module.type == Win32CUI || module.type == Win32GUI ) - { - fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 ); - } + { + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 ); + } } else if ( dll ) { @@ -449,7 +493,7 @@ MSVCBackend::_generate_vcproj ( const Module& module ) fprintf ( OUT, "\t\t\t\t\r\n" ); } - if (configuration.VSProjectVersion < "8.00") { + //if (configuration.VSProjectVersion < "8.00") { if ((source_file.find(".idl") != string::npos) || ((source_file.find(".asm") != string::npos || tolower(source_file.at(source_file.size() - 1)) == 's'))) { fprintf ( OUT, "\t\t\t\t\r\n" ); } - } + //} } fprintf ( OUT, "\t\t\t\r\n" ); } @@ -493,7 +537,7 @@ MSVCBackend::_generate_vcproj ( const Module& module ) fprintf ( OUT, "\t\t\r\n" ); - for ( i = 0; i < header_files.size(); i++ ) + for ( i = 0; i < resource_files.size(); i++ ) { const string& resource_file = resource_files[i]; fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\r\n" ); - fprintf ( OUT, "\t\r\n" ); - fprintf ( OUT, "\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\r\n" ); - fprintf ( OUT, "\t\r\n" ); - fprintf ( OUT, "\r\n" ); -} +//void +//MSVCBackend::_generate_rules_file ( FILE* OUT ) +//{ +// fprintf ( OUT, "\r\n" ); +// fprintf ( OUT, "\r\n" ); +// fprintf ( OUT, "\t\r\n" ); +// fprintf ( OUT, "\t\t\r\n" ); +// fprintf ( OUT, "\t\t\t\r\n" ); +// fprintf ( OUT, "\t\t\t\r\n" ); +// fprintf ( OUT, "\t\t\r\n" ); +// fprintf ( OUT, "\t\r\n" ); +// fprintf ( OUT, "\r\n" ); +//} void MSVCBackend::_generate_sln_header ( FILE* OUT )