Author: cwittich Date: Fri Nov 24 16:57:20 2006 New Revision: 24821
URL: http://svn.reactos.org/svn/reactos?rev=24821&view=rev Log: add mingw, mingw-common and msvcrt libs where needed
Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.h
Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/codebl... ============================================================================== --- trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp (original) +++ trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp Fri Nov 24 16:57:20 2006 @@ -96,6 +96,7 @@ for(size_t i = 0; i < ProjectNode.modules.size(); i++) { Module &module = *ProjectNode.modules[i]; + MingwAddImplicitLibraries( module ); _generate_cbproj ( module ); } } @@ -430,6 +431,22 @@
if ( !module.allowWarnings ) compiler_flags.push_back ( "-Werror" ); + + ///* implicit libraries */ + //libraries.push_back ( "mingw_common" ); + //libpaths.push_back ( module.project.LocateModule("mingw_common") ); + + //if ( !Module.IsDll ) + //{ + // libraries.push_back ( "%s", module.isUnicode ? "mingw_wmain" : "mingw_main" ); + // libpaths.push_back ( module.project.LocateModule("%s"), module.isUnicode ? "mingw_wmain" : "mingw_main" ); + //} + + //if ( module.name != "msvcrt" ) + //{ + // libraries.push_back ( "msvcrt" ); + // libpaths.push_back ( module.project.LocateModule("msvcrt") ); + //}
FILE* OUT = fopen ( cbproj_file.c_str(), "wb" );
@@ -569,7 +586,6 @@
if ( dll ) fprintf ( OUT, "\t\t\t\t\t<Add option="%s.temp.exp" />\r\n", module.name.c_str() ); -
/* libraries */ for ( i = 0; i < libraries.size(); i++ ) @@ -587,7 +603,7 @@ if ( dll ) { fprintf ( OUT, "\t\t\t\t<ExtraCommands>\r\n" ); - fprintf ( OUT, "<Add before="dlltool --dllname %s.%s --def %s.def --output-exp %s.temp.exp --kill-at" />\r\n", module.name.c_str(), module_type.c_str(), module.name.c_str(), module.name.c_str() ); + fprintf ( OUT, "<Add before="dlltool --dllname %s%s --def %s.def --output-exp %s.temp.exp --kill-at" />\r\n", module.name.c_str(), module_type.c_str(), module.name.c_str(), module.name.c_str() ); #ifdef WIN32 fprintf ( OUT, "\t\t\t\t\t<Add after="cmd /c del %s.temp.exp 2>NUL" />\r\n", module.name.c_str() ); #else @@ -715,3 +731,33 @@ } return lflags; } + +void +CBBackend::MingwAddImplicitLibraries( Module &module ) +{ + Library* pLibrary; + + if ( !module.isDefaultEntryPoint ) + return; + + if ( module.IsDLL () ) + { + //pLibrary = new Library ( module, "__mingw_dllmain" ); + //module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary ); + } + else + { + pLibrary = new Library ( module, module.isUnicode ? "mingw_wmain" : "mingw_main" ); + module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary ); + } + + pLibrary = new Library ( module, "mingw_common" ); + module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin() + 1, pLibrary ); + + if ( module.name != "msvcrt" ) + { + // always link in msvcrt to get the basic routines + pLibrary = new Library ( module, "msvcrt" ); + module.non_if_data.libraries.push_back ( pLibrary ); + } +}
Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/codebl... ============================================================================== --- trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.h (original) +++ trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.h Fri Nov 24 16:57:20 2006 @@ -73,6 +73,7 @@ std::string LayoutFileName ( const Module& module ) const; std::string DependFileName ( const Module& module ) const; std::string GenerateProjectLinkerFlags () const; + void MingwAddImplicitLibraries( Module &module ); std::vector<CBConfiguration*> m_configurations;
std::vector<FileUnit> m_fileUnits; @@ -97,5 +98,6 @@ const Property* _lookup_property ( const Module& module, const std::string& name ) const; };
+ #endif // __MSVC_H__