Changeset 1684


Ignore:
Timestamp:
Jul 30, 2012, 2:25:20 AM (11 years ago)
Author:
sam
Message:

build: switch the Android native build rules to autoconf; still a bit rough
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.

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/lol-build

    r1679 r1684  
    8080            # No bootstrapping needed
    8181            ;;
    82         android-arm)
    83             # No bootstrapping needed
    84             ;;
    8582        *)
    8683            PATH="$PATH" M4PATH="$M4PATH" ./bootstrap
     
    157154            ;;
    158155        android-arm)
    159             cd monsterz/android
    160             android update project --path .
     156            ./configure --host=arm-linux-androideabi ac_cv_exeext=.so \
     157                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" \
     158                CFLAGS="-march=armv5te -mtune=xscale -msoft-float -mthumb" \
     159                CXXFLAGS="-march=armv5te -mtune=xscale -msoft-float -mthumb" \
     160                LOL_LIBS="-L$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/libs/armeabi -lstlport_shared -lm -fpic -XCClinker -shared"
     161            # FIXME: is this needed?
     162            # android update project --path .
     163            # ndk-build
     164            # ant compile
     165            # ndk-build distclean
     166            # ant clean
    161167            ;;
    162168        raspi-arm)
     
    210216            xcodebuild -configuration Release -sdk iphonesimulator4.3
    211217            ;;
    212         android-arm)
    213             cd monsterz/android
    214             ndk-build
    215             ant compile
    216             ;;
    217218        *)
    218219            make -j$LOL_PARALLEL
     
    262263            xcodebuild -configuration Release -sdk iphonesimulator4.3 clean
    263264            ;;
    264         android-arm)
    265             cd monsterz/android
    266             ndk-build distclean
    267             ant clean
    268             ;;
    269265        *)
    270266            make distclean
  • trunk/configure.ac

    r1678 r1684  
    197197if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
    198198  AC_CHECK_HEADER(GLES2/gl2.h,
    199    [AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
    200     ac_cv_my_have_gl="yes"])
     199   [ac_cv_my_have_gl="yes"
     200    AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
     201    AC_CHECK_LIB(GLESv2, glEnable,
     202     [GL_LIBS="${GL_LIBS} -lGLESv2"])])
    201203fi
    202204
     
    209211
    210212if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
    211   AC_CHECK_LIB(GL, glLoadIdentity,
     213  AC_CHECK_LIB(GL, glEnable,
    212214   [ac_cv_my_have_gl="yes"
    213215    AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
     
    351353
    352354
     355dnl  Use Android? FIXME: super hacks!
     356ac_cv_my_have_android="no"
     357AC_CHECK_LIB(log, __android_log_vprint,
     358 [ac_cv_my_have_android="yes"
     359  LOL_LIBS="${LOL_LIBS} -llog -module"])
     360AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no")
     361
     362
    353363dnl  Use EGL?
    354364ac_cv_my_have_egl="no"
  • trunk/src/core.h

    r1653 r1684  
    6262#endif
    6363
    64 /* If using NaCl, override main() with our version */
     64/* If using NaCl or Android, override main() with our version */
    6565#if defined __native_client__
    6666#   define main lol_nacl_main
     67#elif defined __ANDROID__
     68#   define main lol_android_main
    6769#endif
    6870
  • trunk/src/eglapp.cpp

    r1674 r1684  
    1313#endif
    1414
    15 #if defined USE_EGL
     15#if defined USE_EGL && !defined __ANDROID__
    1616#   if defined HAVE_BCM_HOST_H
    1717#       include <bcm_host.h>
     
    4141
    4242private:
    43 #if defined USE_EGL
     43#if defined USE_EGL && !defined __ANDROID__
    4444    EGLDisplay egl_dpy;
    4545    EGLContext egl_ctx;
     
    6262    data(new EglAppData())
    6363{
    64 #if defined USE_EGL
     64#if defined USE_EGL && !defined __ANDROID__
    6565#   if defined HAVE_BCM_HOST_H
    6666    bcm_host_init();
     
    231231        /* Tick the renderer, show the frame and clamp to desired framerate. */
    232232        Ticker::TickDraw();
    233 #if defined USE_EGL
     233#if defined USE_EGL && !defined __ANDROID__
    234234        eglSwapBuffers(data->egl_dpy, data->egl_surf);
    235235#endif
     
    239239EglApp::~EglApp()
    240240{
    241 #if defined USE_EGL
     241#if defined USE_EGL && !defined __ANDROID__
    242242    eglDestroyContext(data->egl_dpy, data->egl_ctx);
    243243    eglDestroySurface(data->egl_dpy, data->egl_surf);
  • trunk/src/platform/android/androidapp.cpp

    r1222 r1684  
    2424using namespace lol;
    2525
    26 /* Monsterz-specific */
    27 #include "interface.h"
     26/* One of these wrappers will be overridden by the user's version */
     27void lol_android_main(void) __attribute__((weak));
     28void lol_android_main(void) {}
     29void lol_android_main(int argc, char **argv) __attribute__((weak));
     30void lol_android_main(int argc, char **argv) {}
     31void lol_android_main(int argc, char **argv, char **envp) __attribute__((weak));
     32void lol_android_main(int argc, char **argv, char **envp) {}
    2833
    2934namespace lol
     
    3136JavaVM *g_vm;
    3237jobject g_activity;
     38Thread *g_main_thread;
    3339
    3440AndroidApp::AndroidApp(char const *title, ivec2 res, float fps) :
     
    4854        Ticker::TickDraw();
    4955    }
     56}
     57
     58void *AndroidApp::MainRun(void *data)
     59{
     60    int argc = 1;
     61    char *argv[] = { "", NULL };
     62    char *env[] = { NULL };
     63
     64    /* Call the user's main() function. One of these will work. */
     65    lol_android_main();
     66    lol_android_main(argc, argv);
     67    lol_android_main(argc, argv, env);
     68
     69    return NULL;
    5070}
    5171
     
    7797    Video::Setup(ivec2(320, 200));
    7898
    79     new Interface();
    80     new DebugFps(20, 20);
     99    g_main_thread = new Thread(lol::AndroidApp::MainRun, NULL);;
    81100}
    82101
     
    93112{
    94113    /* FIXME: clean up */
     114    delete g_main_thread;
    95115}
    96116
  • trunk/src/platform/android/androidapp.h

    r1219 r1684  
    3333    void Run();
    3434
     35    static void *MainRun(void *data);
     36
    3537private:
    3638    AndroidAppData *data;
  • trunk/test/Makefile.am

    r1594 r1684  
    1818EXTRA_DIST = data/gradient.png
    1919
    20 noinst_PROGRAMS = quad benchsuite testsuite btphystest
     20noinst_PROGRAMS = quad benchsuite $(testsuite) btphystest
    2121
    22 TESTS = testsuite
     22TESTS = $(testsuite)
     23
     24# Conditionally built for now because of STLport issues
     25if !USE_ANDROID
     26testsuite = testsuite
     27endif
    2328
    2429testsuite_SOURCES = testsuite.cpp \
Note: See TracChangeset for help on using the changeset viewer.