Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 12366

NMake2MSBuild

$
0
0

皆様、雨の多い今日この頃ですが、いかがお過ごしでしょうか。

WDK サポートチームのI沢(アイザワ)です。

 

今回は、ドライバのビルド環境に関するお話です。

WDK 8 からドライバのビルドが Visual Studio 上で行うことができるようになり、非常に便利になったことは既にみなさんご存知かと思います。

しかしながら、それ以前のドライバを Visual Studio でビルドできるようにするためには当然ながら移行作業が必要となります。

実は上記移行作業を簡単にしてくれる便利なツールとして Nmake2MsBuild が用意されております。意外と知られていなかったりしますので、今回はこちらのツールをご紹介いたします。

 

■ インストール

Nmake2MsBuild の威力を確認するために、今回は Windows 8.1 x64 環境に以下をインストールいたします。

 

·         Visual Studio 2013

·         Windows Driver Kit 8.1 Update 1

https://www.microsoft.com/en-us/download/details.aspx?id=42273

·         Windows Driver Kit Version 7.1.0

https://www.microsoft.com/en-us/download/details.aspx?id=11800

 

Visual Studio 2013 および Windows Driver Kit 8.1 Update 1 は、Nmake2MsBuild のインストールおよびNmake2MsBuild で生成されたプロジェクトファイルを用いてドライバをビルドするためにインストールいたします。

Windows Driver Kit Version 7.1.0 は、含まれているサンプルコードを Nmake2MsBuild の変換元として使用いたします。

 

■ ソリューション& プロジェクトファイルの生成

NMake2MSBuild.exe はデフォルトで以下のパスに格納されております。

C:\Program Files (x86)\Windows Kits\8.1\bin\x86\NMake2MSBuild.exe

 

今回、プロジェクトファイルを生成するドライバは toaster bus ドライバサンプルを使用いたします。

デフォルトでは以下のフォルダにソースコードが格納されております。

C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic

 

コマンドプロンプトを起動し、NMake2MSBuild.exe が格納されているフォルダへ移動して、以下のコマンドを実行いたします。

ポイントとしては、引数に指定するのはフォルダではなく sources ファイルとなる点です。

C:\Program Files (x86)\Windows Kits\8.1\bin\x86>NMake2MSBuild.exe C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\sources

 

以下が実行した結果です。

ソリューションファイルとプロジェクトファイルの生成に成功したことがわかります!

C:\Program Files (x86)\Windows Kits\8.1\bin\x86>NMake2MSBuild.exe C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\sources

ConvertFile :   Information  :

    Converting "C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\sources"

GenerateMsBuildFile :   Information  :

    Generated file "C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\sources.props"

ConvertFile         :   Information  :

    Converting "C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\makefile.inc"

GenerateMsBuildFile :   Information  :

    Generated file "C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\makefile.inc.props"

PostProcessing      :   Information  :

    Generated Project File dynambus.vcxproj

GetDependencyInformation :      Information  :

    Checking for external project dependencies

GetDependencyInformation :      Information  :

    The primary project collection does not contain any projects that depend on others.

CreatePackage            :      Information  :

    Generated Package Project file 'C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\dynambus-Package\dynambus-Package.vcxproj'

InitializeProjectsForSolution : Information  :

    Generating solution C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\dynambus.sln from:

        C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\dynambus-Package\dynambus-Package.vcxproj

        C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\dynambus.vcxproj

CreateSolutionIncludingDependencies :   Information  :

    Solution C:\WinDDK\7600.16385.1\src\general\toaster\kmdf\bus\dynamic\dynambus.sln was created successfully

Convert                             :   Information  :

    ========== Project Conversion Finished: 1 Solution created with 2 Projects ==========

 

Visual Studio でのビルド

それでは sources ファイルが格納されているフォルダにソリューションファイル (dynambus.sln) が格納されておりますので、こちらを実行いたしましょう。

実行後、ソリューションエクスプローラーの表示を確認すると、ドライバビルド用のプロジェクトとパッケージング用のプロジェクトが作成されていることが確認できます。

 

clip_image002

 

このままビルドしてみましょう…メニューの [ビルド] から [ソリューションのビルド] を選択すると…。

 

clip_image004

 

ビルドに成功しました!簡単ですね。

これで Visual Studio のパワフルな機能を存分に活用しながらドライバの開発を行うことができます!

新バージョンの OS リリースに備えて過去のドライバを Visual Studio 環境に移行する場合は是非ご活用ください。

 

ではでは。

 


Viewing all articles
Browse latest Browse all 12366

Trending Articles