Don't confuse me with a C++ compiler/linker expert, but I tackled this a
couple of years ago and have not thought of it since.  Like you, we have
a C++.NET wrapper around a 3rd party DLL.  I seem to recall having
trouble with the switches for precompiled header and decided, since we
were building from scratch anyway, that we should not worry about them
at all and just compile everything.  The output is a mangaged assembly
that can be used by other managed assemblies.

Here is an excerpt of my build file for this project showing the
switches we use.  This works in ancient NANT 0.85.2031.0 7-24-05. Note
ability to select difference compiler switches depending on whether this
is a debug or release build.  We also copy a strong key file and an
assembly info file constructed about build time to replace the one used
by developers.  We found we also had to explicitly include the folders
in <includedirs> to get this to work. 

                <property name="outputName"
value="${build.dir}\${nant.project.name}" />
                <property name="common-compile-options" value=" /TP /G7
/D &quot;WIN32&quot; /D &quot;_WINDLL&quot; /D &quot;_MBCS&quot; /EHsc
/W3" />
                <property name="common-link-options"
value="/INCREMENTAL:NO /DEBUG /DLL
/NODEFAULTLIB:&quot;nochkclr.obj&quot;
/NODEFAULTLIB:&quot;libc.lib&quot; /NODEFAULTLIB:&quot;libcmt.lib&quot;
/NODEFAULTLIB:&quot;libcmtd.lib&quot;
/NODEFAULTLIB:&quot;msvcrtd.lib&quot;
/INCLUDE:&quot;[EMAIL PROTECTED]&quot; /FIXED:No msvcrt.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
/NOENTRY" />
                <!-- debug build specific compile and link options -->
                <property name="specific-compile-options" value="/Od /D
&quot;_DEBUG&quot; /MTd /Zi" />
                <property name="specific-link-options" value="" />
                <!-- release build specific options -->
                <property name="specific-compile-options" value="/O2 /D
&quot;NDEBUG&quot; /MT" unless="${build.debug}" />
                <property name="specific-link-options" value=""
unless="${build.debug}" />
                <mkdir dir="${outputName}" />
                <copy file="../CommonAssemblyInfo.cpp"
tofile="CommonAssemblyInfo.cpp" overwrite="true" />
                <copy file="../XXX.snk" tofile="XXX.snk"
overwrite="true" />
                <cl options="${common-compile-options}
${specific-compile-options}" outputdir="${outputName}"
                        managedextensions="true"  pchmode="AutoCreate">
                        <sources>
                                <include name="*.cpp" />
                                <exclude name="AssemblyInfo.cpp" />
                        </sources>
                        <includedirs>
                                <!-- commonassemblyinfo won't compile
without this -->
                                <include name="${nant.project.basedir}"
/>
                                <include name="C:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\**" />
                                <include name="C:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\include\**" />
                        </includedirs>
                        <metadataincludedirs>
                                <include name="${nunitfolder}" />
                        </metadataincludedirs>
                </cl>
                <link output="${outputName}.dll"
options="${common-link-options} ${specific-link-options}">
                        <sources>
                                <include name="${outputName}\*.obj" />
                        </sources>
                        <libdirs>
                                <include name="C:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\lib\**" />
                                <include name="C:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\**" />
                                <include name="C:\Program
Files\Microsoft.NET\SDK\V1.1\Lib\**" />
                        </libdirs>
                </link>
Stephen Lewis
Envisioneering LLC
1982 Innerbelt Business Center Dr.
St. Louis MO 63114
(314) 429 7367 x112
[EMAIL PROTECTED]


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to