Browse Source

native bullet build:
- delete toolchain files for cmake
- add working cross-compile target for windows 32bit (WIP)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8907 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 14 years ago
parent
commit
2571157073

+ 51 - 30
engine/nbproject/build-bullet-natives.xml

@@ -165,8 +165,6 @@
         <mkdir dir="${bullet.output.dir}"/>
         <mkdir dir="build/bullet-native"/>
         <mkdir dir="build/bullet-native-64"/>
-        <mkdir dir="build/bullet-native-mingw"/>
-        <mkdir dir="build/bullet-native-mingw-64"/>
     </target>
     
     <target name="-nativelib-osx" if="isMac">
@@ -239,17 +237,22 @@
     </target>
     
     <target name="-nativelib-linux-mingw-64" if="isLinux64">
-        <echo message="Building 64 bit Linux version of native bullet"/>
+        <echo message="Building 64 bit Windows version of native bullet"/>
+        <!--mkdir dir="build/bullet-native-mingw"/-->
+        <mkdir dir="build/bullet-native-mingw-64"/>
         <mkdir dir="${bullet.output.dir}/windows"/>
-        <cc libtool="i686-w64-mingw32" name="${bullet.linux.compiler}" warnings="severe" debug="${bullet.compile.debug}" link="shared" outfile="${bullet.output.dir}/windows/${bullet.library.name}64" objdir="build/bullet-native-mingw-64">
+        <cc compilertarget="${cross.compile.target64}" name="${bullet.linux.crosscompiler}" warnings="severe" debug="${bullet.compile.debug}" outfile="${bullet.output.dir}/windows/${bullet.library.name}64.dll" objdir="build/bullet-native-mingw-64">
             <fileset dir="${bullet.source.dir}">
                 <include name="*.cpp">
                 </include>
             </fileset>
+            <sysincludepath path="/usr/${cross.compile.target64}/include"/>
             <includepath path="${bullet.java.include}"/>
             <includepath path="${bullet.java.include}/win32"/>
             <includepath path="${bullet.bullet.include}"/>
-            <linker name="${bullet.linux.compiler}" libtool="i686-w64-mingw32">
+            <compilerarg value="-m32"/>
+            <linker name="${bullet.linux.crosscompiler}">
+                <linkerarg value="-mdll"/>
                 <libset dir="build/bullet-base-mingw-64" libs="BulletMultiThreaded,BulletDynamics,BulletCollision,LinearMath"/>
             </linker>
         </cc>
@@ -369,10 +372,10 @@
 
     <target name="-check-bullet-sources">
         <available file="${bullet.folder}" property="haveBulletSource"/>
-        <available file="build/bullet-base/libBulletMultiThreaded.a" property="haveBulletLibrary"/>
-        <available file="build/bullet-base-64/libBulletMultiThreaded.a" property="haveBulletLibrary64"/>
-        <available file="build/bullet-base-mingw/libBulletMultiThreaded.a" property="haveBulletLibraryMingw"/>
-        <available file="build/bullet-base-mingw-64/libBulletMultiThreaded.a" property="haveBulletLibraryMingw64"/>
+        <available file="build/bullet-base/libLinearMath.a" property="haveBulletLibrary"/>
+        <available file="build/bullet-base-64/libLinearMath.a" property="haveBulletLibrary64"/>
+        <available file="build/bullet-base-mingw/libLinearMath.a" property="haveBulletLibraryMingw"/>
+        <available file="build/bullet-base-mingw-64/libLinearMath.a" property="haveBulletLibraryMingw64"/>
     </target>
     
     <target name="-compile-bullet-sources-windows" if="isWindows">
@@ -439,7 +442,45 @@
         <exec executable="${make.linux}" dir="${bullet.folder}"/>
     </target>
 
