From: <ka...@us...> - 2012-11-05 23:17:44
|
Revision: 3815 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3815&view=rev Author: kappa1 Date: 2012-11-05 23:17:34 +0000 (Mon, 05 Nov 2012) Log Message: ----------- Added support to the OS X build.xml for Xcode location discovery, Mac OS SDK discovery, JavaVM.framework discovery and gcc vs gcc-4.2 discovery, special thanks to MC78 for providing this patch Modified Paths: -------------- branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml Modified: branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml =================================================================== --- branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml 2012-11-04 20:11:03 UTC (rev 3814) +++ branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml 2012-11-05 23:17:34 UTC (rev 3815) @@ -1,86 +1,126 @@ - -<project name="OS X Native code" basedir="../../bin/lwjgl" default="nativelibrary"> - <property name="native" location="../../src/native"/> - - <target name="init"> - <mkdir dir="i386"/> - <mkdir dir="x86_64"/> - </target> - - <target name="clean"> - <delete failonerror="false"> - <fileset dir="i386"/> - <fileset dir="x86_64"/> - <fileset dir="." includes="liblwjgl.jnilib"/> - <fileset dir="." includes="lwjgl.symbols"/> - </delete> - </target> - - <target name="compile"> - <apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}"> - <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${native}/common/opengl -I${native}/macosx"/> - <!-- Map from *.m and *.c to .o --> - <mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/> - <fileset dir="${native}/macosx" includes="*.m"/> - <fileset dir="${native}/macosx" includes="*.c"/> - <fileset dir="${native}/common" includes="*.c"/> - <fileset dir="${native}/common/opengl" includes="*.c"/> - <fileset dir="${native}/generated/openal" includes="*.c"/> - <fileset dir="${native}/generated/opencl" includes="*.c"/> - <fileset dir="${native}/generated/opengl" includes="*.c"/> - </apply> - </target> - - <target name="link"> - <apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true"> - <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -weak_framework AppKit -framework JavaVM -framework Carbon -framework OpenGL -framework QuartzCore -F/System/Library/Frameworks/JavaVM.framework/Frameworks"/> - <fileset dir="${objdir}" includes="*.o"/> - </apply> - <apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true"> - <arg line="-S -X"/> - <fileset dir="." file="${libname}"/> - </apply> - </target> - - <target name="nativelibrary" depends="init"> - <property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/> - <property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/> - <property name="universal_flags" value="-isysroot ${universal_sdkroot}"/> - <antcall target="compile"> - <param name="dstdir" location="i386"/> - <param name="compiler" value="gcc-4.2"/> - <param name="sdkroot" location="${universal_sdkroot}"/> - <param name="cflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/> - </antcall> - <antcall target="compile"> - <param name="dstdir" location="x86_64"/> - <param name="compiler" value="gcc-4.2"/> - <param name="sdkroot" location="${universal_sdkroot}"/> - <param name="cflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/> - </antcall> - <exec vmlauncher="true" executable="sh" output="lwjgl.symbols" failonerror="true"> - <arg path="../../platform_build/macosx_ant/build-symbol-list"/> - <arg path="i386"/> - </exec> - <antcall target="link"> - <param name="objdir" location="i386"/> - <param name="libname" value="liblwjgl-i386.jnilib"/> - <param name="linker" value="gcc-4.2"/> - <param name="linkerflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/> - </antcall> - <antcall target="link"> - <param name="objdir" location="x86_64"/> - <param name="libname" value="liblwjgl-i86_64.jnilib"/> - <param name="linker" value="gcc-4.2"/> - <param name="linkerflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/> - </antcall> - <apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" > - <arg value="-create"/> - <srcfile/> - <arg value="-output"/> - <arg path="liblwjgl.jnilib"/> - <fileset file="i386/liblwjgl-i386.jnilib"/> - <fileset file="x86_64/liblwjgl-i86_64.jnilib"/> - </apply> - </target> -</project> + +<project name="OS X Native code" basedir="../../bin/lwjgl" default="nativelibrary"> + <property name="native" location="../../src/native"/> + + <target name="init"> + <mkdir dir="i386"/> + <mkdir dir="x86_64"/> + <property environment="env" /> + <!-- Check which gcc we have, newer releasse of Mac OS do not have gcc-4.2 installed by defaault --> + <available file="gcc" filepath="${env.PATH}" property="gcc" value="gcc"/> + <available file="gcc-4.2" filepath="${env.PATH}" property="gcc" value="gcc-4.2"/> + <!-- Ask Xcode for correct path to XCode tools --> + <!-- Will fail if XCode Command Line Tools are not installed on 10.7+ (Lion) --> + <exec executable="xcode-select" outputproperty="developer_path" errorproperty="xcode-select.error" failonerror="false" failifexecutionfails="false"> + <arg value="-print-path" /> + </exec> + <!-- Default to /Developer if xcode-select fails --> + <condition property="developer_path" value="/Developer"> + <isset property="xcode-select.error" /> + </condition> + <!-- Lion and above do not have /Developer nor the 10.6 SDK, so use 10.7 SDK --> + <condition property="sdkroot" value="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"> + <available file="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk" type="dir"/> + </condition> + <condition property="javavmroot" value="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"> + <available file="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers" type="dir"/> + </condition> + <!-- Fallback to 10.6 SDK if present on file system under new Xcode location --> + <condition property="sdkroot" value="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"> + <available file="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk" type="dir"/> + </condition> + <condition property="javavmroot" value="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"> + <available file="${developer_path}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers" type="dir"/> + </condition> + <!-- Fallback to 10.6 SDK if present on old /Developer path --> + <condition property="sdkroot" value="${developer_path}/SDKs/MacOSx10.6.sdk"> + <available file="${developer_path}/SDKs/MacOSx10.6.sdk" type="dir"/> + </condition> + <!-- Only use /System/Library/Frameworks/JavaVM.framework/ if nothing under other SDK's is found --> + <condition property="javavmroot" value=""> + <and> + <available file="/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers" type="dir"/> + <not> + <isset property="javavmroot" /> + </not> + </and> + </condition> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="i386"/> + <fileset dir="x86_64"/> + <fileset dir="." includes="liblwjgl.jnilib"/> + <fileset dir="." includes="lwjgl.symbols"/> + </delete> + </target> + + <target name="compile" depends="init"> + <apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}"> + <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I${javavmroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${native}/common/opengl -I${native}/macosx -I${javavmroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Versions/A/Headers"/> + <!-- Map from *.m and *.c to .o --> + <mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/> + <fileset dir="${native}/macosx" includes="*.m"/> + <fileset dir="${native}/macosx" includes="*.c"/> + <fileset dir="${native}/common" includes="*.c"/> + <fileset dir="${native}/common/opengl" includes="*.c"/> + <fileset dir="${native}/generated/openal" includes="*.c"/> + <fileset dir="${native}/generated/opencl" includes="*.c"/> + <fileset dir="${native}/generated/opengl" includes="*.c"/> + </apply> + </target> + + <target name="link" depends="init"> + <apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true"> + <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -weak_framework AppKit -framework JavaVM -framework Carbon -framework OpenGL -framework QuartzCore -framework JavaNativeFoundation -F${javavmroot}/System/Library/Frameworks/JavaVM.framework/Frameworks"/> + <fileset dir="${objdir}" includes="*.o"/> + </apply> + <apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true"> + <arg line="-S -X"/> + <fileset dir="." file="${libname}"/> + </apply> + </target> + + <target name="nativelibrary" depends="init"> + <property name="universal_sdkroot" location="${sdkroot}"/> + <property name="x86_64_sdkroot" location="${sdkroot}"/> + <property name="universal_flags" value="-isysroot ${universal_sdkroot}"/> + <antcall target="compile"> + <param name="dstdir" location="i386"/> + <param name="compiler" value="${gcc}"/> + <param name="sdkroot" location="${universal_sdkroot}"/> + <param name="cflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/> + </antcall> + <antcall target="compile"> + <param name="dstdir" location="x86_64"/> + <param name="compiler" value="${gcc}"/> + <param name="sdkroot" location="${universal_sdkroot}"/> + <param name="cflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/> + </antcall> + <exec vmlauncher="true" executable="sh" output="lwjgl.symbols" failonerror="true"> + <arg path="../../platform_build/macosx_ant/build-symbol-list"/> + <arg path="i386"/> + </exec> + <antcall target="link"> + <param name="objdir" location="i386"/> + <param name="libname" value="liblwjgl-i386.jnilib"/> + <param name="linker" value="${gcc}"/> + <param name="linkerflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/> + </antcall> + <antcall target="link"> + <param name="objdir" location="x86_64"/> + <param name="libname" value="liblwjgl-i86_64.jnilib"/> + <param name="linker" value="${gcc}"/> + <param name="linkerflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/> + </antcall> + <apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" > + <arg value="-create"/> + <srcfile/> + <arg value="-output"/> + <arg path="liblwjgl.jnilib"/> + <fileset file="i386/liblwjgl-i386.jnilib"/> + <fileset file="x86_64/liblwjgl-i86_64.jnilib"/> + </apply> + </target> +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |