From f852e8d7e1274e772a83a411e51064b0a919c703 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 3 Apr 2013 17:21:10 +0000 Subject: [PATCH] build: a lot more emscripten build fixes. --- build/autotools/m4/lol-sdl.m4 | 2 +- build/lol-build | 2 +- configure.ac | 3 ++- src/application/application.cpp | 10 +++++----- src/sys/timer.cpp | 20 +++++++++++--------- src/ticker.cpp | 5 +++++ 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/build/autotools/m4/lol-sdl.m4 b/build/autotools/m4/lol-sdl.m4 index a6a882ce..4661fc77 100644 --- a/build/autotools/m4/lol-sdl.m4 +++ b/build/autotools/m4/lol-sdl.m4 @@ -66,7 +66,7 @@ if test "x${cross_compiling}" != xyes -a "x${ac_cv_my_have_sdl}" = xno; then ac_cv_my_have_sdl="yes" SDL_CFLAGS="${SDL_CFLAGS} `${SDL_CONFIG} --cflags`" SDL_LIBS="${SDL_LIBS} `${SDL_CONFIG} --libs`" - AC_DEFINE(HAVE_SDL_H, 1, Define to 1 to use SDL.h), + AC_DEFINE(HAVE_SDL_H, 1, Define to 1 to use SDL.h) fi fi diff --git a/build/lol-build b/build/lol-build index b93624ae..5532bae0 100755 --- a/build/lol-build +++ b/build/lol-build @@ -240,7 +240,7 @@ configure() ;; emscripten-*) EM_HOME=$HOME/emscripten - ./configure CC=$EM_HOME/emcc CXX=$EM_HOME/em++ AR=$EM_HOME/emar RANLIB=$EM_HOME/emranlib PKG_CONFIG=false ac_cv_exeext=".${platform##emscripten-}" + ./configure CC=$EM_HOME/emcc CXX=$EM_HOME/em++ AR=$EM_HOME/emar RANLIB=$EM_HOME/emranlib PKG_CONFIG=/bin/false SDL_CONFIG=/bin/false ac_cv_exeext=".${platform##emscripten-}" ;; *) PATH="$PATH" ./configure CFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS" diff --git a/configure.ac b/configure.ac index e7b06968..18e574b5 100644 --- a/configure.ac +++ b/configure.ac @@ -77,7 +77,7 @@ AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h) AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h unistd.h) AC_CHECK_HEADERS(execinfo.h) AC_CHECK_HEADERS(sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h) -AC_CHECK_HEADERS(sys/wait.h) +AC_CHECK_HEADERS(sys/wait.h sys/time.h) AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h) AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h) AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h) @@ -89,6 +89,7 @@ AC_LANG_POP(C++) dnl Common C functions AC_CHECK_FUNCS(getenv system tmpfile tmpnam getcwd _getcwd backtrace_symbols) +AC_CHECK_FUNCS(gettimeofday usleep) if test "${enable_debug}" = "yes"; then diff --git a/src/application/application.cpp b/src/application/application.cpp index ccf23661..63e2c677 100644 --- a/src/application/application.cpp +++ b/src/application/application.cpp @@ -24,11 +24,11 @@ # include "platform/nacl/nacl-app.h" #elif defined __ANDROID__ # include "platform/android/androidapp.h" -#elif defined HAVE_GLES_2X -# include "eglapp.h" -#else +#elif defined USE_SDL # include "platform/sdl/sdlapp.h" # include "platform/sdl/sdlinput.h" +#elif defined HAVE_GLES_2X +# include "eglapp.h" #endif using namespace std; @@ -52,11 +52,11 @@ class ApplicationData NaClApp app; #elif defined __ANDROID__ AndroidApp app; +#elif defined USE_SDL + SdlApp app; #elif defined HAVE_GLES_2X /* FIXME: this macro is only deactivated if we include "lolgl.h" */ EglApp app; -#elif defined USE_SDL - SdlApp app; #else # error No application class available on this platform #endif diff --git a/src/sys/timer.cpp b/src/sys/timer.cpp index 93d93e41..164aaa97 100644 --- a/src/sys/timer.cpp +++ b/src/sys/timer.cpp @@ -8,29 +8,30 @@ // http://www.wtfpl.net/ for more details. // -#if defined HAVE_CONFIG_H +#if HAVE_CONFIG_H # include "config.h" #endif #include #include -#if defined __linux__ || defined __native_client__ || defined __APPLE__ +#if __linux__ || __native_client__ || __APPLE__ \ + || (HAVE_GETTIMEOFDAY && HAVE_USLEEP && HAVE_SYS_TIME_H && HAVE_UNISTD_H) # include # include -#elif defined _XBOX +#elif _XBOX # include # undef near /* Fuck Microsoft */ # undef far /* Fuck Microsoft again */ # include -#elif defined _WIN32 +#elif _WIN32 # define WIN32_LEAN_AND_MEAN # include -#elif defined __CELLOS_LV2__ +#elif __CELLOS_LV2__ # include # include # include -#elif defined HAVE_SDL_SDL_H +#elif HAVE_SDL_SDL_H # include #else # include @@ -55,7 +56,8 @@ private: (void)GetSeconds(true); } -#if defined __linux__ || defined __native_client__ || defined __APPLE__ +#if __linux__ || __native_client__ || __APPLE__ \ + || (HAVE_GETTIMEOFDAY && HAVE_USLEEP) float GetSeconds(bool reset) { struct timeval tv, tv0 = m_tv; @@ -73,7 +75,7 @@ private: struct timeval m_tv; -#elif defined _WIN32 +#elif _WIN32 float GetSeconds(bool reset) { static float secs_per_cycle = GetSecondsPerCycle(); @@ -99,7 +101,7 @@ private: LARGE_INTEGER m_cycles; -#elif defined __CELLOS_LV2__ +#elif __CELLOS_LV2__ float GetSeconds(bool reset) { static float secs_per_cycle = GetSecondsPerCycle(); diff --git a/src/ticker.cpp b/src/ticker.cpp index 478db8c4..c6a16627 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -422,6 +422,11 @@ void TickerData::DrawThreadTick() Profiler::Stop(Profiler::STAT_TICK_DRAW); } +void TickerData::DiskThreadTick() +{ + ; +} + void Ticker::SetState(Entity * /* entity */, uint32_t /* state */) {