From 95433bb0e521fa49ce66c7294c89b58eb1b024a9 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Fri, 24 Nov 2006 13:57:20 +0000 Subject: [PATCH] add mingw, mingw-common and msvcrt libs where needed svn path=/trunk/; revision=24821 --- .../rbuild/backend/codeblocks/codeblocks.cpp | 50 ++++++++++++++++++- .../rbuild/backend/codeblocks/codeblocks.h | 2 + 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp b/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp index 1de02e1ba04..c337d1a7ade 100644 --- a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp +++ b/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp @@ -96,6 +96,7 @@ void CBBackend::ProcessModules() for(size_t i = 0; i < ProjectNode.modules.size(); i++) { Module &module = *ProjectNode.modules[i]; + MingwAddImplicitLibraries( module ); _generate_cbproj ( module ); } } @@ -431,6 +432,22 @@ CBBackend::_generate_cbproj ( const Module& module ) 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" ); fprintf ( OUT, "\r\n" ); @@ -569,7 +586,6 @@ CBBackend::_generate_cbproj ( const Module& module ) if ( dll ) fprintf ( OUT, "\t\t\t\t\t\r\n", module.name.c_str() ); - /* libraries */ for ( i = 0; i < libraries.size(); i++ ) @@ -587,7 +603,7 @@ CBBackend::_generate_cbproj ( const Module& module ) if ( dll ) { fprintf ( OUT, "\t\t\t\t\r\n" ); - fprintf ( OUT, "\r\n", module.name.c_str(), module_type.c_str(), module.name.c_str(), module.name.c_str() ); + fprintf ( OUT, "\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\r\n", module.name.c_str() ); #else @@ -715,3 +731,33 @@ CBBackend::GenerateProjectLinkerFlags() const } 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 ); + } +} diff --git a/reactos/tools/rbuild/backend/codeblocks/codeblocks.h b/reactos/tools/rbuild/backend/codeblocks/codeblocks.h index cc401c0751d..34cd953292c 100644 --- a/reactos/tools/rbuild/backend/codeblocks/codeblocks.h +++ b/reactos/tools/rbuild/backend/codeblocks/codeblocks.h @@ -73,6 +73,7 @@ class CBBackend : public Backend std::string LayoutFileName ( const Module& module ) const; std::string DependFileName ( const Module& module ) const; std::string GenerateProjectLinkerFlags () const; + void MingwAddImplicitLibraries( Module &module ); std::vector m_configurations; std::vector m_fileUnits; @@ -97,5 +98,6 @@ class CBBackend : public Backend const Property* _lookup_property ( const Module& module, const std::string& name ) const; }; + #endif // __MSVC_H__