From a49e6640b4278c43d8d91049e34c6da8fbcea52b Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 28 Feb 2008 13:35:09 +0000 Subject: [PATCH] - If BASEDIR env var is set to point to your WDK installation, make msvcX will take it into account, and add additional include directories for WDK headers and libraries for all kernelmode modules. svn path=/trunk/; revision=32522 --- .../tools/rbuild/backend/msvc/vcprojmaker.cpp | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp index 8f3316b72c4..e1e9e082a25 100644 --- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp @@ -350,12 +350,36 @@ MSVCBackend::_generate_vcproj ( const Module& module ) multiple_includes = true; } } + else + { + // Add WDK or PSDK paths, if user provides them + if (getenv ( "BASEDIR" ) != NULL && + (module.type == Kernel || + module.type == KernelModeDLL || + module.type == KernelModeDriver)) + { + string WdkBase, SdkPath, CrtPath, DdkPath; + WdkBase = getenv ( "BASEDIR" ); + SdkPath = WdkBase + "\\inc\\api"; + CrtPath = WdkBase + "\\inc\\crt"; + DdkPath = WdkBase + "\\inc\\ddk"; + + if ( multiple_includes ) + fprintf ( OUT, ";" ); + + fprintf ( OUT, "%s;", SdkPath.c_str() ); + fprintf ( OUT, "%s;", CrtPath.c_str() ); + fprintf ( OUT, "%s", DdkPath.c_str() ); + multiple_includes = true; + } + } fprintf ( OUT, "\"\r\n" ); StringSet defines = common_defines; - // Always add _CRT_SECURE_NO_WARNINGS to disable warnings about not using the safe functions introduced in MSVC8. - defines.insert ( "_CRT_SECURE_NO_WARNINGS" ); + // Always add _CRT_SECURE_NO_WARNINGS to disable warnings about not + // using the safe functions introduced in MSVC8. + defines.insert ( "_CRT_SECURE_NO_WARNINGS" ); if ( debug ) { @@ -485,6 +509,26 @@ MSVCBackend::_generate_vcproj ( const Module& module ) fprintf ( OUT, "\"\r\n" ); fprintf ( OUT, "\t\t\t\tAdditionalLibraryDirectories=\"" ); + + // Add WDK libs paths, if needed + if (getenv ( "BASEDIR" ) != NULL && + (module.type == Kernel || + module.type == KernelModeDLL || + module.type == KernelModeDriver)) + { + string WdkBase, CrtPath, DdkPath; + WdkBase = getenv ( "BASEDIR" ); + CrtPath = WdkBase + "\\lib\\crt\\i386"; + DdkPath = WdkBase + "\\lib\\wnet\\i386"; + + fprintf ( OUT, "%s;", CrtPath.c_str() ); + fprintf ( OUT, "%s", DdkPath.c_str() ); + + if (libraries.size () > 0) + fprintf ( OUT, ";" ); + } + + // Add conventional libraries dirs for (i = 0; i < libraries.size (); i++) { if ( i > 0 ) @@ -495,6 +539,7 @@ MSVCBackend::_generate_vcproj ( const Module& module ) libpath = libpath.substr (0, libpath.find_last_of ("\\") ); fprintf ( OUT, "%s", libpath.c_str() ); } + fprintf ( OUT, "\"\r\n" ); fprintf ( OUT, "\t\t\t\tOutputFile=\"$(OutDir)/%s%s\"\r\n", module.name.c_str(), module_type.c_str() );