but we can now create shared objects for each project; only the testsuite is not building properly because of issues with STLport, and EglApp is deactivated because AndroidApp should have precedence.legacy
@@ -0,0 +1,10 @@ | |||
#!/bin/sh | |||
# This can't hurt | |||
make distclean | |||
set -e | |||
./build/lol-build bootstrap android-arm | |||
./build/lol-build configure android-arm | |||
./build/lol-build build android-arm | |||
@@ -79,9 +79,6 @@ bootstrap() | |||
ios-arm) | |||
# No bootstrapping needed | |||
;; | |||
android-arm) | |||
# No bootstrapping needed | |||
;; | |||
*) | |||
PATH="$PATH" M4PATH="$M4PATH" ./bootstrap | |||
;; | |||
@@ -156,8 +153,17 @@ configure() | |||
# No configuration needed | |||
;; | |||
android-arm) | |||
cd monsterz/android | |||
android update project --path . | |||
./configure --host=arm-linux-androideabi ac_cv_exeext=.so \ | |||
CPPFLAGS="-Wno-psabi -I$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/stlport -I$ANDROID_NDK_ROOT/sources/cxx-stl/gabi++/include -fpic -fno-exceptions -fno-rtti -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64" \ | |||
CFLAGS="-march=armv5te -mtune=xscale -msoft-float -mthumb" \ | |||
CXXFLAGS="-march=armv5te -mtune=xscale -msoft-float -mthumb" \ | |||
LOL_LIBS="-L$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/libs/armeabi -lstlport_shared -lm -fpic -XCClinker -shared" | |||
# FIXME: is this needed? | |||
# android update project --path . | |||
# ndk-build | |||
# ant compile | |||
# ndk-build distclean | |||
# ant clean | |||
;; | |||
raspi-arm) | |||
./configure --host=arm-bcm2708hardfp-linux-gnueabi CPPFLAGS="-I$RASPI_SDK_ROOT/firmware/opt/vc/include -I$RASPI_SDK_ROOT/firmware/opt/vc/include/interface/vcos/pthreads" LDFLAGS="-L$RASPI_SDK_ROOT/firmware/opt/vc/lib" | |||
@@ -209,11 +215,6 @@ build() | |||
cd monsterz/ios | |||
xcodebuild -configuration Release -sdk iphonesimulator4.3 | |||
;; | |||
android-arm) | |||
cd monsterz/android | |||
ndk-build | |||
ant compile | |||
;; | |||
*) | |||
make -j$LOL_PARALLEL | |||
;; | |||
@@ -261,11 +262,6 @@ clean() | |||
cd monsterz/ios | |||
xcodebuild -configuration Release -sdk iphonesimulator4.3 clean | |||
;; | |||
android-arm) | |||
cd monsterz/android | |||
ndk-build distclean | |||
ant clean | |||
;; | |||
*) | |||
make distclean | |||
;; | |||
@@ -196,8 +196,10 @@ fi | |||
if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then | |||
AC_CHECK_HEADER(GLES2/gl2.h, | |||
[AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) | |||
ac_cv_my_have_gl="yes"]) | |||
[ac_cv_my_have_gl="yes" | |||
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) | |||
AC_CHECK_LIB(GLESv2, glEnable, | |||
[GL_LIBS="${GL_LIBS} -lGLESv2"])]) | |||
fi | |||
if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then | |||
@@ -208,7 +210,7 @@ if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then | |||
fi | |||
if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then | |||
AC_CHECK_LIB(GL, glLoadIdentity, | |||
AC_CHECK_LIB(GL, glEnable, | |||
[ac_cv_my_have_gl="yes" | |||
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish | |||
GL_LIBS="-lGL"]) | |||
@@ -350,6 +352,14 @@ AC_LANG_POP(C++) | |||
AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no") | |||
dnl Use Android? FIXME: super hacks! | |||
ac_cv_my_have_android="no" | |||
AC_CHECK_LIB(log, __android_log_vprint, | |||
[ac_cv_my_have_android="yes" | |||
LOL_LIBS="${LOL_LIBS} -llog -module"]) | |||
AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no") | |||
dnl Use EGL? | |||
ac_cv_my_have_egl="no" | |||
PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:]) | |||
@@ -61,9 +61,11 @@ static inline int isnan(float f) | |||
} | |||
#endif | |||
/* If using NaCl, override main() with our version */ | |||
/* If using NaCl or Android, override main() with our version */ | |||
#if defined __native_client__ | |||
# define main lol_nacl_main | |||
#elif defined __ANDROID__ | |||
# define main lol_android_main | |||
#endif | |||
/* If using SDL on Windows or OS X, let it override main() */ | |||
@@ -12,7 +12,7 @@ | |||
# include "config.h" | |||
#endif | |||
#if defined USE_EGL | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
# if defined HAVE_BCM_HOST_H | |||
# include <bcm_host.h> | |||
# else | |||
@@ -40,7 +40,7 @@ class EglAppData | |||
friend class EglApp; | |||
private: | |||
#if defined USE_EGL | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
EGLDisplay egl_dpy; | |||
EGLContext egl_ctx; | |||
EGLSurface egl_surf; | |||
@@ -61,7 +61,7 @@ private: | |||
EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
data(new EglAppData()) | |||
{ | |||
#if defined USE_EGL | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
# if defined HAVE_BCM_HOST_H | |||
bcm_host_init(); | |||
@@ -230,7 +230,7 @@ void EglApp::Run() | |||
{ | |||
/* Tick the renderer, show the frame and clamp to desired framerate. */ | |||
Ticker::TickDraw(); | |||
#if defined USE_EGL | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
eglSwapBuffers(data->egl_dpy, data->egl_surf); | |||
#endif | |||
} | |||
@@ -238,7 +238,7 @@ void EglApp::Run() | |||
EglApp::~EglApp() | |||
{ | |||
#if defined USE_EGL | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
eglDestroyContext(data->egl_dpy, data->egl_ctx); | |||
eglDestroySurface(data->egl_dpy, data->egl_surf); | |||
eglTerminate(data->egl_dpy); | |||
@@ -23,13 +23,19 @@ | |||
using namespace lol; | |||
/* Monsterz-specific */ | |||
#include "interface.h" | |||
/* One of these wrappers will be overridden by the user's version */ | |||
void lol_android_main(void) __attribute__((weak)); | |||
void lol_android_main(void) {} | |||
void lol_android_main(int argc, char **argv) __attribute__((weak)); | |||
void lol_android_main(int argc, char **argv) {} | |||
void lol_android_main(int argc, char **argv, char **envp) __attribute__((weak)); | |||
void lol_android_main(int argc, char **argv, char **envp) {} | |||
namespace lol | |||
{ | |||
JavaVM *g_vm; | |||
jobject g_activity; | |||
Thread *g_main_thread; | |||
AndroidApp::AndroidApp(char const *title, ivec2 res, float fps) : | |||
data(0) | |||
@@ -49,6 +55,20 @@ void AndroidApp::Run() | |||
} | |||
} | |||
void *AndroidApp::MainRun(void *data) | |||
{ | |||
int argc = 1; | |||
char *argv[] = { "", NULL }; | |||
char *env[] = { NULL }; | |||
/* Call the user's main() function. One of these will work. */ | |||
lol_android_main(); | |||
lol_android_main(argc, argv); | |||
lol_android_main(argc, argv, env); | |||
return NULL; | |||
} | |||
AndroidApp::~AndroidApp() | |||
{ | |||
} | |||
@@ -76,8 +96,7 @@ Java_org_zoy_LolEngine_LolRenderer_nativeInit(JNIEnv* env) | |||
Ticker::Setup(30.0f); | |||
Video::Setup(ivec2(320, 200)); | |||
new Interface(); | |||
new DebugFps(20, 20); | |||
g_main_thread = new Thread(lol::AndroidApp::MainRun, NULL);; | |||
} | |||
extern "C" void | |||
@@ -92,6 +111,7 @@ extern "C" void | |||
Java_org_zoy_LolEngine_LolRenderer_nativeDone(JNIEnv* env) | |||
{ | |||
/* FIXME: clean up */ | |||
delete g_main_thread; | |||
} | |||
extern "C" void | |||
@@ -32,6 +32,8 @@ public: | |||
void ShowPointer(bool show); | |||
void Run(); | |||
static void *MainRun(void *data); | |||
private: | |||
AndroidAppData *data; | |||
}; | |||
@@ -17,9 +17,14 @@ CLEANFILES = $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \ | |||
EXTRA_DIST = data/gradient.png | |||
noinst_PROGRAMS = quad benchsuite testsuite btphystest | |||
noinst_PROGRAMS = quad benchsuite $(testsuite) btphystest | |||
TESTS = testsuite | |||
TESTS = $(testsuite) | |||
# Conditionally built for now because of STLport issues | |||
if !USE_ANDROID | |||
testsuite = testsuite | |||
endif | |||
testsuite_SOURCES = testsuite.cpp \ | |||
unit/vector.cpp unit/matrix.cpp unit/half.cpp unit/trig.cpp \ | |||