2 # Applied Research Associates Inc. (c)2011
\r
4 # Redistribution and use in source and binary forms,
\r
5 # with or without modification, are permitted provided that the
\r
6 # following conditions are met:
\r
7 # * Redistributions of source code must retain the above copyright
\r
8 # notice, this list of conditions and the following disclaimer.
\r
9 # * Redistributions in binary form must reproduce the above copyright
\r
10 # notice, this list of conditions and the following disclaimer in the
\r
11 # documentation and/or other materials provided with the distribution.
\r
12 # * Neither the name of the Applied Research Associates Inc nor the names
\r
13 # of its contributors may be used to endorse or promote products derived
\r
14 # from this software without specific prior written permission.
\r
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
\r
20 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
\r
21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
\r
22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\r
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
\r
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
26 # POSSIBILITY OF SUCH DAMAGE.
\r
29 # NOTE: The local path here is defined based on an environment
\r
30 # variable that points to the root of the Bullet/PhysicsEffects
\r
31 # code base. The variable must be set in the Cygwin style, e.g.,
\r
32 # BULLET_PFX_ROOT_CYGWIN = /cygdrive/d/tools/PhysicsEffectsRootPath
\r
34 # The reason for *not* just setting local path := $(call my-dir)
\r
35 # is that we wish to access local source files that are *not*
\r
36 # located in a "jni" subfolder and *not* located in a subfolder
\r
37 # of the project folder. This enables us to have Eclipse and
\r
38 # Android NDK projects that fit neatly into the Bullet/PhysicsEffects
\r
39 # folder structure, enabling a multi platform code base, without
\r
40 # forcing the "jni" and subfolder structure that Android SDK/NDK
\r
41 # prefer for pure Android projects.
\r
42 LOCAL_PATH := $(BULLET_PFX_ROOT_CYGWIN)
\r
44 include $(CLEAR_VARS)
\r
45 # Warning: do not enable SIMD vector math functions or NEON for running
\r
46 # in the Android NDK emulator. NEON requires a physical device
\r
47 # with NEON support.
\r
49 # Note that in theory we can let LOCAL_ARM_NEON := true determine
\r
50 # that the flags -mfpu=neon and -mfloat-abi=softfp should be applied.
\r
51 # However, in practice we have seen one case where the ndk-build
\r
52 # script "forgets" these flags for the occasional *.cpp file, thus
\r
53 # causing those files to access the std definition of vectormath
\r
54 # classes, which are completely different, including different size.
\r
55 # So, we explicitly apply these flags to avoid having a broken
\r
58 # Include -DSCE_PFX_USE_SIMD_VECTORMATH to build for ARM NEON SIMD
\r
59 # intrinsics, and leave it off to use NEON for scalar math but without
\r
61 LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -DUSE_PTHREADS -mfpu=neon -mfloat-abi=softfp -pthread -DSCE_PFX_USE_SIMD_VECTORMATH
\r
63 # apply these flags if needed
\r
64 # -ffast-math -funsafe-math-optimizations
\r
66 # apply this to disable optimization
\r
67 # TARGET_CFLAGS := $(TARGET_CFLAGS) -O0
\r
69 # apply these 2 to turn on assembly output (*.c/*.cpp to *.s file)
\r
70 #compile-cpp-source = $(eval $(call ev-compile-cpp-source,$1,$(1:%$(LOCAL_CPP_EXTENSION)=%.s)))
\r
71 #TARGET_CFLAGS := $(TARGET_CFLAGS) -S
\r
73 # Enable or disable NEON. Don't forget to apply, or not apply, -mfpu=neon and -mfloat-abi=softfp
\r
74 # flags in addition, e.g., if this is true both of those need to be included in LOCAL_CFLAGS
\r
75 # to avoid the possibility that ndk-build will "forget" to add them on some files
\r
76 LOCAL_ARM_NEON := true
\r
77 TARGET_CFLAGS := $(filter-out -ffpu=vfp,$(TARGET_CFLAGS))
\r
79 # setup to build static library, libpfxlibrary.a
\r
80 LOCAL_MODULE := libpfxlibrary
\r
81 LOCAL_C_INCLUDES := \
\r
83 include/physics_effects/base_level \
\r
84 include/physics_effects/base_level/base \
\r
85 include/physics_effects/base_level/broadphase \
\r
86 include/physics_effects/base_level/collision \
\r
87 include/physics_effects/base_level/rigidbody \
\r
88 include/physics_effects/base_level/solver \
\r
89 include/physics_effects/base_level/sort \
\r
90 include/physics_effects/low_level \
\r
91 include/physics_effects/low_level/broadphase \
\r
92 include/physics_effects/low_level/collision \
\r
93 include/physics_effects/low_level/solver \
\r
94 include/physics_effects/low_level/sort \
\r
95 include/physics_effects/low_level/task \
\r
96 include/physics_effects/util \
\r
97 include/vecmath/neon \
\r
98 src/base_level/broadphase \
\r
99 src/base_level/collision \
\r
100 src/base_level/solver \
\r
101 src/base_level/sort \
\r
102 src/low_level/broadphase \
\r
103 src/low_level/collision \
\r
104 src/low_level/solver \
\r
105 src/low_level/sort \
\r
106 src/low_level/task \
\r
110 # Note that vectormath_neon_assembly_implementations.S is needed here in order to compile, link, and use the
\r
111 # NEON version of the vectormath library
\r
112 LOCAL_SRC_FILES := \
\r
113 src/base_level/broadphase/pfx_update_broadphase_proxy.cpp \
\r
114 src/base_level/collision/pfx_collidable.cpp \
\r
115 src/base_level/collision/pfx_contact_box_box.cpp \
\r
116 src/base_level/collision/pfx_contact_box_capsule.cpp \
\r
117 src/base_level/collision/pfx_contact_box_sphere.cpp \
\r
118 src/base_level/collision/pfx_contact_cache.cpp \
\r
119 src/base_level/collision/pfx_contact_capsule_capsule.cpp \
\r
120 src/base_level/collision/pfx_contact_capsule_sphere.cpp \
\r
121 src/base_level/collision/pfx_contact_large_tri_mesh.cpp \
\r
122 src/base_level/collision/pfx_contact_manifold.cpp \
\r
123 src/base_level/collision/pfx_contact_sphere_sphere.cpp \
\r
124 src/base_level/collision/pfx_contact_tri_mesh_box.cpp \
\r
125 src/base_level/collision/pfx_contact_tri_mesh_capsule.cpp \
\r
126 src/base_level/collision/pfx_contact_tri_mesh_convex.cpp \
\r
127 src/base_level/collision/pfx_contact_tri_mesh_cylinder.cpp \
\r
128 src/base_level/collision/pfx_contact_tri_mesh_sphere.cpp \
\r
129 src/base_level/collision/pfx_gjk_solver.cpp \
\r
130 src/base_level/collision/pfx_gjk_support_func.cpp \
\r
131 src/base_level/collision/pfx_intersect_ray_box.cpp \
\r
132 src/base_level/collision/pfx_intersect_ray_capsule.cpp \
\r
133 src/base_level/collision/pfx_intersect_ray_convex.cpp \
\r
134 src/base_level/collision/pfx_intersect_ray_cylinder.cpp \
\r
135 src/base_level/collision/pfx_intersect_ray_large_tri_mesh.cpp \
\r
136 src/base_level/collision/pfx_intersect_ray_sphere.cpp \
\r
137 src/base_level/collision/pfx_shape.cpp \
\r
138 src/base_level/collision/pfx_simplex_solver.cpp \
\r
139 src/base_level/solver/pfx_contact_constraint.cpp \
\r
140 src/base_level/solver/pfx_joint_ball.cpp \
\r
141 src/base_level/solver/pfx_joint_fix.cpp \
\r
142 src/base_level/solver/pfx_joint_hinge.cpp \
\r
143 src/base_level/solver/pfx_joint_slider.cpp \
\r
144 src/base_level/solver/pfx_joint_swing_twist.cpp \
\r
145 src/base_level/solver/pfx_joint_universal.cpp \
\r
146 src/base_level/solver/pfx_constraint_row_solver_neon.cpp \
\r
147 src/base_level/sort/pfx_sort.cpp \
\r
148 src/low_level/broadphase/pfx_broadphase_single.cpp \
\r
149 src/low_level/collision/pfx_batched_ray_cast_single.cpp \
\r
150 src/low_level/collision/pfx_batched_ray_cast_parallel.cpp \
\r
151 src/low_level/collision/pfx_collision_detection_single.cpp \
\r
152 src/low_level/collision/pfx_collision_detection_parallel.cpp \
\r
153 src/low_level/collision/pfx_detect_collision_func.cpp \
\r
154 src/low_level/collision/pfx_intersect_ray_func.cpp \
\r
155 src/low_level/collision/pfx_island_generation.cpp \
\r
156 src/low_level/collision/pfx_ray_cast.cpp \
\r
157 src/low_level/collision/pfx_refresh_contacts_single.cpp \
\r
158 src/low_level/collision/pfx_refresh_contacts_parallel.cpp \
\r
159 src/low_level/solver/pfx_constraint_solver_single.cpp \
\r
160 src/low_level/solver/pfx_constraint_solver_parallel.cpp \
\r
161 src/low_level/solver/pfx_joint_constraint_func.cpp \
\r
162 src/low_level/solver/pfx_update_rigid_states_single.cpp \
\r
163 src/low_level/solver/pfx_update_rigid_states_parallel.cpp \
\r
164 src/low_level/sort/pfx_parallel_sort_single.cpp \
\r
165 src/low_level/task/pfx_task_manager_pthreads.cpp \
\r
166 src/low_level/task/pfx_sync_components_pthreads.cpp \
\r
167 src/util/pfx_mass.cpp \
\r
168 src/util/pfx_mesh_creator.cpp \
\r
169 include/vecmath/neon/vectormath_neon_assembly_implementations.S
\r
171 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -lGLESv1_CM -ldl -lm -llog
\r
173 include $(BUILD_STATIC_LIBRARY)
\r