-    <target name="-compile-bullet-sources-linux-mingw-64" if="isLinux64" unless="haveBulletLibraryMingw64">
+    <target name="-compile-bullet-sources-linux-mingw-64" depends="-fix-bullet-sources" if="isLinux64" unless="haveBulletLibraryMingw64">
+        <exec executable="${make.linux}" dir="${bullet.folder}">
+        	<arg value="clean"/>
+        </exec>
+        <exec executable="${cmake.linux}" dir="${bullet.folder}" failonerror="true">
+            <arg value="-DCMAKE_SYSTEM_NAME=Windows"/>
+            <arg value="-DCMAKE_C_COMPILER=${cross.compile.target64}-gcc"/>
+            <arg value="-DCMAKE_CXX_COMPILER=${cross.compile.target64}-g++"/>
+            <arg value="-DCMAKE_RC_COMPILER=${cross.compile.target64}-windres"/>
+            <arg value="-DCMAKE_FIND_ROOT_PATH=/usr/${cross.compile.target64}"/>
+            <arg value="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER"/>
+            <arg value="-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY"/>
+            <arg value="-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY"/>
+        </exec>
+        <mkdir dir="build/bullet-base-mingw-64"/>
+        <property location="build/bullet-base-mingw-64" name="build-mingw64.folder.resolved"/>
+        <exec executable="${cmake.linux}" dir="${bullet.folder}" failonerror="true">
+            <arg value="-DCMAKE_BUILD_TYPE=Release"/>
+            <arg value="-DBUILD_SHARED_LIBS=OFF"/>
+            <arg value="-DBUILD_EXTRAS=OFF"/>
+            <arg value="-DBUILD_DEMOS=OFF"/>
+            <arg value="-DLIBRARY_OUTPUT_PATH='${build-mingw64.folder.resolved}'"/>
+        </exec>
+        <exec executable="${make.linux}" dir="${bullet.folder}"/>
+        <exec executable="${cross.compile.target64}-ranlib">
+        	<arg value="${basedir}/build/bullet-base-mingw-64/libBulletMultiThreaded.a"/>
+        </exec>
+        <exec executable="${cross.compile.target64}-ranlib">
+        	<arg value="${basedir}/build/bullet-base-mingw-64/libBulletDynamics.a"/>
+        </exec>
+        <exec executable="${cross.compile.target64}-ranlib">
+        	<arg value="${basedir}/build/bullet-base-mingw-64/libBulletCollision.a"/>
+        </exec>
+        <exec executable="${cross.compile.target64}-ranlib">
+        	<arg value="${basedir}/build/bullet-base-mingw-64/libLinearMath.a"/>
+        </exec>
+    </target>
+    
+    <target name="-fix-bullet-sources">
         <replace file="${bullet.folder}/CMakeLists.txt" token="#TODO add better GLUT detection for MinGW"
                 value="INCLUDE_DIRECTORIES($${BULLET_PHYSICS_SOURCE_DIR}/Glut)${line.separator}
                        SET(GLUT_INCLUDE_DIR ${BULLET_PHYSICS_SOURCE_DIR}/Glut)${line.separator}
@@ -450,25 +491,5 @@
                                 message('Win64 using Glut/glut64.lib')${line.separator}
                                 SET(GLUT_glut_LIBRARY $${BULLET_PHYSICS_SOURCE_DIR}/Glut/glut64.lib)${line.separator}
                         ENDIF (WIN32)${line.separator}"/>
-        <property name="cross.compile.target" value="i686-w64-mingw32"/>
-        <mkdir dir="build/bullet-base-mingw-64"/>
-        <property location="build/bullet-base-mingw-64" name="build-mingw64.folder.resolved"/>
-        <exec executable="${cmake.linux}" dir="${bullet.folder}" failonerror="true">
-            <arg value="-DLIBRARY_OUTPUT_PATH='${build-mingw64.folder.resolved}'"/>
-            <arg value="-DBUILD_SHARED_LIBS=OFF"/>
-            <arg value="-DBUILD_EXTRAS:BOOL=OFF"/>
-            <arg value="-DBUILD_DEMOS:BOOL=OFF"/>
-            <arg value="-DCMAKE_BUILD_TYPE=Release"/>
-
-            <arg value="-DCMAKE_SYSTEM_NAME=Windows"/>
-            <arg value="-DCMAKE_C_COMPILER=${cross.compile.target}-gcc"/>
-            <arg value="-DCMAKE_CXX_COMPILER=${cross.compile.target}-g++"/>
-            <arg value="-DCMAKE_RC_COMPILER=${cross.compile.target}-windres"/>
-            <arg value="-DCMAKE_FIND_ROOT_PATH=/usr/${cross.compile.target}"/>
-            <arg value="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER"/>
-            <arg value="-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY"/>
-            <arg value="-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY"/>
-        </exec>
-        <exec executable="${make.linux}" dir="${bullet.folder}"/>
     </target>
 </project>

+ 4 - 0
engine/nbproject/bullet-native.properties

@@ -18,6 +18,10 @@ bullet.osx.syslibroot=/Developer/SDKs/MacOSX10.6.sdk
 bullet.windows.compiler=g++
 bullet.linux.compiler=g++
 bullet.solaris.compiler=g++
+#cross compilation options
+bullet.linux.crosscompiler=gcc-cross
+cross.compile.target=i686-w64-mingw32
+cross.compile.target64=i686-w64-mingw32
 # native header include directories
 bullet.java.include=${java.home}/../include
 # OSX has no JRE, only JDK

+ 0 - 17
engine/nbproject/mingw32.toolchain

@@ -1,17 +0,0 @@
-# the name of the target operating system
-SET(CMAKE_SYSTEM_NAME Windows)
-
-# which compilers to use for C and C++
-SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
-SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
-SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
-
-# here is the target environment located
-SET(CMAKE_FIND_ROOT_PATH  /usr/i686-w64-mingw32)
-
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search 
-# programs in the host environment
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

+ 0 - 17
engine/nbproject/mingw64.toolchain

@@ -1,17 +0,0 @@
-# the name of the target operating system
-SET(CMAKE_SYSTEM_NAME Windows)
-
-# which compilers to use for C and C++
-SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
-SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
-SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
-
-# here is the target environment located
-SET(CMAKE_FIND_ROOT_PATH  /usr/x86_64-w64-mingw32)
-
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search 
-# programs in the host environment
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)