SF1709841 Visual C++ 8.0 Visual Studio 2005 compilation. No longer requires VC98 or 2003 Platform SDK.

This commit is contained in:
clay_shooter
2007-04-30 02:37:00 +00:00
parent 9c23a727c2
commit e98dc4b0cf
12 changed files with 476 additions and 493 deletions

251
build.xml
View File

@@ -5,33 +5,22 @@
Created Feb 4, 2005 1:23:05 PM as part of migration from ANT
Last Modified March 24, 2007
Tested on Eclipse 3.2 with the Callisto plugis, Ant 1.6.1 and MS Visual C++ 6.0
Tested on Eclipse 3.2 with the Callisto plugis, Ant 1.6.1 and MS Visual C++ 8 (2005)
Eclipse users are pretty lucky because the whole project
can be built inside eclipse due to their built in ANT support.
The COM portion of this build requires MS Visual C++ 6.0.
The COM portion of this build requires MS Visual C++ 8.0. (2005)
The build proces defined in this build.xml file does not support
MS Visual C++ 8.0 (Visual C++ 2005 Express) when combined with the MS SDK.
The problem is that SafeArray.cpp will not compile because some of the
types have changed sizes in the newer 64bit aware world.
YOU MUST define a file named compilation_tools.properties!
The file for MS Visual C++ 6.0 building only the 32 bit version
The file for MS Visual C++ 8.0 building 32 and 64 bit
(releases up to 1.11 only supported 32 builds) looks something like:
JDK=d:/j2sdk1.4.2_13
MSDEVDIR=d:\\apps\\Microsoft Visual Studio\\VC98
version=1.11-pre2
Construction with 64 bit support requires the MS Platform SDK.
compilation_tools.properties in this situation should look
something like:
JDK=d:/j2sdk1.4.2_13
MSDEVDIR=d:\\apps\\Microsoft Visual Studio\\VC98
MSSDKDIR=D:\\Apps\\Microsoft Platform SDK for Windows Server 2003 R2
version=1.11-pre2
JDK=d:\\j2sdk1.4.2_14
MSDEV_DIR=d:\\apps\\Microsoft Visual Studio 8\\VC
MSDEV_IDE_DIR=d:\\apps\\Microsoft Visual Studio 8\\Common7\\IDE
version=1.13
DO NOT check compilation_tools.properties into source control as the
values are specific to YOUR environment.
@@ -46,14 +35,12 @@
Relies on the fact that properties cannot be reset once set.
================================================================== -->
<property file="compilation_tools.properties" />
<property environment="env"/>
<echo message="Number of Processors = ${env.NUMBER_OF_PROCESSORS}"/>
<property name="JDK" value="JDK not set in compilation_tools properties file"/>
<!-- MSDEVDIR is a required parameter so set to a message if its not set -->
<property name="MSDEVDIR" value="MSDEVDIR not set in compilation_tools properties file"/>
<!-- MSSDKDIR is an optional parameter. It is set to the same as MSDEVDIR if not specified
sets it to the "there is a problem" type message if no SDK or DEV was provided -->
<property name="MSSDKDIR" value="${MSDEVDIR}"/>
<echo message="executing with MSDEVDIR=${MSDEVDIR}" />
<echo message="executing with MSSDKDIR=${MSSDKDIR}"/>
<!-- MSDEV_DIR is a required parameter so set to a message if its not set -->
<property name="MSDEV_DIR" value="MSDEV_DIR not set in compilation_tools properties file"/>
<echo message="executing with MSDEV_DIR=${MSDEV_DIR}" />
<!-- ======================================================================
@@ -73,37 +60,39 @@
<property name="src.java.unittest" value="${basedir}/unittest" />
<property name="src.cpp" value="${basedir}/jni" />
<property name="release.dir" value="${basedir}/release" />
<property name="release.dir" value="${basedir}\release" />
<property name="release.dir.x86" value="${release.dir}/x86" />
<property name="release.dir.x86.cpp" value="${release.dir.x86}/jni" />
<property name="release.file.x86.dll" value="${release.dir.x86}/${generated.filename.dll}" />
<property name="release.dir.x86" value="${release.dir}\x86" />
<property name="release.dir.x86.cpp" value="${release.dir.x86}\jni" />
<property name="release.file.x86.dll" value="${release.dir.x86}\${generated.filename.dll}" />
<property name="release.dir.AMD64" value="${release.dir}/AMD64" />
<property name="release.dir.AMD64.cpp" value="${release.dir.AMD64}/jni" />
<property name="release.file.AMD64.dll" value="${release.dir.AMD64}/${generated.filename.dll}" />
<property name="release.dir.AMD64" value="${release.dir}\AMD64" />
<property name="release.dir.AMD64.cpp" value="${release.dir.AMD64}\jni" />
<property name="release.file.AMD64.dll" value="${release.dir.AMD64}\${generated.filename.dll}" />
<property name="release.dir.java" value="${release.dir}/java" />
<property name="release.file.jar" value="${release.dir.java}/${generated.filename.jar}" />
<property name="release.dir.java" value="${release.dir}\java" />
<property name="release.file.jar" value="${release.dir.java}\${generated.filename.jar}" />
<property name="compiler.x86" value="${MSDEVDIR}\bin\cl.exe" />
<property name="linker.x86" value="${MSDEVDIR}\bin\link.exe" />
<property name="include.x86" value="${MSDEVDIR}\include" />
<property name="include.x86.atl" value="${MSDEVDIR}\atl\include" />
<property name="library.x86" value="${MSDEVDIR}\lib" />
<property name="compiler.x86" value="${MSDEV_DIR}\bin\cl.exe" />
<property name="linker.x86" value="${MSDEV_DIR}\bin\link.exe" />
<property name="manifestool.x86" value="${MSDEV_DIR}\bin\mt.exe" />
<property name="include.x86" value="${MSDEV_DIR}\include" />
<property name="include.x86.platformSDK" value="${MSDEV_DIR}\PlatformSDK\Include" />
<property name="include.x86.atl" value="${MSDEV_DIR}\atlmfc\include" />
<property name="library.x86" value="${MSDEV_DIR}\lib" />
<property name="library.x86.platformSDK" value="${MSDEV_DIR}\PlatformSDK\lib" />
<property name="library.x86.atl" value="${MSDEV_DIR}\atlmfc\lib" />
<!-- You have to love the beautiful asymetry of the MS world -->
<!-- The platform SDK comes with 64 bit tools but not 32 bit tools -->
<property name="compiler.AMD64" value="${MSSDKDIR}\bin\win64\x86\AMD64\cl.exe" />
<property name="linker.AMD64" value="${MSSDKDIR}\bin\win64\x86\AMD64\link.exe" />
<property name="include.AMD64" value="${MSSDKDIR}\include" />
<property name="library.AMD64" value="${MSSDKDIR}\lib\AMD64" />
<property name="compiler.AMD64" value="${MSDEV_DIR}\bin\x86_amd64\cl.exe" />
<property name="linker.AMD64" value="${MSDEV_DIR}\bin\x86_amd64\link.exe" />
<property name="manifesttool.AMD64" value="${MSDEV_DIR}\bin\x86_amd64\mt.exe" />
<property name="include.AMD64" value="${MSDEV_DIR}\include" />
<property name="library.AMD64" value="${MSDEV_DIR}\lib\AMD64" />
<property name="library.AMD64.platformSDK" value="${MSDEV_DIR}\PlatformSDK\lib\AMD64" />
<property name="library.AMD64.atl" value="${MSDEV_DIR}\atlmfc\lib\AMD64" />
<!-- Itanium support not yet implemented -->
<property name="compiler.IA64" value="${MSDEVDIR}\bin\win64\cl.exe" />
<property name="linker.IA64" value="${MSDEVDIR}\bin\win64\link.exe" />
<property name="include.IA64" value="${MSSDKDIR}\include" />
<property name="library.IA64" value="${MSSDKDIR}\lib\IA64" />
<!-- ======================================================================
Create the necessary directory structure (does nothing if it
@@ -128,21 +117,14 @@
<!-- ======================================================================
32 bit x86 can only be built on 32 bit because of a JDK library issue.
arch=x86 true if on 32 bit, unset in all other cases.
Assume 64 bit builds are ok if MSDEVDIR and MSSDKDIR are different
because they are always that way on 64 bit and are that
way on 32 bit if using VC++ 6 with platform libraries
This module used to rely on that. Now it just checks to see if we have
the right compilers.
================================================================== -->
<condition property="canBuildX86">
<os arch="x86"/>
</condition>
<available file="${compiler.x86}" property="canBuildX86"/>
<echo message="canBuildX86=${canBuildX86}" />
<condition property="canBuildAMD64">
<not>
<equals arg1="${MSSDKDIR}" arg2="${MSDEVDIR}"/>
</not>
</condition>
<available file="${compiler.AMD64}" property="canBuildAMD64"/>
<echo message="canBuildAMD64=${canBuildAMD64}" />
<!-- ======================================================================
Compare the date/time of the DLL against that of the cpp source.
Up to date is only true if dll exists and is later than source
@@ -153,14 +135,14 @@
<!-- Check the build file itself as well -->
<srcfiles dir="${basedir}" includes="build.xml" />
</uptodate>
<echo message="checkDllUpToDateX86= ${dllUpToDateX86}" />
<echo message="dllUpToDateX86= ${dllUpToDateX86} (${release.file.x86.dll})" />
<uptodate property="dllUpToDateAMD64" targetfile="${release.file.AMD64.dll}">
<srcfiles dir="${src.cpp}" includes="*.cpp" />
<srcfiles dir="${src.cpp}" includes="*.h" />
<!-- Check the build file itself as well -->
<srcfiles dir="${basedir}" includes="build.xml" />
</uptodate>
<echo message="checkDllUpToDateAMD64= ${dllUpToDateAMD64}" />
<echo message="dllUpToDateAMD64= ${dllUpToDateAMD64} (${release.file.AMD64.dll})" />
<!-- ======================================================================
We should build if we can build and the dll is not up to date
@@ -270,84 +252,64 @@
<echo>Clean up the (x86) target folders and file, for safety</echo>
<delete file="${release.dir.x86.cpp}/**/*.*" />
<echo>Compiling (x86) C++ classes with JDK JNI library ${JDK}</echo>
<apply executable="${compiler.x86}" dir="${release.dir.x86.cpp}" parallel="false" verbose="true" failonerror="true">
<arg value="-c" />
<arg value="/nologo" />
<!-- create a multi threaded library -->
<!-- <arg value="/MT" /> -->
<exec executable="${compiler.x86}" dir="${release.dir.x86.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<env key="include" value="${JDK}\include;${JDK}\include\win32;${include.x86.platformSDK};${include.x86};${include.x86.atl}"/>
<arg value="/nologo"/>
<arg value="/c"/>
<arg value="/D WIN32"/>
<arg value="/D NDEBUG"/>
<arg value="/D _WINDOWS"/>
<arg value="/D _USRDLL"/>
<arg value="/D _WINDLL" />
<!-- create a multi threaded dll -->
<arg value="/MD"/>
<!-- raise the warning level from the default -->
<!-- <arg value="/Wp64"/> -->
<arg value="/W2" />
<!-- sets the exception model -->
<arg value="/EHsc" />
<!-- /O2 and /RCT1 are incompatible -->
<!-- optimize build for speed. (is this VC specific? -->
<arg value="/O2" />
<!-- next two wipe out a lot of deprecated warnings about strings when using VC++ 8.0 and SDK-->
<arg value="/D" />
<arg value="_CRT_SECURE_NO_DEPRECATE" />
<arg value="/D" />
<arg value="_CRT_NONSTDC_NO_DEPRECATE" />
<arg value="/D" />
<arg value="_STATIC_CPPLIB" />
<arg value="-I" />
<arg value="${JDK}\include" />
<arg value="-I" />
<arg value="${JDK}\include\win32" />
<!-- hopefully 6.0 won't barf including same dir twice -->
<arg value="-I" />
<arg value="${include.x86}" />
<arg value="-I" />
<arg value="${include.x86.atl}" />
<!-- after SDK because SDK may be more up to date -->
<arg value="-I" />
<arg value="${MSDEVDIR}\Include" />
<fileset dir="${src.cpp}">
<include name="*.cpp" />
</fileset>
</apply>
<arg value="/D _CRT_SECURE_NO_DEPRECATE" />
<arg value="/D _CRT_NONSTDC_NO_DEPRECATE" />
<arg value="/D _STATIC_CPPLIB" />
<arg value="${src.cpp}/*.cpp"/>
</exec>
</target>
<target name="compileAMD64" if="shouldBuildAMD64">
<echo>Clean up the (AMD64) target folders and file, for safety</echo>
<delete file="${release.dir.AMD64.cpp}/**/*.*" />
<echo>Compiling C++ (AMD64) classes with JDK JNI library ${JDK}</echo>
<apply executable="${compiler.AMD64}" dir="${release.dir.AMD64.cpp}" parallel="false" verbose="true" failonerror="true">
<arg value="-c" />
<arg value="/nologo" />
<!-- create a multi threaded library -->
<!-- <arg value="/MT" /> -->
<exec executable="${compiler.AMD64}" dir="${release.dir.AMD64.cpp}" failonerror="true">
<env key="include" value="${JDK}\include;${JDK}\include\win32;${include.x86.platformSDK};${include.x86};${include.x86.atl}"/>
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="/nologo"/>
<arg value="/c"/>
<arg value="/D WIN64"/>
<arg value="/D NDEBUG"/>
<arg value="/D _WINDOWS"/>
<arg value="/D _USRDLL"/>
<arg value="/D _WINDLL" />
<!-- create a multi threaded dll -->
<arg value="/MD"/>
<!-- raise the warning level from the default -->
<arg value="/W3" />
<!-- <arg value="/Wp64"/> -->
<arg value="/W2" />
<!-- sets the exception model -->
<arg value="/EHsc" />
<!-- /O2 and /RCT1 are incompatible -->
<!-- optimize build for speed. (is this VC specific? -->
<arg value="/O2" />
<!-- next two wipe out a lot of deprecated warnings about strings when using VC++ 8.0 and SDK-->
<arg value="/D" />
<arg value="_CRT_SECURE_NO_DEPRECATE" />
<arg value="/D" />
<arg value="_CRT_NONSTDC_NO_DEPRECATE" />
<arg value="/D" />
<arg value="_STATIC_CPPLIB" />
<arg value="-I" />
<arg value="${JDK}\include" />
<arg value="-I" />
<arg value="${JDK}\include\win32" />
<!-- hopefully 6.0 won't barf including same dir twice -->
<arg value="-I" />
<arg value="${include.AMD64}" />
<arg value="-I" />
<arg value="${include.AMD64}\crt" />
<arg value="-I" />
<arg value="${include.AMD64}\atl" />
<!-- after SDK because SDK may be more up to date -->
<!--
<arg value="-I" />
<arg value="${MSDEVDIR}\Include" />
-->
<fileset dir="${src.cpp}">
<include name="*.cpp" />
</fileset>
</apply>
<arg value="/D _CRT_SECURE_NO_DEPRECATE" />
<arg value="/D _CRT_NONSTDC_NO_DEPRECATE" />
<arg value="/D _STATIC_CPPLIB" />
<arg value="${src.cpp}/*.cpp"/>
</exec>
</target>
<!-- ======================================================================
Link the obj files into a DLL.
@@ -360,40 +322,55 @@
================================================================== -->
<target name="makeDllX86" depends="compileX86" if="shouldBuildX86">
<echo>Clean up the target folders and file, for safety</echo>
<echo>Using ${library.x86}</echo>
<delete file="${release.file.x86.dll}" />
<echo>Creating ${release.file.x86.dll}</echo>
<apply executable="${linker.x86}" dir="${release.dir.x86.cpp}" parallel="true" verbose="true" failonerror="true">
<exec executable="${linker.x86}" dir="${release.dir.x86.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="/nologo" />
<arg value="/MANIFEST" />
<arg value="/MANIFESTFILE:${release.dir.x86.cpp}/jacob.dll.manifest" />
<arg value="/dll" />
<arg value="/version:${version}" />
<arg value="/out:${release.file.x86.dll}" />
<arg value="/libpath:${library.x86}" />
<srcfile />
<arg value="/libpath:${library.x86.platformSDK}" />
<arg value="/libpath:${library.x86.atl}" />
<arg value="${JDK}\lib\jvm.lib" />
<fileset dir="${release.dir.x86.cpp}">
<include name="*.obj" />
</fileset>
</apply>
<arg value="${release.dir.x86.cpp}/*obj"/>
</exec>
<exec executable="${manifestool.x86}" dir="${release.dir.x86.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="-outputresource:${release.file.x86.dll};2"/>
<arg value="-manifest"/>
<arg value="${release.dir.x86.cpp}\jacob.dll.manifest" />
</exec>
</target>
<target name="makeDllAMD64" depends="compileAMD64" if="shouldBuildAMD64">
<echo>Clean up the target folders and file, for safety</echo>
<delete file="${release.file.AMD64.dll}" />
<echo>Creating {$release.file.AMD64.dll}</echo>
<apply executable="${linker.AMD64}" dir="${release.dir.AMD64.cpp}" parallel="true" verbose="true" failonerror="true">
<exec executable="${linker.AMD64}" dir="${release.dir.AMD64.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="/nologo" />
<arg value="/MANIFEST" />
<arg value="/MANIFESTFILE:${release.dir.AMD64.cpp}/jacob.dll.manifest" />
<arg value="/dll" />
<arg value="/version:${version}" />
<arg value="/out:${release.file.AMD64.dll}" />
<arg value="/libpath:${library.AMD64}" />
<arg value="/libpath:${library.AMD64}\atlmfc" />
<srcfile />
<arg value="/libpath:${library.AMD64.platformSDK}" />
<arg value="/libpath:${library.AMD64.atl}" />
<arg value="${JDK}\lib\jvm.lib" />
<arg value="bufferoverflowu.lib" />
<fileset dir="${release.dir.AMD64.cpp}">
<include name="*.obj" />
</fileset>
</apply>
<arg value="${release.dir.AMD64.cpp}/*.obj" />
</exec>
<exec executable="${manifestool.x86}" dir="${release.dir.AMD64.cpp}" failonerror="true">
<env key="Path" value="${MSDEV_IDE_DIR}"/>
<arg value="-outputresource:${release.file.AMD64.dll};2"/>
<arg value="-manifest"/>
<arg value="${release.dir.AMD64.cpp}\jacob.dll.manifest" />
</exec>
</target>
<!-- ======================================================================
@@ -453,7 +430,7 @@
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="jni/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="samples/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="unittest/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="vstudio/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="vstudio/jacob.vcproj" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="lib/**" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="build.xml, README.txt" />
<zipfileset dir="${basedir}" prefix="${generated.filename.zip}" includes="LICENSE.* version.properties" />